OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_COMPONENT_H_ | |
6 #define CHROMEOS_DBUS_IBUS_IBUS_COMPONENT_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 #include "base/basictypes.h" | |
11 #include "chromeos/chromeos_export.h" | |
12 | |
13 namespace dbus { | |
14 class MessageWriter; | |
15 class MessageReader; | |
16 } // namespace dbus | |
17 | |
18 namespace chromeos { | |
19 | |
20 // The IBusComponents is one of IBusObjects and it contains one or more | |
21 // IBusEngineDesc object which describes details of engine information. This | |
22 // object is in used an engine's initialization. | |
23 // | |
24 // DATA STRUCTURE OVERVIEW: | |
25 // | |
26 // IBusEngineDesc: (signature is "ssssssssusss") | |
27 // variant struct { | |
28 // string "IBusEngineDesc" | |
29 // array [] | |
30 // string "_ext_ime" // The engine name. | |
31 // string "Mock IME" // The long engine name. | |
32 // string "Mock IME" // The engine description. | |
33 // string "en" // The language identifier. | |
34 // string "" // The license name field.(not in use). | |
35 // string "MockExtensionIME" // The author name. | |
36 // string "" // The icon path (not in use). | |
37 // string "us" // The keyboard layout. | |
38 // uint32 0 // The engine rank. (not in use). | |
39 // string "" // The hotkey to switch IME.(not in use) | |
40 // string "" // The symbol character of this engine (not in use). | |
41 // string "" // The command line to execute this engine (not in use). | |
42 // } | |
43 // | |
44 // IBusComponent: (signature is "ssssssssavav") | |
45 // variant struct { | |
46 // string "IBusComponent" | |
47 // array [] | |
48 // string "org.freedesktop.IBus._extension_ime" // The component name. | |
49 // string "Mock IME with Extension API" // The component description. | |
50 // string "" // The version of component.(not in use) | |
51 // string "" // The license name field. (not in use). | |
52 // string "MockExtensionIME" // The author name. | |
53 // string "" // The URL to home page(not in use). | |
54 // string "" // The executable path to component (not in use). | |
55 // string "" // The text domain field(not in use). | |
56 // array [] // The observed path object array(not in use). | |
57 // array [ | |
58 // variant struct { | |
59 // string "IBusEngineDesc" | |
60 // array [] | |
61 // string "_ext_ime" | |
62 // string "Mock IME with Extension API" | |
63 // string "Mock IME with Extension API" | |
64 // string "en" | |
65 // string "" | |
66 // string "MockExtensionIME" | |
67 // string "" | |
68 // string "us" | |
69 // uint32 0 | |
70 // string "" | |
71 // string "" | |
72 // string "" | |
73 // } | |
74 // ] | |
75 // } | |
76 class IBusComponent; | |
77 | |
78 // Pops a IBusComponent from |reader|. | |
79 // Returns false if an error occurs. | |
80 bool CHROMEOS_EXPORT PopIBusComponent(dbus::MessageReader* reader, | |
81 IBusComponent* ibus_component); | |
82 | |
83 // Appends a IBusComponent to |writer|. | |
84 void CHROMEOS_EXPORT AppendIBusComponent(const IBusComponent& ibus_component, | |
85 dbus::MessageWriter* writer); | |
86 | |
87 // Handles IBusComponent object which is used in dbus communication with | |
88 // ibus-daemon. The IBusComponent is one of IBusObjects and it contains array of | |
89 // IBusEngineDesc. The IBusEngineDesc is another IBusObject, but it is | |
90 // represented as member structure of IBusComponent because it is only used in | |
91 // IBusComponent. | |
92 class CHROMEOS_EXPORT IBusComponent { | |
93 public: | |
94 struct EngineDescription { | |
95 EngineDescription(); | |
96 EngineDescription(const std::string& engine_id, | |
97 const std::string& display_name, | |
98 const std::string& description, | |
99 const std::string& language_code, | |
100 const std::string& author); | |
101 ~EngineDescription(); | |
102 std::string engine_id; // The engine id. | |
103 std::string display_name; // The display name. | |
104 std::string description; // The engine description. | |
105 std::string language_code; // The engine's language(ex. "en"). | |
106 std::string author; // The author of engine. | |
107 }; | |
108 | |
109 IBusComponent(); | |
110 virtual ~IBusComponent(); | |
111 | |
112 // The component name (ex. "org.freedesktop.IBus.Mozc"). | |
113 const std::string& name() const { return name_; } | |
114 void set_name(const std::string& name) { name_ = name;} | |
115 | |
116 // The component description. | |
117 const std::string& description() const { return description_; } | |
118 void set_description(const std::string& description) { | |
119 description_ = description; | |
120 } | |
121 | |
122 // The component author (ex. "Google Inc."). | |
123 const std::string& author() const { return author_; } | |
124 void set_author(const std::string& author) { author_ = author; } | |
125 | |
126 // The array of engine description data. | |
127 const std::vector<EngineDescription>& engine_description() const { | |
128 return engine_description_; | |
129 } | |
130 std::vector<EngineDescription>* mutable_engine_description() { | |
131 return &engine_description_; | |
132 } | |
133 | |
134 private: | |
135 std::string name_; | |
136 std::string description_; | |
137 std::string author_; | |
138 | |
139 std::vector<EngineDescription> engine_description_; | |
140 | |
141 DISALLOW_COPY_AND_ASSIGN(IBusComponent); | |
142 }; | |
143 | |
144 } // namespace chromeos | |
145 | |
146 #endif // CHROMEOS_DBUS_IBUS_IBUS_COMPONENT_H_ | |
OLD | NEW |