本文整理汇总了C++中xmmsv_get_int函数的典型用法代码示例。如果您正苦于以下问题:C++ xmmsv_get_int函数的具体用法?C++ xmmsv_get_int怎么用?C++ xmmsv_get_int使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmmsv_get_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xmms_browse_list_sortfunc
static gint
xmms_browse_list_sortfunc (xmmsv_t **a, xmmsv_t **b)
{
xmmsv_t *val1, *val2;
const gchar *s1, *s2;
int r1, r2;
g_return_val_if_fail (xmmsv_is_type (*a, XMMSV_TYPE_DICT), 0);
g_return_val_if_fail (xmmsv_is_type (*b, XMMSV_TYPE_DICT), 0);
r1 = xmmsv_dict_get (*a, "intsort", &val1);
r2 = xmmsv_dict_get (*b, "intsort", &val2);
if (r1 && r2) {
gint i1, i2;
if (!xmmsv_get_int (val1, &i1))
return 0;
if (!xmmsv_get_int (val2, &i2))
return 0;
return i1 > i2;
}
if (!xmmsv_dict_get (*a, "path", &val1))
return 0;
if (!xmmsv_dict_get (*b, "path", &val2))
return 0;
if (!xmmsv_get_string (val1, &s1))
return 0;
if (!xmmsv_get_string (val2, &s2))
return 0;
return xmms_natcmp (s1, s2);
}
示例2: __int_xmms_cmd_set_property_int
static void
__int_xmms_cmd_set_property_int (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
xmmsv_t *t;
if (xmmsv_list_get_size (arg->args) != 4) {
XMMS_DBG ("Wrong number of arguments to set_property_int (%d)", xmmsv_list_get_size (arg->args));
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to set_property_int");
return;
}
gint32 argval0;
const char * argval1;
const char * argval2;
gint32 argval3;
if (!xmmsv_list_get (arg->args, 0, &t)) {
XMMS_DBG ("Missing arg 0 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 0 in set_property_int");
return;
}
if (!xmmsv_get_int (t, &argval0)) {
XMMS_DBG ("Error parsing arg 0 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 0 in set_property_int");
return;
}
if (!xmmsv_list_get (arg->args, 1, &t)) {
XMMS_DBG ("Missing arg 1 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 1 in set_property_int");
return;
}
if (!xmmsv_get_string (t, &argval1)) {
XMMS_DBG ("Error parsing arg 1 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 1 in set_property_int");
return;
}
if (!xmmsv_list_get (arg->args, 2, &t)) {
XMMS_DBG ("Missing arg 2 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 2 in set_property_int");
return;
}
if (!xmmsv_get_string (t, &argval2)) {
XMMS_DBG ("Error parsing arg 2 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 2 in set_property_int");
return;
}
if (!xmmsv_list_get (arg->args, 3, &t)) {
XMMS_DBG ("Missing arg 3 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 3 in set_property_int");
return;
}
if (!xmmsv_get_int (t, &argval3)) {
XMMS_DBG ("Error parsing arg 3 in set_property_int");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 3 in set_property_int");
return;
}
xmms_medialib_client_set_property_int ((xmms_medialib_t *) object, argval0, argval1, argval2, argval3, &arg->error);
arg->retval = xmmsv_new_none ();
}
示例3: __int_xmms_cmd_rehash
static void
__int_xmms_cmd_rehash (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
xmmsv_t *t;
if (xmmsv_list_get_size (arg->args) != 1) {
XMMS_DBG ("Wrong number of arguments to rehash (%d)", xmmsv_list_get_size (arg->args));
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to rehash");
return;
}
gint32 argval0;
if (!xmmsv_list_get (arg->args, 0, &t)) {
XMMS_DBG ("Missing arg 0 in rehash");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 0 in rehash");
return;
}
if (!xmmsv_get_int (t, &argval0)) {
XMMS_DBG ("Error parsing arg 0 in rehash");
xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 0 in rehash");
return;
}
xmms_medialib_client_rehash ((xmms_medialib_t *) object, argval0, &arg->error);
arg->retval = xmmsv_new_none ();
}
示例4: refresh_active_playlist
static gint
refresh_active_playlist (xmmsv_t *val, void *udata)
{
cli_cache_t *cache = (cli_cache_t *) udata;
xmmsv_list_iter_t *it;
gint32 id;
if (!xmmsv_is_error (val)) {
/* Reset array */
if (cache->active_playlist->len > 0) {
gint len = cache->active_playlist->len;
cache->active_playlist = g_array_remove_range (cache->active_playlist,
0, len);
}
xmmsv_get_list_iter (val, &it);
/* .. and refill it */
while (xmmsv_list_iter_valid (it)) {
xmmsv_t *entry;
xmmsv_list_iter_entry (it, &entry);
xmmsv_get_int (entry, &id);
g_array_append_val (cache->active_playlist, id);
xmmsv_list_iter_next (it);
}
}
freshness_received (&cache->freshness_active_playlist);
return TRUE;
}
示例5: xmms_ipc_register_broadcast
static void
xmms_ipc_register_broadcast (xmms_ipc_client_t *client,
xmms_ipc_msg_t *msg, xmmsv_t *arguments)
{
xmmsv_t *arg;
gint32 broadcastid;
int r;
if (!arguments || !xmmsv_list_get (arguments, 0, &arg)) {
xmms_log_error ("No broadcastid in this msg?!");
return;
}
r = xmmsv_get_int (arg, &broadcastid);
if (!r) {
xmms_log_error ("Cannot extract broadcast id from value");
return;
}
if (broadcastid < 0 || broadcastid >= XMMS_IPC_SIGNAL_END) {
xmms_log_error ("Bad broadcast id (%d)", broadcastid);
return;
}
g_mutex_lock (client->lock);
client->broadcasts[broadcastid] =
g_list_append (client->broadcasts[broadcastid],
GUINT_TO_POINTER (xmms_ipc_msg_get_cookie (msg)));
g_mutex_unlock (client->lock);
}
示例6: print_hash
void
print_hash (const gchar *key, xmmsv_t *value, void *udata)
{
xmmsv_type_t value_type;
const char *string_val;
unsigned int uint_val;
int int_val;
value_type = xmmsv_get_type (value);
switch (value_type) {
case XMMSV_TYPE_STRING:
xmmsv_get_string (value, &string_val);
print_info ("%s = %s", key, string_val);
break;
case XMMSV_TYPE_INT32:
xmmsv_get_int (value, &int_val);
print_info ("%s = %d", key, int_val);
break;
default:
print_error ("unhandled hash value %i", value_type);
}
}
示例7: xmms_ipc_register_signal
static void
xmms_ipc_register_signal (xmms_ipc_client_t *client,
xmms_ipc_msg_t *msg, xmmsv_t *arguments)
{
xmmsv_t *arg;
gint32 signalid;
int r;
if (!arguments || !xmmsv_list_get (arguments, 0, &arg)) {
xmms_log_error ("No signalid in this msg?!");
return;
}
r = xmmsv_get_int (arg, &signalid);
if (!r) {
xmms_log_error ("Cannot extract signal id from value");
return;
}
if (signalid < 0 || signalid >= XMMS_IPC_SIGNAL_END) {
xmms_log_error ("Bad signal id (%d)", signalid);
return;
}
g_mutex_lock (client->lock);
client->pendingsignals[signalid] = xmms_ipc_msg_get_cookie (msg);
g_mutex_unlock (client->lock);
}
示例8: currently_playing_update_status
static void
currently_playing_update_status (currently_playing_t *entry, xmmsv_t *value)
{
const gchar *status_name;
gint status = -1;
xmmsv_get_int (value, &status);
switch (status) {
case XMMS_PLAYBACK_STATUS_STOP:
status_name = _("Stopped");
break;
case XMMS_PLAYBACK_STATUS_PLAY:
status_name = _("Playing");
break;
case XMMS_PLAYBACK_STATUS_PAUSE:
status_name = _("Paused");
break;
default:
status_name = _("Unknown");
break;
}
xmmsv_dict_set_string (entry->data, "playback_status", status_name);
}
示例9: updater_rehash_file_by_id
static int
updater_rehash_file_by_id (xmmsv_t *value, void *udata)
{
xmmsc_result_t *res;
updater_t *updater;
int mid;
updater = (updater_t *) udata;
g_return_val_if_fail (updater, FALSE);
if (!xmmsv_get_int (value, &mid)) {
return FALSE;
}
if (!mid) {
g_warning ("Couldn't find requested medialib entry.");
return FALSE;
}
res = xmmsc_medialib_rehash (updater->conn, mid);
xmmsc_result_unref (res);
return FALSE;
}
示例10: xmms_playlist_client_radd
/**
* Convenient function for adding a directory to the playlist,
* It will dive down the URL you feed it and recursivly add
* all files there.
*
* @param playlist the playlist to add it URL to.
* @param plname the name of the playlist to modify.
* @param nurl the URL of an directory you want to add
* @param err an #xmms_error_t that should be defined upon error.
*/
static void
xmms_playlist_client_radd (xmms_playlist_t *playlist, const gchar *plname,
const gchar *path, xmms_error_t *err)
{
xmmsv_coll_t *idlist;
xmmsv_list_iter_t *it;
xmmsv_t *list;
idlist = xmms_medialib_add_recursive (playlist->medialib, path, err);
list = xmmsv_coll_idlist_get (idlist);
xmmsv_get_list_iter (list, &it);
while (xmmsv_list_iter_valid (it)) {
xmms_medialib_entry_t entry;
xmmsv_t *value;
xmmsv_list_iter_entry (it, &value);
xmmsv_get_int (value, &entry);
xmms_playlist_add_entry (playlist, plname, entry, err);
xmmsv_list_iter_next (it);
}
xmmsv_coll_unref (idlist);
}
示例11: print_entry
/* dumps a recursive key-source-val dict */
void
print_entry (const gchar *key, xmmsv_t *dict, void *udata)
{
xmmsv_t *v;
const gchar *source;
if (xmmsv_get_type (dict) == XMMSV_TYPE_DICT) {
xmmsv_dict_iter_t *it;
xmmsv_get_dict_iter (dict, &it);
while (xmmsv_dict_iter_valid (it)) {
xmmsv_dict_iter_pair (it, &source, &v);
switch (xmmsv_get_type (v)) {
case XMMSV_TYPE_STRING:
print_entry_string (v, key, source);
break;
case XMMSV_TYPE_INT32:
{
gint i;
xmmsv_get_int (v, &i);
print_info ("[%s] %s = %d", source, key, i);
break;
}
default:
print_info ("[%s] %s = (unknown data)", source, key);
break;
}
xmmsv_dict_iter_next (it);
}
}
}
示例12: updater_remove_file_by_id
static int
updater_remove_file_by_id (xmmsv_t *value, void *udata)
{
xmmsc_result_t *res;
updater_t *updater;
int mid;
updater = (updater_t *) udata;
g_return_val_if_fail (updater, FALSE);
if (!xmmsv_get_int (value, &mid)) {
g_error ("couldn't find this one!");
return FALSE;
}
if (!mid) {
g_debug ("entry not in medialib");
return FALSE;
}
res = xmmsc_medialib_remove_entry (updater->conn, mid);
xmmsc_result_unref (res);
return FALSE;
}
示例13: print_config_entry
static void
print_config_entry (const gchar *confname, xmmsv_t *val, void *udata)
{
xmmsv_type_t type;
type = xmmsv_get_type (val);
switch (type) {
case XMMSV_TYPE_STRING:
{
const gchar *confval;
xmmsv_get_string (val, &confval);
g_printf ("%s = %s\n", confname, confval);
break;
}
case XMMSV_TYPE_INT32:
{
int confval;
xmmsv_get_int (val, &confval);
g_printf ("%s = %d\n", confname, confval);
break;
}
default:
break;
}
}
示例14: xmms_playlist_client_insert_collection
static void
xmms_playlist_client_insert_collection (xmms_playlist_t *playlist, const gchar *plname,
gint32 pos, xmmsv_coll_t *coll,
xmmsv_t *order, xmms_error_t *err)
{
xmmsv_list_iter_t *it;
xmmsv_t *list;
list = xmms_collection_query_ids (playlist->colldag, coll, 0, 0, order, err);
if (xmms_error_iserror (err)) {
return;
}
xmmsv_get_list_iter (list, &it);
xmmsv_list_iter_last (it);
while (xmmsv_list_iter_valid (it)) {
xmms_medialib_entry_t mid;
xmmsv_t *entry;
xmmsv_list_iter_entry (it, &entry);
xmmsv_get_int (entry, &mid);
xmms_playlist_insert_entry (playlist, plname, pos, mid, err);
xmmsv_list_iter_prev (it);
}
xmmsv_unref (list);
}
示例15: add_metadatum
static void
add_metadatum (gpointer _key, gpointer _value, gpointer user_data)
{
xmmsv_t *value = (xmmsv_t *) _value;
gchar *key = (gchar *) _key;
metadata_festate_t *st = (metadata_festate_t *) user_data;
if (xmmsv_get_type (value) == XMMSV_TYPE_STRING) {
const gchar *s;
xmmsv_get_string (value, &s);
xmms_medialib_entry_property_set_str_source (st->session,
st->entry,
key,
s,
st->source);
} else if (xmmsv_get_type (value) == XMMSV_TYPE_INT32) {
gint i;
xmmsv_get_int (value, &i);
xmms_medialib_entry_property_set_int_source (st->session,
st->entry,
key,
i,
st->source);
} else {
XMMS_DBG ("Unknown type?!?");
}
}