• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ config_setting_lookup_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: parse_ue_sim_param

bool parse_ue_sim_param(config_setting_t *ue_setting, int user_id, usim_data_conf_t *u) {
	int rc = true;
	config_setting_t *ue_param_setting = NULL;
	ue_param_setting = config_setting_get_member(ue_setting, SIM);
	if (ue_param_setting == NULL) {
		printf("Check SIM section for UE%d. EXITING...\n", user_id);
		return false;
	}
	rc = config_setting_lookup_string(ue_param_setting, MSIN, &u->msin);
	if (rc != 1 || strlen(u->msin) > 10 || strlen(u->msin) < 9) {
		printf("Check SIM MSIN section for UE%d. Exiting\n", user_id);
		return false;
	}
	rc = config_setting_lookup_string(ue_param_setting, USIM_API_K,
			&u->usim_api_k);
	if (rc != 1) {
		printf("Check SIM USIM_API_K  section for UE%d. Exiting\n", user_id);
		return false;
	}
	rc = config_setting_lookup_string(ue_param_setting, OPC, &u->opc);
	if (rc != 1) {
		printf("Check SIM OPC section for UE%d. Exiting\n", user_id);
		return false;
	}
	rc = config_setting_lookup_string(ue_param_setting, MSISDN, &u->msisdn);
	if (rc != 1) {
		printf("Check SIM MSISDN section for UE%d. Exiting\n", user_id);
		return false;
	}
	return true;
}
开发者ID:ShibinMathew36,项目名称:OAI-step,代码行数:31,代码来源:conf_usim.c


示例2: configure_cgi_handlers

void configure_cgi_handlers(spade_server* server, config_t* configuration) {
    config_setting_t* handler_settings = config_lookup(configuration,
            "cgi.handlers");
    int cgi_handler_count = config_setting_length(handler_settings);

    for (int n = 0; n < cgi_handler_count; n++) {
        config_setting_t* handler_setting = config_setting_get_elem(
                handler_settings, n);
        const char* handler = NULL;
        config_setting_lookup_string(handler_setting, "handler", &handler);

        const char* url = NULL;
        config_setting_lookup_string(handler_setting, "url", &url);

        if(!register_cgi_handler(server, url, handler)) {
            log4c_category_log(log4c_category_get("spade"), LOG4C_PRIORITY_INFO,
                    "Registered CGI handler '%s' for URL prefix '%s'",
                    handler, url);
        }
    }
    if (server->cgi_handler_count == 0) {
        log4c_category_log(log4c_category_get("spade"), LOG4C_PRIORITY_INFO,
                "No CGI handlers registered");
    } else {
        log4c_category_log(log4c_category_get("spade"), LOG4C_PRIORITY_INFO,
                "Registered a total of %d CGI handlers",
                server->cgi_handler_count);
    }
}
开发者ID:peplin,项目名称:spade,代码行数:29,代码来源:config.c


示例3: read_pairs_setting

/*! \brief read pair setting */
static int read_pairs_setting(config_setting_t * setting, add_pair_mapping add, void * data)
{
	int i;
	config_setting_t * pair;
	for (i = 0; (pair = config_setting_get_elem(setting, i)) != NULL; ++i)
	{
		int rv;
		const char * local;
		const char * remote;

		rv = config_setting_lookup_string(pair, "local", &local);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_ERROR, FACILITY_CONFIG, "Failed to read local key from pairs in shared config.\n");
			return CONFIG_FALSE;
		}

		rv = config_setting_lookup_string(pair, "remote", &remote);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_ERROR, FACILITY_CONFIG, "Failed to read remote key from pairs in shared config.\n");
			return CONFIG_FALSE;
		}

		add(data, local, remote);
	}

	return CONFIG_TRUE;
}
开发者ID:snua12,项目名称:zlomekfs,代码行数:30,代码来源:shared_config.c


示例4: configure_clay_handlers

