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_MESSAGE_H_ | 5 #ifndef DBUS_MESSAGE_H_ |
6 #define DBUS_MESSAGE_H_ | 6 #define DBUS_MESSAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <dbus/dbus.h> | 10 #include <dbus/dbus.h> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // SetSignature() does not exist as we cannot do it. | 104 // SetSignature() does not exist as we cannot do it. |
105 | 105 |
106 // Gets the destination, the path, the interface, the member, etc. | 106 // Gets the destination, the path, the interface, the member, etc. |
107 // If not set, an empty string is returned. | 107 // If not set, an empty string is returned. |
108 std::string GetDestination(); | 108 std::string GetDestination(); |
109 ObjectPath GetPath(); | 109 ObjectPath GetPath(); |
110 std::string GetInterface(); | 110 std::string GetInterface(); |
111 std::string GetMember(); | 111 std::string GetMember(); |
112 std::string GetErrorName(); | 112 std::string GetErrorName(); |
113 std::string GetSender(); | 113 std::string GetSender(); |
114 std::string GetSignature(); | 114 std::string GetDataSignature(); |
115 // Gets the serial and reply serial numbers. Returns 0 if not set. | 115 // Gets the serial and reply serial numbers. Returns 0 if not set. |
116 uint32 GetSerial(); | 116 uint32 GetSerial(); |
117 uint32 GetReplySerial(); | 117 uint32 GetReplySerial(); |
118 | 118 |
119 // Returns the string representation of this message. Useful for | 119 // Returns the string representation of this message. Useful for |
120 // debugging. The output is truncated as needed (ex. strings are truncated | 120 // debugging. The output is truncated as needed (ex. strings are truncated |
121 // if longer than a certain limit defined in the .cc file). | 121 // if longer than a certain limit defined in the .cc file). |
122 std::string ToString(); | 122 std::string ToString(); |
123 | 123 |
124 protected: | 124 protected: |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 bool PopVariantOfUint64(uint64* value); | 456 bool PopVariantOfUint64(uint64* value); |
457 bool PopVariantOfDouble(double* value); | 457 bool PopVariantOfDouble(double* value); |
458 bool PopVariantOfString(std::string* value); | 458 bool PopVariantOfString(std::string* value); |
459 bool PopVariantOfObjectPath(ObjectPath* value); | 459 bool PopVariantOfObjectPath(ObjectPath* value); |
460 | 460 |
461 // Get the data type of the value at the current iterator | 461 // Get the data type of the value at the current iterator |
462 // position. INVALID_DATA will be returned if the iterator points to the | 462 // position. INVALID_DATA will be returned if the iterator points to the |
463 // end of the message. | 463 // end of the message. |
464 Message::DataType GetDataType(); | 464 Message::DataType GetDataType(); |
465 | 465 |
| 466 // Get the DBus signature of the value at the current iterator position. |
| 467 // An empty string will be returned if the iterator points to the end of |
| 468 // the message. |
| 469 std::string GetDataSignature(); |
| 470 |
466 private: | 471 private: |
467 // Returns true if the data type at the current iterator position | 472 // Returns true if the data type at the current iterator position |
468 // matches the given D-Bus type, such as DBUS_TYPE_BYTE. | 473 // matches the given D-Bus type, such as DBUS_TYPE_BYTE. |
469 bool CheckDataType(int dbus_type); | 474 bool CheckDataType(int dbus_type); |
470 | 475 |
471 // Helper function used to implement PopByte() etc. | 476 // Helper function used to implement PopByte() etc. |
472 bool PopBasic(int dbus_type, void *value); | 477 bool PopBasic(int dbus_type, void *value); |
473 | 478 |
474 // Helper function used to implement PopArray() etc. | 479 // Helper function used to implement PopArray() etc. |
475 bool PopContainer(int dbus_type, MessageReader* sub_reader); | 480 bool PopContainer(int dbus_type, MessageReader* sub_reader); |
476 | 481 |
477 // Helper function used to implement PopVariantOfByte() etc. | 482 // Helper function used to implement PopVariantOfByte() etc. |
478 bool PopVariantOfBasic(int dbus_type, void* value); | 483 bool PopVariantOfBasic(int dbus_type, void* value); |
479 | 484 |
480 Message* message_; | 485 Message* message_; |
481 DBusMessageIter raw_message_iter_; | 486 DBusMessageIter raw_message_iter_; |
482 | 487 |
483 DISALLOW_COPY_AND_ASSIGN(MessageReader); | 488 DISALLOW_COPY_AND_ASSIGN(MessageReader); |
484 }; | 489 }; |
485 | 490 |
486 } // namespace dbus | 491 } // namespace dbus |
487 | 492 |
488 #endif // DBUS_MESSAGE_H_ | 493 #endif // DBUS_MESSAGE_H_ |
OLD | NEW |