… | |
… | |
166 | }; |
166 | }; |
167 | |
167 | |
168 | INTERFACE_CLASS(object_thawer) |
168 | INTERFACE_CLASS(object_thawer) |
169 | struct object_thawer |
169 | struct object_thawer |
170 | { |
170 | { |
|
|
171 | static bool errors_are_fatal; // true during server startup only |
|
|
172 | |
171 | char *line; // current beginning of line |
173 | char *line; // current beginning of line |
172 | SV *text; // text part |
174 | SV *text; // text part |
173 | AV *av; // perl part |
175 | AV *av; // perl part |
174 | int linenum; |
176 | int linenum; |
175 | keyword kw; |
177 | keyword kw; |
… | |
… | |
179 | const char *name; |
181 | const char *name; |
180 | |
182 | |
181 | operator bool () const { return !!text; } |
183 | operator bool () const { return !!text; } |
182 | |
184 | |
183 | object_thawer (const_utf8_string path = 0); |
185 | object_thawer (const_utf8_string path = 0); |
|
|
186 | object_thawer (const_utf8_string dir, const_utf8_string file); |
184 | object_thawer (const_utf8_string data, AV *perlav); |
187 | object_thawer (const_utf8_string data, AV *perlav); |
185 | ~object_thawer (); |
188 | ~object_thawer (); |
186 | |
189 | |
187 | void get (attachable *obj, int oid); |
190 | void get (attachable *obj, int oid); |
188 | |
191 | |
189 | // parse next line as keyword-value pair |
192 | // parse next line as keyword-value pair |
190 | MTH void next (); |
193 | MTH void next (); |
191 | |
194 | |
192 | // parse next line, as a single value - skips initial whitespace and comments |
195 | // parse next line, as a single value |
|
|
196 | // skips initial whitespace and comments |
|
|
197 | // and sets kw to KW_value on success. |
193 | MTH void next_line (); |
198 | MTH bool next_line (); |
194 | |
199 | |
195 | // skip the current key-value (usually fetch next line, for |
200 | // skip the current key-value (usually fetch next line, for |
196 | // multiline-fields, skips till the corresponding end-kw |
201 | // multiline-fields, skips till the corresponding end-kw |
197 | MTH void skip (); |
202 | MTH void skip (); |
198 | MTH void skip_block (); // skips till and over KW_end |
203 | MTH void skip_block (); // skips till and over KW_end |
… | |
… | |
232 | }; |
237 | }; |
233 | std::vector<delayed_ref> delrefs; |
238 | std::vector<delayed_ref> delrefs; |
234 | |
239 | |
235 | void delayed_deref (attachable *op, object_ptr &ptr, const_utf8_string ref); |
240 | void delayed_deref (attachable *op, object_ptr &ptr, const_utf8_string ref); |
236 | MTH void resolve_delayed_derefs (bool deref = true); |
241 | MTH void resolve_delayed_derefs (bool deref = true); |
|
|
242 | private: |
|
|
243 | void new_from_path (const_utf8_string path); |
237 | }; |
244 | }; |
238 | |
245 | |
239 | //TODO: remove |
|
|
240 | char *fgets (char *s, int n, object_thawer &thawer); |
|
|
241 | |
|
|
242 | #endif |
246 | #endif |
243 | |
247 | |