本文整理汇总了C++中set_boolean函数的典型用法代码示例。如果您正苦于以下问题:C++ set_boolean函数的具体用法?C++ set_boolean怎么用?C++ set_boolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_boolean函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cmd_set
/* SYNTAX: SET [-clear] [<key> [<value>] */
static void cmd_set(char *data)
{
GHashTable *optlist;
GSList *sets, *tmp;
const char *last_section;
char *key, *value;
void *free_arg;
int found, clear;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
"set", &optlist, &key, &value))
return;
clear = g_hash_table_lookup(optlist, "clear") != NULL;
last_section = "";
found = 0;
sets = settings_get_sorted();
for (tmp = sets; tmp != NULL; tmp = tmp->next) {
SETTINGS_REC *rec = tmp->data;
if (((clear || *value != '\0') && g_strcasecmp(rec->key, key) != 0) ||
(*value == '\0' && *key != '\0' && stristr(rec->key, key) == NULL))
continue;
if (strcmp(last_section, rec->section) != 0) {
/* print section */
printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "%_[ %s ]", rec->section);
last_section = rec->section;
}
if (clear || *value != '\0') {
/* change the setting */
switch (rec->type) {
case SETTING_TYPE_BOOLEAN:
set_boolean(key, clear ? FALSE : value);
break;
case SETTING_TYPE_INT:
settings_set_int(key, clear ? 0 : atoi(value));
break;
case SETTING_TYPE_STRING:
settings_set_str(key, clear ? "" : value);
break;
}
signal_emit("setup changed", 0);
}
set_print(rec);
found = TRUE;
if (clear || *value != '\0')
break;
}
g_slist_free(sets);
if (!found)
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown setting %s", key);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:61,代码来源:fe-settings.c
示例2: cmd_toggle
/* SYNTAX: TOGGLE <key> [on|off|toggle] */
static void cmd_toggle(const char *data)
{
char *key, *value;
void *free_arg;
int type;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST | PARAM_FLAG_STRIP_TRAILING_WS, &key, &value))
return;
if (*key == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
type = settings_get_type(key);
if (type == SETTING_TYPE_ANY)
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
else if (type != SETTING_TYPE_BOOLEAN)
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_NOT_BOOLEAN, key);
else {
set_boolean(key, *value != '\0' ? value : "TOGGLE");
set_print(settings_get_record(key));
signal_emit("setup changed", 0);
}
cmd_params_free(free_arg);
}
开发者ID:ahf,项目名称:irssi,代码行数:26,代码来源:fe-settings.c
示例3: set_pass_peer
int set_pass_peer (char *word, char *value, int context, void *item)
{
switch (context & ~CONTEXT_DEFAULT)
{
case CONTEXT_LAC:
if (set_boolean (word, value, &(((struct lac *) item)->pass_peer)))
return -1;
break;
case CONTEXT_LNS:
if (set_boolean (word, value, &(((struct lns *) item)->pass_peer)))
return -1;
break;
default:
snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
word);
return -1;
}
return 0;
}
开发者ID:aunoor,项目名称:xl2tpd,代码行数:19,代码来源:file.c
示例4: load_constants
static int load_constants(struct load_state *S, ktap_proto *f)
{
int i,n;
n = READ_INT(S);
f->sizek = n;
f->k = NEW_VECTOR(S, n * sizeof(ktap_value));
for (i = 0; i < n; i++)
set_nil(&f->k[i]);
for (i=0; i < n; i++) {
ktap_value *o = &f->k[i];
int t = READ_CHAR(S);
switch (t) {
case KTAP_TNIL:
set_nil(o);
break;
case KTAP_TBOOLEAN:
set_boolean(o, READ_CHAR(S));
break;
case KTAP_TNUMBER:
/*
* todo: kernel not support fp, check double when
* loading
*/
set_number(o, READ_NUMBER(S));
break;
case KTAP_TSTRING:
set_string(o, READ_STRING(S));
break;
default:
kp_error(S->ks, "ktap: load_constants: "
"unknow ktap_value\n");
return -1;
}
}
n = READ_INT(S);
f->p = NEW_VECTOR(S, n * sizeof(ktap_proto));
f->sizep = n;
for (i = 0; i < n; i++)
f->p[i] = NULL;
for (i = 0; i < n; i++) {
f->p[i] = kp_newproto(S->ks);
if (load_function(S, f->p[i]))
return -1;
}
return 0;
}
开发者ID:bruce2008github,项目名称:ktap,代码行数:53,代码来源:loader.c
示例5: set_papchap
int set_papchap (char *word, char *value, int context, void *item)
{
int result;
char *c;
struct lac *l = (struct lac *) item;
struct lns *n = (struct lns *) item;
if (set_boolean (word, value, &result))
return -1;
c = strchr (word, ' ');
c++;
switch (context & ~CONTEXT_DEFAULT)
{
case CONTEXT_LAC:
if (c[0] == 'p') /* PAP */
if (word[2] == 'f')
l->pap_refuse = result;
else
l->pap_require = result;
else if (c[0] == 'a') /* Authentication */
if (word[2] == 'f')
l->authself = !result;
else
l->authpeer = result;
else /* CHAP */ if (word[2] == 'f')
l->chap_refuse = result;
else
l->chap_require = result;
break;
case CONTEXT_LNS:
if (c[0] == 'p') /* PAP */
if (word[2] == 'f')
n->pap_refuse = result;
else
n->pap_require = result;
else if (c[0] == 'a') /* Authentication */
if (word[2] == 'f')
n->authself = !result;
else
n->authpeer = result;
else /* CHAP */ if (word[2] == 'f')
n->chap_refuse = result;
else
n->chap_require = result;
break;
default:
snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
word);
return -1;
}
return 0;
}
开发者ID:aunoor,项目名称:xl2tpd,代码行数:51,代码来源:file.c
示例6: parmlist_get_bool
bool parmlist_get_bool(struct parmlist *ctx, const char *name, bool default_v)
{
struct parmlist_entry *p = parmlist_get(ctx, name);
bool ret;
if (p == NULL)
return default_v;
if (!set_boolean(p->value, &ret)) {
DEBUG(0,("lp_bool(%s): value is not boolean!\n", p->value));
return default_v;
}
return ret;
}
开发者ID:285858315,项目名称:samba,代码行数:15,代码来源:parmlist.c
示例7: set_debugstate
int set_debugstate (char *word, char *value, int context, void *item)
{
switch (context & ~CONTEXT_DEFAULT)
{
case CONTEXT_GLOBAL:
if (set_boolean
(word, value, &(((struct global *) item)->debug_state)))
return -1;
break;
default:
snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
word);
return -1;
}
return 0;
}
开发者ID:aunoor,项目名称:xl2tpd,代码行数:16,代码来源:file.c
示例8: conv_str_bool
/**
* Parse a string containing a boolean value.
*
* val will be set to the read value.
*
* @retval true if a boolean value was parsed, false otherwise.
*/
_PUBLIC_ bool conv_str_bool(const char * str, bool * val)
{
char * end = NULL;
long lval;
if (str == NULL || *str == '\0') {
return false;
}
lval = strtol(str, &end, 10 /* base */);
if (end == NULL || *end != '\0' || end == str) {
return set_boolean(str, val);
}
*val = (lval) ? true : false;
return true;
}
开发者ID:AIdrifter,项目名称:samba,代码行数:24,代码来源:util_str.c
示例9: set_ipsec_saref
int set_ipsec_saref (char *word, char *value, int context, void *item)
{
struct global *g = ((struct global *) item);
switch (context & ~CONTEXT_DEFAULT)
{
case CONTEXT_GLOBAL:
if (set_boolean
(word, value, &(g->ipsecsaref)))
return -1;
if(g->ipsecsaref) {
l2tp_log(LOG_WARNING, "Enabling IPsec SAref processing for L2TP transport mode SAs\n");
}
break;
default:
snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
word);
return -1;
}
return 0;
}
开发者ID:Disrupt6,项目名称:xavl2tp,代码行数:20,代码来源:file.c
示例10: cmd_toggle
/* SYNTAX: TOGGLE <key> [on|off|toggle] */
static void cmd_toggle(const char *data)
{
char *key, *value;
void *free_arg;
int type;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &key, &value))
return;
if (*key == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
type = settings_get_type(key);
if (type == -1)
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown setting %_%s", key);
else if (type != SETTING_TYPE_BOOLEAN)
printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Setting %_%s%_ isn't boolean, use /SET", key);
else {
set_boolean(key, *value != '\0' ? value : "TOGGLE");
set_print(settings_get_record(key));
}
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:24,代码来源:fe-settings.c
示例11: set_flow
int set_flow (char *word, char *value, int context, void *item)
{
int v;
set_boolean (word, value, &v);
if (v < 0)
return -1;
switch (context & ~CONTEXT_DEFAULT)
{
case CONTEXT_LAC:
if (v)
{
if (((struct lac *) item)->call_rws < 0)
((struct lac *) item)->call_rws = 0;
}
else
{
((struct lac *) item)->call_rws = -1;
}
break;
case CONTEXT_LNS:
if (v)
{
if (((struct lns *) item)->call_rws < 0)
((struct lns *) item)->call_rws = 0;
}
else
{
((struct lns *) item)->call_rws = -1;
}
break;
default:
snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
word);
return -1;
}
return 0;
}
开发者ID:aunoor,项目名称:xl2tpd,代码行数:37,代码来源:file.c
示例12: do_common_parameter
bool do_common_parameter(vscan_config_struct *vscan_config, const char *param, const char *value)
{
/* we assume we handled a common parameter */
bool ret = True;
if ( StrCaseCmp("max file size", param) == 0 ) {
/* FIXME: sanity check missing! what, if value is out of range?
atoi returns int - what about LFS? atoi should be avoided!
*/
/* FIXME: changed atoi to atoll, but atoll might not be available
on all platforms! */
vscan_config->common.max_size = atoll(value);
DEBUG(3, ("max file size is: %lld\n", (long long)vscan_config->common.max_size));
} else if ( StrCaseCmp("verbose file logging", param) == 0 ) {
set_boolean(value, &vscan_config->common.verbose_file_logging);
DEBUG(3, ("verbose file logging is: %d\n", vscan_config->common.verbose_file_logging));
} else if ( StrCaseCmp("scan on open", param) == 0 ) {
set_boolean(value, &vscan_config->common.scan_on_open);
DEBUG(3, ("scan on open: %d\n", vscan_config->common.scan_on_open));
} else if ( StrCaseCmp("scan on close", param) == 0 ) {
set_boolean(value, &vscan_config->common.scan_on_close);
DEBUG(3, ("scan on close is: %d\n", vscan_config->common.scan_on_close));
} else if ( StrCaseCmp("deny access on error", param) == 0 ) {
set_boolean(value, &vscan_config->common.deny_access_on_error);
DEBUG(3, ("deny access on error is: %d\n", vscan_config->common.deny_access_on_error));
} else if ( StrCaseCmp("deny access on minor error", param) == 0 ) {
set_boolean(value, &vscan_config->common.deny_access_on_minor_error);
DEBUG(3, ("deny access on minor error is: %d\n", vscan_config->common.deny_access_on_minor_error));
} else if ( StrCaseCmp("send warning message", param) == 0 ) {
set_boolean(value, &vscan_config->common.send_warning_message);
DEBUG(3, ("send warning message is: %d\n", vscan_config->common.send_warning_message));
} else if ( StrCaseCmp("infected file action", param) == 0 ) {
if (StrCaseCmp("quarantine", value) == 0) {
vscan_config->common.infected_file_action = INFECTED_QUARANTINE;
} else if (StrCaseCmp("delete", value) == 0) {
vscan_config->common.infected_file_action = INFECTED_DELETE;
} else if (StrCaseCmp("nothing", value) == 0) {
vscan_config->common.infected_file_action = INFECTED_DO_NOTHING;
} else {
DEBUG(2, ("samba-vscan: badly formed infected file action in configuration file, parameter %s\n", value));
}
DEBUG(3, ("infected file action is: %d\n", vscan_config->common.infected_file_action));
} else if ( StrCaseCmp("quarantine directory", param) == 0 ) {
fstrcpy(vscan_config->common.quarantine_dir, value);
DEBUG(3, ("quarantine directory is: %s\n", vscan_config->common.quarantine_dir));
} else if ( StrCaseCmp("quarantine prefix", param) == 0 ) {
fstrcpy(vscan_config->common.quarantine_prefix, value);
DEBUG(3, ("quarantine prefix is: %s\n", vscan_config->common.quarantine_prefix));
} else if ( StrCaseCmp("max lru files entries", param) == 0 ) {
vscan_config->common.max_lrufiles = atoi(value);
DEBUG(3, ("max lru files entries is: %d\n", vscan_config->common.max_lrufiles));
} else if ( StrCaseCmp("lru file entry lifetime", param) == 0 ) {
vscan_config->common.lrufiles_invalidate_time = atol(value);
DEBUG(3, ("lru file entry lifetime is: %li\n", (long)vscan_config->common.lrufiles_invalidate_time));
} else if ( StrCaseCmp("exclude file types", param) == 0 ) {
pstrcpy(vscan_config->common.exclude_file_types, value);
DEBUG(3, ("exclude file type list is: %s\n", vscan_config->common.exclude_file_types));
} else if ( StrCaseCmp("exclude file regexp", param) == 0 ) {
pstrcpy(vscan_config->common.exclude_file_regexp, value);
DEBUG(3, ("exclude file regexp is: %s\n", vscan_config->common.exclude_file_regexp));
} else {
/* unknown common parameter, it must be handled by
corresponding module */
DEBUG(5, ("unkown common parameter: %s\n", param));
ret = False;
}
return ret;
}
开发者ID:BillTheBest,项目名称:zentyal,代码行数:70,代码来源:vscan-parameter.c
示例13: parse_config
//.........这里部分代码省略.........
if (strcmp(strval, "carbon") == 0) {
protoc = &config->carbon_config;
config->carbon_config.initialized = true;
} else if (strcmp(strval, "statsd") == 0) {
protoc = &config->statsd_config;
config->statsd_config.initialized = true;
} else {
stats_error_log("unexpectedly got map value: \"%s\"", strval);
goto parse_err;
}
break;
case 2:
if (is_key) {
if (strcmp(strval, "bind") == 0) {
update_bind = true;
} else if (strcmp(strval, "max_send_queue") == 0) {
update_send_queue = true;
} else if (strcmp(strval, "shard_map") == 0) {
shard_count = -1;
expect_shard_map = true;
} else if (strcmp(strval, "validate") == 0) {
update_validate = true;
} else if (strcmp(strval, "tcp_cork") == 0) {
update_tcp_cork = true;
} else if (strcmp(strval, "always_resolve_dns") == 0) {
always_resolve_dns = true;
}
} else {
if (update_bind) {
free(protoc->bind);
protoc->bind = strdup(strval);
update_bind = false;
} else if (update_send_queue) {
if (!convert_number(strval, &numval)) {
stats_error_log("max_send_queue was not a number: %s", strval);
}
protoc->max_send_queue = numval;
update_send_queue = false;
} else if (update_validate) {
if (!set_boolean(strval, &protoc->enable_validation)) {
goto parse_err;
}
update_validate = false;
} else if (update_tcp_cork) {
if (!set_boolean(strval, &protoc->enable_tcp_cork)) {
goto parse_err;
}
update_tcp_cork = false;
} else if (always_resolve_dns) {
if (!set_boolean(strval, &protoc->always_resolve_dns)) {
goto parse_err;
}
}
}
break;
case 3:
if (!expect_shard_map) {
stats_error_log("was not expecting shard map");
goto parse_err;
} else if (is_key) {
if (!convert_number(strval, &numval)) {
stats_error_log("shard key was not a number: \"%s\"", strval);
goto parse_err;
}
shard_count++;
if (numval != shard_count) {
stats_error_log("expected to see shard key %d, instead saw %d",
shard_count, numval);
goto parse_err;
}
} else {
if (statsrelay_list_expand(protoc->ring) == NULL) {
stats_error_log("unable to expand list");
goto parse_err;
}
if ((protoc->ring->data[protoc->ring->size - 1] = strdup(strval)) == NULL) {
stats_error_log("failed to copy string");
goto parse_err;
}
}
}
is_key = !is_key;
break;
default:
stats_error_log("unhandled yaml event");
goto parse_err;
}
yaml_event_delete(&event);
}
yaml_parser_delete(&parser);
return config;
parse_err:
destroy_config(config);
yaml_event_delete(&event);
yaml_parser_delete(&parser);
return NULL;
}
开发者ID:JeremyGrosser,项目名称:statsrelay,代码行数:101,代码来源:yaml_config.c
示例14: impl
XPathObject::XPathObject(bool value)
: impl(std::make_shared<XPathObject_Impl>())
{
set_boolean(value);
}
开发者ID:tornadocean,项目名称:ClanLib,代码行数:5,代码来源:xpath_object.cpp
示例15: entry_billable_handler
static gboolean
entry_billable_handler (xmlNodePtr node, gpointer entry_pdata)
{
struct entry_pdata *pdata = entry_pdata;
return set_boolean (node, pdata->entry, gncEntrySetBillable);
}
开发者ID:Danvil,项目名称:gnucash,代码行数:6,代码来源:gnc-entry-xml-v2.c
示例16: entry_btaxincluded_handler
static gboolean
entry_btaxincluded_handler (xmlNodePtr node, gpointer entry_pdata)
{
struct entry_pdata *pdata = entry_pdata;
return set_boolean (node, pdata->entry, gncEntrySetBillTaxIncluded);
}
开发者ID:Danvil,项目名称:gnucash,代码行数:6,代码来源:gnc-entry-xml-v2.c
示例17: vendor_taxtableoverride_handler
static gboolean
vendor_taxtableoverride_handler (xmlNodePtr node, gpointer vendor_pdata)
{
struct vendor_pdata* pdata = static_cast<decltype (pdata)> (vendor_pdata);
return set_boolean (node, pdata->vendor, gncVendorSetTaxTableOverride);
}
开发者ID:CAARNICL,项目名称:gnucash,代码行数:6,代码来源:gnc-vendor-xml-v2.cpp
示例18: vendor_active_handler
static gboolean
vendor_active_handler (xmlNodePtr node, gpointer vendor_pdata)
{
struct vendor_pdata* pdata = static_cast<decltype (pdata)> (vendor_pdata);
return set_boolean (node, pdata->vendor, gncVendorSetActive);
}
开发者ID:CAARNICL,项目名称:gnucash,代码行数:6,代码来源:gnc-vendor-xml-v2.cpp
示例19: entry_itaxincluded_handler
static gboolean
entry_itaxincluded_handler (xmlNodePtr node, gpointer entry_pdata)
{
struct entry_pdata* pdata = static_cast<decltype (pdata)> (entry_pdata);
return set_boolean (node, pdata->entry, gncEntrySetInvTaxIncluded);
}
开发者ID:CAARNICL,项目名称:gnucash,代码行数:6,代码来源:gnc-entry-xml-v2.cpp
示例20: cmd_set
/* SYNTAX: SET [-clear | -default] [<key> [<value>]] */
static void cmd_set(char *data)
{
GHashTable *optlist;
char *key, *value;
void *free_arg;
int clear, set_default;
SETTINGS_REC *rec;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST |
PARAM_FLAG_OPTIONS,
"set", &optlist, &key, &value))
return;
clear = g_hash_table_lookup(optlist, "clear") != NULL;
set_default = g_hash_table_lookup(optlist, "default") != NULL;
if (*key == '\0')
clear = set_default = FALSE;
if (!(clear || set_default || *value != '\0'))
set_print_pattern(key);
else {
rec = settings_get_record(key);
if (rec != NULL) {
/* change the setting */
switch (rec->type) {
case SETTING_TYPE_BOOLEAN:
if (clear)
settings_set_bool(key, FALSE);
else if (set_default)
settings_set_bool(key, rec->default_value.v_bool);
else
set_boolean(key, value);
break;
case SETTING_TYPE_INT:
if (clear)
settings_set_int(key, 0);
else if (set_default)
settings_set_int(key, rec->default_value.v_int);
else
set_int(key, value);
break;
case SETTING_TYPE_CHOICE:
if (clear || set_default)
settings_set_choice(key, rec->choices[rec->default_value.v_int]);
else
set_choice(key, value);
break;
case SETTING_TYPE_STRING:
settings_set_str(key, clear ? "" :
set_default ? rec->default_value.v_string :
value);
break;
case SETTING_TYPE_TIME:
if (!settings_set_time(key, clear ? "0" :
set_default ? rec->default_value.v_string : value))
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_TIME);
break;
case SETTING_TYPE_LEVEL:
if (!settings_set_level(key, clear ? "" :
set_default ? rec->default_value.v_string : value))
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_LEVEL);
break;
case SETTING_TYPE_SIZE:
if (!settings_set_size(key, clear ? "0" :
set_default ? rec->default_value.v_string : value))
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_SIZE);
break;
case SETTING_TYPE_ANY:
/* Unpossible! */
break;
}
signal_emit("setup changed", 0);
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_SET_TITLE, rec->section);
set_print(rec);
} else
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
}
cmd_params_free(free_arg);
}
开发者ID:ahf,项目名称:irssi,代码行数:82,代码来源:fe-settings.c
注:本文中的set_boolean函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论