OLD | NEW |
---|---|
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_TEXT_H_ | 5 #ifndef CHROMEOS_IME_IBUS_TEXT_H_ |
6 #define CHROMEOS_DBUS_IBUS_IBUS_TEXT_H_ | 6 #define CHROMEOS_IME_IBUS_TEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
12 | 12 |
13 namespace dbus { | |
14 class MessageWriter; | |
15 class MessageReader; | |
16 } // dbus | |
17 | |
18 namespace chromeos { | 13 namespace chromeos { |
19 | 14 |
20 // The IBusText is one of IBusObjects and it contains IBusAttrList object which | |
21 // contains array of IBusAttribute object. The overview of each data structure | |
22 // is as follows: | |
23 // | |
24 // DATA STRUCTURE OVERVIEW: | |
25 // | |
26 // IBusAttribute: (signature is "uuuu") | |
27 // variant struct { | |
28 // string "IBusAttribute" | |
29 // array[] | |
30 // uint32 1 // Type of attribute. | |
31 // uint32 1 // The value of attribute. | |
32 // uint32 0 // The start index of the text. | |
33 // uint32 1 // The end index of the text. | |
34 // } | |
35 // | |
36 // IBusAttrList: (signature is "av") | |
37 // variant struct { | |
38 // string "IBusAttrList" | |
39 // array[] | |
40 // array[ // The array of IBusAttribute. | |
41 // variant struct{ | |
42 // string "IBusAttribute" | |
43 // ... | |
44 // } | |
45 // variant struct{ | |
46 // string "IBusAttribute" | |
47 // ... | |
48 // } | |
49 // variant struct{ | |
50 // string "IBusAttribute" | |
51 // ... | |
52 // } | |
53 // ] | |
54 // } | |
55 // | |
56 // IBusText: (signature is "sv") | |
57 // variant struct { | |
58 // string "IBusText" | |
59 // array[] | |
60 // string "A" | |
61 // variant struct { | |
62 // string "IBusAttrList" | |
63 // array[] | |
64 // array[ | |
65 // variant struct{ | |
66 // string "IBusAttribute" | |
67 // ... | |
68 // } | |
69 // variant struct{ | |
70 // string "IBusAttribute" | |
71 // ... | |
72 // } | |
73 // ] | |
74 // } | |
75 // } | |
76 // | |
77 class IBusText; | |
78 | |
79 // Pops a IBusText from |reader|. | |
80 // Returns false if an error occurs. | |
81 bool CHROMEOS_EXPORT PopIBusText(dbus::MessageReader* reader, | |
82 IBusText* ibus_text); | |
83 // Pops a IBusText from |reader| and stores it's text field into text. Use | |
84 // PopIBusText instead in the case of using any attribute entries in IBusText. | |
85 // Returns true on success. | |
86 bool CHROMEOS_EXPORT PopStringFromIBusText(dbus::MessageReader* reader, | |
87 std::string* text); | |
88 // Appends a IBusText to |writer|. Annotation and description field is not | |
89 // filled with AppendIBusText. | |
90 // TODO(nona): Support annotation/description appending if necessary. | |
91 void CHROMEOS_EXPORT AppendIBusText(const IBusText& ibus_text, | |
92 dbus::MessageWriter* writer); | |
93 | |
94 // Appends a string to |writer| as IBusText without any attributes. Use | |
95 // AppendIBusText instead in the case of using any attribute entries. | |
96 // TODO(nona): Support annotation/description appending if necessary. | |
97 void CHROMEOS_EXPORT AppendStringAsIBusText(const std::string& text, | |
98 dbus::MessageWriter* writer); | |
99 | |
100 // Handles IBusText object which is used in dbus communication with ibus-daemon. | |
101 // The IBusAttribute has four uint32 variables and the IBusAttributes represents | 15 // The IBusAttribute has four uint32 variables and the IBusAttributes represents |
Seigo Nonaka
2013/11/13 14:09:52
Please also remove this comment. This describes IB
Hiro Komatsu
2013/11/14 02:55:01
Done.
| |
102 // three type of decoration based on it's values. | 16 // three type of decoration based on it's values. |
103 // 1. Underline decoration (corresponds to UnderlineAttribute structure) | 17 // 1. Underline decoration (corresponds to UnderlineAttribute structure) |
104 // 1st value: indicates underline attribute. | 18 // 1st value: indicates underline attribute. |
105 // 2nd value: type of decoration. Chrome only support single and double | 19 // 2nd value: type of decoration. Chrome only support single and double |
106 // underline and error line. | 20 // underline and error line. |
107 // 3rd value: the start index of this attribute in multibyte. | 21 // 3rd value: the start index of this attribute in multibyte. |
108 // 4th value: the end index of this attribute in multibyte. | 22 // 4th value: the end index of this attribute in multibyte. |
109 // | 23 // |
110 // 2. Background decoration (corresponds to SelectionAttribute structure) | 24 // 2. Background decoration (corresponds to SelectionAttribute structure) |
111 // NOTE: Background decoration is treated as selection in Chrome. | 25 // NOTE: Background decoration is treated as selection in Chrome. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 std::string description_title_; | 94 std::string description_title_; |
181 std::string description_body_; | 95 std::string description_body_; |
182 std::vector<UnderlineAttribute> underline_attributes_; | 96 std::vector<UnderlineAttribute> underline_attributes_; |
183 std::vector<SelectionAttribute> selection_attributes_; | 97 std::vector<SelectionAttribute> selection_attributes_; |
184 | 98 |
185 DISALLOW_COPY_AND_ASSIGN(IBusText); | 99 DISALLOW_COPY_AND_ASSIGN(IBusText); |
186 }; | 100 }; |
187 | 101 |
188 } // namespace chromeos | 102 } // namespace chromeos |
189 | 103 |
190 #endif // CHROMEOS_DBUS_IBUS_IBUS_TEXT_H_ | 104 #endif // CHROMEOS_IME_IBUS_TEXT_H_ |
OLD | NEW |