本文整理汇总了C++中options_set_number函数的典型用法代码示例。如果您正苦于以下问题:C++ options_set_number函数的具体用法?C++ options_set_number怎么用?C++ options_set_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了options_set_number函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmd_rename_window_exec
enum cmd_retval
cmd_rename_window_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
struct winlink *wl = cmdq->state.tflag.wl;
window_set_name(wl->window, args->argv[0]);
options_set_number(wl->window->options, "automatic-rename", 0);
server_status_window(wl->window);
return (CMD_RETURN_NORMAL);
}
示例2: cmd_set_option_attributes
/* Set an attributes option. */
struct options_entry *
cmd_set_option_attributes(unused struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
int attr;
if ((attr = attributes_fromstring(value)) == -1) {
ctx->error(ctx, "bad attributes: %s", value);
return (NULL);
}
return (options_set_number(oo, oe->name, attr));
}
示例3: options_table_populate_tree
/* Populate an options tree from a table. */
void
options_table_populate_tree(
const struct options_table_entry *table, struct options *oo)
{
const struct options_table_entry *oe;
for (oe = table; oe->name != NULL; oe++) {
if (oe->default_str != NULL)
options_set_string(oo, oe->name, "%s", oe->default_str);
else
options_set_number(oo, oe->name, oe->default_num);
}
}
示例4: cmd_set_option_key
/* Set a key option. */
struct options_entry *
cmd_set_option_key(unused struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
int key;
if ((key = key_string_lookup_string(value)) == KEYC_NONE) {
ctx->error(ctx, "bad key: %s", value);
return (NULL);
}
return (options_set_number(oo, oe->name, key));
}
示例5: cmd_set_option_colour
/* Set a colour option. */
struct options_entry *
cmd_set_option_colour(unused struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
int colour;
if ((colour = colour_fromstring(value)) == -1) {
ctx->error(ctx, "bad colour: %s", value);
return (NULL);
}
return (options_set_number(oo, oe->name, colour));
}
示例6: input_exit_rename
/* Rename terminator (ST) received. */
void
input_exit_rename(struct input_ctx *ictx)
{
if (ictx->flags & INPUT_DISCARD)
return;
log_debug("%s: \"%s\"", __func__, ictx->input_buf);
xfree(ictx->wp->window->name);
ictx->wp->window->name = xstrdup(ictx->input_buf);
options_set_number(&ictx->wp->window->options, "automatic-rename", 0);
server_status_window(ictx->wp->window);
}
示例7: input_exit_rename
/* Rename terminator (ST) received. */
void
input_exit_rename(struct input_ctx *ictx)
{
if (ictx->flags & INPUT_DISCARD)
return;
if (!options_get_number(ictx->wp->window->options, "allow-rename"))
return;
log_debug("%s: \"%s\"", __func__, ictx->input_buf);
window_set_name(ictx->wp->window, ictx->input_buf);
options_set_number(ictx->wp->window->options, "automatic-rename", 0);
server_status_window(ictx->wp->window);
}
示例8: cmd_set_option_attributes
/* Set an attributes option. */
struct options_entry *
cmd_set_option_attributes(struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo)
{
struct cmd_target_data *data = self->data;
int attr;
if ((attr = attributes_fromstring(data->arg2)) == -1) {
ctx->error(ctx, "bad attributes: %s", data->arg2);
return (NULL);
}
return (options_set_number(oo, oe->name, attr));
}
示例9: cmd_set_option_colour
/* Set a colour option. */
struct options_entry *
cmd_set_option_colour(struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo)
{
struct cmd_target_data *data = self->data;
int colour;
if ((colour = colour_fromstring(data->arg2)) == -1) {
ctx->error(ctx, "bad colour: %s", data->arg2);
return (NULL);
}
return (options_set_number(oo, oe->name, colour));
}
示例10: cmd_set_option_number
/* Set a number option. */
struct options_entry *
cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
long long ll;
const char *errstr;
ll = strtonum(value, oe->minimum, oe->maximum, &errstr);
if (errstr != NULL) {
cmdq_error(cmdq, "value is %s: %s", errstr, value);
return (NULL);
}
return (options_set_number(oo, oe->name, ll));
}
示例11: cmd_set_option_number
/* Set a number option. */
struct options_entry *
cmd_set_option_number(struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo)
{
struct cmd_target_data *data = self->data;
long long ll;
const char *errstr;
ll = strtonum(data->arg2, oe->minimum, oe->maximum, &errstr);
if (errstr != NULL) {
ctx->error(ctx, "value is %s: %s", errstr, data->arg2);
return (NULL);
}
return (options_set_number(oo, oe->name, ll));
}
示例12: cmd_rename_window_exec
enum cmd_retval
cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
struct session *s;
struct winlink *wl;
if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
return (CMD_RETURN_ERROR);
window_set_name(wl->window, args->argv[0]);
options_set_number(&wl->window->options, "automatic-rename", 0);
server_status_window(wl->window);
return (CMD_RETURN_NORMAL);
}
示例13: cmd_rename_window_exec
int
cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct session *s;
struct winlink *wl;
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
return (-1);
xfree(wl->window->name);
wl->window->name = xstrdup(data->arg);
options_set_number(&wl->window->options, "automatic-rename", 0);
server_status_window(wl->window);
return (0);
}
示例14: options_table_populate_tree
/* Populate an options tree from a table. */
void
options_table_populate_tree(
const struct options_table_entry *table, struct options *oo)
{
const struct options_table_entry *oe;
for (oe = table; oe->name != NULL; oe++) {
switch (oe->type) {
case OPTIONS_TABLE_STRING:
options_set_string(oo, oe->name, "%s", oe->default_str);
break;
case OPTIONS_TABLE_STYLE:
options_set_style(oo, oe->name, oe->default_str, 0);
break;
default:
options_set_number(oo, oe->name, oe->default_num);
break;
}
}
}
示例15: cmd_set_option_attributes
void
cmd_set_option_attributes(struct cmd_ctx *ctx, struct options *oo,
const struct set_option_entry *entry, char *value)
{
struct options_entry *o;
int attr;
if (value == NULL) {
ctx->error(ctx, "empty value");
return;
}
if ((attr = attributes_fromstring(value)) == -1) {
ctx->error(ctx, "bad attributes: %s", value);
return;
}
o = options_set_number(oo, entry->name, attr);
ctx->info(ctx,
"set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
}