theConfig 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - cs - py - rb - jv - cc
Loading...
Searching...
No Matches
LcSettingC_Misc_C_API

LcSettingC - various functions to perform misc operations … More...

+ Collaboration diagram for LcSettingC_Misc_C_API:

Functions

void LcSettingLog_RT (MK_RT mkrt, LC_CFSN const setting, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
 log the setting
 
static LC_CFS LcSettingParent (LC_CFSN setting)
 This function returns the parent setting of the given setting, or NULL if setting is the root setting …
 
static MK_I32 LcSettingIndex (LC_CFSN setting)
 This function returns the index of the given setting within its parent setting …
 
static MK_I32 LcSettingLength (LC_CFSN setting)
 This function returns the number of settings in a group, or the number of elements in a list or array …
 
static MK_STRN LcSettingName (LC_CFSN setting)
 This function returns the name of the given setting, or NULL if the setting has no name …
 
static enum MkErrorE LcSettingRemove (LC_CFS parent, MK_STRN name)
 This function removes and destroys the setting named name from the parent setting parent, which must be a group …
 
static enum MkErrorE LcSettingRemoveElem (LC_CFS parent, MK_I32 idx)
 This function removes the child setting at the given index index from the setting parent, which must be a group, list, or array …
 
static MK_STRN LcSettingSourceFile (LC_CFSN setting)
 This function returns the name of the file from which the setting setting was read, or NULL if the setting was not read from a file …
 
static MK_I32 LcSettingSourceLine (LC_CFSN setting)
 This function returns the line number of the configuration file or stream at which the setting setting was read, or 0 if no line number is available …
 
static enum LcConfigTypeE LcSettingType (LC_CFSN setting)
 This function returns the type of the given setting
 
static LC_CFS LcSettingAddIfNotExists (LC_CFS setting, MK_STRN name, enum LcConfigTypeE cfgtype)
 addon - add name with type only if not exists in the setting
 
static bool LcSettingExists (const LC_CFS setting, MK_STRN name)
 addon - return true if name exists in the setting otherwise false
 

LcSettingC - LcSettingC_Misc_C_API - function

LC_CFS LcSettingAddIfNotExistsP (LC_CFS setting, MK_STRN name, enum LcConfigTypeE cfgtype)
 Non-inline replacement for LcSettingAddIfNotExists
 
LC_CFS LcSettingParentP (LC_CFSN setting)
 Non-inline replacement for LcSettingParent
 
MK_BOOL LcSettingExistsP (LC_CFS const setting, MK_STRN name)
 Non-inline replacement for LcSettingExists
 
MK_I32 LcSettingIndexP (LC_CFSN setting)
 Non-inline replacement for LcSettingIndex
 
MK_I32 LcSettingLengthP (LC_CFSN setting)
 Non-inline replacement for LcSettingLength
 
MK_STRN LcSettingNameP (LC_CFSN setting)
 Non-inline replacement for LcSettingName
 
enum MkErrorE LcSettingRemoveP (LC_CFS parent, MK_STRN name)
 Non-inline replacement for LcSettingRemove
 
enum MkErrorE LcSettingRemoveElemP (LC_CFS parent, MK_I32 idx)
 Non-inline replacement for LcSettingRemoveElem
 
MK_STRN LcSettingSourceFileP (LC_CFSN setting)
 Non-inline replacement for LcSettingSourceFile
 
MK_I32 LcSettingSourceLineP (LC_CFSN setting)
 Non-inline replacement for LcSettingSourceLine
 
enum LcConfigTypeE LcSettingTypeP (LC_CFSN setting)
 Non-inline replacement for LcSettingType
 

LcSettingC - LcSettingC_Misc_C_API - overload

#define LcSettingLog_NULL(...)
 
#define LcSettingLog(...)
 
#define LcSettingLog_4(setting, fmtobj, debug, callfunc)
 
#define LcSettingLog_3(setting, fmtobj, debug)
 
#define LcSettingLog_2(setting, fmtobj)
 
#define LcSettingLog_1(setting)
 
#define LcSettingRemove_E(...)
 
#define LcSettingRemove_C(...)
 
#define LcSettingRemoveElem_E(...)
 
#define LcSettingRemoveElem_C(...)
 

Detailed Description

LcSettingC - various functions to perform misc operations …

Macro Definition Documentation

◆ LcSettingLog

#define LcSettingLog ( ...)
Value:
void LcSettingLog_RT(MK_RT mkrt, LC_CFSN const setting, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
log the setting …
#define MK_RT_CALL

Definition at line 214 of file config_overload_lc.h.

◆ LcSettingLog_1

#define LcSettingLog_1 ( setting)
Value:
LcSettingLog(setting,NULL,0,__func__,0)
#define LcSettingLog(...)

Definition at line 218 of file config_overload_lc.h.

◆ LcSettingLog_2

#define LcSettingLog_2 ( setting,
fmtobj )
Value:
LcSettingLog(setting,fmtobj,0,__func__,0)

Definition at line 217 of file config_overload_lc.h.

◆ LcSettingLog_3

#define LcSettingLog_3 ( setting,
fmtobj,
debug )
Value:
LcSettingLog(setting,fmtobj,debug,__func__,0)

