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
|
#ifndef __GI_CPP_EXAMPLE_H__
#define __GI_CPP_EXAMPLE_H__
#include <glib-object.h>
#include <glib.h>
G_BEGIN_DECLS
// enum
typedef enum _CEnum { ENUM_VALUE_0, ENUM_VALUE_1 } CEnum;
GType gi_cpp_enum_get_type(void);
#define GI_CPP_TYPE_ENUM (gi_cpp_enum_get_type())
// flags
typedef enum _CFlags { FLAG_VALUE_0 = 1, FLAG_VALUE_1 = 2 } CFlags;
GType gi_cpp_flags_get_type(void);
#define GI_CPP_TYPE_FLAGS (gi_cpp_flags_get_type())
// object
GType gi_cpp_example_get_type();
#define GI_CPP_TYPE_EXAMPLE (gi_cpp_example_get_type())
#define GI_CPP_EXAMPLE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GI_CPP_TYPE_EXAMPLE, GICppExample))
#define GI_CPP_EXAMPLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GI_CPP_TYPE_EXAMPLE, GICppExampleClass))
#define GI_IS_CPP_EXAMPLE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GI_CPP_TYPE_EXAMPLE))
#define GI_IS_CPP_EXAMPLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GI_CPP_TYPE_EXAMPLE))
typedef struct _GICppExample GICppExample;
typedef struct _GICppExampleClass GICppExampleClass;
struct _GICppExampleClass
{
GObjectClass parent_class;
/* virtual method */
int (*vmethod)(GICppExample *, int a, int b);
int (*cmethod)(GICppExample *, int a, int b);
};
enum {
PROP_0,
PROP_DATA,
PROP_NUMBER,
PROP_FNUMBER,
PROP_OBJECT,
PROP_PRESENT,
PROP_ENUM,
PROP_FLAGS,
PROP_LAST = PROP_FLAGS
};
#define NAME_NUMBER "number"
#define NAME_FNUMBER "fnumber"
#define NAME_DATA "data"
#define NAME_PRESENT "present"
#define NAME_OBJECT "object"
#define NAME_ENUM "choice"
#define NAME_FLAGS "flags"
#define NAME_INUMBER "itf-number"
// interface
GICppExample *gi_cpp_example_new();
typedef struct _GICppExampleItf GICppExampleItf;
typedef struct _GICppExampleInterface GICppExampleInterface;
struct _GICppExampleInterface
{
GTypeInterface iface;
/* virtual method */
int (*vmethod)(GICppExampleItf *, int a);
int (*imethod)(GICppExampleItf *, int a);
};
GType gi_cpp_example_interface_get_type();
// property interface
typedef struct _GICppPropertyItf GICppPropertyItf;
typedef struct _GICppPropertyInterface GICppPropertyInterface;
struct _GICppPropertyInterface
{
GTypeInterface iface;
};
GType gi_cpp_property_interface_get_type();
G_END_DECLS
#endif /* __GI_CPP_EXAMPLE_H__ */
|