#include "config.h"
#include <stddef.h>
#include <limits.h>
#include <stdint.h>
#include "mutt/lib.h"
#include "quad.h"
#include "set.h"
#include "subset.h"
#include "types.h"
Go to the source code of this file.
|
static int | quad_string_set (const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err) |
| Set a Quad-option by string - Implements ConfigSetType::string_set() More...
|
|
static int | quad_string_get (const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result) |
| Get a Quad-option as a string - Implements ConfigSetType::string_get() More...
|
|
static int | quad_native_set (const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err) |
| Set a Quad-option config item by int - Implements ConfigSetType::native_set() More...
|
|
static intptr_t | quad_native_get (const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err) |
| Get an int object from a Quad-option config item - Implements ConfigSetType::native_get() More...
|
|
static int | quad_reset (const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err) |
| Reset a Quad-option to its initial value - Implements ConfigSetType::reset() More...
|
|
static int | quad_toggle (int opt) |
| Toggle (invert) the value of a quad option. More...
|
|
int | quad_he_toggle (struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err) |
| Toggle the value of a quad. More...
|
|
int | quad_str_toggle (struct ConfigSubset *sub, const char *name, struct Buffer *err) |
| Toggle the value of a quad. More...
|
|
Type representing a quad-option
- Authors
-
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file quad.c.
◆ quad_string_set()
static int quad_string_set |
( |
const struct ConfigSet * |
cs, |
|
|
void * |
var, |
|
|
struct ConfigDef * |
cdef, |
|
|
const char * |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
|
static |
◆ quad_string_get()
static int quad_string_get |
( |
const struct ConfigSet * |
cs, |
|
|
void * |
var, |
|
|
const struct ConfigDef * |
cdef, |
|
|
struct Buffer * |
result |
|
) |
| |
|
static |
◆ quad_native_set()
static int quad_native_set |
( |
const struct ConfigSet * |
cs, |
|
|
void * |
var, |
|
|
const struct ConfigDef * |
cdef, |
|
|
intptr_t |
value, |
|
|
struct Buffer * |
err |
|
) |
| |
|
static |
Set a Quad-option config item by int - Implements ConfigSetType::native_set()
Definition at line 126 of file quad.c.
135 if (value == (*(
char *) var))
140 int rc = cdef->
validator(cs, cdef, value, err);
146 *(
char *) var = value;
◆ quad_native_get()
static intptr_t quad_native_get |
( |
const struct ConfigSet * |
cs, |
|
|
void * |
var, |
|
|
const struct ConfigDef * |
cdef, |
|
|
struct Buffer * |
err |
|
) |
| |
|
static |
◆ quad_reset()
◆ quad_toggle()
static int quad_toggle |
( |
int |
opt | ) |
|
|
static |
Toggle (invert) the value of a quad option.
- Parameters
-
By toggling the low bit, the following are swapped:
Definition at line 188 of file quad.c.
◆ quad_he_toggle()
Toggle the value of a quad.
- Parameters
-
sub | Config subset |
he | HashElem representing config item |
err | Buffer for error messages |
- Return values
-
- See also
- quad_toggle()
Definition at line 202 of file quad.c.
204 if (!sub || !he || !he->
data)
212 if (value == INT_MIN)
◆ quad_str_toggle()
Toggle the value of a quad.
- Parameters
-
sub | Config subset |
name | HashElem representing config item |
err | Buffer for error messages |
- Return values
-
- See also
- quad_toggle()
Definition at line 233 of file quad.c.
◆ QuadValues
Initial value:= {
"no", "yes", "ask-no", "ask-yes", NULL,
}
Valid strings for creating a QuadValue.
These strings are case-insensitive.
Definition at line 48 of file quad.c.
◆ cst_quad
Initial value:= {
"quad",
NULL,
NULL,
NULL,
}
Config type representing a quad-option.
Definition at line 243 of file quad.c.
#define DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
static int quad_reset(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a Quad-option to its initial value - Implements ConfigSetType::reset()
#define CSR_SUCCESS
Action completed successfully.
void * data
User-supplied data.
#define DTYPE(x)
Mask for the Data Type.
static int quad_native_set(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set a Quad-option config item by int - Implements ConfigSetType::native_set()
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
void cs_subset_notify_observers(const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev)
Notify all observers of an event.
@ LL_DEBUG1
Log at debug level 1.
static intptr_t quad_native_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get an int object from a Quad-option config item - Implements ConfigSetType::native_get()
intptr_t cs_he_native_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
#define mutt_array_size(x)
int quad_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a quad.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
static int quad_toggle(int opt)
Toggle (invert) the value of a quad option.
@ NT_CONFIG_SET
Config item has been set.
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
intptr_t initial
Initial value.
struct ConfigSet * cs
Parent ConfigSet.
static int quad_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a Quad-option as a string - Implements ConfigSetType::string_get()
#define mutt_debug(LEVEL,...)
int type
Type of data stored in Hash Table, e.g. DT_STRING.
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
static int quad_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set a Quad-option by string - Implements ConfigSetType::string_set()
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate a config variable.
#define CSR_ERR_CODE
Problem with the code.
The item stored in a Hash Table.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_INV_TYPE
Value is not valid for the type.
const char * QuadValues[]
Valid strings for creating a QuadValue.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int cs_he_native_set(const struct ConfigSet *cs, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.