当前位置: 首页>>代码示例>>C++>>正文


C++ G_VALUE_HOLDS函数代码示例

本文整理汇总了C++中G_VALUE_HOLDS函数的典型用法代码示例。如果您正苦于以下问题:C++ G_VALUE_HOLDS函数的具体用法?C++ G_VALUE_HOLDS怎么用?C++ G_VALUE_HOLDS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了G_VALUE_HOLDS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dbus_glib_object1_struct_example_method_impl

gboolean dbus_glib_object1_struct_example_method_impl (DBusGlibObject1 *self, 
		GValueArray*         st,        
        gint*		 ret,
        GError **error)
{	
	GValue *val;    
	
	val = g_value_array_get_nth(st, 0);
	  
	if (G_VALUE_HOLDS(val, G_TYPE_INT)) 
		if (g_value_type_compatible (G_VALUE_TYPE (val), G_TYPE_INT))
	    	if(g_value_get_int(val) != 1234)
	              *ret = -1;
	    	
	val = g_value_array_get_nth(st, 1);
  
	if (G_VALUE_HOLDS(val, G_TYPE_STRING))
    	if (g_value_type_compatible (G_VALUE_TYPE (val), G_TYPE_STRING))
    		if(strcmp("StructPassing", g_value_get_string(val)))
    				*ret = -1;
	
    if(*ret != -1)
    	*ret = 5050;
    
	return TRUE;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:26,代码来源:dbus_glib_server1.c

示例2: g_hash_table_lookup

static GList *parse_one_formats_list (GHashTable *sysinfo_dict, 
                                      const char *key)
{
    GValue *to_parse;
    GList *formats = NULL;
    GValueArray *array;
    gint i;

    to_parse = g_hash_table_lookup (sysinfo_dict, key);
    if (to_parse == NULL) {
        return NULL;
    }
    if (!G_VALUE_HOLDS (to_parse, G_TYPE_VALUE_ARRAY)) {
        return NULL;
    }
    array = (GValueArray*)g_value_get_boxed (to_parse);
    for (i = 0; i < array->n_values; i++) {
        Itdb_ArtworkFormat *format;
	/* SysInfoExtended on the iPhone has <string> fields in the artwork
	 * format array in addition to the hash we parse
	 */
	if (!G_VALUE_HOLDS (g_value_array_get_nth (array, i), G_TYPE_HASH_TABLE)) {
	    continue;
	}
	format = g_value_to_image_format (g_value_array_get_nth (array, i));
	if (format != NULL) {
		formats = g_list_prepend (formats, format);
	}
    } 
    g_hash_table_remove (sysinfo_dict, key);
    return formats;
}
开发者ID:Babl0lka,项目名称:libgpod,代码行数:32,代码来源:itdb_sysinfo_extended_parser.c

示例3: fs_stream_parse_new_active_candidate_pair

/**
 * fs_stream_parse_new_active_candidate_pair:
 * @stream: a #FsStream to match against the message
 * @message: a #GstMessage to parse
 * @local_candidate: (out) (transfer none): Returns the local #FsCandidate in
 *  the message if not %NULL.
 * @remote_candidate: (out) (transfer none): Returns the remote #FsCandidate in
 *  the message if not %NULL.
 *
 * Parses a "farstream-new-active-candidate-pair" message and checks
 * if it matches the @stream parameters.
 *
 * Returns: %TRUE if the message matches the stream and is valid.
 */
gboolean
fs_stream_parse_new_active_candidate_pair (FsStream *stream,
        GstMessage *message,
        FsCandidate **local_candidate,
        FsCandidate **remote_candidate)
{
    const GstStructure *s;
    const GValue *value;

    g_return_val_if_fail (stream != NULL, FALSE);

    if (!check_message (message, stream, "farstream-new-active-candidate-pair"))
        return FALSE;

    s = gst_message_get_structure (message);

    value = gst_structure_get_value (s, "local-candidate");
    if (!value || !G_VALUE_HOLDS (value, FS_TYPE_CANDIDATE))
        return FALSE;
    if (local_candidate)
        *local_candidate = g_value_get_boxed (value);


    value = gst_structure_get_value (s, "remote-candidate");
    if (!value || !G_VALUE_HOLDS (value, FS_TYPE_CANDIDATE))
        return FALSE;
    if (remote_candidate)
        *remote_candidate = g_value_get_boxed (value);

    return TRUE;
}
开发者ID:kakaroto,项目名称:farstream,代码行数:45,代码来源:fs-stream.c

示例4: fs_stream_parse_component_state_changed

/**
 * fs_stream_parse_component_state_changed:
 * @stream: a #FsStream to match against the message
 * @message: a #GstMessage to parse
 * @component: (out): Returns the component from the #GstMessage if not %NULL
 * @state: (out): Returns the #FsStreamState from the #GstMessage if not %NULL
 *
 * Parses a "farstream-component-state-changed" message and checks if it matches
 * the @stream parameters.
 *
 * Returns: %TRUE if the message matches the stream and is valid.
 */
gboolean
fs_stream_parse_component_state_changed (FsStream *stream,
        GstMessage *message,
        guint *component,
        FsStreamState *state)
{
    const GstStructure *s;
    const GValue *value;

    g_return_val_if_fail (stream != NULL, FALSE);

    if (!check_message (message, stream, "farstream-component-state-changed"))
        return FALSE;

    s = gst_message_get_structure (message);

    value = gst_structure_get_value (s, "component");
    if (!value || !G_VALUE_HOLDS (value, G_TYPE_UINT))
        return FALSE;
    if (component)
        *component = g_value_get_uint (value);


    value = gst_structure_get_value (s, "state");
    if (!value || !G_VALUE_HOLDS (value, G_TYPE_ENUM))
        return FALSE;
    if (state)
        *state = g_value_get_enum (value);

    return TRUE;
}
开发者ID:kakaroto,项目名称:farstream,代码行数:43,代码来源:fs-stream.c

示例5: midgard_timestamp_transform_from_gda_timestamp

static void midgard_timestamp_transform_from_gda_timestamp(const GValue *src, GValue *dst)
{
	g_return_if_fail(G_VALUE_HOLDS(src, GDA_TYPE_TIMESTAMP) &&
			G_VALUE_HOLDS(dst, MGD_TYPE_TIMESTAMP));

	MidgardTimestamp *mt = midgard_timestamp_new();	

	GdaTimestamp *gt = (GdaTimestamp *) g_value_get_boxed(src);

	mt->year = gt->year;
	/* Avoid 0000 year */
	if (mt->year == 0)
		mt->year = 1;

	mt->month = gt->month;
	/* Avoid 00 month */
	if (mt->month == 0)
		mt->month = 1;

	mt->day = gt->day;
	/* Avoid 00 day */
	if (mt->day == 0)
		mt->day = 1;

	mt->hour = gt->hour;
	mt->minute = gt->minute;
	mt->second = gt->second;

	mt->offset = gt->timezone;
	if (gt->timezone == GDA_TIMEZONE_INVALID)
		mt->offset = 0;

	g_value_take_boxed(dst, mt);	
}
开发者ID:William-Wai,项目名称:midgard-core,代码行数:34,代码来源:midgard_timestamp.c

示例6: fs_session_parse_send_codec_changed

/**
 * fs_session_parse_send_codec_changed:
 * @session: a #FsSession to match against the message
 * @message: a #GstMessage to parse
 * @codec: (out) (transfer none): Returns the #FsCodec in the message if not
 *   %NULL.
 * @secondary_codecs: (out) (transfer none) (element-type FsCodec):
 *  Returns a #GList of #FsCodec of the message if not %NULL
 *
 * Parses a "farstream-send-codec-changed" message and checks if it matches
 * the @session parameters.
 *
 * Returns: %TRUE if the message matches the session and is valid.
 */
gboolean
fs_session_parse_send_codec_changed ( FsSession *session,
    GstMessage *message,
    FsCodec **codec,
    GList **secondary_codecs)
{
  const GstStructure *s;
  const GValue *value;

  g_return_val_if_fail (session != NULL, FALSE);

  if (!check_message (message, session, "farstream-send-codec-changed"))
    return FALSE;

  s = gst_message_get_structure (message);

  value = gst_structure_get_value (s, "codec");
  if (!value || !G_VALUE_HOLDS (value, FS_TYPE_CODEC))
    return FALSE;
  if (codec)
    *codec = g_value_get_boxed (value);

  value = gst_structure_get_value (s, "secondary-codecs");
  if (!value || !G_VALUE_HOLDS (value, FS_TYPE_CODEC_LIST))
    return FALSE;
  if (secondary_codecs)
    *secondary_codecs = g_value_get_boxed (value);

  return TRUE;
}
开发者ID:mssurajkaiga,项目名称:farstream,代码行数:44,代码来源:fs-session.c

示例7: gda_postgres_render_CREATE_DB

gchar *
gda_postgres_render_CREATE_DB (GdaServerProvider *provider, GdaConnection *cnc, 
			       GdaServerOperation *op, G_GNUC_UNUSED GError **error)
{
	GString *string;
	const GValue *value;
	gchar *sql = NULL;
	gchar *tmp;

	string = g_string_new ("CREATE DATABASE ");

	tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/DB_DEF_P/DB_NAME", error);
	if (!tmp) {
		g_string_free (string, TRUE);
		return NULL;
	}

	g_string_append (string, tmp);
	g_free (tmp);

	value = gda_server_operation_get_value_at (op, "/DB_DEF_P/OWNER");
	if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value)) {
		g_string_append (string, " OWNER ");
		g_string_append (string, g_value_get_string (value));
	}

	value = gda_server_operation_get_value_at (op, "/DB_DEF_P/TEMPLATE");
	if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value)) {
		g_string_append (string, " TEMPLATE ");
		g_string_append (string, g_value_get_string (value));
	}

	value = gda_server_operation_get_value_at (op, "/DB_DEF_P/DB_CSET");
	if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value)) {
		GdaDataHandler *dh;
		gchar *str;
		
		dh = gda_server_provider_get_data_handler_g_type (provider, cnc, G_TYPE_STRING);
		str = gda_data_handler_get_sql_from_value (dh, value);
		if (str) {
			g_string_append (string, " ENCODING ");
			g_string_append (string, str);
			g_free (str);
		}
	}

	value = gda_server_operation_get_value_at (op, "/DB_DEF_P/TABLESPACE");
	if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value)) {
		g_string_append (string, " TABLESPACE ");
		g_string_append (string, g_value_get_string (value));
	}

	sql = string->str;
	g_string_free (string, FALSE);

	return sql;	
}
开发者ID:arthurnn,项目名称:libgda,代码行数:57,代码来源:gda-postgres-ddl.c

