NeoMutt  2025-01-09-117-gace867
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
native_get()

Get a string from a config item. More...

+ Collaboration diagram for native_get():

Functions

static intptr_t address_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get an Address object from an Address config item - Implements ConfigSetType::native_get() -.
 
static intptr_t bool_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get a bool from a Bool config item - Implements ConfigSetType::native_get() -.
 
static intptr_t enum_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get an int object from an Enumeration config item - Implements ConfigSetType::native_get() -.
 
static intptr_t long_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get a long from a Long config item - Implements ConfigSetType::native_get() -.
 
static intptr_t mbtable_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get an MbTable object from a MbTable config item - Implements ConfigSetType::native_get() -.
 
static intptr_t myvar_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get a string from a MyVar config item - Implements ConfigSetType::native_get() -.
 
static intptr_t number_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get an int from a Number config item - Implements ConfigSetType::native_get() -.
 
static intptr_t path_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get a string from a Path config item - Implements ConfigSetType::native_get() -.
 
static intptr_t quad_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get an int object from a Quad-option config item - Implements ConfigSetType::native_get() -.
 
static intptr_t regex_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get a Regex object from a Regex config item - Implements ConfigSetType::native_get() -.
 
static intptr_t slist_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get a Slist from a Slist config item - Implements ConfigSetType::native_get() -.
 
static intptr_t sort_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get an int from a Sort config item - Implements ConfigSetType::native_get() -.
 
static intptr_t string_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get a string from a String config item - Implements ConfigSetType::native_get() -.
 
