… | |
… | |
55 | } |
55 | } |
56 | |
56 | |
57 | template<class T> |
57 | template<class T> |
58 | T *refcache<T>::get (const char *id) |
58 | T *refcache<T>::get (const char *id) |
59 | { |
59 | { |
60 | for (T **i = begin (); i < end (); ++i) |
60 | for (T **i = this->begin (); i < this->end (); ++i) |
61 | { |
61 | { |
62 | if (!strcmp (id, (*i)->id)) |
62 | if (!strcmp (id, (*i)->id)) |
63 | { |
63 | { |
64 | (*i)->referenced++; |
64 | (*i)->referenced++; |
65 | return *i; |
65 | return *i; |
… | |
… | |
70 | |
70 | |
71 | obj->referenced = 1; |
71 | obj->referenced = 1; |
72 | |
72 | |
73 | if (obj && obj->init ()) |
73 | if (obj && obj->init ()) |
74 | { |
74 | { |
75 | push_back (obj); |
75 | this->push_back (obj); |
76 | return obj; |
76 | return obj; |
77 | } |
77 | } |
78 | else |
78 | else |
79 | { |
79 | { |
80 | delete obj; |
80 | delete obj; |
… | |
… | |
88 | if (!obj) |
88 | if (!obj) |
89 | return; |
89 | return; |
90 | |
90 | |
91 | if (!--obj->referenced) |
91 | if (!--obj->referenced) |
92 | { |
92 | { |
93 | erase (find (begin (), end (), obj)); |
93 | this->erase (find (this->begin (), this->end (), obj)); |
94 | delete obj; |
94 | delete obj; |
95 | } |
95 | } |
96 | } |
96 | } |
97 | |
97 | |
98 | template<class T> |
98 | template<class T> |
99 | refcache<T>::~refcache () |
99 | refcache<T>::~refcache () |
100 | { |
100 | { |
101 | while (size ()) |
101 | while (this->size ()) |
102 | put (*begin ()); |
102 | put (*this->begin ()); |
103 | } |
103 | } |
104 | |
104 | |
105 | ///////////////////////////////////////////////////////////////////////////// |
105 | ///////////////////////////////////////////////////////////////////////////// |
106 | |
106 | |
107 | static void |
107 | static void |
… | |
… | |
307 | return XInternAtom (display, name, False); |
307 | return XInternAtom (display, name, False); |
308 | } |
308 | } |
309 | |
309 | |
310 | ///////////////////////////////////////////////////////////////////////////// |
310 | ///////////////////////////////////////////////////////////////////////////// |
311 | |
311 | |
312 | template refcache<rxvt_display>; |
312 | template class refcache<rxvt_display>; |
313 | refcache<rxvt_display> displays; |
313 | refcache<rxvt_display> displays; |
314 | |
314 | |
315 | ///////////////////////////////////////////////////////////////////////////// |
315 | ///////////////////////////////////////////////////////////////////////////// |
316 | |
316 | |
317 | bool |
317 | bool |