CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Settings Access

Macros

#define setsGetSub(sets, path)   ssdSubtree(sets, path, SSD_Create_Hashtable)
 
#define setsGet(sets, path, type, out, def)   ssdCopyOutD(sets, path, type, out, def)
 
#define setsSet(sets, path, type, val)   ssdSet(sets, path, true, stvar(type, val))
 
#define setsRemove(sets, path)   ssdRemove(sets, path)
 

Detailed Description

Compatibility macros for code written against an earlier version of the settings API. These wrap the underlying SSD tree operations. New code should use the SSD tree functions directly (ssdCopyOutD, ssdSet, ssdRemove, ssdSubtree).

Macro Definition Documentation

◆ setsGet

#define setsGet (   sets,
  path,
  type,
  out,
  def 
)    ssdCopyOutD(sets, path, type, out, def)

bool setsGet(SSDNode *sets, strref path, type, out, def)

Retrieves a setting value with type conversion and a default.

Reads the value at the specified path, converts it to the requested type, and stores it in the output variable. If the path doesn't exist or conversion fails, the default value is used instead.

Parameters
setsThe settings tree root
pathPath to the setting (e.g., "window/width")
typeExpected type (e.g., int32, string, float32)
outPointer to output variable
defDefault value to use if path doesn't exist
Returns
true if the value was found, false if default was used

Example:

int32 width;
setsGet(settings, _SL("window/width"), int32, &width, 1024);
#define setsGet(sets, path, type, out, def)
Definition settings.h:308
#define _SL(s)
Inline ASCII string literal with compile-time embedded length (STR_LEN8). Content must be < 200 bytes...
Definition strliteral.h:207

Definition at line 308 of file settings.h.

◆ setsGetSub

#define setsGetSub (   sets,
  path 
)    ssdSubtree(sets, path, SSD_Create_Hashtable)

SSDNode *setsGetSub(SSDNode *sets, strref path)

Retrieves a subtree node, creating it as a hashtable if it doesn't exist.

This is a compatibility wrapper around ssdSubtree() that automatically creates hashtable nodes. New code should use ssdSubtree() directly.

Important: The returned node has an acquired reference - caller must call objRelease().

Parameters
setsThe settings tree root
pathPath to the subtree (e.g., "display/advanced")
Returns
The subtree node (caller must release), or NULL on error

Example:

SSDNode *display = setsGetSub(settings, _SL("display"));
setsSet(display, _SL("brightness"), int32, 80);
objRelease(&display);
#define objRelease(pinst)
Definition objclass.h:257
#define setsSet(sets, path, type, val)
Definition settings.h:327
#define setsGetSub(sets, path)
Definition settings.h:286

Definition at line 286 of file settings.h.

◆ setsRemove

#define setsRemove (   sets,
  path 
)    ssdRemove(sets, path)

void setsRemove(SSDNode *sets, strref path)

Removes a setting from the tree.

Deletes the value at the specified path. This is a compatibility wrapper around ssdRemove().

Parameters
setsThe settings tree root
pathPath to the setting to remove

Example:

setsRemove(settings, _SL("obsolete/setting"));
#define setsRemove(sets, path)
Definition settings.h:342

Definition at line 342 of file settings.h.

◆ setsSet

#define setsSet (   sets,
  path,
  type,
  val 
)    ssdSet(sets, path, true, stvar(type, val))

void setsSet(SSDNode *sets, strref path, type, val)

Sets a setting value, creating intermediate nodes as needed.

Stores a value at the specified path. If intermediate nodes don't exist, they are automatically created as hashtables.

Parameters
setsThe settings tree root
pathPath where to store the value (e.g., "audio/volume")
typeType of the value (e.g., int32, string, bool)
valThe value to store

Example:

setsSet(settings, _SL("audio/volume"), int32, 75);
setsSet(settings, _SL("display/fullscreen"), bool, true);

Definition at line 327 of file settings.h.