static int expando_native_set (void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
 Set an Expando object from an Expando config item - Implements ConfigSetType::native_get() -.
 
static intptr_t expando_native_get (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Get an Expando object from an Expando config item - Implements ConfigSetType::native_get() -.
 

Detailed Description

Get a string from a config item.

Parameters
varVariable to get
cdefVariable definition
errBuffer for error messages (may be NULL)
Return values
intptr_tConfig item string
INT_MINError
Precondition
var is not NULL
cdef is not NULL

Function Documentation

◆ address_native_get()

static intptr_t address_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get an Address object from an Address config item - Implements ConfigSetType::native_get() -.

Definition at line 205 of file config_type.c.

206{
207 struct Address *addr = *(struct Address **) var;
208
209 return (intptr_t) addr;
210}
An email address.
Definition: address.h:36

◆ bool_native_get()

static intptr_t bool_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get a bool from a Bool config item - Implements ConfigSetType::native_get() -.

Definition at line 158 of file bool.c.

159{
160 return *(bool *) var;
161}

◆ enum_native_get()

static intptr_t enum_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get an int object from an Enumeration config item - Implements ConfigSetType::native_get() -.

Definition at line 153 of file enum.c.

154{
155 return *(unsigned char *) var;
156}

◆ long_native_get()

static intptr_t long_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get a long from a Long config item - Implements ConfigSetType::native_get() -.

Definition at line 143 of file long.c.

144{
145 return *(long *) var;
146}

◆ mbtable_native_get()

static intptr_t mbtable_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get an MbTable object from a MbTable config item - Implements ConfigSetType::native_get() -.

Definition at line 249 of file mbtable.c.

250{
251 struct MbTable *table = *(struct MbTable **) var;
252
253 return (intptr_t) table;
254}
Multibyte character table.
Definition: mbtable.h:36

◆ myvar_native_get()

static intptr_t myvar_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get a string from a MyVar config item - Implements ConfigSetType::native_get() -.

Definition at line 141 of file myvar.c.

142{
143 const char *str = *(const char **) var;
144
145 return (intptr_t) str;
146}

◆ number_native_get()

static intptr_t number_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get an int from a Number config item - Implements ConfigSetType::native_get() -.

Definition at line 182 of file number.c.

183{
184 return native_get(var);
185}
static intptr_t native_get(void *var)
Get an int from a Number config item.
Definition: number.c:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ path_native_get()

static intptr_t path_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get a string from a Path config item - Implements ConfigSetType::native_get() -.

Definition at line 207 of file path.c.

208{
209 const char *str = *(const char **) var;
210
211 return (intptr_t) str;
212}

◆ quad_native_get()

static intptr_t quad_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get an int object from a Quad-option config item - Implements ConfigSetType::native_get() -.

Definition at line 164 of file quad.c.

165{
166 return *(char *) var;
167}

◆ regex_native_get()

static intptr_t regex_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get a Regex object from a Regex config item - Implements ConfigSetType::native_get() -.

Definition at line 274 of file regex.c.

275{
276 struct Regex *r = *(struct Regex **) var;
277
278 return (intptr_t) r;
279}
Cached regular expression.
Definition: regex3.h:86

◆ slist_native_get()

static intptr_t slist_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get a Slist from a Slist config item - Implements ConfigSetType::native_get() -.

Definition at line 178 of file slist.c.

179{
180 struct Slist *list = *(struct Slist **) var;
181
182 return (intptr_t) list;
183}
String list.
Definition: slist.h:37

◆ sort_native_get()

static intptr_t sort_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get an int from a Sort config item - Implements ConfigSetType::native_get() -.

Definition at line 190 of file sort.c.

191{
192 return *(short *) var;
193}

◆ string_native_get()

static intptr_t string_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get a string from a String config item - Implements ConfigSetType::native_get() -.

Definition at line 178 of file string.c.

179{
180 const char *str = *(const char **) var;
181
182 return (intptr_t) str;
183}

◆ expando_native_set()

static int expando_native_set ( void *  var,
const struct ConfigDef cdef,
intptr_t  value,
struct Buffer err 
)
static

Set an Expando object from an Expando config item - Implements ConfigSetType::native_get() -.

Definition at line 160 of file config_type.c.

162{
163 int rc;
164
165 struct Expando *exp_value = (struct Expando *) value;
166 if (!exp_value && (cdef->type & D_NOT_EMPTY))
167 {
168 buf_printf(err, _("Option %s may not be empty"), cdef->name);
170 }
171
172 struct Expando *exp_old = *(struct Expando **) var;
173 if (expando_equal(exp_value, exp_old))
175
176 if (startup_only(cdef, err))
178
179 if (cdef->validator)
180 {
181 rc = cdef->validator(cdef, value, err);
182
183 if (CSR_RESULT(rc) != CSR_SUCCESS)
184 return rc | CSR_INV_VALIDATOR;
185 }
186
187 expando_free(var);
188
189 struct Expando *exp_copy = NULL;
190
191 if (exp_value)
192 {
193 const struct ExpandoDefinition *defs = (const struct ExpandoDefinition *)
194 cdef->data;
195 exp_copy = expando_parse(exp_value->string, defs, err);
196 }
197
198 rc = CSR_SUCCESS;
199 if (!exp_copy)
200 rc |= CSR_SUC_EMPTY;
201
202 *(struct Expando **) var = exp_copy;
203 return rc;
204}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:161
static bool startup_only(const struct ConfigDef *cdef, struct Buffer *err)
Validator function for D_ON_STARTUP.
Definition: set.h:293
#define CSR_ERR_INVALID
Value hasn't been set.
Definition: set.h:36
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
Definition: set.h:46
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
Definition: set.h:42
#define CSR_RESULT(x)
Definition: set.h:50
#define CSR_SUC_EMPTY
Value is empty/unset.
Definition: set.h:40
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:33
struct Expando * expando_parse(const char *str, const struct ExpandoDefinition *defs, struct Buffer *err)
Parse an Expando string.
Definition: expando.c:81
void expando_free(struct Expando **ptr)
Free an Expando object.
Definition: expando.c:61
bool expando_equal(const struct Expando *a, const struct Expando *b)
Compare two expandos.
Definition: expando.c:137
#define _(a)
Definition: message.h:28
const char * name
User-visible name.
Definition: set.h:63
int(* validator)(const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Definition: set.h:79
intptr_t data
Extra variable data.
Definition: set.h:66
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:64
Definition of a format string.
Definition: definition.h:44
Parsed Expando trees.
Definition: expando.h:41
const char * string
Pointer to the parsed string.
Definition: expando.h:42
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition: types.h:79
+ Here is the call graph for this function:

◆ expando_native_get()

static intptr_t expando_native_get ( void *  var,
const struct ConfigDef cdef,
struct Buffer err 
)
static

Get an Expando object from an Expando config item - Implements ConfigSetType::native_get() -.

Definition at line 209 of file config_type.c.

210{
211 struct Expando *exp = *(struct Expando **) var;
212
213 return (intptr_t) exp;
214}