void configure_clay_handlers(spade_server* server, config_t* configuration) {
    config_setting_t* handler_settings = config_lookup(configuration,
            "clay.handlers");
    if (!handler_settings) {
        log4c_category_log(log4c_category_get("spade"), LOG4C_PRIORITY_INFO,
                "No Clay handlers registered");
        return;
    }
    int clay_handler_count = config_setting_length(handler_settings);

    for (int n = 0; n < clay_handler_count; n++) {
        config_setting_t* handler_setting = config_setting_get_elem(
                handler_settings, n);
        const char* endpoint = NULL;
        config_setting_lookup_string(handler_setting, "endpoint", &endpoint);

        const char* url = NULL;
        config_setting_lookup_string(handler_setting, "url", &url);

        if(!register_clay_handler(server, url, endpoint)) {
            log4c_category_log(log4c_category_get("spade"), LOG4C_PRIORITY_INFO,
                    "Registered Clay handler for URL prefix '%s' at endpoint %s",
                    url, endpoint);
        }
    }
    if (server->clay_handler_count == 0) {
        log4c_category_log(log4c_category_get("spade"), LOG4C_PRIORITY_INFO,
                "No Clay handlers registered");
    } else {
        log4c_category_log(log4c_category_get("spade"), LOG4C_PRIORITY_INFO,
                "Registered a total of %d Clay handlers",
                server->clay_handler_count);
    }
}
开发者ID:peplin,项目名称:spade,代码行数:34,代码来源:config.c


示例5: read_dokan_config

/*! \brief read dokan config from local config */
static int read_dokan_config(config_t * config)
{
	config_setting_t * dokan_setting = config_lookup(config, "dokan");
	if (dokan_setting == NULL)
	{
		message(LOG_INFO, FACILITY_CONFIG, "No dokan section was found in local config.\n");
		return CONFIG_TRUE;
	}

	int rv;
	const char * volume_name;
	/* dokan::volume_name */
	rv = config_setting_lookup_string(dokan_setting, "volume_name", &volume_name);
	if (rv == CONFIG_TRUE)
	{
		xmkstring(&(zfs_config.dokan.volume_name), volume_name);
	}

	const char * file_system_name;
	/* dokan::filesystem_name */
	rv = config_setting_lookup_string(dokan_setting, "file_system_name", &file_system_name);
	if (rv == CONFIG_TRUE)
	{
		xmkstring(&(zfs_config.dokan.file_system_name), file_system_name);
	}

	return CONFIG_TRUE;
}
开发者ID:snua12,项目名称:zlomekfs,代码行数:29,代码来源:local_config.c


示例6: load_mods

static int
load_mods(config_t *config, config_setting_t *setting)
{
    int err;
    unsigned int mod_count;
    int i;
    const char* mod_name;
    const char* mod_so;
    const char* mod_ident;
    config_setting_t *mod_setting;
    err = 0;

    fprintf(stderr, "load mods from config\n");
    setting = config_lookup(config, "mods");
    if (setting != NULL) {
        mod_count = config_setting_length(setting);
        for (i = 0; i < mod_count; ++i) {
            mod_setting = config_setting_get_elem(setting, i);
            if (mod_setting) {
                if (!config_setting_lookup_string(mod_setting,
                                                  "name",
                                                  &mod_name) ||
                        !config_setting_lookup_string(mod_setting,
                                                      "so",
                                                      &mod_so)) {
                    continue;
                }
                if (!config_setting_lookup_string(mod_setting,
                                                  "ident",
                                                  &mod_ident)) {
                    mod_ident = NULL;
                }
                fprintf(stderr, "load module %s - %s - [%s]\n",
                        mod_name, mod_so, mod_ident);
                module_t *mod = module_open(mod_name,
                                            mod_ident,
                                            mod_so,
                                            RTLD_NOW);
                if (!mod) {
                    err = 1;
                    break;
                }
                if (module_map_insert(&g_config.module_root, mod) == NULL) {
                    err = 1;
                    module_close(mod);
                    break;
                }
                if (module_call_init_func(mod, &g_config)) {
                    fprintf(stderr, "ERROR %s returned not 0\n", mod->name);
                    err = 1;
                    module_close(mod);
                    break;
                }
            }
        }
    }

    return err;
}
开发者ID:MarkusPfundstein,项目名称:Network-HTTP-Server,代码行数:59,代码来源:main.c


示例7: thermal_constructor

