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

Unified Diff: chromeos/dbus/ibus/ibus_object.h

Issue 10384141: Extends IBusObject. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/dbus/ibus/ibus_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/ibus/ibus_object.h
diff --git a/chromeos/dbus/ibus/ibus_object.h b/chromeos/dbus/ibus/ibus_object.h
index 8df1d0fcf6cc64ec4a552ad09a894bd47a448510..d56b556b7fe57ab80a31652fe180bd448dd20aa2 100644
--- a/chromeos/dbus/ibus/ibus_object.h
+++ b/chromeos/dbus/ibus/ibus_object.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/ibus/ibus_text.h"
namespace dbus {
class MessageReader;
@@ -16,6 +17,8 @@ class MessageWriter;
} // dbus
namespace chromeos {
+// TODO(nona): Remove ibus namespace after complete libibus removal.
+namespace ibus {
// The data structure of IBusObject is represented as variant in "(sav...)"
// signatur. The IBusObject is constructed with two sections, header and
@@ -25,7 +28,8 @@ namespace chromeos {
//
// DATA STRUCTURE OVERVIEW:
//
-// variant struct {
+// variant // Handle with top_variant_writer_/top_variant_reader_.
+// struct { // Handle with contents_writer_/contents_reader_.
// // Header section
// string typename // The type name of object, like "IBusText"
// array [] // attachement array.
@@ -91,9 +95,22 @@ class CHROMEOS_EXPORT IBusObjectReader {
bool PopString(std::string* out);
bool PopUint32(uint32* out);
bool PopArray(dbus::MessageReader* reader);
- bool PopIBusObject(IBusObjectReader* reader);
+ bool PopBool(bool* out);
+ bool PopInt32(int32* out);
bool HasMoreData();
+ // Sets up |reader| for reading an IBusObject entry.
+ bool PopIBusObject(IBusObjectReader* reader);
+
+ // Pops a IBusText.
+ // Returns true on success.
+ bool PopIBusText(ibus::IBusText* text);
+
+ // Pops a IBusText and store it's text field into |text|. Use PopIBusText
+ // instead in the case of using any attribute entries in IBusText.
+ // Return true on success.
+ bool PopStringFromIBusText(std::string* text);
+
private:
enum CheckResult {
IBUS_OBJECT_VALID, // Already checked and valid type.
@@ -141,6 +158,8 @@ class CHROMEOS_EXPORT IBusObjectWriter {
// The following functions delegate dbus::MessageReader's functions.
void AppendString(const std::string& input);
void AppendUint32(uint32 value);
+ void AppendInt32(int32 value);
+ void AppendBool(bool value);
void OpenArray(const std::string& signature,
dbus::MessageWriter* writer);
void CloseContainer(dbus::MessageWriter* writer);
@@ -154,8 +173,14 @@ class CHROMEOS_EXPORT IBusObjectWriter {
// Returns true if writer is initialized.
bool IsInitialized() const;
+ // Appends a IBusText.
+ void AppendIBusText(const ibus::IBusText& text);
+
+ // Appends a string as IBusText without any attributes. Use AppendIBusText
+ // instead in the case of using any attribute entries.
+ void AppendStringAsIBusText(const std::string& text);
+
private:
- friend class TestableIBusObjectWriter;
// Appends IBusObject headers, should be called once.
void Init();
@@ -168,6 +193,7 @@ class CHROMEOS_EXPORT IBusObjectWriter {
DISALLOW_COPY_AND_ASSIGN(IBusObjectWriter);
};
+} // namespace ibus
} // namespace chromeos
#endif // CHROMEOS_DBUS_IBUS_IBUS_OBJECT_H_
« no previous file with comments | « no previous file | chromeos/dbus/ibus/ibus_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698