Definition at line 216 of file config_overload_lc.h.

◆ LcSettingLog_4

#define LcSettingLog_4 ( setting,
fmtobj,
debug,
callfunc )
Value:
LcSettingLog(setting,fmtobj,debug,callfunc,0)

Definition at line 215 of file config_overload_lc.h.

◆ LcSettingLog_NULL

#define LcSettingLog_NULL ( ...)
Value:
#define MK_RT_CALL_NULL

Definition at line 213 of file config_overload_lc.h.

◆ LcSettingRemove_C

#define LcSettingRemove_C ( ...)
Value:
if (MkErrorCheckI(LcSettingRemove(__VA_ARGS__)))
static enum MkErrorE LcSettingRemove(LC_CFS parent, MK_STRN name)
This function removes and destroys the setting named name from the parent setting parent,...

Definition at line 220 of file config_overload_lc.h.

◆ LcSettingRemove_E

#define LcSettingRemove_E ( ...)
Value:
MkErrorCheck(LcSettingRemove(__VA_ARGS__))

Definition at line 219 of file config_overload_lc.h.

◆ LcSettingRemoveElem_C

#define LcSettingRemoveElem_C ( ...)
Value:
if (MkErrorCheckI(LcSettingRemoveElem(__VA_ARGS__)))
static enum MkErrorE LcSettingRemoveElem(LC_CFS parent, MK_I32 idx)
This function removes the child setting at the given index index from the setting parent,...

Definition at line 222 of file config_overload_lc.h.

◆ LcSettingRemoveElem_E

#define LcSettingRemoveElem_E ( ...)
Value:
MkErrorCheck(LcSettingRemoveElem(__VA_ARGS__))

Definition at line 221 of file config_overload_lc.h.

Function Documentation

◆ LcSettingAddIfNotExists()

static LC_CFS LcSettingAddIfNotExists ( LC_CFS setting,
MK_STRN name,
enum LcConfigTypeE cfgtype )
inlinestatic

addon - add name with type only if not exists in the setting

If parent is an array or list, the name parameter is ignored and may be NULL.

The function returns the new setting on success, or NULL if parent is not a group, array, or list; or if there is already a child setting of parent named name; or if type is invalid. If type is a scalar type, the new setting will have a default value of 0, 0.0, false, or NULL, as appropriate.

Definition at line 477 of file LcSettingC_lc.h.

481 {
482 config_setting_t* mbr = config_setting_get_member(setting->nat,name);
483 if (mbr == NULL) {
484 mbr = config_setting_add ( setting->nat, name, cfgtype );
485 }
486 return LcSettingC_ObjNew(mbr);
487}
static MK_ARTIFICIAL LC_CFS LcSettingC_ObjNew(config_setting_t *hdl)
return Programming-Language-Micro-Kernel (PLMK) instance from native hdl …
LIBCONFIG_API config_setting_t * config_setting_get_member(const config_setting_t *setting, const char *name)
LIBCONFIG_API config_setting_t * config_setting_add(config_setting_t *parent, const char *name, int __type)
config_setting_t * nat
internal - link between LcSettingS and native library
+ Here is the caller graph for this function:

◆ LcSettingAddIfNotExistsP()

LC_CFS LcSettingAddIfNotExistsP ( LC_CFS setting,
MK_STRN name,
enum LcConfigTypeE cfgtype )

Non-inline replacement for LcSettingAddIfNotExists

◆ LcSettingExists()

static bool LcSettingExists ( const LC_CFS setting,
MK_STRN name )
inlinestatic

addon - return true if name exists in the setting otherwise false

Same as LcSettingGetMember but only test on exists