static GtkWidget *
thermal_constructor(LXPanel *panel, config_setting_t *settings)
{
    thermal *th;
    GtkWidget *p;
    const char *tmp;

    ENTER;
    th = g_new0(thermal, 1);
    th->panel = panel;
    th->settings = settings;

    p = gtk_event_box_new();
    lxpanel_plugin_set_data(p, th, thermal_destructor);
    gtk_widget_set_has_window(p, FALSE);
    gtk_container_set_border_width( GTK_CONTAINER(p), 2 );

    th->namew = gtk_label_new("ww");
    gtk_container_add(GTK_CONTAINER(p), th->namew);

    th->tip = g_string_new(NULL);

    /* By default, use automatic, that is, "not custom" temperature levels. If
     * we were using custom levels, they would be 0°C at startup, so we would
     * display in warning colors by default. */
    th->not_custom_levels = TRUE;

    if (config_setting_lookup_string(settings, "NormalColor", &tmp))
        th->str_cl_normal = g_strdup(tmp);
    if (config_setting_lookup_string(settings, "Warning1Color", &tmp))
        th->str_cl_warning1 = g_strdup(tmp);
    if (config_setting_lookup_string(settings, "Warning2Color", &tmp))
        th->str_cl_warning2 = g_strdup(tmp);
    config_setting_lookup_int(settings, "AutomaticSensor", &th->auto_sensor);
    /* backward compatibility for wrong variable */
    config_setting_lookup_int(settings, "CustomLevels", &th->not_custom_levels);
    config_setting_lookup_int(settings, "AutomaticLevels", &th->not_custom_levels);
    if (config_setting_lookup_string(settings, "Sensor", &tmp))
        th->sensor = g_strdup(tmp);
    config_setting_lookup_int(settings, "Warning1Temp", &th->warning1);
    config_setting_lookup_int(settings, "Warning2Temp", &th->warning2);

    if(!th->str_cl_normal)
        th->str_cl_normal = g_strdup("#00ff00");
    if(!th->str_cl_warning1)
        th->str_cl_warning1 = g_strdup("#fff000");
    if(!th->str_cl_warning2)
        th->str_cl_warning2 = g_strdup("#ff0000");

    applyConfig(p);

    gtk_widget_show(th->namew);

    update_display(th);
    th->timer = g_timeout_add_seconds(3, (GSourceFunc) update_display_timeout, (gpointer)th);

    RET(p);
}
开发者ID:bluemutedwisdom,项目名称:lxpanel,代码行数:58,代码来源:thermal.c


示例8: channel_read_sub

/**
 * Attempt to create a global channel from the channel config
 * @param chan: Channel list
 * @param tmp_chan: Temporary channel data
 * @param i: Index
 * @return True on success or false on failure
 */
