| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // Where a round-trip is necessary, the Get() method is provided. And to | 343 // Where a round-trip is necessary, the Get() method is provided. And to |
| 344 // update the remote object value, the Set() method is also provided; these | 344 // update the remote object value, the Set() method is also provided; these |
| 345 // both simply call methods on PropertySet. | 345 // both simply call methods on PropertySet. |
| 346 // | 346 // |
| 347 // Handling of particular D-Bus types is performed via specialization, | 347 // Handling of particular D-Bus types is performed via specialization, |
| 348 // typically the PopValueFromReader() and AppendSetValueToWriter() methods | 348 // typically the PopValueFromReader() and AppendSetValueToWriter() methods |
| 349 // will need to be provided, and in rare cases a constructor to provide a | 349 // will need to be provided, and in rare cases a constructor to provide a |
| 350 // default value. Specializations for basic D-Bus types, strings, object | 350 // default value. Specializations for basic D-Bus types, strings, object |
| 351 // paths and arrays are provided for you. | 351 // paths and arrays are provided for you. |
| 352 template <class T> | 352 template <class T> |
| 353 class Property : public PropertyBase { | 353 class CHROME_DBUS_EXPORT Property : public PropertyBase { |
| 354 public: | 354 public: |
| 355 Property() {} | 355 Property() {} |
| 356 | 356 |
| 357 // Retrieves the cached value. | 357 // Retrieves the cached value. |
| 358 const T& value() const { return value_; } | 358 const T& value() const { return value_; } |
| 359 | 359 |
| 360 // Requests an updated value from the remote object incurring a | 360 // Requests an updated value from the remote object incurring a |
| 361 // round-trip. |callback| will be called when the new value is available. | 361 // round-trip. |callback| will be called when the new value is available. |
| 362 // This may not be implemented by some interfaces. | 362 // This may not be implemented by some interfaces. |
| 363 virtual void Get(dbus::PropertySet::GetCallback callback) { | 363 virtual void Get(dbus::PropertySet::GetCallback callback) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 // Current cached value of the property. | 402 // Current cached value of the property. |
| 403 T value_; | 403 T value_; |
| 404 | 404 |
| 405 // Replacement value of the property. | 405 // Replacement value of the property. |
| 406 T set_value_; | 406 T set_value_; |
| 407 }; | 407 }; |
| 408 | 408 |
| 409 template <> Property<uint8>::Property(); | 409 template <> Property<uint8>::Property(); |
| 410 template <> bool Property<uint8>::PopValueFromReader(MessageReader* reader); | 410 template <> bool Property<uint8>::PopValueFromReader(MessageReader* reader); |
| 411 template <> void Property<uint8>::AppendSetValueToWriter(MessageWriter* writer); | 411 template <> void Property<uint8>::AppendSetValueToWriter(MessageWriter* writer); |
| 412 template class CHROME_DBUS_EXPORT Property<uint8>; | |
| 413 | 412 |
| 414 template <> Property<bool>::Property(); | 413 template <> Property<bool>::Property(); |
| 415 template <> bool Property<bool>::PopValueFromReader(MessageReader* reader); | 414 template <> bool Property<bool>::PopValueFromReader(MessageReader* reader); |
| 416 template <> void Property<bool>::AppendSetValueToWriter(MessageWriter* writer); | 415 template <> void Property<bool>::AppendSetValueToWriter(MessageWriter* writer); |
| 417 template class CHROME_DBUS_EXPORT Property<bool>; | |
| 418 | 416 |
| 419 template <> Property<int16>::Property(); | 417 template <> Property<int16>::Property(); |
| 420 template <> bool Property<int16>::PopValueFromReader(MessageReader* reader); | 418 template <> bool Property<int16>::PopValueFromReader(MessageReader* reader); |
| 421 template <> void Property<int16>::AppendSetValueToWriter(MessageWriter* writer); | 419 template <> void Property<int16>::AppendSetValueToWriter(MessageWriter* writer); |
| 422 template class CHROME_DBUS_EXPORT Property<int16>; | |
| 423 | 420 |
| 424 template <> Property<uint16>::Property(); | 421 template <> Property<uint16>::Property(); |
| 425 template <> bool Property<uint16>::PopValueFromReader(MessageReader* reader); | 422 template <> bool Property<uint16>::PopValueFromReader(MessageReader* reader); |
| 426 template <> void Property<uint16>::AppendSetValueToWriter( | 423 template <> void Property<uint16>::AppendSetValueToWriter( |
| 427 MessageWriter* writer); | 424 MessageWriter* writer); |
| 428 template class CHROME_DBUS_EXPORT Property<uint16>; | |
| 429 | 425 |
| 430 template <> Property<int32>::Property(); | 426 template <> Property<int32>::Property(); |
| 431 template <> bool Property<int32>::PopValueFromReader(MessageReader* reader); | 427 template <> bool Property<int32>::PopValueFromReader(MessageReader* reader); |
| 432 template <> void Property<int32>::AppendSetValueToWriter(MessageWriter* writer); | 428 template <> void Property<int32>::AppendSetValueToWriter(MessageWriter* writer); |
| 433 template class CHROME_DBUS_EXPORT Property<int32>; | |
| 434 | 429 |
| 435 template <> Property<uint32>::Property(); | 430 template <> Property<uint32>::Property(); |
| 436 template <> bool Property<uint32>::PopValueFromReader(MessageReader* reader); | 431 template <> bool Property<uint32>::PopValueFromReader(MessageReader* reader); |
| 437 template <> void Property<uint32>::AppendSetValueToWriter( | 432 template <> void Property<uint32>::AppendSetValueToWriter( |
| 438 MessageWriter* writer); | 433 MessageWriter* writer); |
| 439 template class CHROME_DBUS_EXPORT Property<uint32>; | |
| 440 | 434 |
| 441 template <> Property<int64>::Property(); | 435 template <> Property<int64>::Property(); |
| 442 template <> bool Property<int64>::PopValueFromReader(MessageReader* reader); | 436 template <> bool Property<int64>::PopValueFromReader(MessageReader* reader); |
| 443 template <> void Property<int64>::AppendSetValueToWriter(MessageWriter* writer); | 437 template <> void Property<int64>::AppendSetValueToWriter(MessageWriter* writer); |
| 444 template class CHROME_DBUS_EXPORT Property<int64>; | |
| 445 | 438 |
| 446 template <> Property<uint64>::Property(); | 439 template <> Property<uint64>::Property(); |
| 447 template <> bool Property<uint64>::PopValueFromReader(MessageReader* reader); | 440 template <> bool Property<uint64>::PopValueFromReader(MessageReader* reader); |
| 448 template <> void Property<uint64>::AppendSetValueToWriter( | 441 template <> void Property<uint64>::AppendSetValueToWriter( |
| 449 MessageWriter* writer); | 442 MessageWriter* writer); |
| 450 template class CHROME_DBUS_EXPORT Property<uint64>; | |
| 451 | 443 |
| 452 template <> Property<double>::Property(); | 444 template <> Property<double>::Property(); |
| 453 template <> bool Property<double>::PopValueFromReader(MessageReader* reader); | 445 template <> bool Property<double>::PopValueFromReader(MessageReader* reader); |
| 454 template <> void Property<double>::AppendSetValueToWriter( | 446 template <> void Property<double>::AppendSetValueToWriter( |
| 455 MessageWriter* writer); | 447 MessageWriter* writer); |
| 456 template class CHROME_DBUS_EXPORT Property<double>; | |
| 457 | 448 |
| 458 template <> bool Property<std::string>::PopValueFromReader( | 449 template <> bool Property<std::string>::PopValueFromReader( |
| 459 MessageReader* reader); | 450 MessageReader* reader); |
| 460 template <> void Property<std::string>::AppendSetValueToWriter( | 451 template <> void Property<std::string>::AppendSetValueToWriter( |
| 461 MessageWriter* writer); | 452 MessageWriter* writer); |
| 462 template class CHROME_DBUS_EXPORT Property<std::string>; | |
| 463 | 453 |
| 464 template <> bool Property<ObjectPath>::PopValueFromReader( | 454 template <> bool Property<ObjectPath>::PopValueFromReader( |
| 465 MessageReader* reader); | 455 MessageReader* reader); |
| 466 template <> void Property<ObjectPath>::AppendSetValueToWriter( | 456 template <> void Property<ObjectPath>::AppendSetValueToWriter( |
| 467 MessageWriter* writer); | 457 MessageWriter* writer); |
| 468 template class CHROME_DBUS_EXPORT Property<ObjectPath>; | |
| 469 | 458 |
| 470 template <> bool Property<std::vector<std::string> >::PopValueFromReader( | 459 template <> bool Property<std::vector<std::string> >::PopValueFromReader( |
| 471 MessageReader* reader); | 460 MessageReader* reader); |
| 472 template <> void Property<std::vector<std::string> >::AppendSetValueToWriter( | 461 template <> void Property<std::vector<std::string> >::AppendSetValueToWriter( |
| 473 MessageWriter* writer); | 462 MessageWriter* writer); |
| 474 template class CHROME_DBUS_EXPORT Property<std::vector<std::string> >; | |
| 475 | 463 |
| 476 template <> bool Property<std::vector<ObjectPath> >::PopValueFromReader( | 464 template <> bool Property<std::vector<ObjectPath> >::PopValueFromReader( |
| 477 MessageReader* reader); | 465 MessageReader* reader); |
| 478 template <> void Property<std::vector<ObjectPath> >::AppendSetValueToWriter( | 466 template <> void Property<std::vector<ObjectPath> >::AppendSetValueToWriter( |
| 479 MessageWriter* writer); | 467 MessageWriter* writer); |
| 480 template class CHROME_DBUS_EXPORT Property<std::vector<ObjectPath> >; | |
| 481 | 468 |
| 482 template <> bool Property<std::vector<uint8> >::PopValueFromReader( | 469 template <> bool Property<std::vector<uint8> >::PopValueFromReader( |
| 483 MessageReader* reader); | 470 MessageReader* reader); |
| 484 template <> void Property<std::vector<uint8> >::AppendSetValueToWriter( | 471 template <> void Property<std::vector<uint8> >::AppendSetValueToWriter( |
| 485 MessageWriter* writer); | 472 MessageWriter* writer); |
| 486 template class CHROME_DBUS_EXPORT Property<std::vector<uint8> >; | |
| 487 | 473 |
| 488 } // namespace dbus | 474 } // namespace dbus |
| 489 | 475 |
| 490 #endif // DBUS_PROPERTY_H_ | 476 #endif // DBUS_PROPERTY_H_ |
| OLD | NEW |