Definition at line 502 of file LcSettingC_lc.h.

505 {
506 return config_setting_get_member(setting->nat,name) != NULL;
507}
+ Here is the caller graph for this function:

◆ LcSettingExistsP()

MK_BOOL LcSettingExistsP ( LC_CFS const setting,
MK_STRN name )

Non-inline replacement for LcSettingExists

◆ LcSettingIndex()

static MK_I32 LcSettingIndex ( LC_CFSN setting)
inlinestatic

This function returns the index of the given setting within its parent setting …

If setting is the root setting, this function returns -1.

Definition at line 296 of file LcSettingC_lc.h.

296 {
297 LC_INSTANCE_HDL(setting);
298 return config_setting_index(setting->nat);
299 }
#define LC_INSTANCE_HDL(x)
LIBCONFIG_API int config_setting_index(const config_setting_t *setting)
+ Here is the caller graph for this function:

◆ LcSettingIndexP()

MK_I32 LcSettingIndexP ( LC_CFSN setting)

Non-inline replacement for LcSettingIndex

◆ LcSettingLength()

static MK_I32 LcSettingLength ( LC_CFSN setting)
inlinestatic

This function returns the number of settings in a group, or the number of elements in a list or array …

For other types of settings, it returns 0.

Definition at line 302 of file LcSettingC_lc.h.

302 {
303 LC_INSTANCE_HDL(setting);
304 return config_setting_length(setting->nat);
305 }
LIBCONFIG_API int config_setting_length(const config_setting_t *setting)
+ Here is the caller graph for this function:

◆ LcSettingLengthP()

MK_I32 LcSettingLengthP ( LC_CFSN setting)

Non-inline replacement for LcSettingLength

◆ LcSettingLog_RT()

void LcSettingLog_RT ( MK_RT mkrt,
LC_CFSN const setting,
MK_OBJN fmtobj,
MK_DBG const debug,
MK_STRN const callfunc,
MK_I32 const lvl )

log the setting

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]settingsame as config_setting_t
[in]fmtobjmanaged object used to format the log-message (default="MK_NULL" → use default-format)
[in]debugthe debug level from MkRuntimeS::debug, use 0 <= debug <= 9 (default=0)
[in]callfunca user-defined postfix to identify the calling function or the environment (default=name-of-function)
[in]lvla user-defined prefix starting with "" for lvl=0 and increase with " " for lvl+1 (default=0)

◆ LcSettingName()

static MK_STRN LcSettingName ( LC_CFSN setting)
inlinestatic

This function returns the name of the given setting, or NULL if the setting has no name …

Storage for the returned string is managed by the library and released automatically when the setting is destroyed; the string must not be freed by the caller.

Definition at line 308 of file LcSettingC_lc.h.

308 {
309 LC_INSTANCE_HDL(setting);
310 MK_STRN __retVal__L = config_setting_name(setting->nat);
311 return __retVal__L;
312 }
const MK_STRB * MK_STRN
#define config_setting_name(S)
+ Here is the caller graph for this function:

◆ LcSettingNameP()

MK_STRN LcSettingNameP ( LC_CFSN setting)

Non-inline replacement for LcSettingName

◆ LcSettingParent()

static LC_CFS LcSettingParent ( LC_CFSN setting)
inlinestatic

This function returns the parent setting of the given setting, or NULL if setting is the root setting …

Definition at line 288 of file LcSettingC_lc.h.

288 {
289 LC_INSTANCE_HDL(setting);
291 }
#define config_setting_parent(S)
+ Here is the caller graph for this function:

◆ LcSettingParentP()

LC_CFS LcSettingParentP ( LC_CFSN setting)

Non-inline replacement for LcSettingParent

◆ LcSettingRemove()

static enum MkErrorE LcSettingRemove ( LC_CFS parent,
MK_STRN name )
inlinestatic

This function removes and destroys the setting named name from the parent setting parent, which must be a group …

Any child settings of the setting are recursively destroyed as well.

The name parameter can also specify a setting path relative to the provided parent. (In that case, the setting will be looked up and removed.)

The function returns CONFIG_TRUE on success. If parent is not a group, or if it has no setting with the given name, it returns CONFIG_FALSE.

Definition at line 315 of file LcSettingC_lc.h.

