CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Value Modification

Macros

#define ssdSet(root, path, createpath, val)    _ssdSet(root, path, createpath, val, (SSDLockState*)_ssdCurrentLockState)
 
#define ssdSetC(root, path, createpath, val)    _ssdSetC(root, path, createpath, val, (SSDLockState*)_ssdCurrentLockState)
 
#define ssdRemove(root, path)   _ssdRemove(root, path, (SSDLockState*)_ssdCurrentLockState)
 

Detailed Description

Functions for setting, removing, and modifying values in the tree.

Macro Definition Documentation

◆ ssdRemove

#define ssdRemove (   root,
  path 
)    _ssdRemove(root, path, (SSDLockState*)_ssdCurrentLockState)

bool ssdRemove(SSDNode *root, strref path)

Removes a value at the specified path from the tree.

Parameters
rootThe root node
pathPath to the value to remove
Returns
true if the value was removed, false if not found

Definition at line 447 of file ssdtree.h.

◆ ssdSet

#define ssdSet (   root,
  path,
  createpath,
  val 
)     _ssdSet(root, path, createpath, val, (SSDLockState*)_ssdCurrentLockState)

bool ssdSet(SSDNode *root, strref path, bool createpath, stvar val)

Sets a value at the specified path in the tree.

If createpath is true, any intermediate nodes along the path are automatically created as hashtables. If false and the path doesn't exist, the operation fails.

Parameters
rootThe root node
pathPath where to set the value (NULL for root node)
createpathIf true, create intermediate nodes as needed
valThe value to set (copied into the tree)
Returns
true on success, false on failure

Example:

ssdSet(root, _SL("config/port"), true, stvar(int32, 8080));
#define ssdSet(root, path, createpath, val)
Definition ssdtree.h:417
#define _SL(s)
Inline ASCII string literal with compile-time embedded length (STR_LEN8). Content must be < 200 bytes...
Definition strliteral.h:207
#define stvar(typen, val)
Definition stvar.h:162

Definition at line 417 of file ssdtree.h.

◆ ssdSetC

#define ssdSetC (   root,
  path,
  createpath,
  val 
)     _ssdSetC(root, path, createpath, val, (SSDLockState*)_ssdCurrentLockState)

bool ssdSetC(SSDNode *root, strref path, bool createpath, stvar *val)

Sets a value at the specified path, consuming the provided stvar.

This function takes ownership of the value and will consume it even on failure. This is more efficient than ssdSet() when you don't need to keep the original value.

Parameters
rootThe root node
pathPath where to set the value
createpathIf true, create intermediate nodes as needed
valPointer to the value (consumed and invalidated)
Returns
true on success, false on failure

Definition at line 435 of file ssdtree.h.