示例8: opus_dec_sink_setcaps

static gboolean
opus_dec_sink_setcaps (GstPad * pad, GstCaps * caps)
{
  GstOpusDec *dec = GST_OPUS_DEC (gst_pad_get_parent (pad));
  gboolean ret = TRUE;
  GstStructure *s;
  const GValue *streamheader;

  s = gst_caps_get_structure (caps, 0);
  if ((streamheader = gst_structure_get_value (s, "streamheader")) &&
      G_VALUE_HOLDS (streamheader, GST_TYPE_ARRAY) &&
      gst_value_array_get_size (streamheader) >= 2) {
    const GValue *header;
    GstBuffer *buf;
    GstFlowReturn res = GST_FLOW_OK;

    header = gst_value_array_get_value (streamheader, 0);
    if (header && G_VALUE_HOLDS (header, GST_TYPE_BUFFER)) {
      buf = gst_value_get_buffer (header);
      res = opus_dec_chain_parse_header (dec, buf);
      if (res != GST_FLOW_OK)
        goto done;
      gst_buffer_replace (&dec->streamheader, buf);
    }
#if 0
    vorbiscomment = gst_value_array_get_value (streamheader, 1);
    if (vorbiscomment && G_VALUE_HOLDS (vorbiscomment, GST_TYPE_BUFFER)) {
      buf = gst_value_get_buffer (vorbiscomment);
      res = opus_dec_chain_parse_comments (dec, buf);
      if (res != GST_FLOW_OK)
        goto done;
      gst_buffer_replace (&dec->vorbiscomment, buf);
    }
#endif

    g_list_foreach (dec->extra_headers, (GFunc) gst_mini_object_unref, NULL);
    g_list_free (dec->extra_headers);
    dec->extra_headers = NULL;

    if (gst_value_array_get_size (streamheader) > 2) {
      gint i, n;

      n = gst_value_array_get_size (streamheader);
      for (i = 2; i < n; i++) {
        header = gst_value_array_get_value (streamheader, i);
        buf = gst_value_get_buffer (header);
        dec->extra_headers =
            g_list_prepend (dec->extra_headers, gst_buffer_ref (buf));
      }
    }
  }

done:
  gst_object_unref (dec);
  return ret;
}
开发者ID:LCW523,项目名称:gst-plugins-bad,代码行数:56,代码来源:gstopusdec.c

