… | |
… | |
99 | attachable_base () |
99 | attachable_base () |
100 | { |
100 | { |
101 | attachable_clear (); |
101 | attachable_clear (); |
102 | } |
102 | } |
103 | |
103 | |
|
|
104 | ~attachable_base () |
|
|
105 | { |
|
|
106 | clear (); |
|
|
107 | } |
|
|
108 | |
104 | attachable_base (const attachable_base &src) |
109 | attachable_base (const attachable_base &src) |
105 | : self (0), cb (0), attach (src.attach) |
110 | : self (0), cb (0), attach (src.attach) |
106 | { |
111 | { |
|
|
112 | } |
|
|
113 | |
|
|
114 | attachable_base &operator = (const attachable_base &src) |
|
|
115 | { |
|
|
116 | clear (); |
|
|
117 | attach = src.attach; |
|
|
118 | return *this; |
107 | } |
119 | } |
108 | }; |
120 | }; |
109 | |
121 | |
110 | // objects attachable from perl (or any other extension) should include or |
122 | // objects attachable from perl (or any other extension) should include or |
111 | // derive using the curiously recurring template pattern, to avoid |
123 | // derive using the curiously recurring template pattern, to avoid |
… | |
… | |
218 | add (' '); |
230 | add (' '); |
219 | add (v); |
231 | add (v); |
220 | add ('\n'); |
232 | add ('\n'); |
221 | } |
233 | } |
222 | |
234 | |
223 | void put (keyword kbeg, keyword kend, const char *v) |
235 | void put (keyword kbeg, keyword kend, const shstr &v) |
224 | { |
236 | { |
225 | add (keyword_str [kbeg], keyword_len [kbeg]); add ('\n'); |
237 | add (keyword_str [kbeg], keyword_len [kbeg]); add ('\n'); |
226 | |
238 | |
227 | if (v) |
239 | if (v) |
228 | { |
240 | { |
… | |
… | |
246 | void put (keyword k, unsigned long long v) { put_(k, (sint64)v); } |
258 | void put (keyword k, unsigned long long v) { put_(k, (sint64)v); } |
247 | |
259 | |
248 | template<typename T> |
260 | template<typename T> |
249 | void put (keyword k, T *v) |
261 | void put (keyword k, T *v) |
250 | { |
262 | { |
|
|
263 | if (v) |
|
|
264 | put (k, v->name); |
|
|
265 | else |
251 | put (k, v ? (const char *)v->name : 0); |
266 | put (k, (const char *)0); |
252 | } |
267 | } |
253 | |
268 | |
254 | bool save (const char *filename); |
269 | bool save (const char *filename); |
255 | |
270 | |
256 | operator bool () { return !!av; } |
271 | operator bool () { return !!av; } |