… | |
… | |
196 | |
196 | |
197 | enum { |
197 | enum { |
198 | F_DESTROYED = 0x01, |
198 | F_DESTROYED = 0x01, |
199 | F_DEBUG_TRACE = 0x02, |
199 | F_DEBUG_TRACE = 0x02, |
200 | }; |
200 | }; |
201 | uint8 ACC (RW, flags); |
201 | uint8 ACC (RW, attachable_flags); |
202 | |
202 | |
203 | static unordered_vector<attachable *> mortals; |
203 | static unordered_vector<attachable *> mortals; |
204 | MTH static void check_mortals (); |
204 | MTH static void check_mortals (); |
205 | |
205 | |
206 | // object is delete'd after the refcount reaches 0 |
206 | // object is delete'd after the refcount reaches 0 |
… | |
… | |
212 | // this politely asks everybody interested the reduce |
212 | // this politely asks everybody interested the reduce |
213 | // the refcount to 0 as soon as possible. |
213 | // the refcount to 0 as soon as possible. |
214 | MTH void destroy (); |
214 | MTH void destroy (); |
215 | |
215 | |
216 | // return wether an object was destroyed already |
216 | // return wether an object was destroyed already |
217 | MTH bool destroyed () const { return flags & F_DESTROYED; } |
217 | MTH bool destroyed () const { return attachable_flags & F_DESTROYED; } |
218 | |
218 | |
219 | virtual void gather_callbacks (AV *&callbacks, event_type event) const; |
219 | virtual void gather_callbacks (AV *&callbacks, event_type event) const; |
220 | |
220 | |
221 | #if 0 |
221 | #if 0 |
222 | private: |
222 | private: |
… | |
… | |
230 | |
230 | |
231 | void sever_self (); // sever this object from its self, if it has one. |
231 | void sever_self (); // sever this object from its self, if it has one. |
232 | void optimise (); // possibly save some memory by destroying unneeded data |
232 | void optimise (); // possibly save some memory by destroying unneeded data |
233 | |
233 | |
234 | attachable () |
234 | attachable () |
235 | : flags (0), self (0), cb (0), attach (0) |
235 | : attachable_flags (0), self (0), cb (0), attach (0) |
236 | { |
236 | { |
237 | } |
237 | } |
238 | |
238 | |
239 | attachable (const attachable &src) |
239 | attachable (const attachable &src) |
240 | : flags (0), self (0), cb (0), attach (src.attach) |
240 | : attachable_flags (0), self (0), cb (0), attach (src.attach) |
241 | { |
241 | { |
242 | } |
242 | } |
243 | |
243 | |
244 | // set a custom key to the given value, or delete it if value = 0 |
244 | // set a custom key to the given value, or delete it if value = 0 |
245 | void set_key (const char *key, const char *value = 0, bool is_utf8 = 0); |
245 | void set_key (const char *key, const char *value = 0, bool is_utf8 = 0); |