bool channel_read_sub(config_setting_t *chan, struct Channel *tmp_chan, uint8 i) {
	config_setting_t  *group_list = NULL;
	int delay = 1000, autojoin = 0, leave = 1, chat = 1, color_override = 0,
		self_notif = 1, join_notif = 0, leave_notif = 0;
	int type = CHAN_TYPE_PUBLIC, group_count = 0;
	const char *name = NULL, *password = NULL, *alias = NULL, *color_str = "Default", *type_str = NULL;

	if (tmp_chan == NULL)
		return false;

	if (!config_setting_lookup_string(chan, "name", &name)) {
		ShowError("Please input channel 'name' at '%s' line '%d'! Skipping...\n", chan->file, chan->line);
		return false;
	}
	if (config_setting_lookup_string(chan, "type", &type_str) && !script_get_constant(type_str, &type)) {
		ShowError("Invalid channel type %s at '%s' line '%d'! Skipping...\n", type_str, chan->file, chan->line);
		return false;
	}
	config_setting_lookup_string(chan, "password", &password);
	config_setting_lookup_string(chan, "alias", &alias);
	config_setting_lookup_string(chan, "color", &color_str);
	config_setting_lookup_int(chan, "delay", &delay);
	config_setting_lookup_bool(chan, "autojoin", &autojoin);
	config_setting_lookup_bool(chan, "leave", &leave);
	config_setting_lookup_bool(chan, "chat", &chat);
	config_setting_lookup_bool(chan, "color_override", &color_override);
	config_setting_lookup_bool(chan, "self_notif", &self_notif);
	config_setting_lookup_bool(chan, "join_notif", &join_notif);
	config_setting_lookup_bool(chan, "leave_notif", &leave_notif);

	safestrncpy(tmp_chan->name,name+1,sizeof(tmp_chan->name));
	if (password)
		safestrncpy(tmp_chan->pass,password,sizeof(tmp_chan->pass));
	else
		tmp_chan->pass[0] = '\0';
	safestrncpy(tmp_chan->alias,alias?alias:name,sizeof(tmp_chan->alias));
	tmp_chan->msg_delay = delay;
	tmp_chan->type = (enum Channel_Type)type;
	tmp_chan->color = channel_getColor(color_str);

	tmp_chan->opt = (autojoin ? CHAN_OPT_AUTOJOIN : 0) |
		(leave ? CHAN_OPT_CAN_LEAVE : 0) |
		(chat ? CHAN_OPT_CAN_CHAT : 0) |
		(color_override ? CHAN_OPT_COLOR_OVERRIDE : 0) |
		(self_notif ? CHAN_OPT_ANNOUNCE_SELF : 0) |
		(join_notif ? CHAN_OPT_ANNOUNCE_JOIN : 0) |
		(leave_notif ? CHAN_OPT_ANNOUNCE_LEAVE : 0);

	if ((group_list = config_setting_get_member(chan, "groupid")) && (group_count = config_setting_length(group_list)) > 0) {
		int j;
		CREATE(tmp_chan->groups, unsigned short, group_count);
		tmp_chan->group_count = group_count;
		for (j = 0; j < group_count; j++) {
			int groupid = config_setting_get_int_elem(group_list, j);
			tmp_chan->groups[j] = groupid;
		}
	}
开发者ID:Atemo,项目名称:rathena,代码行数:64,代码来源:channel.cpp


示例9: read_node_list_shared_config

int read_node_list_shared_config(config_t * config)
{
	config_setting_t * node_list = config_lookup(config, "node:list");
	if (node_list == NULL)
	{
		message(LOG_ERROR, FACILITY_CONFIG, "No node list section in shared config was found.\n");
		return CONFIG_FALSE;
	}

	config_setting_t * node_entry;
	int i;

	for (i = 0; (node_entry = config_setting_get_elem(node_list, i)) != NULL; ++i)
	{
		
		uint64_t id;
		const char * name;
		const char * address;
		int rv;

		rv = config_setting_lookup_uint64_t(node_entry, "id", &id);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_ERROR, FACILITY_CONFIG, "Id config key is wrong type or is missing in shared config.\n");
			return CONFIG_FALSE;
		}

		rv = config_setting_lookup_string(node_entry, "name", &name);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_ERROR, FACILITY_CONFIG, "Name config key is wrong type or is missing in shared config.\n");
			return CONFIG_FALSE;
		}

		rv = config_setting_lookup_string(node_entry, "address", &address);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_ERROR, FACILITY_CONFIG, "Addres config key is wrong type or is missing in shared config.\n");
			return CONFIG_FALSE;
		}

		string str_name;
		string str_address;

		xmkstring(&str_name, name);
		xmkstring(&str_address, address);

		node nod = try_create_node(id, &str_name, &str_name, read_tcp_port_setting(node_entry));
		if (nod)
			zfsd_mutex_unlock(&nod->mutex);
	}

	return CONFIG_TRUE;
}
开发者ID:snua12,项目名称:zlomekfs,代码行数:54,代码来源:shared_config.c


示例10: volume_entry_read

