LEFT | RIGHT |
1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ | 1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ |
2 /* vim:set et sts=4: */ | 2 /* vim:set et sts=4: */ |
3 /* ibus - The Input Bus | 3 /* ibus - The Input Bus |
4 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com> | 4 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com> |
5 * Copyright (C) 2008-2010 Red Hat, Inc. | 5 * Copyright (C) 2008-2010 Red Hat, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 */ | 119 */ |
120 struct _IBusSerializable { | 120 struct _IBusSerializable { |
121 /*< private >*/ | 121 /*< private >*/ |
122 IBusObject parent; | 122 IBusObject parent; |
123 IBusSerializablePrivate *priv; | 123 IBusSerializablePrivate *priv; |
124 /* instance members */ | 124 /* instance members */ |
125 }; | 125 }; |
126 | 126 |
127 /** | 127 /** |
128 * IBusSerializableSerializeFunc: | 128 * IBusSerializableSerializeFunc: |
129 * @object: An IBusSerializable. | 129 * @serializable: An #IBusSerializable. |
130 * @iter: An IBusMessageIter. | 130 * @builder: A #GVariantBuilder. |
131 * @returns: TRUE if succeed; FALSE otherwise. | 131 * @returns: %TRUE if succeed; %FALSE otherwise. |
132 * | 132 * |
133 * Prototype of serialize function. | 133 * Prototype of serialize function. |
134 * Serialize function convert an IBusSerializable to IBusMessageIter. | 134 * Serialize function convert an IBusSerializable to IBusMessageIter. |
135 * Returns a gboolean value which indicates whether the conversion is success. | 135 * Returns a gboolean value which indicates whether the conversion is success. |
136 * Return TRUE if succeed. | 136 * Return %TRUE if succeed. |
137 */ | 137 */ |
138 typedef gboolean (* IBusSerializableSerializeFunc) (IBusSerializable
*object, | 138 typedef gboolean (* IBusSerializableSerializeFunc) (IBusSerializable
*serializable, |
139 GVariantBuilder
*builder); | 139 GVariantBuilder
*builder); |
140 | 140 |
141 /** | 141 /** |
142 * IBusSerializableDeserializeFunc: | 142 * IBusSerializableDeserializeFunc: |
143 * @object: An IBusSerializable. | 143 * @serializable: An #IBusSerializable. |
144 * @iter: An IBusMessageIter. | 144 * @variant: A #GVariant contains a tuple. |
145 * @returns: TRUE if succeed; FALSE otherwise. | 145 * @returns: The number of values in the variant(tuple) are consumed. |
146 * | 146 * |
147 * Prototype of deserialize function. | 147 * Prototype of deserialize function. |
148 * Deserialize function convert an IBusMessageIter to IBusSerializable. | 148 * Deserialize function convert an IBusMessageIter to IBusSerializable. |
149 * Returns a gboolean value which indicates whether the conversion is success. | 149 * Returns an integer value which indicates how many values in |
150 */ | 150 * the variant(tuple) are consumed. |
151 typedef gint (* IBusSerializableDeserializeFunc) (IBusSerializable
*object, | 151 */ |
| 152 typedef gint (* IBusSerializableDeserializeFunc) (IBusSerializable
*serializable, |
152 GVariant
*variant); | 153 GVariant
*variant); |
153 | 154 |
154 /** | 155 /** |
155 * IBusSerializableCopyFunc: | 156 * IBusSerializableCopyFunc: |
156 * @dest: The destination IBusSerializable. | 157 * @dest: The destination #IBusSerializable. |
157 * @src: A source IBusMessageIter. | 158 * @src: A source #IBusMessageIter. |
158 * @returns: TRUE if succeed; FALSE otherwise. | 159 * @returns: %TRUE if succeed; %FALSE otherwise. |
159 * | 160 * |
160 * Prototype of copy function. | 161 * Prototype of copy function. |
161 * Copy function copy from source IBusSerializable to the destination one. | 162 * Copy function copy from source #IBusSerializable to the destination one. |
162 * Returns a gboolean value which indicates whether the copying is success. | 163 * Returns a gboolean value which indicates whether the copying is success. |
163 */ | 164 */ |
164 typedef gboolean (* IBusSerializableCopyFunc) (IBusSerializable
*dest, | 165 typedef gboolean (* IBusSerializableCopyFunc) (IBusSerializable
*dest, |
165 const IBusSerializable
*src); | 166 const IBusSerializable
*src); |
166 struct _IBusSerializableClass { | 167 struct _IBusSerializableClass { |
167 /*< private >*/ | 168 /*< private >*/ |
168 IBusObjectClass parent; | 169 IBusObjectClass parent; |
169 | 170 |
170 /* virtual table */ | 171 /* virtual table */ |
171 gboolean (* serialize) (IBusSerializable *object, | 172 gboolean (* serialize) (IBusSerializable *object, |
(...skipping 13 matching lines...) Expand all Loading... |
185 * ibus_serializable_new: | 186 * ibus_serializable_new: |
186 * | 187 * |
187 * Creates a new instance of an #IBusSerializable. | 188 * Creates a new instance of an #IBusSerializable. |
188 * | 189 * |
189 * Returns: a new instance of #IBusSerializable. | 190 * Returns: a new instance of #IBusSerializable. |
190 */ | 191 */ |
191 IBusSerializable *ibus_serializable_new (void); | 192 IBusSerializable *ibus_serializable_new (void); |
192 | 193 |
193 /** | 194 /** |
194 * ibus_serializable_set_qattachment: | 195 * ibus_serializable_set_qattachment: |
195 * @object: An IBusSerializable. | 196 * @serializable: An #IBusSerializable. |
196 * @key: String formatted key for indexing value. | 197 * @key: String formatted key for indexing value. |
197 * @value: Value to be attached or NULL to remove any prevoius value. | 198 * @value: Value to be attached or %NULL to remove any prevoius value. |
198 * | 199 * |
199 * Attach a value to an IBusSerializable. If the value is floating, | 200 * Attach a value to an IBusSerializable. If the value is floating, |
200 * the serializable will take the ownership. | 201 * the serializable will take the ownership. |
201 * | 202 * |
202 * @see_also: ibus_serializable_set_attachment(). | 203 * @see_also: ibus_serializable_set_attachment(). |
203 */ | 204 */ |
204 void ibus_serializable_set_qattachment (IBusSerializable *ser
ializable, | 205 void ibus_serializable_set_qattachment (IBusSerializable *ser
ializable, |
205 GQuark key
, | 206 GQuark key
, |
206 GVariant *val
ue); | 207 GVariant *val
ue); |
207 | 208 |
208 /** | 209 /** |
209 * ibus_serializable_get_qattachment: | 210 * ibus_serializable_get_qattachment: |
210 * @object: An IBusSerializable. | 211 * @serializable: An #IBusSerializable. |
211 * @key: String formatted key for indexing value. | 212 * @key: String formatted key for indexing value. |
212 * @returns: The attached value; or NULL if fail to retrieve the value. | 213 * @returns: The attached value; or %NULL if fail to retrieve the value. |
213 * | 214 * |
214 * Get a value from attachment of an IBusSerializable. | 215 * Get a value from attachment of an #IBusSerializable. |
215 * @see_also: ibus_serializable_set_attachment(). | 216 * @see_also: ibus_serializable_set_attachment(). |
216 */ | 217 */ |
217 GVariant *ibus_serializable_get_qattachment (IBusSerializable *ser
ializable, | 218 GVariant *ibus_serializable_get_qattachment (IBusSerializable *ser
ializable, |
218 GQuark key
); | 219 GQuark key
); |
219 | 220 |
220 /** | 221 /** |
221 * ibus_serializable_remove_qattachment: | 222 * ibus_serializable_remove_qattachment: |
222 * @object: An IBusSerializable. | 223 * @serializable: An #IBusSerializable. |
223 * @key: String formatted key for indexing value. | 224 * @key: String formatted key for indexing value. |
224 * | 225 * |
225 * Remove a value from attachment of an IBusSerializable. | 226 * Remove a value from attachment of an #IBusSerializable. |
226 * @see_also: ibus_serializable_remove_attachment(). | 227 * @see_also: ibus_serializable_remove_attachment(). |
227 */ | 228 */ |
228 void ibus_serializable_remove_qattachment | 229 void ibus_serializable_remove_qattachment |
229 (IBusSerializable *ser
ializable, | 230 (IBusSerializable *ser
ializable, |
230 GQuark key
); | 231 GQuark key
); |
231 | 232 |
232 /** | 233 /** |
233 * ibus_serializable_copy: | 234 * ibus_serializable_copy: |
234 * @object: An IBusSerializable. | 235 * @serializable: An #IBusSerializable. |
235 * @returns: A newly allocated clone object; or NULL if @object is not serializa
ble. | 236 * @returns: A newly allocated clone object; or %NULL if @object is not serializ
able. |
236 * | 237 * |
237 * Clone an IBusSerializable. | 238 * Clone an #IBusSerializable. |
238 * The copy method should be implemented in extended class. | 239 * The copy method should be implemented in extended class. |
239 * | 240 * |
240 * @see_also: IBusSerializableCopyFunc(). | 241 * @see_also: IBusSerializableCopyFunc(). |
241 */ | 242 */ |
242 IBusSerializable *ibus_serializable_copy (IBusSerializable *ser
ializable); | 243 IBusSerializable *ibus_serializable_copy (IBusSerializable *ser
ializable); |
243 | 244 |
244 /** | 245 /** |
245 * ibus_serializable_serialize: | 246 * ibus_serializable_serialize: |
246 * @object: An IBusSerializable. | 247 * @serializable: An #IBusSerializable. |
247 * @iter: An IBusMessageIter. | 248 * @returns: A #GVariant. |
248 * @returns: TRUE if succeed; FALSE otherwise. | 249 * |
249 * | 250 * Serialize an #IBusSerializable to a #GVariant. |
250 * Serialize an IBusSerializable to an IBusMessageIter. | |
251 * The serialize method should be implemented in extended class. | 251 * The serialize method should be implemented in extended class. |
252 * | 252 * |
253 * @see_also: IBusSerializableCopyFunc(). | 253 * @see_also: IBusSerializableCopyFunc(). |
254 */ | 254 */ |
255 GVariant *ibus_serializable_serialize (IBusSerializable *ser
ializable); | 255 GVariant *ibus_serializable_serialize (IBusSerializable *ser
ializable); |
256 | 256 |
257 /** | 257 /** |
258 * ibus_serializable_deserialize: | 258 * ibus_serializable_deserialize: |
259 * @iter: An IBusMessageIter. | 259 * @variant: A #GVariant. |
260 * @returns: The deserialized IBusSerializable. | 260 * @returns: The deserialized #IBusSerializable. |
261 * | 261 * |
262 * Deserialize an IBusMessageIter to an IBusSerializable/ | 262 * Deserialize a #GVariant to an #IBusSerializable/ |
263 * The deserialize method should be implemented in extended class. | 263 * The deserialize method should be implemented in extended class. |
264 * | 264 * |
265 * @see_also: IBusSerializableCopyFunc(). | 265 * @see_also: IBusSerializableCopyFunc(). |
266 */ | 266 */ |
267 IBusSerializable *ibus_serializable_deserialize (GVariant *var
iant); | 267 IBusSerializable *ibus_serializable_deserialize (GVariant *var
iant); |
268 | 268 |
269 G_END_DECLS | 269 G_END_DECLS |
270 #endif | 270 #endif |
271 | 271 |
LEFT | RIGHT |