示例9: _sort_by_index

static int
_sort_by_index (ClutterModel *model,
                const GValue *a,
                const GValue *b,
                gpointer user_data)
{
    g_assert (G_VALUE_HOLDS (a, G_TYPE_UINT));
    g_assert (G_VALUE_HOLDS (b, G_TYPE_UINT));

    return g_value_get_uint (a) - g_value_get_uint (b);
}
开发者ID:Cyrene,项目名称:media-explorer,代码行数:11,代码来源:mtn-service-model.c

示例10: gda_postgres_render_DROP_INDEX

gchar *
gda_postgres_render_DROP_INDEX   (GdaServerProvider *provider, GdaConnection *cnc, 
				  GdaServerOperation *op, G_GNUC_UNUSED GError **error)
{
	GString *string;
	const GValue *value;
	gchar *sql = NULL;
	gchar *tmp;

	string = g_string_new ("DROP INDEX ");

	tmp = gda_server_operation_get_sql_identifier_at (op, cnc, provider, "/INDEX_DESC_P/INDEX_NAME", error);
	if (!tmp) {
		g_string_free (string, TRUE);
		return NULL;
	}

	g_string_append (string, tmp);
	g_free (tmp);

	value = gda_server_operation_get_value_at (op, "/INDEX_DESC_P/REFERENCED_ACTION");
	if (value && G_VALUE_HOLDS (value, G_TYPE_STRING)) {
		g_string_append_c (string, ' ');
		g_string_append (string, g_value_get_string (value));
	}

	sql = string->str;
	g_string_free (string, FALSE);

	return sql;
}
开发者ID:arthurnn,项目名称:libgda,代码行数:31,代码来源:gda-postgres-ddl.c