/*! \brief reads volume entry from shared config */
static int volume_entry_read(config_setting_t * volume_setting, volume_entry * ve)
{
	int rv;

	uint64_t id;
	rv = config_setting_lookup_uint64_t(volume_setting, "id", &id);
	if (rv != CONFIG_TRUE)
	{
		message (LOG_ERROR, FACILITY_CONFIG, "Id confg key is missing or is wrong type in volume list.\n");
		return CONFIG_FALSE;
	}

	const char * volume_name;
	rv = config_setting_lookup_string(volume_setting, "name", &volume_name);
	if (rv != CONFIG_TRUE)
	{
		message(LOG_ERROR, FACILITY_CONFIG, "Name config key is missing or is wrong type in volume list.\n");
		return CONFIG_FALSE;
	}

	const char * volume_mountpoint;
	rv = config_setting_lookup_string(volume_setting, "mountpoint", &volume_mountpoint);
	if (rv != CONFIG_TRUE)
	{
		message(LOG_ERROR, FACILITY_CONFIG, "Mountpoint config key is missing or is wrong type in volume list.\n");
		return CONFIG_FALSE;
	}
	
	if (is_valid_volume_id(id) == false)
	{
		message(LOG_ERROR, FACILITY_CONFIG, "Volume id is invalid.\n");
		return CONFIG_FALSE;
	}

	if (is_valid_volume_name(volume_name) == false)
	{
		message(LOG_ERROR, FACILITY_CONFIG, "Volume name is invalid.\n");
		return CONFIG_FALSE;
	}

	if (is_valid_local_path(volume_mountpoint) == false)
	{
		message(LOG_ERROR, FACILITY_CONFIG, "Volume mountpoint is invalid.\n");
		return CONFIG_FALSE;
	}

	//id, name mountpoint
	ve->id = id;
	xmkstring(&ve->name, volume_name);
	xmkstring(&ve->mountpoint, volume_mountpoint);

	return CONFIG_TRUE;
}
开发者ID:snua12,项目名称:zlomekfs,代码行数:54,代码来源:shared_config.c


示例11: monitors_constructor

static GtkWidget *
monitors_constructor(LXPanel *panel, config_setting_t *settings)
{
    ENTER;
    int i;
    MonitorsPlugin *mp;
    GtkWidget *p;
    const char *tmp;

    mp = g_new0(MonitorsPlugin, 1);
    mp->panel = panel;
    mp->settings = settings;

    p = gtk_hbox_new(TRUE, 2);
    lxpanel_plugin_set_data(p, mp, monitors_destructor);

    /* First time we use this plugin : only display CPU usage */
    mp->displayed_monitors[CPU_POSITION] = 1;

    /* Apply options */
    config_setting_lookup_int(settings, "DisplayCPU",
                              &mp->displayed_monitors[CPU_POSITION]);
    config_setting_lookup_int(settings, "DisplayRAM",
                              &mp->displayed_monitors[MEM_POSITION]);
    if (config_setting_lookup_string(settings, "Action", &tmp))
        mp->action = g_strdup(tmp);
    if (config_setting_lookup_string(settings, "CPUColor", &tmp))
        colors[CPU_POSITION] = g_strndup(tmp, COLOR_SIZE-1);
    if (config_setting_lookup_string(settings, "RAMColor", &tmp))
        colors[MEM_POSITION] = g_strndup(tmp, COLOR_SIZE-1);

    /* Initializing monitors */
    for (i = 0; i < N_MONITORS; i++)
    {
        if (!colors[i])
            colors[i] = g_strndup(default_colors[i], COLOR_SIZE-1);

        if (mp->displayed_monitors[i])
        {
            mp->monitors[i] = monitors_add_monitor(p, mp,
                                                   update_functions[i],
                                                   tooltip_update[i],
                                                   colors[i]);
        }
    }

    /* Adding a timer : monitors will be updated every UPDATE_PERIOD
     * seconds */
    mp->timer = g_timeout_add_seconds(UPDATE_PERIOD, (GSourceFunc) monitors_update,
                              (gpointer) mp);
    RET(p);
}
开发者ID:setzer22,项目名称:lxpanel,代码行数:52,代码来源:monitors.c


示例12: zcfg_load_interfaces

/**
 * Load interfaces section.
 * @param[in] option Option name.
 * @param[in,out] array Resulting array.
 * @return <0 - error. 0 - success. >0 - not found.
 */
