| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 virtual bool PopValueFromReader(MessageReader*); | 379 virtual bool PopValueFromReader(MessageReader*); |
| 380 | 380 |
| 381 // Method used by PropertySet to append the set value to a MessageWriter, | 381 // Method used by PropertySet to append the set value to a MessageWriter, |
| 382 // no knowledge of the contained type is required. | 382 // no knowledge of the contained type is required. |
| 383 // Implementation provided by specialization. | 383 // Implementation provided by specialization. |
| 384 virtual void AppendSetValueToWriter(MessageWriter* writer); | 384 virtual void AppendSetValueToWriter(MessageWriter* writer); |
| 385 | 385 |
| 386 // Method used by test and stub implementations of dbus::PropertySet::Set | 386 // Method used by test and stub implementations of dbus::PropertySet::Set |
| 387 // to replace the property value with the set value without using a | 387 // to replace the property value with the set value without using a |
| 388 // dbus::MessageReader. | 388 // dbus::MessageReader. |
| 389 virtual void ReplaceValueWithSetValue() { value_ = set_value_; } | 389 virtual void ReplaceValueWithSetValue() { |
| 390 value_ = set_value_; |
| 391 property_set()->NotifyPropertyChanged(name()); |
| 392 } |
| 390 | 393 |
| 391 // Method used by test and stub implementations to directly set the | 394 // Method used by test and stub implementations to directly set the |
| 392 // value of a property. | 395 // value of a property. |
| 393 void ReplaceValue(const T& value) { value_ = value; } | 396 void ReplaceValue(const T& value) { |
| 397 value_ = value; |
| 398 property_set()->NotifyPropertyChanged(name()); |
| 399 } |
| 394 | 400 |
| 395 private: | 401 private: |
| 396 // Current cached value of the property. | 402 // Current cached value of the property. |
| 397 T value_; | 403 T value_; |
| 398 | 404 |
| 399 // Replacement value of the property. | 405 // Replacement value of the property. |
| 400 T set_value_; | 406 T set_value_; |
| 401 }; | 407 }; |
| 402 | 408 |
| 403 template <> Property<uint8>::Property(); | 409 template <> Property<uint8>::Property(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 MessageWriter* writer); | 462 MessageWriter* writer); |
| 457 | 463 |
| 458 template <> bool Property<std::vector<ObjectPath> >::PopValueFromReader( | 464 template <> bool Property<std::vector<ObjectPath> >::PopValueFromReader( |
| 459 MessageReader* reader); | 465 MessageReader* reader); |
| 460 template <> void Property<std::vector<ObjectPath> >::AppendSetValueToWriter( | 466 template <> void Property<std::vector<ObjectPath> >::AppendSetValueToWriter( |
| 461 MessageWriter* writer); | 467 MessageWriter* writer); |
| 462 | 468 |
| 463 } // namespace dbus | 469 } // namespace dbus |
| 464 | 470 |
| 465 #endif // DBUS_PROPERTY_H_ | 471 #endif // DBUS_PROPERTY_H_ |
| OLD | NEW |