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 #include <utility> | 10 #include <utility> |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 void ReplaceSetValueForTesting(const T& value) { set_value_ = value; } | 419 void ReplaceSetValueForTesting(const T& value) { set_value_ = value; } |
420 | 420 |
421 private: | 421 private: |
422 // Current cached value of the property. | 422 // Current cached value of the property. |
423 T value_; | 423 T value_; |
424 | 424 |
425 // Replacement value of the property. | 425 // Replacement value of the property. |
426 T set_value_; | 426 T set_value_; |
427 }; | 427 }; |
428 | 428 |
429 template <> Property<uint8>::Property(); | 429 // Clang and GCC don't agree on how attributes should work for explicitly |
430 template <> bool Property<uint8>::PopValueFromReader(MessageReader* reader); | 430 // instantiated templates. GCC ignores attributes on explicit instantiations |
431 template <> void Property<uint8>::AppendSetValueToWriter(MessageWriter* writer); | 431 // (and emits a warning) while Clang requires the visiblity attribute on the |
432 extern template class Property<uint8>; | 432 // explicit instantiations for them to be visible to other compilation units. |
433 | 433 // Hopefully clang and GCC agree one day, and this can be cleaned up: |
434 template <> Property<bool>::Property(); | 434 // https://llvm.org/bugs/show_bug.cgi?id=24815 |
435 template <> bool Property<bool>::PopValueFromReader(MessageReader* reader); | 435 #pragma GCC diagnostic push |
436 template <> void Property<bool>::AppendSetValueToWriter(MessageWriter* writer); | 436 #pragma GCC diagnostic ignored "-Wattributes" |
437 extern template class Property<bool>; | |
438 | |
439 template <> Property<int16>::Property(); | |
440 template <> bool Property<int16>::PopValueFromReader(MessageReader* reader); | |
441 template <> void Property<int16>::AppendSetValueToWriter(MessageWriter* writer); | |
442 extern template class Property<int16>; | |
443 | |
444 template <> Property<uint16>::Property(); | |
445 template <> bool Property<uint16>::PopValueFromReader(MessageReader* reader); | |
446 template <> void Property<uint16>::AppendSetValueToWriter( | |
447 MessageWriter* writer); | |
448 extern template class Property<uint16>; | |
449 | |
450 template <> Property<int32>::Property(); | |
451 template <> bool Property<int32>::PopValueFromReader(MessageReader* reader); | |
452 template <> void Property<int32>::AppendSetValueToWriter(MessageWriter* writer); | |
453 extern template class Property<int32>; | |
454 | |
455 template <> Property<uint32>::Property(); | |
456 template <> bool Property<uint32>::PopValueFromReader(MessageReader* reader); | |
457 template <> void Property<uint32>::AppendSetValueToWriter( | |
458 MessageWriter* writer); | |
459 extern template class Property<uint32>; | |
460 | |
461 template <> Property<int64>::Property(); | |
462 template <> bool Property<int64>::PopValueFromReader(MessageReader* reader); | |
463 template <> void Property<int64>::AppendSetValueToWriter(MessageWriter* writer); | |
464 extern template class Property<int64>; | |
465 | |
466 template <> Property<uint64>::Property(); | |
467 template <> bool Property<uint64>::PopValueFromReader(MessageReader* reader); | |
468 template <> void Property<uint64>::AppendSetValueToWriter( | |
469 MessageWriter* writer); | |
470 extern template class Property<uint64>; | |
471 | |
472 template <> Property<double>::Property(); | |
473 template <> bool Property<double>::PopValueFromReader(MessageReader* reader); | |
474 template <> void Property<double>::AppendSetValueToWriter( | |
475 MessageWriter* writer); | |
476 extern template class Property<double>; | |
477 | |
478 template <> bool Property<std::string>::PopValueFromReader( | |
479 MessageReader* reader); | |
480 template <> void Property<std::string>::AppendSetValueToWriter( | |
481 MessageWriter* writer); | |
482 extern template class Property<std::string>; | |
483 | |
484 template <> bool Property<ObjectPath>::PopValueFromReader( | |
485 MessageReader* reader); | |
486 template <> void Property<ObjectPath>::AppendSetValueToWriter( | |
487 MessageWriter* writer); | |
488 extern template class Property<ObjectPath>; | |
489 | |
490 template <> bool Property<std::vector<std::string> >::PopValueFromReader( | |
491 MessageReader* reader); | |
492 template <> void Property<std::vector<std::string> >::AppendSetValueToWriter( | |
493 MessageWriter* writer); | |
494 extern template class Property<std::vector<std::string> >; | |
495 | |
496 template <> bool Property<std::vector<ObjectPath> >::PopValueFromReader( | |
497 MessageReader* reader); | |
498 template <> void Property<std::vector<ObjectPath> >::AppendSetValueToWriter( | |
499 MessageWriter* writer); | |
500 extern template class Property<std::vector<ObjectPath> >; | |
501 | |
502 template <> bool Property<std::vector<uint8> >::PopValueFromReader( | |
503 MessageReader* reader); | |
504 template <> void Property<std::vector<uint8> >::AppendSetValueToWriter( | |
505 MessageWriter* writer); | |
506 extern template class Property<std::vector<uint8> >; | |
507 | 437 |
508 template <> | 438 template <> |
509 bool Property<std::map<std::string, std::string>>::PopValueFromReader( | 439 CHROME_DBUS_EXPORT Property<uint8>::Property(); |
| 440 template <> |
| 441 CHROME_DBUS_EXPORT bool Property<uint8>::PopValueFromReader( |
510 MessageReader* reader); | 442 MessageReader* reader); |
511 template <> | 443 template <> |
512 void Property<std::map<std::string, std::string>>::AppendSetValueToWriter( | 444 CHROME_DBUS_EXPORT void Property<uint8>::AppendSetValueToWriter( |
513 MessageWriter* writer); | 445 MessageWriter* writer); |
514 extern template class Property<std::map<std::string, std::string>>; | 446 extern template class CHROME_DBUS_EXPORT Property<uint8>; |
515 | 447 |
516 template <> | 448 template <> |
517 bool Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>:: | 449 CHROME_DBUS_EXPORT Property<bool>::Property(); |
| 450 template <> |
| 451 CHROME_DBUS_EXPORT bool Property<bool>::PopValueFromReader( |
| 452 MessageReader* reader); |
| 453 template <> |
| 454 CHROME_DBUS_EXPORT void Property<bool>::AppendSetValueToWriter( |
| 455 MessageWriter* writer); |
| 456 extern template class CHROME_DBUS_EXPORT Property<bool>; |
| 457 |
| 458 template <> |
| 459 CHROME_DBUS_EXPORT Property<int16>::Property(); |
| 460 template <> |
| 461 CHROME_DBUS_EXPORT bool Property<int16>::PopValueFromReader( |
| 462 MessageReader* reader); |
| 463 template <> |
| 464 CHROME_DBUS_EXPORT void Property<int16>::AppendSetValueToWriter( |
| 465 MessageWriter* writer); |
| 466 extern template class CHROME_DBUS_EXPORT Property<int16>; |
| 467 |
| 468 template <> |
| 469 CHROME_DBUS_EXPORT Property<uint16>::Property(); |
| 470 template <> |
| 471 CHROME_DBUS_EXPORT bool Property<uint16>::PopValueFromReader( |
| 472 MessageReader* reader); |
| 473 template <> |
| 474 CHROME_DBUS_EXPORT void Property<uint16>::AppendSetValueToWriter( |
| 475 MessageWriter* writer); |
| 476 extern template class CHROME_DBUS_EXPORT Property<uint16>; |
| 477 |
| 478 template <> |
| 479 CHROME_DBUS_EXPORT Property<int32>::Property(); |
| 480 template <> |
| 481 CHROME_DBUS_EXPORT bool Property<int32>::PopValueFromReader( |
| 482 MessageReader* reader); |
| 483 template <> |
| 484 CHROME_DBUS_EXPORT void Property<int32>::AppendSetValueToWriter( |
| 485 MessageWriter* writer); |
| 486 extern template class CHROME_DBUS_EXPORT Property<int32>; |
| 487 |
| 488 template <> |
| 489 CHROME_DBUS_EXPORT Property<uint32>::Property(); |
| 490 template <> |
| 491 CHROME_DBUS_EXPORT bool Property<uint32>::PopValueFromReader( |
| 492 MessageReader* reader); |
| 493 template <> |
| 494 CHROME_DBUS_EXPORT void Property<uint32>::AppendSetValueToWriter( |
| 495 MessageWriter* writer); |
| 496 extern template class CHROME_DBUS_EXPORT Property<uint32>; |
| 497 |
| 498 template <> |
| 499 CHROME_DBUS_EXPORT Property<int64>::Property(); |
| 500 template <> |
| 501 CHROME_DBUS_EXPORT bool Property<int64>::PopValueFromReader( |
| 502 MessageReader* reader); |
| 503 template <> |
| 504 CHROME_DBUS_EXPORT void Property<int64>::AppendSetValueToWriter( |
| 505 MessageWriter* writer); |
| 506 extern template class CHROME_DBUS_EXPORT Property<int64>; |
| 507 |
| 508 template <> |
| 509 CHROME_DBUS_EXPORT Property<uint64>::Property(); |
| 510 template <> |
| 511 CHROME_DBUS_EXPORT bool Property<uint64>::PopValueFromReader( |
| 512 MessageReader* reader); |
| 513 template <> |
| 514 CHROME_DBUS_EXPORT void Property<uint64>::AppendSetValueToWriter( |
| 515 MessageWriter* writer); |
| 516 extern template class CHROME_DBUS_EXPORT Property<uint64>; |
| 517 |
| 518 template <> |
| 519 CHROME_DBUS_EXPORT Property<double>::Property(); |
| 520 template <> |
| 521 CHROME_DBUS_EXPORT bool Property<double>::PopValueFromReader( |
| 522 MessageReader* reader); |
| 523 template <> |
| 524 CHROME_DBUS_EXPORT void Property<double>::AppendSetValueToWriter( |
| 525 MessageWriter* writer); |
| 526 extern template class CHROME_DBUS_EXPORT Property<double>; |
| 527 |
| 528 template <> |
| 529 CHROME_DBUS_EXPORT bool Property<std::string>::PopValueFromReader( |
| 530 MessageReader* reader); |
| 531 template <> |
| 532 CHROME_DBUS_EXPORT void Property<std::string>::AppendSetValueToWriter( |
| 533 MessageWriter* writer); |
| 534 extern template class CHROME_DBUS_EXPORT Property<std::string>; |
| 535 |
| 536 template <> |
| 537 CHROME_DBUS_EXPORT bool Property<ObjectPath>::PopValueFromReader( |
| 538 MessageReader* reader); |
| 539 template <> |
| 540 CHROME_DBUS_EXPORT void Property<ObjectPath>::AppendSetValueToWriter( |
| 541 MessageWriter* writer); |
| 542 extern template class CHROME_DBUS_EXPORT Property<ObjectPath>; |
| 543 |
| 544 template <> |
| 545 CHROME_DBUS_EXPORT bool Property<std::vector<std::string>>::PopValueFromReader( |
| 546 MessageReader* reader); |
| 547 template <> |
| 548 CHROME_DBUS_EXPORT void Property< |
| 549 std::vector<std::string>>::AppendSetValueToWriter(MessageWriter* writer); |
| 550 extern template class CHROME_DBUS_EXPORT Property<std::vector<std::string>>; |
| 551 |
| 552 template <> |
| 553 CHROME_DBUS_EXPORT bool Property<std::vector<ObjectPath>>::PopValueFromReader( |
| 554 MessageReader* reader); |
| 555 template <> |
| 556 CHROME_DBUS_EXPORT void Property< |
| 557 std::vector<ObjectPath>>::AppendSetValueToWriter(MessageWriter* writer); |
| 558 extern template class CHROME_DBUS_EXPORT Property<std::vector<ObjectPath>>; |
| 559 |
| 560 template <> |
| 561 CHROME_DBUS_EXPORT bool Property<std::vector<uint8>>::PopValueFromReader( |
| 562 MessageReader* reader); |
| 563 template <> |
| 564 CHROME_DBUS_EXPORT void Property<std::vector<uint8>>::AppendSetValueToWriter( |
| 565 MessageWriter* writer); |
| 566 extern template class CHROME_DBUS_EXPORT Property<std::vector<uint8>>; |
| 567 |
| 568 template <> |
| 569 CHROME_DBUS_EXPORT bool |
| 570 Property<std::map<std::string, std::string>>::PopValueFromReader( |
| 571 MessageReader* reader); |
| 572 template <> |
| 573 CHROME_DBUS_EXPORT void |
| 574 Property<std::map<std::string, std::string>>::AppendSetValueToWriter( |
| 575 MessageWriter* writer); |
| 576 extern template class CHROME_DBUS_EXPORT |
| 577 Property<std::map<std::string, std::string>>; |
| 578 |
| 579 template <> |
| 580 CHROME_DBUS_EXPORT bool |
| 581 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>:: |
518 PopValueFromReader(MessageReader* reader); | 582 PopValueFromReader(MessageReader* reader); |
519 template <> | 583 template <> |
520 void Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>:: | 584 CHROME_DBUS_EXPORT void |
| 585 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>:: |
521 AppendSetValueToWriter(MessageWriter* writer); | 586 AppendSetValueToWriter(MessageWriter* writer); |
522 extern template class Property< | 587 extern template class CHROME_DBUS_EXPORT |
523 std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>; | 588 Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>; |
| 589 |
| 590 #pragma GCC diagnostic pop |
524 | 591 |
525 } // namespace dbus | 592 } // namespace dbus |
526 | 593 |
527 #endif // DBUS_PROPERTY_H_ | 594 #endif // DBUS_PROPERTY_H_ |
OLD | NEW |