int zcfg_load_interfaces(const config_setting_t *option, UT_array *array)
{
    utarray_init(array, &ut_zif_pair_icd);

    if (!option) {
        return 1;
    }

    if (CONFIG_TYPE_LIST != option->type) {
        return -1;
    }

    u_int count = (u_int) config_setting_length(option);

    for (u_int i = 0; i < count; i++) {
        zifpair_t if_pair;
        const char *str;
        config_setting_t *entry = config_setting_get_elem(option, i);

        if (!config_setting_lookup_string(entry, ZCFG_LAN, &str)) {
            ZLOG(LOG_ERR, "config:%s:%s: invalid or missing 'lan' property", option->parent->name, option->name);
            goto fail;
        }
        strncpy(if_pair.lan, str, sizeof(if_pair.lan));

        if (!config_setting_lookup_string(entry, ZCFG_WAN, &str)) {
            ZLOG(LOG_ERR, "config:%s:%s: invalid or missing 'wan' property", option->parent->name, option->name);
            goto fail;
        }
        strncpy(if_pair.wan, str, sizeof(if_pair.wan));

        int affinity = 0;
        if (!config_setting_lookup_int(entry, ZCFG_AFFINITY, &affinity)) {
            ZLOG(LOG_ERR, "config:%s:%s: invalid or missing 'affinity' property", option->parent->name, option->name);
            goto fail;
        }
        if ((affinity < 0) || affinity >= UINT16_MAX) {
            ZLOG(LOG_ERR, "config:%s:%s: invalid 'affinity' value", option->parent->name, option->name);
            goto fail;
        }
        if_pair.affinity = (uint16_t) affinity;

        utarray_push_back(array, &if_pair);
    }

    return 0;

    fail:
    utarray_done(array);
    return -1;
}
开发者ID:intersvyaz,项目名称:zerod,代码行数:57,代码来源:config.c


示例13: setup

static void setup(config_setting_t *settings)
{
    if (settings != NULL) {
        config_setting_lookup_string(settings, "apikey", &apikey);
        config_setting_lookup_string(settings, "email", &email);

        unsigned char *md5bytes = MD5((unsigned char *)email, strlen(email), NULL);

        int i;
        for (i = 0; i < MD5_DIGEST_LENGTH; i++) {
            sprintf(&md5email[i*2], "%02x", md5bytes[i]);
        }
    }
}
开发者ID:ejholmes,项目名称:utorrent-notifier-daemon,代码行数:14,代码来源:boxcar.c


示例14: g_new0

/* Plugin constructor. */
static GtkWidget *wincmd_constructor(LXPanel *panel, config_setting_t *settings)
{
    /* Allocate plugin context and set into Plugin private data pointer. */
    WinCmdPlugin * wc = g_new0(WinCmdPlugin, 1);
    GtkWidget * p;
    const char *str;
    int tmp_int;

    /* Initialize to defaults. */
    wc->button_1_command = WC_ICONIFY;
    wc->button_2_command = WC_SHADE;

    /* Load parameters from the configuration file. */
    if (config_setting_lookup_string(settings, "Button1", &str))
    {
        if (g_ascii_strcasecmp(str, "shade") == 0)
            wc->button_1_command = WC_SHADE;
        else if (g_ascii_strcasecmp(str, "none") == 0)
            wc->button_1_command = WC_NONE;
        /* default is WC_ICONIFY */
    }
    if (config_setting_lookup_string(settings, "Button2", &str))
    {
        if (g_ascii_strcasecmp(str, "iconify") == 0)
            wc->button_2_command = WC_ICONIFY;
        else if (g_ascii_strcasecmp(str, "none") == 0)
            wc->button_2_command = WC_NONE;
    }
    if (config_setting_lookup_string(settings, "image", &str))
        wc->image = expand_tilda(str);
    if (config_setting_lookup_int(settings, "Toggle", &tmp_int))
        wc->toggle_preference = tmp_int != 0;

    /* Default the image if unspecified. */
    if (wc->image == NULL)
        wc->image = g_strdup("window-manager");

    /* Save construction pointers */
    wc->settings = settings;

    /* Allocate top level widget and set into Plugin widget pointer. */
    p = lxpanel_button_new_for_icon(panel, wc->image, NULL, NULL);
    lxpanel_plugin_set_data(p, wc, wincmd_destructor);
    gtk_container_set_border_width(GTK_CONTAINER(p), 0);
    gtk_widget_set_tooltip_text(p, _("Left click to iconify all windows.  Middle click to shade them."));

    /* Show the widget and return. */
    return p;
}
开发者ID:bluemutedwisdom,项目名称:lxpanel,代码行数:50,代码来源:wincmd.c


示例15: print_layouts