示例11: check_message

static gboolean
check_message (GstMessage *message,
    FsSession *session,
    const gchar *message_name)
{
  const GstStructure *s;
  const GValue *value;
  FsSession *message_session;

  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
    return FALSE;

  s = gst_message_get_structure (message);

  if (!gst_structure_has_name (s, message_name))
    return FALSE;

  value = gst_structure_get_value (s, "session");
  if (!value || !G_VALUE_HOLDS (value, FS_TYPE_SESSION))
    return FALSE;
  message_session = g_value_get_object (value);

  if (session != message_session)
    return FALSE;

  return TRUE;
}
开发者ID:mssurajkaiga,项目名称:farstream,代码行数:27,代码来源:fs-session.c

示例12: g_return_val_if_fail

static Itdb_ArtworkFormat *g_value_to_image_format (GValue *value)
{
    GHashTable *dict;
    Itdb_ArtworkFormat *img_spec;

    g_return_val_if_fail (G_VALUE_HOLDS (value, G_TYPE_HASH_TABLE), NULL);
    dict = g_value_get_boxed (value);
    g_return_val_if_fail (dict != NULL, NULL);

    img_spec = g_new0 (Itdb_ArtworkFormat, 1);
    if (img_spec == NULL) {
        return NULL;
    }

    if (!set_pixel_format (img_spec, dict)) {
        g_free (img_spec);
        return NULL;
    }
    set_back_color (img_spec, dict);

    dict_to_struct (dict, sysinfo_image_format_fields_mapping, img_spec);

    if (get_boolean (dict, "AlignRowBytes")
            && (img_spec->row_bytes_alignment == 0)) {
        /* at least the nano3g has the AlignRowBytes key with no
         * RowBytesAlignment key.
         */
        img_spec->row_bytes_alignment = 4;
    }

    return img_spec;
}
开发者ID:Babl0lka,项目名称:libgpod,代码行数:32,代码来源:itdb_sysinfo_extended_parser.c

