|
CX Framework
Cross-platform C utility framework
|
Functions | |
| SSDNode * | setsOpen (VFS *vfs, strref path, int64 flush_interval) |
| bool | setsClose (SSDNode **psets) |
| bool | setsFlush (SSDNode *sets) |
| void | setsSetDirty (SSDNode *sets) |
Functions for opening, closing, and persisting settings files.
| bool setsClose | ( | SSDNode ** | psets | ) |
Closes a settings tree and ensures all changes are flushed to disk.
Performs a final flush of all pending changes, including checking all bound variables, then removes the tree from background monitoring and releases the tree object.
| psets | Pointer to the settings tree root (will be set to NULL after closing) |
| bool setsFlush | ( | SSDNode * | sets | ) |
Immediately flushes all changes to disk.
Normally changes are flushed automatically at the configured interval. This function forces an immediate flush of any pending changes, including checking all bound variables for modifications.
| sets | The settings tree root |
| SSDNode * setsOpen | ( | VFS * | vfs, |
| strref | path, | ||
| int64 | flush_interval | ||
| ) |
Opens a settings tree backed by a JSON file in a VFS.
Creates or loads a settings tree from the specified file. If the file doesn't exist or cannot be parsed, an empty settings tree is created. A background thread is automatically started to monitor the tree and flush changes periodically.
| vfs | The VFS instance to use for file access |
| path | Path to the JSON settings file within the VFS |
| flush_interval | Time interval between automatic flushes (in time units, e.g., timeS(30) for 30 seconds) |
Example:
| void setsSetDirty | ( | SSDNode * | sets | ) |
Marks the settings tree as dirty to force a save at the next flush interval.
This bypasses the normal change detection and ensures the tree will be written to disk at the next flush, even if no modifications were detected. Useful when making external changes that might not be caught by the normal change tracking.
| sets | The settings tree root |