315 {
316 LC_INSTANCE_HDL(parent);
317 enum LcErrorE errVal = (enum LcErrorE)config_setting_remove(parent->nat, name);
318 LcErrorE_Check(parent, errVal);
319 return MK_OK;
320 error:
321 return MK_ERROR;
322 }
LcErrorE
Signals an error and is used as the return value of a function …
Definition LcEnum_lc.h:191
#define LcErrorE_Check(lc_hdl, PROC)
check on a tcllcconfig error and convert into a tcllcconfig error …
MK_ERROR
MK_OK
LIBCONFIG_API int config_setting_remove(config_setting_t *parent, const char *name)
+ Here is the caller graph for this function:

◆ LcSettingRemoveElem()

static enum MkErrorE LcSettingRemoveElem ( LC_CFS parent,
MK_I32 idx )
inlinestatic

This function removes the child setting at the given index index from the setting parent, which must be a group, list, or array …

Any child settings of the removed setting are recursively destroyed as well.

The function returns CONFIG_TRUE on success. If parent is not a group, list, or array, or if index is out of range, it returns CONFIG_FALSE.

Definition at line 325 of file LcSettingC_lc.h.

325 {
326 LC_INSTANCE_HDL(parent);
327 enum LcErrorE errVal = (enum LcErrorE)config_setting_remove_elem(parent->nat, (MK_U32)idx);
328 LcErrorE_Check(parent, errVal);
329 return MK_OK;
330 error:
331 return MK_ERROR;
332 }
unsigned int MK_U32
LIBCONFIG_API int config_setting_remove_elem(config_setting_t *parent, unsigned int idx)
+ Here is the caller graph for this function:

◆ LcSettingRemoveElemP()

enum MkErrorE LcSettingRemoveElemP ( LC_CFS parent,
MK_I32 idx )

Non-inline replacement for LcSettingRemoveElem

◆ LcSettingRemoveP()

enum MkErrorE LcSettingRemoveP ( LC_CFS parent,
MK_STRN name )

Non-inline replacement for LcSettingRemove

◆ LcSettingSourceFile()

static MK_STRN LcSettingSourceFile ( LC_CFSN setting)
inlinestatic

This function returns the name of the file from which the setting setting was read, or NULL if the setting was not read from a file …

This information is useful for reporting application-level errors. Storage for the returned string is managed by the library and released automatically when the configuration is destroyed; the string must not be freed by the caller.

Definition at line 335 of file LcSettingC_lc.h.

335 {
336 LC_INSTANCE_HDL(setting);
337 MK_STRN __retVal__L = config_setting_source_file(setting->nat);
338 return __retVal__L;
339 }
#define config_setting_source_file( S)
+ Here is the caller graph for this function:

◆ LcSettingSourceFileP()

MK_STRN LcSettingSourceFileP ( LC_CFSN setting)

Non-inline replacement for LcSettingSourceFile

◆ LcSettingSourceLine()

static MK_I32 LcSettingSourceLine ( LC_CFSN setting)
inlinestatic

This function returns the line number of the configuration file or stream at which the setting setting was read, or 0 if no line number is available …

This information is useful for reporting application-level errors.

Definition at line 342 of file LcSettingC_lc.h.

342 {
343 LC_INSTANCE_HDL(setting);
344 return (MK_I32)config_setting_source_line(setting->nat);
345 }
signed int MK_I32
#define config_setting_source_line( S)
+ Here is the caller graph for this function:

◆ LcSettingSourceLineP()

MK_I32 LcSettingSourceLineP ( LC_CFSN setting)

Non-inline replacement for LcSettingSourceLine

◆ LcSettingType()

static enum LcConfigTypeE LcSettingType ( LC_CFSN setting)
inlinestatic

This function returns the type of the given setting

The return value is one of the constants CONFIG_TYPE_INT, CONFIG_TYPE_INT64, CONFIG_TYPE_FLOAT, CONFIG_TYPE_STRING, CONFIG_TYPE_BOOL, CONFIG_TYPE_ARRAY, CONFIG_TYPE_LIST, or CONFIG_TYPE_GROUP.

Definition at line 348 of file LcSettingC_lc.h.

348 {
349 LC_INSTANCE_HDL(setting);
350 return (enum LcConfigTypeE)config_setting_type(setting->nat);
351 }
LcConfigTypeE
define the data-type of a LcSettingC …
Definition LcEnum_lc.h:81
#define config_setting_type(S)
+ Here is the caller graph for this function:

◆ LcSettingTypeP()

enum LcConfigTypeE LcSettingTypeP ( LC_CFSN setting)

Non-inline replacement for LcSettingType