示例13: _gda_sqlite_render_DROP_VIEW

gchar *
_gda_sqlite_render_DROP_VIEW (G_GNUC_UNUSED GdaServerProvider *provider, GdaConnection *cnc, 
			     GdaServerOperation *op, G_GNUC_UNUSED GError **error)
{
	GString *string;
	const GValue *value;
	gchar *sql = NULL;
	gchar *tmp;

	string = g_string_new ("DROP VIEW");

	value = gda_server_operation_get_value_at (op, "/VIEW_DESC_P/VIEW_IFEXISTS");
	if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value))
		g_string_append (string, " IF EXISTS");

	tmp = gda_connection_operation_get_sql_identifier_at (cnc,  op, "/VIEW_DESC_P/VIEW_NAME", error);
	if (!tmp) {
		g_string_free (string, TRUE);
		return NULL;
	}
	g_string_append_c (string, ' ');
	g_string_append (string, tmp);
	g_free (tmp);

	sql = string->str;
	g_string_free (string, FALSE);

	return sql;
}
开发者ID:GNOME,项目名称:libgda,代码行数:29,代码来源:gda-sqlite-ddl.c

示例14: gdl_dock_reorder

static gboolean
gdl_dock_reorder (GdlDockObject    *object,
                  GdlDockObject    *requestor,
                  GdlDockPlacement  new_position,
                  GValue           *other_data)
{
    GdlDock *dock = GDL_DOCK (object);
    gboolean handled = FALSE;
    
    if (dock->_priv->floating &&
        new_position == GDL_DOCK_FLOATING &&
        dock->root == requestor) {
        
        if (other_data && G_VALUE_HOLDS (other_data, GDK_TYPE_RECTANGLE)) {
            GdkRectangle *rect;

            rect = g_value_get_boxed (other_data);
            gtk_window_move (GTK_WINDOW (dock->_priv->window),
                             rect->x,
                             rect->y);
            handled = TRUE;
        }
    }
    
    return handled;
}
开发者ID:EQ4,项目名称:samplecat,代码行数:26,代码来源:gdl-dock.c

示例15: _nm_ip6_address_array_demarshal

gboolean
_nm_ip6_address_array_demarshal (GValue *value, GSList **dest)
{
	GPtrArray *array;

	if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UCHAR))
		return FALSE;

	if (*dest) {
		g_slist_foreach (*dest, (GFunc) g_free, NULL);
		g_slist_free (*dest);
		*dest = NULL;
	}

	array = (GPtrArray *) g_value_get_boxed (value);
	if (array && array->len) {
		int i;

		for (i = 0; i < array->len; i++) {
			GByteArray *bytearray = (GByteArray *) g_ptr_array_index (array, i);
			struct in6_addr *addr;

			addr = g_malloc0 (sizeof (struct in6_addr));
			memcpy (addr->s6_addr, bytearray->data, bytearray->len);
			*dest = g_slist_append (*dest, addr);
		}
	}

	return TRUE;
}
开发者ID:T100012,项目名称:NetworkManager,代码行数:30,代码来源:nm-types.c


注:本文中的G_VALUE_HOLDS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。