OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DBUS_PROPERTY_H_ | 5 #ifndef DBUS_PROPERTY_H_ |
6 #define DBUS_PROPERTY_H_ | 6 #define DBUS_PROPERTY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // no knowledge of the contained type is required, this method returns | 157 // no knowledge of the contained type is required, this method returns |
158 // true if its expected type was found, false if not. | 158 // true if its expected type was found, false if not. |
159 // Implementation provided by specialization. | 159 // Implementation provided by specialization. |
160 virtual bool PopValueFromReader(MessageReader*) = 0; | 160 virtual bool PopValueFromReader(MessageReader*) = 0; |
161 | 161 |
162 // Method used by PropertySet to append the set value to a MessageWriter, | 162 // Method used by PropertySet to append the set value to a MessageWriter, |
163 // no knowledge of the contained type is required. | 163 // no knowledge of the contained type is required. |
164 // Implementation provided by specialization. | 164 // Implementation provided by specialization. |
165 virtual void AppendSetValueToWriter(MessageWriter* writer) = 0; | 165 virtual void AppendSetValueToWriter(MessageWriter* writer) = 0; |
166 | 166 |
| 167 // Method used by test and stub implementations of dbus::PropertySet::Set |
| 168 // to replace the property value with the set value without using a |
| 169 // dbus::MessageReader. |
| 170 virtual void ReplaceValueWithSetValue() = 0; |
| 171 |
167 protected: | 172 protected: |
168 // Retrieves the associated property set. | 173 // Retrieves the associated property set. |
169 PropertySet* property_set() { return property_set_; } | 174 PropertySet* property_set() { return property_set_; } |
170 | 175 |
171 private: | 176 private: |
172 // Pointer to the PropertySet instance that this instance is a member of, | 177 // Pointer to the PropertySet instance that this instance is a member of, |
173 // no ownership is taken and |property_set_| must outlive this class. | 178 // no ownership is taken and |property_set_| must outlive this class. |
174 PropertySet* property_set_; | 179 PropertySet* property_set_; |
175 | 180 |
176 // Name of the property. | 181 // Name of the property. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // Method used by PropertySet to retrieve the value from a MessageReader, | 375 // Method used by PropertySet to retrieve the value from a MessageReader, |
371 // no knowledge of the contained type is required, this method returns | 376 // no knowledge of the contained type is required, this method returns |
372 // true if its expected type was found, false if not. | 377 // true if its expected type was found, false if not. |
373 virtual bool PopValueFromReader(MessageReader*); | 378 virtual bool PopValueFromReader(MessageReader*); |
374 | 379 |
375 // Method used by PropertySet to append the set value to a MessageWriter, | 380 // Method used by PropertySet to append the set value to a MessageWriter, |
376 // no knowledge of the contained type is required. | 381 // no knowledge of the contained type is required. |
377 // Implementation provided by specialization. | 382 // Implementation provided by specialization. |
378 virtual void AppendSetValueToWriter(MessageWriter* writer); | 383 virtual void AppendSetValueToWriter(MessageWriter* writer); |
379 | 384 |
| 385 // Method used by test and stub implementations of dbus::PropertySet::Set |
| 386 // to replace the property value with the set value without using a |
| 387 // dbus::MessageReader. |
| 388 virtual void ReplaceValueWithSetValue() { value_ = set_value_; } |
| 389 |
| 390 // Method used by test and stub implementations to directly set the |
| 391 // value of a property. |
| 392 void ReplaceValue(const T& value) { value_ = value; } |
| 393 |
380 private: | 394 private: |
381 // Current cached value of the property. | 395 // Current cached value of the property. |
382 T value_; | 396 T value_; |
383 | 397 |
384 // Replacement value of the property. | 398 // Replacement value of the property. |
385 T set_value_; | 399 T set_value_; |
386 }; | 400 }; |
387 | 401 |
388 } // namespace dbus | 402 } // namespace dbus |
389 | 403 |
390 #endif // DBUS_PROPERTY_H_ | 404 #endif // DBUS_PROPERTY_H_ |
OLD | NEW |