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, _S"window/width", int32, &width, 1024);
#define setsGet(sets, path, type, out, def)
Definition settings.h:301
#define _S
Creates a static ASCII string from a string literal.
Definition strbase.h:392

Definition at line 301 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, _S"display");
setsSet(display, _S"brightness", int32, 80);
objRelease(&display);
#define objRelease(pinst)
Definition objclass.h:223
#define setsSet(sets, path, type, val)
Definition settings.h:320
#define setsGetSub(sets, path)
Definition settings.h:279

Definition at line 279 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, _S"obsolete/setting");
#define setsRemove(sets, path)
Definition settings.h:335

Definition at line 335 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, _S"audio/volume", int32, 75);
setsSet(settings, _S"display/fullscreen", bool, true);

Definition at line 320 of file settings.h.