Index: chromeos/dbus/ibus/ibus_lookup_table.h |
diff --git a/chromeos/dbus/ibus/ibus_lookup_table.h b/chromeos/dbus/ibus/ibus_lookup_table.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2e99ad816e8e52ab4feff77250d2df5a52df01ab |
--- /dev/null |
+++ b/chromeos/dbus/ibus/ibus_lookup_table.h |
@@ -0,0 +1,124 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ |
+#define CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ |
+ |
+#include <string> |
+#include <vector> |
+#include "base/basictypes.h" |
+#include "chromeos/chromeos_export.h" |
+ |
+namespace dbus { |
+class MessageWriter; |
+class MessageReader; |
+} // namespace dbus |
+ |
+namespace chromeos { |
+ |
+// The IBusLookupTable is one of IBusObjects. IBusLookupTable contains IBusTexts |
+// but all of them are used as plain string. The overview of each data |
+// strucutres is as follows: |
+// |
+// DATA STRUCTURE OVERVIEW: |
+// variant struct { |
+// string "IBusLookupTable" |
+// array [ |
+// ] |
+// uint32 9 // Page size |
+// uint32 1 // Cursor position |
+// boolean true // Cursor visibility. |
+// boolean true // Round lookup table or not. Not used in Chrome. |
+// int32 1 // Orientation |
+// array [ // Array of candidate text. |
+// variant struct { |
+// string "IBusText" |
+// array [] |
+// string "青" |
+// variant struct { |
+// string "IBusAttrList" |
+// array [] |
+// array [] |
+// } |
+// } |
+// ... more IBusTexts |
+// ] |
+// array [ // Array of label text |
+// variant struct { |
+// string "IBusText" |
+// array [] |
+// string "1" |
+// variant struct { |
+// string "IBusAttrList" |
+// array [] |
+// array [] |
+// } |
+// } |
+// ... more IBusTexts |
+// ] |
+// } |
+class IBusLookupTable; |
+ |
+// Pops a IBusLookupTable from |reader|. |
+// Returns false if an error occures. |
+bool CHROMEOS_EXPORT PopIBusLookupTable(dbus::MessageReader* reader, |
+ IBusLookupTable* table); |
+// Appends a IBusLookupTable to |writer|. |
+void CHROMEOS_EXPORT AppendIBusLookupTable(const IBusLookupTable& table, |
+ dbus::MessageWriter* writer); |
+ |
+// An representation of IBusLookupTable object which is used in dbus |
+// communication with ibus-daemon. |
+class CHROMEOS_EXPORT IBusLookupTable { |
+ public: |
+ enum Orientation { |
+ IBUS_LOOKUP_TABLE_ORIENTATION_HORIZONTAL = 0, |
+ IBUS_LOOKUP_TABLE_ORIENTATION_VERTICAL = 1, |
+ }; |
+ |
+ IBusLookupTable(); |
+ virtual ~IBusLookupTable(); |
+ |
+ // Accessors. |
+ uint32 page_size() const; |
+ void set_page_size(uint32 page_size); |
+ |
+ uint32 cursor_position() const; |
+ void set_cursor_position(uint32 cursor_position); |
+ |
+ bool is_cursor_visible() const; |
+ void set_is_cursor_visible(bool is_cursor_visible); |
+ |
+ Orientation orientation() const; |
+ void set_orientation(Orientation orientation); |
+ |
+ const std::vector<std::string>& candidates() const; |
+ std::vector<std::string>* mutable_candidates(); |
+ |
+ const std::vector<std::string>& labels() const; |
+ std::vector<std::string>* mutable_labels(); |
+ |
+ private: |
+ // The number of candidate in one page. |
+ uint32 page_size_; |
+ uint32 cursor_position_; |
+ bool is_cursor_visible_; |
+ Orientation orientation_; |
+ |
+ // A vector of candidate string. In dbus communication, this field is |
+ // represent as IBusText, but attributes are not used in Chrome. So just |
+ // simple string is enough in this case. |
+ std::vector<std::string> candidates_; |
+ |
+ // A vector of label string. In dbus communication, this field is represent as |
+ // IBusText, but attributes are not used in Chrome. So just simple string is |
+ // enough in this case. |
+ std::vector<std::string> labels_; |
satorux1
2012/05/11 22:55:29
I thought candidates_ and labels_ should have the
Seigo Nonaka
2012/05/18 17:57:46
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(IBusLookupTable); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ |