NeoMutt  2025-01-09-104-g5de5ef
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config_type.c File Reference

Type representing an Expando. More...

#include "config.h"
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "expando.h"
+ Include dependency graph for config_type.c:

Go to the source code of this file.

Functions

static void expando_destroy (void *var, const struct ConfigDef *cdef)
 Destroy an Expando object - Implements ConfigSetType::destroy() -.
 
static int expando_string_set (void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
 Set an Expando by string - Implements ConfigSetType::string_set() -.
 
static int expando_string_get (void *var, const struct ConfigDef *cdef, struct Buffer *result)
 Get an Expando as a string - Implements ConfigSetType::string_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() -.
 
static int expando_string_plus_equals (void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
 Add to an Expando by string - Implements ConfigSetType::string_plus_equals() -.
 
static bool expando_has_been_set (void *var, const struct ConfigDef *cdef)
 Is the config value different to its initial value? - Implements ConfigSetType::has_been_set() -.
 
static int expando_reset (void *var, const struct ConfigDef *cdef, struct Buffer *err)
 Reset an Expando to its initial value - Implements ConfigSetType::reset() -.
 
const struct Expandocs_subset_expando (const struct ConfigSubset *sub, const char *name)
 Get an Expando config item by name.
 

Variables

const struct ConfigSetType CstExpando
 Config type representing an Expando.
 

Detailed Description

Type representing an Expando.

Authors
  • Tóth János
  • Richard Russon

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 config_type.c.

Function Documentation

◆ cs_subset_expando()

const struct Expando * cs_subset_expando ( const struct ConfigSubset sub,
const char *  name 
)

Get an Expando config item by name.

Parameters
subConfig Subset
nameName of config item
Return values
ptrExpando
NULLEmpty Expando

Definition at line 361 of file config_type.c.

362{
363 ASSERT(sub && name);
364
365 struct HashElem *he = cs_subset_create_inheritance(sub, name);
366 ASSERT(he);
367
368#ifndef NDEBUG
369 struct HashElem *he_base = cs_get_base(he);
370 ASSERT(CONFIG_TYPE(he_base->type) == DT_EXPANDO);
371#endif
372
373 intptr_t value = cs_subset_he_native_get(sub, he, NULL);
374 ASSERT(value != INT_MIN);
375
376 return (const struct Expando *) value;
377}
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
Definition: set.c:160
#define ASSERT(COND)
Definition: signal2.h:60
Parsed Expando trees.
Definition: expando.h:41
The item stored in a Hash Table.
Definition: hash.h:44
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:45
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
Definition: subset.c:260
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
Definition: subset.c:210
#define CONFIG_TYPE(t)
Definition: types.h:49
@ DT_EXPANDO
an expando
Definition: types.h:34
+ Here is the call graph for this function:

Variable Documentation

◆ CstExpando

const struct ConfigSetType CstExpando
Initial value:
= {
"expando",
NULL,
}
static void expando_destroy(void *var, const struct ConfigDef *cdef)
Destroy an Expando object - Implements ConfigSetType::destroy() -.
Definition: config_type.c:49
static bool expando_has_been_set(void *var, const struct ConfigDef *cdef)
Is the config value different to its initial value? - Implements ConfigSetType::has_been_set() -.
Definition: config_type.c:278
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() -.
Definition: config_type.c:160
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() -.
Definition: config_type.c:209
static int expando_reset(void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset an Expando to its initial value - Implements ConfigSetType::reset() -.
Definition: config_type.c:291
static int expando_string_get(void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get an Expando as a string - Implements ConfigSetType::string_get() -.
Definition: config_type.c:135
static int expando_string_plus_equals(void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
Add to an Expando by string - Implements ConfigSetType::string_plus_equals() -.
Definition: config_type.c:219
static int expando_string_set(void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set an Expando by string - Implements ConfigSetType::string_set() -.
Definition: config_type.c:61

Config type representing an Expando.

Definition at line 340 of file config_type.c.