31#ifndef Fl_Preferences_H
32# define Fl_Preferences_H
35# include "Fl_Export.H"
107 static char remove(
ID id_) {
return ((Node*)id_)->remove(); }
111 const char *
name() {
return node->name(); }
115 const char *
path() {
return node->path(); }
118 const char *group(
int num_group );
119 char groupExists(
const char *key );
120 char deleteGroup(
const char *group );
121 char deleteAllGroups();
124 const char *entry(
int index );
125 char entryExists(
const char *key );
126 char deleteEntry(
const char *entry );
127 char deleteAllEntries();
131 char set(
const char *entry,
int value );
132 char set(
const char *entry,
float value );
133 char set(
const char *entry,
float value,
int precision );
134 char set(
const char *entry,
double value );
135 char set(
const char *entry,
double value,
int precision );
136 char set(
const char *entry,
const char *value );
137 char set(
const char *entry,
const void *value,
int size );
139 char get(
const char *entry,
int &value,
int defaultValue );
140 char get(
const char *entry,
float &value,
float defaultValue );
141 char get(
const char *entry,
double &value,
double defaultValue );
142 char get(
const char *entry,
char *&value,
const char *defaultValue );
143 char get(
const char *entry,
char *value,
const char *defaultValue,
int maxSize );
144 char get(
const char *entry,
void *&value,
const void *defaultValue,
int defaultSize );
145 char get(
const char *entry,
void *value,
const void *defaultValue,
int defaultSize,
int maxSize );
147 int size(
const char *entry );
149 char getUserdataPath(
char *path,
int pathlen );
172 Name(
unsigned int n );
173 Name(
const char *format, ... );
179 operator const char *() {
return data_; }
192 static char nameBuffer[128];
193 static char uuidBuffer[40];
198 class FL_EXPORT Node {
200 Node *child_, *next_;
207 int nEntry_, NEntry_;
208 unsigned char dirty_:1;
209 unsigned char top_:1;
210 unsigned char indexed_:1;
213 int nIndex_, NIndex_;
218 static int lastEntrySet;
220 Node(
const char *path );
223 int write( FILE *f );
225 const char *path() {
return path_; }
226 Node *find(
const char *path );
227 Node *search(
const char *path,
int offset=0 );
228 Node *childNode(
int ix );
229 Node *addChild(
const char *path );
230 void setParent( Node *parent );
231 Node *parent() {
return top_?0L:parent_; }
232 void setRoot(RootNode *r) { root_ = r; top_ = 1; }
233 RootNode *findRoot();
236 void deleteAllChildren();
239 const char *child(
int ix );
240 void set(
const char *name,
const char *value );
241 void set(
const char *line );
242 void add(
const char *line );
243 const char *get(
const char *name );
244 int getEntry(
const char *name );
245 char deleteEntry(
const char *name );
246 void deleteAllEntries();
247 int nEntry() {
return nEntry_; }
248 Entry &entry(
int i) {
return entry_[i]; }
252 class FL_EXPORT RootNode {
253 Fl_Preferences *prefs_;
255 char *vendor_, *application_;
257 RootNode( Fl_Preferences *, Root root,
const char *vendor,
const char *application );
258 RootNode( Fl_Preferences *,
const char *path,
const char *vendor,
const char *application );
259 RootNode( Fl_Preferences * );
263 char getPath(
char *path,
int pathlen );
265 friend class RootNode;
'Name' provides a simple method to create numerical or more complex procedural names for entries and ...
Definition Fl_Preferences.H:167
Name(unsigned int n)
Creates a group name or entry name on the fly.
Definition Fl_Preferences.cxx:923
Fl_Preferences provides methods to store user settings between application starts.
Definition Fl_Preferences.H:69
Root
Define the scope of the preferences.
Definition Fl_Preferences.H:75
@ SYSTEM
Preferences are used system-wide.
Definition Fl_Preferences.H:76
@ USER
Preferences apply only to the current user.
Definition Fl_Preferences.H:77
ID id()
Return an ID that can later be reused to open more references to this dataset.
Definition Fl_Preferences.H:103
const char * path()
Return the the full path to this entry.
Definition Fl_Preferences.H:115
void * ID
Every Fl_Preferences-Group has a uniqe ID.
Definition Fl_Preferences.H:87
const char * name()
Return the name of this entry.
Definition Fl_Preferences.H:111
static char remove(ID id_)
Remove the group with this ID from a database.
Definition Fl_Preferences.H:107
const char * group(int num_group)
Returns the name of the Nth (num_group) group.
Definition Fl_Preferences.cxx:404
static const char * newUUID()
Returns a UUID as generated by the system.
Definition Fl_Preferences.cxx:87
Fl_Preferences(Root root, const char *vendor, const char *application)
The constructor creates a group that manages name/value pairs and child groups.
Definition Fl_Preferences.cxx:237
Definition Fl_Preferences.H:184