void print_layouts(int num_frame)
{
	
	config_setting_t *category_list, *category, *layout_list, *layout;
	config_t layout_config;
	int layout_length, i;
	const char* ascii_image;

	config_init(&layout_config);
	config_read_file(&layout_config, "./layout.cfg");
	
	category_list = config_lookup(&layout_config, "application.layout_group");
	category = config_setting_get_elem(category_list, num_frame - MIN_NUM_FRAME);
	
	layout_list = config_setting_get_member(category, "layout");
	layout_length = config_setting_length(layout_list);
	for(i = 0; i < layout_length; i++)
	{
		layout = config_setting_get_elem(layout_list, i);
		config_setting_lookup_string(layout, "image", &ascii_image);
		printf(" %c)\n", 'a' + i);
		printf("%s\n", ascii_image);
	}
	
	config_destroy(&layout_config);
}
开发者ID:ChiaraCaiazza,项目名称:collageMaker,代码行数:26,代码来源:layout.c


示例16: configure

static void configure(config_setting_t *setting_recording, int gfx_event_id)
{
	const char *output_file;

	if (config_setting_lookup_string(setting_recording, CFG_OUTPUT_FILE, &output_file) != CONFIG_TRUE)
	{
		LOG_ERROR("Recording not started: no output file specified");
	}

	SF_INFO sndinfo;

	sndinfo.samplerate = 44100;
	sndinfo.channels = 2;
	sndinfo.format = SF_FORMAT_WAV|SF_FORMAT_PCM_16;
	sndfile = sf_open(output_file, SFM_WRITE, &sndinfo);

	if (sndfile != NULL)
	{
		gfx_object.id = gfx_event_id;
		gfx_register_event_receiver_handler(GFX_EVENT_WAVE, wave_event_handler, &gfx_object);
		gfx_register_event_receiver_handler(GFX_EVENT_SILENCE, silence_event_handler, &gfx_object);
	}
	else
	{
		LOG_ERROR("Recording not started: %s", sf_strerror(sndfile));
	}
}
开发者ID:dozencrows,项目名称:pithesiser,代码行数:27,代码来源:recording.c


示例17: read_mapping_setting

int read_mapping_setting(config_setting_t * setting, add_mapping add, void * data)
{
	int i;
	config_setting_t * pair;
	for (i = 0; (pair = config_setting_get_elem(setting, i)) != NULL; ++i)
	{
		int rv;
		uint64_t id;

		rv = config_setting_lookup_uint64_t(pair, "id", &id);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_ERROR, FACILITY_CONFIG, "Id config key is wrong type or is missing in shared config.\n");
			return CONFIG_FALSE;
		}

		const char * name;
		rv = config_setting_lookup_string(pair, "name", &name);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_ERROR, FACILITY_CONFIG, "Name config key is wrong type or is missing in shared config.\n");
			return CONFIG_FALSE;
		}

		string str_name;
		xmkstring(&str_name, name);
		add(data, id, &str_name);	
	}

	return CONFIG_TRUE;
}
开发者ID:snua12,项目名称:zlomekfs,代码行数:31,代码来源:shared_config.c


示例18: read_volume_tree_node_setting

/*! \brief read volume tree node settings */
static int read_volume_tree_node_setting(config_setting_t * node_setting)
{
	int rv;
	const char * node_key;

	rv = config_setting_lookup_string(node_setting, "node", &node_key);
	if (rv != CONFIG_TRUE)
	{
		message(LOG_INFO, FACILITY_CONFIG, "No node key in hierarchy tree in shared config found.\n");
		return rv;
	}

	config_setting_t * children = config_setting_get_member(node_setting, "children");
	if (children == NULL)
		return CONFIG_TRUE;

	int i;
	config_setting_t * child;
	
	for (i = 0; (child = config_setting_get_elem(children, i)) != NULL; ++i)
	{
		rv = read_volume_tree_node_setting(child);
		if (rv != CONFIG_TRUE)
		{
			message(LOG_INFO, FACILITY_CONFIG, "Failed to read hierarchy tree from shared config.\n"); 
			return rv;
		}
	}

	return CONFIG_TRUE;
}
开发者ID:snua12,项目名称:zlomekfs,代码行数:32,代码来源:shared_config.c


示例19: config_check

/**
 * Checks if the configuration is valid. The function checks if all 
 * required parameters are set and adds default values if necessary.
 * @param cfg configuration
 */
