Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 #include <dbus/dbus.h> | 11 #include <dbus/dbus.h> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "dbus/file_descriptor.h" | |
| 14 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
| 15 | 16 |
| 16 namespace google { | 17 namespace google { |
| 17 namespace protobuf { | 18 namespace protobuf { |
| 18 | 19 |
| 19 class MessageLite; | 20 class MessageLite; |
| 20 | 21 |
| 21 } // namespace protobuf | 22 } // namespace protobuf |
| 22 } // namespace google | 23 } // namespace google |
| 23 | 24 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 UINT32 = DBUS_TYPE_UINT32, | 61 UINT32 = DBUS_TYPE_UINT32, |
| 61 INT64 = DBUS_TYPE_INT64, | 62 INT64 = DBUS_TYPE_INT64, |
| 62 UINT64 = DBUS_TYPE_UINT64, | 63 UINT64 = DBUS_TYPE_UINT64, |
| 63 DOUBLE = DBUS_TYPE_DOUBLE, | 64 DOUBLE = DBUS_TYPE_DOUBLE, |
| 64 STRING = DBUS_TYPE_STRING, | 65 STRING = DBUS_TYPE_STRING, |
| 65 OBJECT_PATH = DBUS_TYPE_OBJECT_PATH, | 66 OBJECT_PATH = DBUS_TYPE_OBJECT_PATH, |
| 66 ARRAY = DBUS_TYPE_ARRAY, | 67 ARRAY = DBUS_TYPE_ARRAY, |
| 67 STRUCT = DBUS_TYPE_STRUCT, | 68 STRUCT = DBUS_TYPE_STRUCT, |
| 68 DICT_ENTRY = DBUS_TYPE_DICT_ENTRY, | 69 DICT_ENTRY = DBUS_TYPE_DICT_ENTRY, |
| 69 VARIANT = DBUS_TYPE_VARIANT, | 70 VARIANT = DBUS_TYPE_VARIANT, |
| 71 #if defined(DBUS_TYPE_UNIX_FD) | |
|
satorux1
2012/03/28 00:32:43
Please add some comment that DBUS_TYPE_UNIX_FD is
Sam Leffler
2012/03/28 17:28:09
Done.
| |
| 72 UNIX_FD = DBUS_TYPE_UNIX_FD, | |
| 73 #endif | |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 // Returns the type of the message. Returns MESSAGE_INVALID if | 76 // Returns the type of the message. Returns MESSAGE_INVALID if |
| 73 // raw_message_ is NULL. | 77 // raw_message_ is NULL. |
| 74 MessageType GetMessageType(); | 78 MessageType GetMessageType(); |
| 75 | 79 |
| 76 // Returns the type of the message as string like "MESSAGE_METHOD_CALL" | 80 // Returns the type of the message as string like "MESSAGE_METHOD_CALL" |
| 77 // for instance. | 81 // for instance. |
| 78 std::string GetMessageTypeAsString(); | 82 std::string GetMessageTypeAsString(); |
| 79 | 83 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 void AppendBool(bool value); | 265 void AppendBool(bool value); |
| 262 void AppendInt16(int16 value); | 266 void AppendInt16(int16 value); |
| 263 void AppendUint16(uint16 value); | 267 void AppendUint16(uint16 value); |
| 264 void AppendInt32(int32 value); | 268 void AppendInt32(int32 value); |
| 265 void AppendUint32(uint32 value); | 269 void AppendUint32(uint32 value); |
| 266 void AppendInt64(int64 value); | 270 void AppendInt64(int64 value); |
| 267 void AppendUint64(uint64 value); | 271 void AppendUint64(uint64 value); |
| 268 void AppendDouble(double value); | 272 void AppendDouble(double value); |
| 269 void AppendString(const std::string& value); | 273 void AppendString(const std::string& value); |
| 270 void AppendObjectPath(const ObjectPath& value); | 274 void AppendObjectPath(const ObjectPath& value); |
| 275 void AppendFileDescriptor(const FileDescriptor& value); | |
| 271 | 276 |
| 272 // Opens an array. The array contents can be added to the array with | 277 // Opens an array. The array contents can be added to the array with |
| 273 // |sub_writer|. The client code must close the array with | 278 // |sub_writer|. The client code must close the array with |
| 274 // CloseContainer(), once all contents are added. | 279 // CloseContainer(), once all contents are added. |
| 275 // | 280 // |
| 276 // |signature| parameter is used to supply the D-Bus type signature of | 281 // |signature| parameter is used to supply the D-Bus type signature of |
| 277 // the array contents. For instance, if you want an array of strings, | 282 // the array contents. For instance, if you want an array of strings, |
| 278 // then you pass "s" as the signature. | 283 // then you pass "s" as the signature. |
| 279 // | 284 // |
| 280 // See the spec for details about the type signatures. | 285 // See the spec for details about the type signatures. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 bool PopBool(bool* value); | 375 bool PopBool(bool* value); |
| 371 bool PopInt16(int16* value); | 376 bool PopInt16(int16* value); |
| 372 bool PopUint16(uint16* value); | 377 bool PopUint16(uint16* value); |
| 373 bool PopInt32(int32* value); | 378 bool PopInt32(int32* value); |
| 374 bool PopUint32(uint32* value); | 379 bool PopUint32(uint32* value); |
| 375 bool PopInt64(int64* value); | 380 bool PopInt64(int64* value); |
| 376 bool PopUint64(uint64* value); | 381 bool PopUint64(uint64* value); |
| 377 bool PopDouble(double* value); | 382 bool PopDouble(double* value); |
| 378 bool PopString(std::string* value); | 383 bool PopString(std::string* value); |
| 379 bool PopObjectPath(ObjectPath* value); | 384 bool PopObjectPath(ObjectPath* value); |
| 385 bool PopFileDescriptor(FileDescriptor* value); | |
| 380 | 386 |
| 381 // Sets up the given message reader to read an array at the current | 387 // Sets up the given message reader to read an array at the current |
| 382 // iterator position. | 388 // iterator position. |
| 383 // Returns true and advances the iterator on success. | 389 // Returns true and advances the iterator on success. |
| 384 // Returns false if the data type is not an array | 390 // Returns false if the data type is not an array |
| 385 bool PopArray(MessageReader* sub_reader); | 391 bool PopArray(MessageReader* sub_reader); |
| 386 bool PopStruct(MessageReader* sub_reader); | 392 bool PopStruct(MessageReader* sub_reader); |
| 387 bool PopDictEntry(MessageReader* sub_reader); | 393 bool PopDictEntry(MessageReader* sub_reader); |
| 388 bool PopVariant(MessageReader* sub_reader); | 394 bool PopVariant(MessageReader* sub_reader); |
| 389 | 395 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 | 467 |
| 462 Message* message_; | 468 Message* message_; |
| 463 DBusMessageIter raw_message_iter_; | 469 DBusMessageIter raw_message_iter_; |
| 464 | 470 |
| 465 DISALLOW_COPY_AND_ASSIGN(MessageReader); | 471 DISALLOW_COPY_AND_ASSIGN(MessageReader); |
| 466 }; | 472 }; |
| 467 | 473 |
| 468 } // namespace dbus | 474 } // namespace dbus |
| 469 | 475 |
| 470 #endif // DBUS_MESSAGE_H_ | 476 #endif // DBUS_MESSAGE_H_ |
| OLD | NEW |