roo_prefs
API Documentation for roo_prefs
Loading...
Searching...
No Matches
roo_prefs.h
Go to the documentation of this file.
1#pragma once
2
3/// Umbrella header for the roo_prefs module.
4///
5/// Provides preference collections, transactions, and typed accessors.
6
8#include "roo_prefs/pref.h"
9#include "roo_prefs/status.h"
12
13/// Basic usage:
14///
15/// @code
16/// roo_prefs::Collection c("col-name"); // Statically declared.
17///
18/// {
19/// roo_prefs::Transaction t(c);
20/// t.store().writeI32("pref-name", val);
21/// }
22/// @endcode
23///
24/// In the snippet above, `Preferences::begin()` / `Preferences::end()` are
25/// called automatically by transaction constructor/destructor.
26///
27/// If you want in-memory caching, prefer typed `Pref` classes over direct
28/// transactions.
29///
30/// Transactions are reference-counted and reentrant. Nested usage only calls
31/// `begin()` / `end()` once.
32///
33/// @code
34/// void foo(const std::string& key, int val) {
35/// roo_prefs::Transaction t(c);
36/// t.store().writeI32(key.c_str(), val);
37/// }
38///
39/// {
40/// roo_prefs::Transaction t(c);
41/// foo("a", 1);
42/// foo("b", 2);
43/// }
44/// @endcode