void config_check(config_t *cfg)
{
    int i, j;
    const char *s;
    double f;
    config_setting_t *cs, *vs;

    for (i = 0; defaults[i].name; i++) {
        /* Lookup setting group */
        cs = config_lookup(cfg, defaults[i].group);
        if (!cs)
            cs = config_setting_add(config_root_setting(cfg),
                                    defaults[i].group, CONFIG_TYPE_GROUP);

        /* (1) Check for string */
        if (defaults[i].type == CONFIG_TYPE_STRING) {
            if (config_setting_lookup_string(cs, defaults[i].name, &s))
                continue;

            /* Add default value */
            vs = config_setting_add(cs, defaults[i].name, CONFIG_TYPE_STRING);
            config_setting_set_string(vs, defaults[i].val.sval);
        /* (2) Check for float */            
        } else if (defaults[i].type == CONFIG_TYPE_FLOAT) {
            if (config_setting_lookup_float(cs, defaults[i].name, &f))
                continue;

            /* Check for mis-interpreted integer */
            if (config_setting_lookup_int(cs, defaults[i].name, &j)) {
                config_setting_remove(cs, defaults[i].name);
                vs = config_setting_add(cs, defaults[i].name, CONFIG_TYPE_FLOAT);
                config_setting_set_float(vs, (double) j);
                continue;
            }

            /* Add default value */
            vs = config_setting_add(cs, defaults[i].name, CONFIG_TYPE_FLOAT);
            config_setting_set_float(vs, defaults[i].val.fval);
        /* (3) Check for integer */            
        } else if (defaults[i].type == CONFIG_TYPE_INT) {
            if (config_setting_lookup_int(cs, defaults[i].name, &j))
                continue;

            /* Check for mis-interpreted float */
            if (config_setting_lookup_float(cs, defaults[i].name, &f)) {
                config_setting_remove(cs, defaults[i].name);
                vs = config_setting_add(cs, defaults[i].name, CONFIG_TYPE_INT);
                config_setting_set_int(vs, (long) round(f));
                continue;
            }

            /* Add default value */
            vs = config_setting_add(cs, defaults[i].name, CONFIG_TYPE_INT);
            config_setting_set_int(vs, defaults[i].val.ival);
        } else {
            error("Unknown configuration type");
        }
    }
}
开发者ID:MLDroid,项目名称:malheur,代码行数:64,代码来源:mconfig.c


示例20: initialize_rig

int initialize_rig()
{
  RIG *my_rig;            /* handle to rig (nstance) */
  int retcode;

  config_setting_t *rig_control_settings;
  rig_control_settings = config_lookup(&cfg, "repeater.rig_control");

  int rig_id, baud_rate, data_bits, stop_bits, enabled;
  const char *serial_port, *frequency;
  
  config_setting_lookup_int(rig_control_settings, "rig_id", &rig_id);
  config_setting_lookup_int(rig_control_settings, "baud_rate", &baud_rate);
  config_setting_lookup_int(rig_control_settings, "data_bits", &data_bits);
  config_setting_lookup_int(rig_control_settings, "stop_bits", &stop_bits);
  config_setting_lookup_bool(rig_control_settings, "enabled", &enabled);
  config_setting_lookup_string(rig_control_settings, "frequency", &frequency);
  config_setting_lookup_string(rig_control_settings, "serial_port", &serial_port);

  if (!enabled)
    return -1;
  
  printf("frequency: %s\n", frequency);

  rig_set_debug(RIG_DEBUG_WARN);
  my_rig = rig_init(rig_id);

  if (!my_rig) {
    fprintf(stderr,"Unknown rig num: %d\n", rig_id);
    fprintf(stderr,"Please check riglist.h\n");
    exit(1); /* whoops! something went wrong (mem alloc?) */
  }

  strncpy(my_rig->state.rigport.pathname, "/dev/ttyS0", FILPATHLEN - 1);
  my_rig->state.rigport.parm.serial.rate = baud_rate;
  my_rig->state.rigport.parm.serial.data_bits = data_bits;
  my_rig->state.rigport.parm.serial.stop_bits = stop_bits;

  retcode = rig_open(my_rig);
  if (retcode != RIG_OK) {
    printf("rig_open: error = %s\n", rigerror(retcode));
    exit(2);
  }

  return rig_set_freq(my_rig, RIG_VFO_CURR, atoi(frequency));
}
开发者ID:W8UPD,项目名称:simplex-repeater,代码行数:46,代码来源:hamlib.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ config_to_string函数代码示例发布时间:2022-05-30
下一篇:
C++ config_setting_length函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap