~ubuntu-branches/ubuntu/trusty/gobject-introspection/trusty

« back to all changes in this revision

Viewing changes to girepository/gitypelib-internal.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2011-03-22 00:32:36 UTC
  • mfrom: (1.4.1 upstream) (3.3.33 multiarch)
  • Revision ID: james.westby@ubuntu.com-20110322003236-4spdgfk1vai6xay1
Tags: 0.10.4-2
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 *
53
53
 * The typelib has the following general format.
54
54
 *
55
 
 * typelib ::= header, directory, blobs, attributes, attributedata
 
55
 * typelib ::= header, section-index, directory, blobs, attributes, attributedata
56
56
 *
57
57
 * directory ::= list of entries
58
58
 *
72
72
/*
73
73
TYPELIB HISTORY
74
74
-----
 
75
 
 
76
Version 1.1
 
77
- Add ref/unref/set-value/get-value functions to Object, to be able
 
78
  to support instantiatable fundamental types which are not GObject based.
 
79
 
75
80
Version 1.0
76
81
- Rename class_struct to gtype_struct, add to interfaces
77
82
 
176
181
        ((blob)->blob_type == BLOB_TYPE_STRUCT ||   \
177
182
         (blob)->blob_type == BLOB_TYPE_UNION  ||   \
178
183
         (blob)->blob_type == BLOB_TYPE_ENUM   ||   \
 
184
         (blob)->blob_type == BLOB_TYPE_FLAGS  ||   \
179
185
         (blob)->blob_type == BLOB_TYPE_OBJECT ||   \
180
186
         (blob)->blob_type == BLOB_TYPE_INTERFACE)
181
187
 
227
233
 * write parser which continue to work if the format is extended by
228
234
 * adding new fields before the first flexible array member in
229
235
 * variable-size blobs.
 
236
 * @sections: Offset of section blob array
230
237
 *
231
238
 * The header structure appears exactly once at the beginning of a typelib.  It is a
232
239
 * collection of meta-information, such as the number of entries and dependencies.
272
279
  guint16 interface_blob_size;
273
280
  guint16 union_blob_size;
274
281
 
 
282
  guint32 sections;
 
283
 
275
284
  /* <private> */
276
 
  guint16 padding[7];
 
285
  guint16 padding[5];
277
286
} Header;
278
287
 
 
288
typedef enum {
 
289
  GI_SECTION_END = 0,
 
290
  GI_SECTION_DIRECTORY_INDEX = 1
 
291
} SectionType;
 
292
 
 
293
/**
 
294
 * Section:
 
295
 * @id: A #SectionType
 
296
 * @offset: Integer offset for this section
 
297
 *
 
298
 * A section is a blob of data that's (at least theoretically) optional,
 
299
 * and may or may not be present in the typelib.  Presently, just used
 
300
 * for the directory index.  This allows a form of dynamic extensibility
 
301
 * with different tradeoffs from the format minor version.
 
302
 *
 
303
 */
 
304
typedef struct {
 
305
  guint32 id;
 
306
  guint32 offset;
 
307
} Section;
 
308
 
 
309
 
279
310
/**
280
311
 * DirEntry:
281
312
 * @blob_type: A #GTypelibBlobType
397
428
  guint          scope                        : 3;
398
429
  /* <private> */
399
430
  guint          reserved                     :21;
400
 
 
 
431
  /* <public> */
401
432
  gint8        closure;
402
433
  gint8        destroy;
403
434
 
626
657
/**
627
658
 * ValueBlob:
628
659
 * @deprecated: Whether this value is deprecated
 
660
 * @unsigned_value: if set, value is a 32-bit unsigned integer cast to gint32
629
661
 * @value: The numerical value
630
662
 * @name: Name of blob
631
663
 *
633
665
 */
634
666
typedef struct {
635
667
  guint32 deprecated : 1;
 
668
  guint32 unsigned_value : 1;
636
669
  /* <private> */
637
 
  guint32 reserved   :31;
 
670
  guint32 reserved   :30;
638
671
  /* <public> */
639
672
  guint32 name;
640
673
  gint32 value;
815
848
 * @writable:
816
849
 * @construct:
817
850
 * @construct_only: The ParamFlags used when registering the property.
 
851
 * @transfer_ownership: When writing, the type containing the property takes
 
852
 * ownership of the value. When reading, the returned value needs to be released
 
853
 * by the caller.
 
854
 * @transfer_container_ownership: For container types indicates that the
 
855
 * ownership of the container, but not of its contents, is transferred. This is
 
856
 * typically the case when reading lists of statically allocated things.
818
857
 * @type: Describes the type of the property.
819
858
 */
820
859
typedef struct {
821
860
  guint32        name;
822
861
 
823
 
  guint32        deprecated     : 1;
824
 
  guint32        readable       : 1;
825
 
  guint32        writable       : 1;
826
 
  guint32        construct      : 1;
827
 
  guint32        construct_only : 1;
828
 
  guint32        reserved       :27;
 
862
  guint32        deprecated                   : 1;
 
863
  guint32        readable                     : 1;
 
864
  guint32        writable                     : 1;
 
865
  guint32        construct                    : 1;
 
866
  guint32        construct_only               : 1;
 
867
  guint32        transfer_ownership           : 1;
 
868
  guint32        transfer_container_ownership : 1;
 
869
  guint32        reserved                     :25;
829
870
 
830
871
  guint32        reserved2;
831
872
 
910
951
/**
911
952
 * ObjectBlob:
912
953
 * @blob_type: #BLOB_TYPE_OBJECT
 
954
 * @fundamental: this object is not a GObject derived type, instead it's
 
955
 * an additional fundamental type.
913
956
 * @gtype_name: String name of the associated #GType
914
957
 * @gtype_init: String naming the symbol which gets the runtime #GType
915
958
 * @parent: The directory index of the parent type. This is only set for
930
973
 * @signals: Describes the signals.
931
974
 * @vfuncs: Describes the virtual functions.
932
975
 * @constants: Describes the constants.
 
976
 * @ref_func: String pointing to a function which can be called to increase
 
977
 * the reference count for an instance of this object type.
 
978
 * @unref_func: String pointing to a function which can be called to decrease
 
979
 * the reference count for an instance of this object type.
 
980
 * @set_value_func: String pointing to a function which can be called to
 
981
 * convert a pointer of this object to a GValue
 
982
 * @get_value_func: String pointing to a function which can be called to
 
983
 * convert extract a pointer to this object from a GValue
933
984
 */
934
985
typedef struct {
935
986
  guint16   blob_type;  /* 7 */
936
987
  guint16   deprecated   : 1;
937
988
  guint16   abstract     : 1;
938
 
  guint16   reserved     :14;
 
989
  guint16   fundamental  : 1;
 
990
  guint16   reserved     :13;
939
991
  guint32   name;
940
992
 
941
993
  guint32   gtype_name;
953
1005
  guint16   n_constants;
954
1006
  guint16   reserved2;
955
1007
 
 
1008
  guint32   ref_func;
 
1009
  guint32   unref_func;
 
1010
  guint32   set_value_func;
 
1011
  guint32   get_value_func;
 
1012
 
956
1013
  guint32   reserved3;
957
1014
  guint32   reserved4;
958
1015
 
1055
1112
} AttributeBlob;
1056
1113
 
1057
1114
/**
1058
 
 * GTypelib:
 
1115
 * GITypelib:
1059
1116
 */
1060
 
struct _GTypelib {
 
1117
struct _GITypelib {
1061
1118
  /* <private> */
1062
1119
  guchar *data;
1063
1120
  gsize len;
1067
1124
  gboolean open_attempted;
1068
1125
};
1069
1126
 
1070
 
DirEntry *g_typelib_get_dir_entry (GTypelib *typelib,
 
1127
DirEntry *g_typelib_get_dir_entry (GITypelib *typelib,
1071
1128
                                   guint16   index);
1072
1129
 
 
1130
DirEntry *g_typelib_get_dir_entry_by_name (GITypelib *typelib,
 
1131
                                           const char *name);
 
1132
 
 
1133
DirEntry *g_typelib_get_dir_entry_by_gtype (GITypelib *typelib,
 
1134
                                            gboolean   fastpass,
 
1135
                                            GType      gtype);
 
1136
 
1073
1137
void      g_typelib_check_sanity (void);
1074
1138
 
1075
1139
#define   g_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])
1076
1140
 
1077
1141
 
1078
1142
/**
1079
 
 * GTypelibError:
 
1143
 * GITypelibError:
1080
1144
 * @G_TYPELIB_ERROR_INVALID: the typelib is invalid
1081
1145
 * @G_TYPELIB_ERROR_INVALID_HEADER: the typelib header is invalid
1082
1146
 * @G_TYPELIB_ERROR_INVALID_DIRECTORY: the typelib directory is invalid
1083
1147
 * @G_TYPELIB_ERROR_INVALID_ENTRY: a typelib entry is invalid
1084
1148
 * @G_TYPELIB_ERROR_INVALID_BLOB: a typelib blob is invalid
1085
1149
 *
1086
 
 * A error set while validating the #GTypelib
 
1150
 * A error set while validating the #GITypelib
1087
1151
 */
1088
1152
typedef enum
1089
1153
{
1092
1156
  G_TYPELIB_ERROR_INVALID_DIRECTORY,
1093
1157
  G_TYPELIB_ERROR_INVALID_ENTRY,
1094
1158
  G_TYPELIB_ERROR_INVALID_BLOB
1095
 
} GTypelibError;
 
1159
} GITypelibError;
1096
1160
 
1097
1161
#define G_TYPELIB_ERROR (g_typelib_error_quark ())
1098
1162
 
1099
1163
GQuark g_typelib_error_quark (void);
1100
1164
 
1101
 
gboolean g_typelib_validate (GTypelib  *typelib,
 
1165
gboolean g_typelib_validate (GITypelib  *typelib,
1102
1166
                             GError    **error);
1103
1167
 
1104
1168
 
 
1169
/* defined in gibaseinfo.c */
 
1170
AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info,
 
1171
                                           guint32     blob_offset);
 
1172
 
 
1173
typedef struct _GITypelibHashBuilder GITypelibHashBuilder;
 
1174
 
 
1175
GITypelibHashBuilder * _gi_typelib_hash_builder_new (void);
 
1176
 
 
1177
void _gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, guint16 value);
 
1178
 
 
1179
gboolean _gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder);
 
1180
 
 
1181
guint32 _gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder);
 
1182
 
 
1183
void _gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 size);
 
1184
 
 
1185
void _gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder);
 
1186
 
 
1187
guint16 _gi_typelib_hash_search (guint8* memory, const char *str);
 
1188
 
 
1189
 
1105
1190
G_END_DECLS
1106
1191
 
1107
1192
#endif  /* __G_TYPELIB_H__ */