OLD | NEW |
1 $$ This is a pump file for generating file templates. Pump is a python | 1 $$ This is a pump file for generating file templates. Pump is a python |
2 $$ script that is part of the Google Test suite of utilities. Description | 2 $$ script that is part of the Google Test suite of utilities. Description |
3 $$ can be found here: | 3 $$ can be found here: |
4 $$ | 4 $$ |
5 $$ http://code.google.com/p/googletest/wiki/PumpManual | 5 $$ http://code.google.com/p/googletest/wiki/PumpManual |
6 $$ | 6 $$ |
7 | 7 |
8 $$ See comment for MAX_ARITY in base/bind.h.pump. | 8 $$ See comment for MAX_ARITY in base/bind.h.pump. |
9 $var MAX_ARITY = 7 | 9 $var MAX_ARITY = 7 |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 private: | 103 private: |
104 CallbackListBase<CallbackType>* list_; | 104 CallbackListBase<CallbackType>* list_; |
105 typename std::list<CallbackType>::iterator iter_; | 105 typename std::list<CallbackType>::iterator iter_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(Subscription); | 107 DISALLOW_COPY_AND_ASSIGN(Subscription); |
108 }; | 108 }; |
109 | 109 |
110 // Add a callback to the list. The callback will remain registered until the | 110 // Add a callback to the list. The callback will remain registered until the |
111 // returned Subscription is destroyed, which must occur before the | 111 // returned Subscription is destroyed, which must occur before the |
112 // CallbackList is destroyed. | 112 // CallbackList is destroyed. |
113 scoped_ptr<Subscription> Add(const CallbackType& cb) { | 113 scoped_ptr<Subscription> Add(const CallbackType& cb) WARN_UNUSED_RESULT { |
114 DCHECK(!cb.is_null()); | 114 DCHECK(!cb.is_null()); |
115 return scoped_ptr<Subscription>( | 115 return scoped_ptr<Subscription>( |
116 new Subscription(this, callbacks_.insert(callbacks_.end(), cb))); | 116 new Subscription(this, callbacks_.insert(callbacks_.end(), cb))); |
117 } | 117 } |
118 | 118 |
119 protected: | 119 protected: |
120 // An iterator class that can be used to access the list of callbacks. | 120 // An iterator class that can be used to access the list of callbacks. |
121 class Iterator { | 121 class Iterator { |
122 public: | 122 public: |
123 explicit Iterator(CallbackListBase<CallbackType>* list) | 123 explicit Iterator(CallbackListBase<CallbackType>* list) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 private: | 239 private: |
240 DISALLOW_COPY_AND_ASSIGN(CallbackList); | 240 DISALLOW_COPY_AND_ASSIGN(CallbackList); |
241 }; | 241 }; |
242 | 242 |
243 | 243 |
244 ]] $$ for ARITY | 244 ]] $$ for ARITY |
245 } // namespace base | 245 } // namespace base |
246 | 246 |
247 #endif // BASE_CALLBACK_LIST_H_ | 247 #endif // BASE_CALLBACK_LIST_H_ |
OLD | NEW |