Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: dbus/message.cc

Issue 7686013: Add AppendArrayOfObjectPaths, which was missing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dbus/message.h ('k') | dbus/message_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "dbus/message.h" 5 #include "dbus/message.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 OpenArray("y", &array_writer); 505 OpenArray("y", &array_writer);
506 const bool success = dbus_message_iter_append_fixed_array( 506 const bool success = dbus_message_iter_append_fixed_array(
507 &(array_writer.raw_message_iter_), 507 &(array_writer.raw_message_iter_),
508 DBUS_TYPE_BYTE, 508 DBUS_TYPE_BYTE,
509 &values, 509 &values,
510 static_cast<int>(length)); 510 static_cast<int>(length));
511 CHECK(success) << "Unable to allocate memory"; 511 CHECK(success) << "Unable to allocate memory";
512 CloseContainer(&array_writer); 512 CloseContainer(&array_writer);
513 } 513 }
514 514
515 void MessageWriter::AppendArrayOfObjectPaths(
516 const std::vector<std::string>& object_paths) {
517 DCHECK(!container_is_open_);
518 MessageWriter array_writer(message_);
519 OpenArray("o", &array_writer);
520 for (size_t i = 0; i < object_paths.size(); ++i) {
521 array_writer.AppendObjectPath(object_paths[i]);
522 }
523 CloseContainer(&array_writer);
524 }
525
515 void MessageWriter::AppendVariantOfByte(uint8 value) { 526 void MessageWriter::AppendVariantOfByte(uint8 value) {
516 AppendVariantOfBasic(DBUS_TYPE_BYTE, &value); 527 AppendVariantOfBasic(DBUS_TYPE_BYTE, &value);
517 } 528 }
518 529
519 void MessageWriter::AppendVariantOfBool(bool value) { 530 void MessageWriter::AppendVariantOfBool(bool value) {
520 // See the comment at MessageWriter::AppendBool(). 531 // See the comment at MessageWriter::AppendBool().
521 dbus_bool_t dbus_value = value; 532 dbus_bool_t dbus_value = value;
522 AppendVariantOfBasic(DBUS_TYPE_BOOLEAN, &dbus_value); 533 AppendVariantOfBasic(DBUS_TYPE_BOOLEAN, &dbus_value);
523 } 534 }
524 535
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 } 805 }
795 806
796 bool MessageReader::PopVariantOfBasic(int dbus_type, void* value) { 807 bool MessageReader::PopVariantOfBasic(int dbus_type, void* value) {
797 dbus::MessageReader variant_reader(message_); 808 dbus::MessageReader variant_reader(message_);
798 if (!PopVariant(&variant_reader)) 809 if (!PopVariant(&variant_reader))
799 return false; 810 return false;
800 return variant_reader.PopBasic(dbus_type, value); 811 return variant_reader.PopBasic(dbus_type, value);
801 } 812 }
802 813
803 } // namespace dbus 814 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/message.h ('k') | dbus/message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698