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

Side by Side Diff: chromeos/dbus/ibus/ibus_object.h

Issue 11783053: Clean Up: Remove ibus namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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 | « chromeos/dbus/ibus/ibus_lookup_table_unittest.cc ('k') | chromeos/dbus/ibus/ibus_object.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) 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 CHROMEOS_DBUS_IBUS_IBUS_OBJECT_H_ 5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_OBJECT_H_
6 #define CHROMEOS_DBUS_IBUS_IBUS_OBJECT_H_ 6 #define CHROMEOS_DBUS_IBUS_IBUS_OBJECT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/ibus/ibus_property.h" 14 #include "chromeos/dbus/ibus/ibus_property.h"
15 #include "chromeos/dbus/ibus/ibus_text.h" 15 #include "chromeos/dbus/ibus/ibus_text.h"
16 16
17 namespace base { 17 namespace base {
18 class Value; 18 class Value;
19 } // namespace base 19 } // namespace base
20 20
21 namespace dbus { 21 namespace dbus {
22 class MessageReader; 22 class MessageReader;
23 class MessageWriter; 23 class MessageWriter;
24 } // namespace dbus 24 } // namespace dbus
25 25
26 namespace chromeos { 26 namespace chromeos {
27 // TODO(nona): Remove ibus namespace after complete libibus removal.
28 namespace ibus {
29 27
30 // The data structure of IBusObject is represented as variant in "(sav...)" 28 // The data structure of IBusObject is represented as variant in "(sav...)"
31 // signature. The IBusObject is constructed with two sections, header and 29 // signature. The IBusObject is constructed with two sections, header and
32 // contents. The header section is represent as "sav" which contains type name 30 // contents. The header section is represent as "sav" which contains type name
33 // and attachment array. The contents section is corresponding to "..." in 31 // and attachment array. The contents section is corresponding to "..." in
34 // above signature, which can store arbitrary type values including IBusObject. 32 // above signature, which can store arbitrary type values including IBusObject.
35 // 33 //
36 // DATA STRUCTURE OVERVIEW: 34 // DATA STRUCTURE OVERVIEW:
37 // 35 //
38 // variant // Handle with top_variant_writer_/top_variant_reader_. 36 // variant // Handle with top_variant_writer_/top_variant_reader_.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 bool PopArray(dbus::MessageReader* reader); 115 bool PopArray(dbus::MessageReader* reader);
118 bool PopBool(bool* out); 116 bool PopBool(bool* out);
119 bool PopInt32(int32* out); 117 bool PopInt32(int32* out);
120 bool HasMoreData(); 118 bool HasMoreData();
121 119
122 // Sets up |reader| for reading an IBusObject entry. 120 // Sets up |reader| for reading an IBusObject entry.
123 bool PopIBusObject(IBusObjectReader* reader); 121 bool PopIBusObject(IBusObjectReader* reader);
124 122
125 // Pops a IBusText. 123 // Pops a IBusText.
126 // Returns true on success. 124 // Returns true on success.
127 bool PopIBusText(ibus::IBusText* text); 125 bool PopIBusText(IBusText* text);
128 126
129 // Pops a IBusText and store it's text field into |text|. Use PopIBusText 127 // Pops a IBusText and store it's text field into |text|. Use PopIBusText
130 // instead in the case of using any attribute entries in IBusText. 128 // instead in the case of using any attribute entries in IBusText.
131 // Return true on success. 129 // Return true on success.
132 bool PopStringFromIBusText(std::string* text); 130 bool PopStringFromIBusText(std::string* text);
133 131
134 // Pops a IBusProperty. 132 // Pops a IBusProperty.
135 bool PopIBusProperty(ibus::IBusProperty* property); 133 bool PopIBusProperty(IBusProperty* property);
136 134
137 // Pops a IBusPropertyList. 135 // Pops a IBusPropertyList.
138 bool PopIBusPropertyList(ibus::IBusPropertyList* property_list); 136 bool PopIBusPropertyList(IBusPropertyList* property_list);
139 137
140 // Gets attachment entry corresponding to |key|. Do not free returned value. 138 // Gets attachment entry corresponding to |key|. Do not free returned value.
141 // Returns NULL if there is no entry. 139 // Returns NULL if there is no entry.
142 const base::Value* GetAttachment(const std::string& key); 140 const base::Value* GetAttachment(const std::string& key);
143 141
144 private: 142 private:
145 enum CheckResult { 143 enum CheckResult {
146 IBUS_OBJECT_VALID, // Already checked and valid type. 144 IBUS_OBJECT_VALID, // Already checked and valid type.
147 IBUS_OBJECT_INVALID, // Already checked but invalid type. 145 IBUS_OBJECT_INVALID, // Already checked but invalid type.
148 IBUS_OBJECT_NOT_CHECKED, // Not checked yet. 146 IBUS_OBJECT_NOT_CHECKED, // Not checked yet.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 dbus::MessageWriter* writer); 215 dbus::MessageWriter* writer);
218 void CloseContainer(dbus::MessageWriter* writer); 216 void CloseContainer(dbus::MessageWriter* writer);
219 217
220 // Sets up |writer| for writing new IBusObject entry. 218 // Sets up |writer| for writing new IBusObject entry.
221 void AppendIBusObject(IBusObjectWriter* writer); 219 void AppendIBusObject(IBusObjectWriter* writer);
222 220
223 // Closes all opened containers. 221 // Closes all opened containers.
224 void CloseAll(); 222 void CloseAll();
225 223
226 // Appends a IBusText. 224 // Appends a IBusText.
227 void AppendIBusText(const ibus::IBusText& text); 225 void AppendIBusText(const IBusText& text);
228 226
229 // Appends a string as IBusText without any attributes. Use AppendIBusText 227 // Appends a string as IBusText without any attributes. Use AppendIBusText
230 // instead in the case of using any attribute entries. 228 // instead in the case of using any attribute entries.
231 void AppendStringAsIBusText(const std::string& text); 229 void AppendStringAsIBusText(const std::string& text);
232 230
233 // Appends a IBusProperty. 231 // Appends a IBusProperty.
234 void AppendIBusProperty(const ibus::IBusProperty& property); 232 void AppendIBusProperty(const IBusProperty& property);
235 233
236 // Appends a IBusPropertyList. 234 // Appends a IBusPropertyList.
237 void AppendIBusPropertyList(const ibus::IBusPropertyList& property_list); 235 void AppendIBusPropertyList(const IBusPropertyList& property_list);
238 236
239 private: 237 private:
240 // Appends IBusObject headers, should be called once. 238 // Appends IBusObject headers, should be called once.
241 void Init(); 239 void Init();
242 240
243 std::string type_name_; 241 std::string type_name_;
244 std::string signature_; 242 std::string signature_;
245 dbus::MessageWriter* original_writer_; 243 dbus::MessageWriter* original_writer_;
246 WriterState state_; 244 WriterState state_;
247 scoped_ptr<dbus::MessageWriter> top_variant_writer_; 245 scoped_ptr<dbus::MessageWriter> top_variant_writer_;
248 scoped_ptr<dbus::MessageWriter> contents_writer_; 246 scoped_ptr<dbus::MessageWriter> contents_writer_;
249 scoped_ptr<dbus::MessageWriter> attachment_writer_; 247 scoped_ptr<dbus::MessageWriter> attachment_writer_;
250 248
251 DISALLOW_COPY_AND_ASSIGN(IBusObjectWriter); 249 DISALLOW_COPY_AND_ASSIGN(IBusObjectWriter);
252 }; 250 };
253 251
254 } // namespace ibus
255 } // namespace chromeos 252 } // namespace chromeos
256 253
257 #endif // CHROMEOS_DBUS_IBUS_IBUS_OBJECT_H_ 254 #endif // CHROMEOS_DBUS_IBUS_IBUS_OBJECT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/ibus/ibus_lookup_table_unittest.cc ('k') | chromeos/dbus/ibus/ibus_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698