init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
2766
cmake/external/glib/cppgir/test/main.cpp
vendored
Normal file
2766
cmake/external/glib/cppgir/test/main.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
36
cmake/external/glib/cppgir/test/test_boxed.c
vendored
Normal file
36
cmake/external/glib/cppgir/test/test_boxed.c
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "test_boxed.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
GBExample* gi_cpp_gbexample_new ()
|
||||
{
|
||||
return g_new0 (GBExample, 1);
|
||||
}
|
||||
|
||||
static GBExample*
|
||||
gb_example_copy (const GBExample * src)
|
||||
{
|
||||
GBExample *out = gi_cpp_gbexample_new ();
|
||||
*out = *src;
|
||||
return out;
|
||||
}
|
||||
|
||||
static void
|
||||
gb_example_free (GBExample * ex)
|
||||
{
|
||||
g_free (ex);
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GBExample, gi_cpp_gbexample, gb_example_copy, gb_example_free)
|
||||
|
||||
CBExample* gi_cpp_cbexample_new ()
|
||||
{
|
||||
return g_new0 (CBExample, 1);
|
||||
}
|
||||
|
||||
void gi_cpp_cbexample_free (CBExample * ex)
|
||||
{
|
||||
g_free (ex);
|
||||
}
|
||||
|
||||
34
cmake/external/glib/cppgir/test/test_boxed.h
vendored
Normal file
34
cmake/external/glib/cppgir/test/test_boxed.h
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef TEST_BOXED_H
|
||||
#define TEST_BOXED_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gi_cpp_gbexample_get_type();
|
||||
|
||||
#define GI_CPP_TYPE_BOXED_EXAMPLE (gi_cpp_gbexample_get_type())
|
||||
|
||||
/* G_TYPE_BOXED example */
|
||||
|
||||
typedef struct _GBExample
|
||||
{
|
||||
int data;
|
||||
} GBExample;
|
||||
|
||||
GBExample *gi_cpp_gbexample_new();
|
||||
|
||||
/* plain struct example */
|
||||
|
||||
typedef struct _CBExample
|
||||
{
|
||||
int data;
|
||||
} CBExample;
|
||||
|
||||
CBExample *gi_cpp_cbexample_new();
|
||||
void gi_cpp_cbexample_free(CBExample *);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // TEST_BOXED_H
|
||||
293
cmake/external/glib/cppgir/test/test_object.c
vendored
Normal file
293
cmake/external/glib/cppgir/test/test_object.c
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
#include "test_object.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
// helper enum
|
||||
GType
|
||||
gi_cpp_enum_get_type (void)
|
||||
{
|
||||
static GType enum_type = 0;
|
||||
|
||||
static const GEnumValue enum_types[] = {
|
||||
{ENUM_VALUE_0, "EnumValue0", "v0"},
|
||||
{ENUM_VALUE_1, "EnumValue1", "v1"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (!enum_type) {
|
||||
enum_type = g_enum_register_static ("GICppEnum", enum_types);
|
||||
}
|
||||
return enum_type;
|
||||
}
|
||||
|
||||
// helper flags
|
||||
GType
|
||||
gi_cpp_flags_get_type (void)
|
||||
{
|
||||
static GType flags_type = 0;
|
||||
|
||||
static const GFlagsValue flags_types[] = {
|
||||
{FLAG_VALUE_0, "FlagValue0", "f0"},
|
||||
{FLAG_VALUE_1, "FlagValue1", "f1"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (!flags_type) {
|
||||
flags_type = g_flags_register_static ("GICppFlags", flags_types);
|
||||
}
|
||||
return flags_type;
|
||||
}
|
||||
|
||||
// interface
|
||||
typedef GICppExampleInterface GICppIExampleInterface;
|
||||
G_DEFINE_INTERFACE (GICppIExample, gi_cpp_example_interface, 0)
|
||||
|
||||
static void
|
||||
gi_cpp_example_interface_default_init (GICppExampleInterface *iface)
|
||||
{
|
||||
(void) iface;
|
||||
}
|
||||
|
||||
// property interface
|
||||
typedef GICppPropertyInterface GICppIPropertyInterface;
|
||||
G_DEFINE_INTERFACE (GICppIProperty, gi_cpp_property_interface, 0)
|
||||
|
||||
static void
|
||||
gi_cpp_property_interface_default_init (GICppPropertyInterface *iface)
|
||||
{
|
||||
(void) iface;
|
||||
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_int (NAME_INUMBER, "ItfNumber",
|
||||
"ItfNumber", 0, 50, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
enum {
|
||||
EXAMPLE_TO_INT,
|
||||
EXAMPLE_TO_STRING,
|
||||
EXAMPLE_TO_VOID,
|
||||
EXAMPLE_TO_OUTPUT_INT,
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint example_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
struct _GICppExample
|
||||
{
|
||||
GObject object;
|
||||
|
||||
/* properties */
|
||||
gchar *data;
|
||||
gint number;
|
||||
gdouble fnumber;
|
||||
GObject *obj;
|
||||
gboolean present;
|
||||
CEnum enumvalue;
|
||||
CFlags flagsvalue;
|
||||
GError *error;
|
||||
gint itf_number;
|
||||
};
|
||||
|
||||
static int
|
||||
vmethod_interface_default (GICppExampleItf * itf, int a)
|
||||
{
|
||||
// sanity check
|
||||
g_assert (GI_IS_CPP_EXAMPLE (itf));
|
||||
|
||||
return 2 + a;
|
||||
}
|
||||
|
||||
static void
|
||||
gi_cpp_example_interface_init (GICppExampleInterface *iface)
|
||||
{
|
||||
iface->vmethod = vmethod_interface_default;
|
||||
}
|
||||
|
||||
#define gi_cpp_example_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GICppExample, gi_cpp_example, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (gi_cpp_example_interface_get_type(), gi_cpp_example_interface_init))
|
||||
|
||||
static void
|
||||
gi_cpp_example_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GICppExample *ex = GI_CPP_EXAMPLE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DATA:
|
||||
g_value_set_string (value, ex->data);
|
||||
break;
|
||||
case PROP_NUMBER:
|
||||
g_value_set_int (value, ex->number);
|
||||
break;
|
||||
case PROP_FNUMBER:
|
||||
g_value_set_double (value, ex->fnumber);
|
||||
break;
|
||||
case PROP_PRESENT:
|
||||
g_value_set_boolean (value, ex->present);
|
||||
break;
|
||||
case PROP_OBJECT:
|
||||
g_value_set_object (value, ex->obj);
|
||||
break;
|
||||
case PROP_ENUM:
|
||||
g_value_set_enum (value, ex->enumvalue);
|
||||
break;
|
||||
case PROP_FLAGS:
|
||||
g_value_set_flags (value, ex->flagsvalue);
|
||||
break;
|
||||
case PROP_ERROR:
|
||||
g_value_set_boxed (value, ex->error);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gi_cpp_example_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GICppExample *ex = GI_CPP_EXAMPLE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DATA:
|
||||
g_free (ex->data);
|
||||
ex->data = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_NUMBER:
|
||||
ex->number = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_FNUMBER:
|
||||
ex->fnumber = g_value_get_double (value);
|
||||
break;
|
||||
case PROP_PRESENT:
|
||||
ex->present = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_OBJECT:
|
||||
if (ex->obj)
|
||||
g_object_unref (ex->obj);
|
||||
ex->obj = g_value_dup_object (value);
|
||||
break;
|
||||
case PROP_ENUM:
|
||||
ex->enumvalue = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_FLAGS:
|
||||
ex->flagsvalue = g_value_get_flags (value);
|
||||
break;
|
||||
case PROP_ERROR:
|
||||
if (ex->error)
|
||||
g_error_free(ex->error);
|
||||
ex->error = g_value_dup_boxed(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gi_cpp_example_finalize (GObject * object)
|
||||
{
|
||||
GICppExample *ex = GI_CPP_EXAMPLE (object);
|
||||
|
||||
g_free (ex->data);
|
||||
if (ex->obj)
|
||||
g_object_unref (ex->obj);
|
||||
if (ex->error)
|
||||
g_error_free(ex->error);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static int
|
||||
vmethod_default (GICppExample * ex, int a, int b)
|
||||
{
|
||||
// sanity check
|
||||
g_assert (GI_IS_CPP_EXAMPLE (ex));
|
||||
|
||||
(void)ex;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
static void
|
||||
gi_cpp_example_class_init (GICppExampleClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
|
||||
gobject_class->finalize = gi_cpp_example_finalize;
|
||||
gobject_class->set_property = gi_cpp_example_set_property;
|
||||
gobject_class->get_property = gi_cpp_example_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_NUMBER,
|
||||
g_param_spec_int (NAME_NUMBER, "Number",
|
||||
"Number", 0, 50, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_FNUMBER,
|
||||
g_param_spec_double (NAME_FNUMBER, "FNumber",
|
||||
"FNumber", 0, 50, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_DATA,
|
||||
g_param_spec_string (NAME_DATA, "Data", "Data", NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_PRESENT,
|
||||
g_param_spec_boolean (NAME_PRESENT, "Present", "Present",
|
||||
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_OBJECT,
|
||||
g_param_spec_object (NAME_OBJECT, "Object", "Object",
|
||||
G_TYPE_OBJECT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_ENUM,
|
||||
g_param_spec_enum (NAME_ENUM, "Enum", "Enum",
|
||||
GI_CPP_TYPE_ENUM, ENUM_VALUE_0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_FLAGS,
|
||||
g_param_spec_flags (NAME_FLAGS, "Flags", "Flags",
|
||||
GI_CPP_TYPE_FLAGS, FLAG_VALUE_0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_ERROR,
|
||||
g_param_spec_boxed (NAME_ERROR, "Error", "Error",
|
||||
G_TYPE_ERROR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
example_signals[EXAMPLE_TO_INT] =
|
||||
g_signal_new ("to-int", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_INT, 4,
|
||||
G_TYPE_OBJECT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING);
|
||||
|
||||
example_signals[EXAMPLE_TO_STRING] =
|
||||
g_signal_new ("to-string", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_STRING, 2,
|
||||
G_TYPE_INT, G_TYPE_INT64);
|
||||
|
||||
example_signals[EXAMPLE_TO_VOID] =
|
||||
g_signal_new ("to-void", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 3,
|
||||
G_TYPE_DOUBLE, GI_CPP_TYPE_ENUM, GI_CPP_TYPE_FLAGS);
|
||||
|
||||
example_signals[EXAMPLE_TO_VOID] =
|
||||
g_signal_new ("to-output-int", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_PTR_ARRAY, G_TYPE_POINTER);
|
||||
|
||||
klass->vmethod = vmethod_default;
|
||||
}
|
||||
|
||||
static void
|
||||
gi_cpp_example_init (GICppExample * ex)
|
||||
{
|
||||
(void)ex;
|
||||
}
|
||||
|
||||
GICppExample *
|
||||
gi_cpp_example_new ()
|
||||
{
|
||||
return g_object_new (GI_CPP_TYPE_EXAMPLE, NULL);
|
||||
}
|
||||
100
cmake/external/glib/cppgir/test/test_object.h
vendored
Normal file
100
cmake/external/glib/cppgir/test/test_object.h
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
#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_ERROR,
|
||||
PROP_LAST = PROP_ERROR
|
||||
};
|
||||
|
||||
#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_ERROR "error"
|
||||
|
||||
#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__ */
|
||||
Reference in New Issue
Block a user