本文整理汇总了C++中G_TYPE_FUNDAMENTAL函数的典型用法代码示例。如果您正苦于以下问题:C++ G_TYPE_FUNDAMENTAL函数的具体用法?C++ G_TYPE_FUNDAMENTAL怎么用?C++ G_TYPE_FUNDAMENTAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_TYPE_FUNDAMENTAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gtk_argloc_set_from_value
static inline gboolean
gtk_argloc_set_from_value (GtkArg *arg,
GValue *value,
gboolean copy_string)
{
switch (G_TYPE_FUNDAMENTAL (arg->type))
{
case G_TYPE_CHAR: *GTK_RETLOC_CHAR (*arg) = g_value_get_char (value); break;
case G_TYPE_UCHAR: *GTK_RETLOC_UCHAR (*arg) = g_value_get_uchar (value); break;
case G_TYPE_BOOLEAN: *GTK_RETLOC_BOOL (*arg) = g_value_get_boolean (value); break;
case G_TYPE_INT: *GTK_RETLOC_INT (*arg) = g_value_get_int (value); break;
case G_TYPE_UINT: *GTK_RETLOC_UINT (*arg) = g_value_get_uint (value); break;
case G_TYPE_LONG: *GTK_RETLOC_LONG (*arg) = g_value_get_long (value); break;
case G_TYPE_ULONG: *GTK_RETLOC_ULONG (*arg) = g_value_get_ulong (value); break;
case G_TYPE_ENUM: *GTK_RETLOC_ENUM (*arg) = g_value_get_enum (value); break;
case G_TYPE_FLAGS: *GTK_RETLOC_FLAGS (*arg) = g_value_get_flags (value); break;
case G_TYPE_FLOAT: *GTK_RETLOC_FLOAT (*arg) = g_value_get_float (value); break;
case G_TYPE_DOUBLE: *GTK_RETLOC_DOUBLE (*arg) = g_value_get_double (value); break;
case G_TYPE_BOXED: *GTK_RETLOC_BOXED (*arg) = g_value_get_boxed (value); break;
case G_TYPE_POINTER: *GTK_RETLOC_POINTER (*arg) = g_value_get_pointer (value); break;
case G_TYPE_OBJECT: *GTK_RETLOC_POINTER (*arg) = g_value_get_object (value); break;
case G_TYPE_STRING: if (copy_string)
*GTK_RETLOC_STRING (*arg) = g_value_dup_string (value);
else
*GTK_RETLOC_STRING (*arg) = (char *) g_value_get_string (value);
break;
default:
return FALSE;
}
return TRUE;
}
开发者ID:batman52,项目名称:dingux-code,代码行数:31,代码来源:gtksignal.c
示例2: gobj_mark
static void
gobj_mark(gpointer ptr)
{
GObject* gobj = ptr;
guint n_properties;
GParamSpec** properties;
GValue gval = {0,};
guint i;
properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(gobj), &n_properties);
for (i = 0; i < n_properties; i++) {
GParamSpec* pspec = properties[i];
GType value_type = G_PARAM_SPEC_VALUE_TYPE(pspec);
if (G_TYPE_FUNDAMENTAL(value_type) != G_TYPE_OBJECT) continue;
if (!(pspec->flags & G_PARAM_READABLE)) continue;
/* FIXME: exclude types that doesn't have identity. */
{
g_value_init(&gval, value_type);
g_object_get_property(gobj, pspec->name, &gval);
rbgobj_gc_mark_gvalue(&gval);
g_value_unset(&gval);
}
}
g_free(properties);
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:28,代码来源:rbgobj_object.c
示例3: gtk_arg_static_to_value
static inline gboolean
gtk_arg_static_to_value (GtkArg *arg,
GValue *value)
{
switch (G_TYPE_FUNDAMENTAL (arg->type))
{
case G_TYPE_CHAR: g_value_set_char (value, GTK_VALUE_CHAR (*arg)); break;
case G_TYPE_UCHAR: g_value_set_uchar (value, GTK_VALUE_UCHAR (*arg)); break;
case G_TYPE_BOOLEAN: g_value_set_boolean (value, GTK_VALUE_BOOL (*arg)); break;
case G_TYPE_INT: g_value_set_int (value, GTK_VALUE_INT (*arg)); break;
case G_TYPE_UINT: g_value_set_uint (value, GTK_VALUE_UINT (*arg)); break;
case G_TYPE_LONG: g_value_set_long (value, GTK_VALUE_LONG (*arg)); break;
case G_TYPE_ULONG: g_value_set_ulong (value, GTK_VALUE_ULONG (*arg)); break;
case G_TYPE_ENUM: g_value_set_enum (value, GTK_VALUE_ENUM (*arg)); break;
case G_TYPE_FLAGS: g_value_set_flags (value, GTK_VALUE_FLAGS (*arg)); break;
case G_TYPE_FLOAT: g_value_set_float (value, GTK_VALUE_FLOAT (*arg)); break;
case G_TYPE_DOUBLE: g_value_set_double (value, GTK_VALUE_DOUBLE (*arg)); break;
case G_TYPE_STRING: g_value_set_static_string (value, GTK_VALUE_STRING (*arg)); break;
case G_TYPE_BOXED: g_value_set_static_boxed (value, GTK_VALUE_BOXED (*arg)); break;
case G_TYPE_POINTER: g_value_set_pointer (value, GTK_VALUE_POINTER (*arg)); break;
case G_TYPE_OBJECT: g_value_set_object (value, GTK_VALUE_POINTER (*arg)); break;
default:
return FALSE;
}
return TRUE;
}
开发者ID:batman52,项目名称:dingux-code,代码行数:26,代码来源:gtksignal.c
示例4: rbgobj_ruby_object_from_instance2
VALUE
rbgobj_ruby_object_from_instance2(gpointer instance, gboolean alloc)
{
VALUE object;
GType type;
if (!instance)
return Qnil;
type = G_TYPE_FROM_INSTANCE(instance);
if (alloc) {
GType parent_type;
for (parent_type = type;
parent_type != G_TYPE_INVALID;
parent_type = g_type_parent(parent_type)) {
if (rbgobj_convert_instance2robj(parent_type, instance, &object))
return object;
}
}
switch (G_TYPE_FUNDAMENTAL(type)) {
case G_TYPE_OBJECT:
return rbgobj_get_ruby_object_from_gobject(instance, alloc);
case G_TYPE_PARAM:
return rbgobj_get_ruby_object_from_param_spec(instance, alloc);
default:
if (alloc) {
rb_raise(rb_eTypeError, "%s isn't supported", g_type_name(type));
} else {
return Qnil;
}
}
}
开发者ID:pkorenev,项目名称:ruby-gnome2,代码行数:33,代码来源:rbgobject.c
示例5: rbgobj_initialize_object
void
rbgobj_initialize_object(VALUE obj, gpointer cobj)
{
GType type;
GType parent_type;
if (!cobj)
rb_raise(rb_eRuntimeError, "failed to initialize");
type = RVAL2GTYPE(obj);
for (parent_type = type;
parent_type != G_TYPE_INVALID;
parent_type = g_type_parent(parent_type)) {
if (rbgobj_convert_initialize(parent_type, obj, cobj))
return;
}
type = G_TYPE_FUNDAMENTAL(type);
switch (type){
case G_TYPE_OBJECT:
rbgobj_gobject_initialize(obj, cobj);
break;
case G_TYPE_PARAM:
rbgobj_param_spec_initialize(obj, cobj);
break;
case G_TYPE_BOXED:
rbgobj_boxed_initialize(obj, cobj);
break;
default:
rbgobj_convert_initialize(type, obj, cobj);
}
}
开发者ID:pkorenev,项目名称:ruby-gnome2,代码行数:34,代码来源:rbgobject.c
示例6: GOM_ASTRING_TO_GSTRING_RETURN
/* void setAttribute (in nsIAtom name, in AString newValue); */
NS_IMETHODIMP
xgGtkElement::SetAttribute (nsIAtom *name, const nsAString &newValue)
{
GOM_ASTRING_TO_GSTRING_RETURN (value, newValue, NS_ERROR_INVALID_ARG);
GParamSpec *spec;
guint signal_id;
if (!Resolve (name, &spec, &signal_id)) {
return NS_ERROR_FAILURE;
}
if (!spec) {
return NS_ERROR_FAILURE;
}
GError *error = NULL;
GValue gval = { 0 };
if (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (spec)) == G_TYPE_OBJECT) {
g_warning (GOM_LOC ("Attribute %s.%s is a %s, which a string cannot be converted to"),
G_OBJECT_TYPE_NAME (mObject), spec->name,
g_type_name (G_PARAM_SPEC_VALUE_TYPE (spec)));
return NS_ERROR_FAILURE;
} else if (gtk_builder_value_from_string (NULL, spec, value, &gval, &error)) {
g_object_set_property (mObject, spec->name, &gval);
g_value_unset (&gval);
} else {
g_warning (GOM_LOC ("Could not get value from string: '%s'"), value);
return NS_ERROR_FAILURE;
}
return NS_OK;
}
开发者ID:jberkman,项目名称:gom,代码行数:31,代码来源:xgGtkElement.cpp
示例7: rbgobj_instance_from_ruby_object
gpointer
rbgobj_instance_from_ruby_object(VALUE obj)
{
GType type;
if (NIL_P(obj))
return NULL;
type = RVAL2GTYPE(obj);
if (rbgobj_convert_has_type(type)) {
gpointer instance;
if (rbgobj_convert_robj2instance(type, obj, &instance))
return instance;
}
type = G_TYPE_FUNDAMENTAL(type);
switch (type){
case G_TYPE_OBJECT:
return rbgobj_get_gobject(obj);
case G_TYPE_PARAM:
return rbgobj_get_param_spec(obj);
default:
{
gpointer instance;
if (!rbgobj_convert_robj2instance(type, obj, &instance)) {
rb_raise(rb_eTypeError, "%s isn't supported",
rb_class2name(CLASS_OF(obj)));
}
return instance;
}
}
}
开发者ID:pkorenev,项目名称:ruby-gnome2,代码行数:32,代码来源:rbgobject.c
示例8: gog_object_set_arg
void
gog_object_set_arg (char const *name, char const *val, GogObject *obj)
{
GParamSpec *pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (obj), name);
GType prop_type;
GValue res = { 0 };
gboolean success = TRUE;
if (pspec == NULL) {
g_warning ("unknown property `%s' for class `%s'",
name, G_OBJECT_TYPE_NAME (obj));
return;
}
prop_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
if (val == NULL &&
G_TYPE_FUNDAMENTAL (prop_type) != G_TYPE_BOOLEAN) {
g_warning ("could not convert NULL to type `%s' for property `%s'",
g_type_name (prop_type), pspec->name);
return;
}
if (!gsf_xml_gvalue_from_str (&res, prop_type, val))
success = FALSE;
if (!success) {
g_warning ("could not convert string to type `%s' for property `%s'",
g_type_name (prop_type), pspec->name);
} else
g_object_set_property (G_OBJECT (obj), name, &res);
g_value_unset (&res);
}
开发者ID:GNOME,项目名称:goffice,代码行数:31,代码来源:gog-object-xml.c
示例9: G_VALUE_TYPE
void bb_interpolate_value (GValue *out,
gdouble frac,
const GValue *a,
const GValue *b,
BbInterpolationMode interp_mode)
{
GType type = G_VALUE_TYPE (out);
g_assert (type == G_VALUE_TYPE (a));
g_assert (type == G_VALUE_TYPE (b));
switch (G_TYPE_FUNDAMENTAL (type))
{
case G_TYPE_DOUBLE:
g_value_set_double (out, bb_interpolate_double (frac, g_value_get_double (a), g_value_get_double (b), interp_mode));
break;
default:
if (type == BB_TYPE_DURATION)
{
BbDuration adur, bdur;
bb_value_get_duration (a, &adur);
bb_value_get_duration (b, &bdur);
if (adur.units != bdur.units)
g_error ("cannot interpolate between durations that are in different units");
adur.value = bb_interpolate_double (frac, adur.value, bdur.value, interp_mode);
bb_value_set_duration (out, adur.units, adur.value);
break;
}
else
g_error ("cannot interpolate value of type %s", g_type_name (type));
}
}
开发者ID:davebenson,项目名称:beatbox2,代码行数:30,代码来源:bb-utils.c
示例10: rbgobj_gc_mark_gvalue
void
rbgobj_gc_mark_gvalue(GValue* value)
{
GType gtype = G_VALUE_TYPE(value);
/* FIXME */
if (G_TYPE_FUNDAMENTAL(gtype) == G_TYPE_OBJECT)
rbgobj_gc_mark_instance(g_value_get_object(value));
}
开发者ID:dmaciejak,项目名称:ruby-gnome2,代码行数:8,代码来源:rbgobj_value.c
示例11: rg_set_child_property
static VALUE
rg_set_child_property(VALUE self, VALUE child,
VALUE prop_name, VALUE val)
{
GParamSpec* pspec;
const char* name;
if (SYMBOL_P(prop_name)) {
name = rb_id2name(SYM2ID(prop_name));
} else {
StringValue(prop_name);
name = StringValuePtr(prop_name);
}
pspec = goo_canvas_item_class_find_child_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name);
if (!pspec)
rb_raise(rb_eRuntimeError, "No such child property: %s", name);
#define _SET_PROP_FOR_TYPE(gtype, ctype, val) \
case gtype: \
goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, (ctype)(val), NULL); \
break;
switch (G_TYPE_FUNDAMENTAL(G_PARAM_SPEC_VALUE_TYPE(pspec))) {
_SET_PROP_FOR_TYPE(G_TYPE_CHAR, gchar, NUM2INT(val));
_SET_PROP_FOR_TYPE(G_TYPE_UCHAR, guchar, NUM2INT(val));
_SET_PROP_FOR_TYPE(G_TYPE_BOOLEAN, gboolean, RTEST(val));
_SET_PROP_FOR_TYPE(G_TYPE_INT, gint, NUM2INT(val));
_SET_PROP_FOR_TYPE(G_TYPE_UINT, guint, NUM2UINT(val));
_SET_PROP_FOR_TYPE(G_TYPE_LONG, glong, NUM2LONG(val));
_SET_PROP_FOR_TYPE(G_TYPE_ULONG, gulong, NUM2ULONG(val));
_SET_PROP_FOR_TYPE(G_TYPE_INT64, gint64, rbglib_num_to_int64(val));
_SET_PROP_FOR_TYPE(G_TYPE_UINT64, guint64, rbglib_num_to_uint64(val));
_SET_PROP_FOR_TYPE(G_TYPE_ENUM, gint, rbgobj_get_enum(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
_SET_PROP_FOR_TYPE(G_TYPE_FLAGS, guint, rbgobj_get_flags(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
_SET_PROP_FOR_TYPE(G_TYPE_FLOAT, gfloat, NUM2DBL(val));
_SET_PROP_FOR_TYPE(G_TYPE_DOUBLE, gdouble, NUM2DBL(val));
case G_TYPE_STRING:
{
if (SYMBOL_P(val))
val = rb_funcall(val, rb_intern("to_s"), 0);
goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, StringValuePtr(val), NULL);
break;
}
default:
g_warning("rb_goo_canvas_item_set_child_property: unsupported type: %s\n", g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec)));
return Qnil;
}
#undef _SET_PROP_FOR_TYPE
G_CHILD_ADD(child, val);
return self;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:56,代码来源:rbgoocanvasitem.c
示例12: __get_expression_value
static void
__get_expression_value (GdaConnection *cnc, GValue *src, GString *str)
{
gchar *escaped_string = NULL;
switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (src))) {
case G_TYPE_STRING:
escaped_string = gda_connection_value_to_sql_string(cnc, src);
g_string_append_printf (str, "%s", escaped_string);
g_free(escaped_string);
break;
case G_TYPE_UINT:
g_string_append_printf (str, "%d", g_value_get_uint (src));
break;
case G_TYPE_INT:
g_string_append_printf (str, "%d", g_value_get_int (src));
break;
case G_TYPE_FLOAT:
g_string_append_printf (str, "%.04f", g_value_get_float (src));
break;
case G_TYPE_BOOLEAN:
g_string_append_printf (str, "%d", g_value_get_boolean (src));
break;
case G_TYPE_BOXED:
if (G_VALUE_TYPE (src) == G_TYPE_VALUE_ARRAY) {
GValueArray *array = (GValueArray *) g_value_get_boxed (src);
if (!array) {
/* FIXME, add this to validate */
g_warning ("Empty array given");
return;
}
guint i;
for (i = 0; i < array->n_values; i++) {
if (i > 0)
g_string_append (str, ", ");
__get_expression_value (cnc, g_value_array_get_nth (array, i), str);
}
} else {
/*FIXME, add this to validate */
g_warning ("BOXED type '%s' not implemented \n", G_VALUE_TYPE_NAME (src));
}
break;
default:
break;
}
return;
}
开发者ID:William-Wai,项目名称:midgard-core,代码行数:54,代码来源:midgard_sql_query_constraint.c
示例13: tp_g_value_slice_new_take_boxed
/**
* tp_g_value_slice_new_take_boxed:
* @type: a boxed type
* @p: a pointer of type @type which will be freed with g_boxed_free() by the
* returned #GValue (the caller must own it before calling this function, but
* no longer owns it after this function returns)
*
* Slice-allocate and initialize a #GValue. This function is convenient to
* use when constructing hash tables from string to #GValue, for example.
*
* Returns: a #GValue of type @type whose value is @p,
* to be freed with tp_g_value_slice_free() or g_slice_free()
*
* Since: 0.7.27
*/
GValue *
tp_g_value_slice_new_take_boxed (GType type,
gpointer p)
{
GValue *v;
g_return_val_if_fail (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED, NULL);
v = tp_g_value_slice_new (type);
g_value_take_boxed (v, p);
return v;
}
开发者ID:psunkari,项目名称:spicebird,代码行数:26,代码来源:util.c
示例14: switch
static json_t *json_serialize_pspec (const GValue *value)
{
/* Only types in json-glib but G_TYPE_BOXED */
switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (value))) {
case G_TYPE_STRING:
if (!g_value_get_string (value))
break;
else
return json_string (g_value_get_string (value));
case G_TYPE_BOOLEAN:
if (g_value_get_boolean (value))
return json_true ();
else return json_false ();
case G_TYPE_INT:
return json_integer (g_value_get_int (value));
case G_TYPE_UINT:
return json_integer (g_value_get_uint (value));
case G_TYPE_LONG:
return json_integer (g_value_get_long (value));
case G_TYPE_ULONG:
return json_integer (g_value_get_ulong (value));
case G_TYPE_INT64:
return json_integer (g_value_get_int64 (value));
case G_TYPE_FLOAT:
return json_real (g_value_get_float (value));
case G_TYPE_DOUBLE:
return json_real (g_value_get_double (value));
case G_TYPE_CHAR:
return json_integer (g_value_get_schar (value));
case G_TYPE_UCHAR:
return json_integer (g_value_get_uchar (value));
case G_TYPE_ENUM:
return json_integer (g_value_get_enum (value));
case G_TYPE_FLAGS:
return json_integer (g_value_get_flags (value));
case G_TYPE_NONE:
break;
case G_TYPE_OBJECT:
{
GObject *object = g_value_get_object (value);
if (object)
return json_gobject_serialize (object);
}
break;
defalut:
g_warning("Unsuppoted type `%s'",g_type_name (G_VALUE_TYPE (value)));
}
return json_null();
}
开发者ID:9thsector,项目名称:libsearpc,代码行数:49,代码来源:searpc-utils.c
示例15: gimp_config_deserialize_value
static GTokenType
gimp_config_deserialize_value (GValue *value,
GimpConfig *config,
GParamSpec *prop_spec,
GScanner *scanner)
{
if (G_TYPE_FUNDAMENTAL (prop_spec->value_type) == G_TYPE_ENUM)
{
return gimp_config_deserialize_enum (value, prop_spec, scanner);
}
else if (G_TYPE_IS_FUNDAMENTAL (prop_spec->value_type))
{
return gimp_config_deserialize_fundamental (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_MEMSIZE)
{
return gimp_config_deserialize_memsize (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_CONFIG_PATH)
{
return gimp_config_deserialize_path (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_RGB)
{
return gimp_config_deserialize_rgb (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_MATRIX2)
{
return gimp_config_deserialize_matrix2 (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_VALUE_ARRAY)
{
return gimp_config_deserialize_value_array (value,
config, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_UNIT)
{
return gimp_config_deserialize_unit (value, prop_spec, scanner);
}
else if (prop_spec->value_type == G_TYPE_FILE)
{
return gimp_config_deserialize_file_value (value, prop_spec, scanner);
}
/* This fallback will only work for value_types that
* can be transformed from a string value.
*/
return gimp_config_deserialize_any (value, prop_spec, scanner);
}
开发者ID:LebedevRI,项目名称:gimp,代码行数:49,代码来源:gimpconfig-deserialize.c
示例16: get_fundamental_type
static inline GType
get_fundamental_type (GType type)
{
GType result;
result = G_TYPE_FUNDAMENTAL (type);
if (result == G_TYPE_INTERFACE)
{
if (g_type_is_a (type, G_TYPE_OBJECT))
result = G_TYPE_OBJECT;
}
return result;
}
开发者ID:Pfiver,项目名称:gtk,代码行数:15,代码来源:gtktreedatalist.c
示例17: gtk2hs_value_as_haskellobj
inline static HaskellObj gtk2hs_value_as_haskellobj(Capability *cap, const GValue *value) {
switch (G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value))) {
case G_TYPE_INTERFACE:
if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT))
return rts_mkPtr(cap, g_value_get_object(value));
else
break;
case G_TYPE_CHAR:
return rts_mkChar(cap, g_value_get_char(value));
case G_TYPE_UCHAR:
return rts_mkChar(cap, g_value_get_uchar(value));
case G_TYPE_BOOLEAN:
return rts_mkBool(cap, g_value_get_boolean(value));
case G_TYPE_INT:
return rts_mkInt(cap, g_value_get_int(value));
case G_TYPE_UINT:
return rts_mkWord(cap, g_value_get_uint(value));
case G_TYPE_LONG:
return rts_mkInt(cap, g_value_get_long(value));
case G_TYPE_ULONG:
return rts_mkWord(cap, g_value_get_ulong(value));
/* case G_TYPE_INT64:
return rts_mkInt64(cap, g_value_get_int64(value));
case G_TYPE_UINT64:
return rts_mkWord64(cap, g_value_get_uint64(value)); */
case G_TYPE_ENUM:
return rts_mkInt(cap, g_value_get_enum(value));
case G_TYPE_FLAGS:
return rts_mkWord(cap, g_value_get_enum(value));
case G_TYPE_FLOAT:
return rts_mkFloat(cap, g_value_get_float(value));
case G_TYPE_DOUBLE:
return rts_mkDouble(cap, g_value_get_double(value));
case G_TYPE_STRING:
return rts_mkPtr(cap, (char *)g_value_get_string(value)); /* CHECKME: is the string freed? */
case G_TYPE_POINTER:
return rts_mkPtr(cap, g_value_get_pointer(value));
case G_TYPE_BOXED:
return rts_mkPtr(cap, g_value_get_boxed(value));
/* case G_TYPE_PARAM:
return g_value_get_param(value); */
case G_TYPE_OBJECT:
return rts_mkPtr(cap, g_value_get_object(value));
}
g_error("gtk2hs_value_as_haskellobj: unable to handle GValue with type %s\n"
"please report this as a bug to [email protected]",
g_type_name(G_VALUE_TYPE(value)));
}
开发者ID:abarbu,项目名称:Clutterhs,代码行数:48,代码来源:hsgvalue.c
示例18: go_component_new_by_mime_type
void GOComponentView::loadBuffer(const UT_ConstByteBufPtr & sGOComponentData, const char *_mime_type)
{
if (!component) {
mime_type = _mime_type;
component = go_component_new_by_mime_type (_mime_type);
}
UT_return_if_fail (component);
go_component_set_inline (component, true);
go_component_set_use_font_from_app (component, true);
g_signal_connect (G_OBJECT (component), "changed",
G_CALLBACK (changed_cb), this);
if (component == NULL) {
// we should do something intelligent in that case
return;
}
go_component_set_default_size (component, 2.5, 2.5, 0.);
if (sGOComponentData->getLength () > 0) {
if (m_pRun) {
PP_AttrProp const *Props = m_pRun->getSpanAP ();
GParamSpec *prop_spec;
int i = 0;
GValue res = G_VALUE_INIT;
gchar const *szName, *szValue;
while (Props->getNthProperty (i++, szName, szValue)) {
prop_spec = g_object_class_find_property (
G_OBJECT_GET_CLASS (component), szName);
if (prop_spec && (prop_spec->flags & GO_PARAM_PERSISTENT) &&
gsf_xml_gvalue_from_str (&res,
G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (prop_spec)),
szValue)) {
g_object_set_property (G_OBJECT (component), szName, &res);
g_value_unset (&res);
}
}
}
go_component_set_data (component,
(char const*) sGOComponentData->getPointer (0),
(int) sGOComponentData->getLength ());
} else
go_component_edit (component);
width = 0; // force pixbuf update
// update ascent and descent now, otherwise it will not be updated when loading
double _ascent, _descent;
g_object_get (G_OBJECT (component), "ascent", &_ascent, "descent", &_descent, NULL);
ascent = (UT_sint32) rint (_ascent * UT_LAYOUT_RESOLUTION);
descent = (UT_sint32) rint (_descent * UT_LAYOUT_RESOLUTION);
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:47,代码来源:AbiGOComponent.cpp
示例19: rbgobj_instance_unref
void
rbgobj_instance_unref(gpointer instance)
{
GType type;
type = G_TYPE_FROM_INSTANCE(instance);
if (!rbgobj_convert_unref(type, instance)) {
type = G_TYPE_FUNDAMENTAL(type);
switch (type) {
case G_TYPE_OBJECT:
g_object_unref(instance);
break;
default:
rbgobj_convert_unref(type, instance);
break;
}
}
}
开发者ID:ruby-gnome2,项目名称:ruby-gnome2,代码行数:18,代码来源:rbgobject.c
示例20: gogo_prop_end
static void
gogo_prop_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
{
GogXMLReadState *state = (GogXMLReadState *)xin->user_state;
char const *content = xin->content->str;
GType prop_type, prop_ftype;
GValue val = { 0 };
if (state->obj == NULL || state->prop_spec == NULL)
return;
prop_type = G_PARAM_SPEC_VALUE_TYPE (state->prop_spec);
prop_ftype = G_TYPE_FUNDAMENTAL (prop_type);
if (prop_ftype == G_TYPE_OBJECT) {
GogObject *obj = state->obj;
if (!state->prop_pushed_obj)
return;
state->obj = state->obj_stack->data;
state->obj_stack = g_slist_remove (state->obj_stack, state->obj);
state->prop_pushed_obj = FALSE;
g_value_init (&val, prop_type);
g_value_set_object (&val, G_OBJECT (obj));
g_object_unref (obj);
} else {
if (content == NULL && prop_ftype != G_TYPE_BOOLEAN) {
g_warning ("could not convert NULL to type `%s' for property `%s'",
g_type_name (prop_type), state->prop_spec->name);
return;
}
if (!gsf_xml_gvalue_from_str (&val, prop_type, content)) {
g_warning ("could not convert string to type `%s' for property `%s'",
g_type_name (prop_type), state->prop_spec->name);
return;
}
}
g_object_set_property (G_OBJECT (state->obj),
state->prop_spec->name, &val);
g_value_unset (&val);
}
开发者ID:GNOME,项目名称:goffice,代码行数:43,代码来源:gog-object-xml.c
注:本文中的G_TYPE_FUNDAMENTAL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论