/usr/include/ibus-1.0/ibusserializable.h is in libibus-1.0-dev 1.5.17-3ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
* Copyright (C) 2008-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
#error "Only <ibus.h> can be included directly"
#endif
#ifndef __IBUS_SERIALIZABLE_H_
#define __IBUS_SERIALIZABLE_H_
/**
* SECTION: ibusserializable
* @short_description: A serializable object.
* @stability: Stable
*
* An #IBusSerializable is an IBus object which can be serialized, that is,
* to be to and from a #GVariant.
*
* This class is to be extended by other class that requires serialization.
* An extended class should overrides following methods:
* <itemizedlist>
* <listitem>
* <para><function>serialize(object,iter)</function>: for serialize.</para>
* </listitem>
* <listitem>
* <para><function>deserialize(object,iter)</function>: for deserialize.</para>
* </listitem>
* <listitem>
* <para><function>copy(desc,src)</function>: for copy between IBusSerializable.</para>
* </listitem>
* </itemizedlist>
* See IBusSerializableSerializeFunc(), IBusSerializableDeserializeFunc(), IBusSerializableCopyFunc()
* for function prototype.
*/
#include "ibusobject.h"
/*
* Type macros.
*/
/* define IBusSerializable macros */
#define IBUS_TYPE_SERIALIZABLE \
(ibus_serializable_get_type ())
#define IBUS_SERIALIZABLE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_SERIALIZABLE, IBusSerializable))
#define IBUS_SERIALIZABLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_SERIALIZABLE, IBusSerializableClass))
#define IBUS_IS_SERIALIZABLE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_SERIALIZABLE))
#define IBUS_IS_SERIALIZABLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_SERIALIZABLE))
#define IBUS_SERIALIZABLE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_SERIALIZABLE, IBusSerializableClass))
/**
* ibus_serializable_set_attachment:
* @o: An IBusSerializable.
* @k: String formatted key for indexing value.
* @v: Value to be attached. Should be also serializable.
*
* Attach a value to an IBusSerializable.
* This macro is an convenient wrapper of ibus_serializable_set_qattachment().
*/
#define ibus_serializable_set_attachment(o, k, v) \
ibus_serializable_set_qattachment (o, g_quark_from_string (k), v)
/**
* ibus_serializable_get_attachment:
* @o: An #IBusSerializable.
* @k: String formatted key for indexing value.
*
* Get a value from attachment of an #IBusSerializable.
* This macro is an convenient wrapper of ibus_serializable_get_qattachment().
*/
#define ibus_serializable_get_attachment(o, k) \
ibus_serializable_get_qattachment (o, g_quark_from_string (k))
/**
* ibus_serializable_remove_attachment:
* @o: An #IBusSerializable.
* @k: String formatted key for indexing value.
*
* Remove a value from attachment of an #IBusSerializable.
* This macro is an convenient wrapper of ibus_serializable_remove_qattachment().
*/
#define ibus_serializable_remove_attachment(o, k) \
ibus_serializable_remove_qattachment (o, g_quark_from_string (k))
G_BEGIN_DECLS
typedef struct _IBusSerializable IBusSerializable;
typedef struct _IBusSerializableClass IBusSerializableClass;
typedef struct _IBusSerializablePrivate IBusSerializablePrivate;
/**
* IBusSerializable:
*
* All the fields in the <structname>IBusSerializable</structname> structure are
* private to the #IBusSerializable and should never be accessed directly.
*/
struct _IBusSerializable {
/*< private >*/
IBusObject parent;
IBusSerializablePrivate *priv;
/* instance members */
};
/**
* IBusSerializableSerializeFunc:
* @serializable: An #IBusSerializable.
* @builder: A #GVariantBuilder.
*
* Prototype of serialize function.
* Serialize function convert an #IBusSerializable to #GVariantBuilder.
* Returns a gboolean value which indicates whether the conversion is success.
* Return %TRUE if succeed.
*
* Returns: %TRUE if succeed; %FALSE otherwise.
*/
typedef gboolean (* IBusSerializableSerializeFunc) (IBusSerializable *serializable,
GVariantBuilder *builder);
/**
* IBusSerializableDeserializeFunc:
* @serializable: An #IBusSerializable.
* @variant: A #GVariant contains a tuple.
*
* Prototype of deserialize function.
* Deserialize function convert a #GVariant to #IBusSerializable.
* Returns an integer value which indicates how many values in
* the variant(tuple) are consumed.
*
* Returns: The number of values in the variant(tuple) are consumed.
*/
typedef gint (* IBusSerializableDeserializeFunc) (IBusSerializable *serializable,
GVariant *variant);
/**
* IBusSerializableCopyFunc:
* @dest: The destination #IBusSerializable.
* @src: A source #IBusSerializable.
*
* Prototype of copy function.
* Copy function copy from source #IBusSerializable to the destination one.
* Returns a gboolean value which indicates whether the copying is success.
*
* Returns: %TRUE if succeed; %FALSE otherwise.
*/
typedef gboolean (* IBusSerializableCopyFunc) (IBusSerializable *dest,
const IBusSerializable *src);
struct _IBusSerializableClass {
/*< private >*/
IBusObjectClass parent;
/* virtual table */
gboolean (* serialize) (IBusSerializable *object,
GVariantBuilder *builder);
gint (* deserialize) (IBusSerializable *object,
GVariant *variant);
gboolean (* copy) (IBusSerializable *dest,
const IBusSerializable *src);
/*< private >*/
/* padding */
gpointer pdummy[5];
};
GType ibus_serializable_get_type (void);
/**
* ibus_serializable_new:
*
* Creates a new instance of an #IBusSerializable.
*
* Returns: a new instance of #IBusSerializable.
*/
IBusSerializable *ibus_serializable_new (void);
/**
* ibus_serializable_set_qattachment:
* @serializable: An #IBusSerializable.
* @key: String formatted key for indexing value.
* @value: Value to be attached or %NULL to remove any prevoius value.
*
* Attach a value to an #IBusSerializable. If the value is floating,
* the serializable will take the ownership.
*
* See also: ibus_serializable_set_attachment().
*/
void ibus_serializable_set_qattachment (IBusSerializable *serializable,
GQuark key,
GVariant *value);
/**
* ibus_serializable_get_qattachment:
* @serializable: An #IBusSerializable.
* @key: String formatted key for indexing value.
*
* Gets a value from attachment of an #IBusSerializable.
*
* Returns: The attached value; or %NULL if fail to retrieve the value.
*
* See also: ibus_serializable_set_attachment().
*/
GVariant *ibus_serializable_get_qattachment (IBusSerializable *serializable,
GQuark key);
/**
* ibus_serializable_remove_qattachment:
* @serializable: An #IBusSerializable.
* @key: String formatted key for indexing value.
*
* Remove a value from attachment of an #IBusSerializable.
* See also: ibus_serializable_remove_attachment().
*/
void ibus_serializable_remove_qattachment
(IBusSerializable *serializable,
GQuark key);
/**
* ibus_serializable_copy:
* @serializable: An #IBusSerializable.
*
* Clone an #IBusSerializable.
* The copy method should be implemented in extended class.
*
* Returns: (transfer none): A newly allocated clone object; or %NULL
* if @object is not serializable.
*
* See also: IBusSerializableCopyFunc().
*/
IBusSerializable *ibus_serializable_copy (IBusSerializable *serializable);
/**
* ibus_serializable_serialize:
* @serializable: An #IBusSerializable.
*
* Serialize an #IBusSerializable to a #GVariant.
* The serialize method should be implemented in extended class.
*
* Returns: A #GVariant.
*
* See also: IBusSerializableCopyFunc().
*/
GVariant *ibus_serializable_serialize (IBusSerializable *serializable);
/**
* ibus_serializable_deserialize:
* @variant: A #GVariant.
*
* Deserialize a #GVariant to an #IBusSerializable/
* The deserialize method should be implemented in extended class.
*
* Returns: (transfer none): The deserialized #IBusSerializable.
*
* See also: IBusSerializableCopyFunc().
*/
IBusSerializable *ibus_serializable_deserialize (GVariant *variant);
G_END_DECLS
#endif
|