diff --git a/FL/Fl_Preferences.H b/FL/Fl_Preferences.H index 5f1c33600..9659e10a4 100644 --- a/FL/Fl_Preferences.H +++ b/FL/Fl_Preferences.H @@ -27,16 +27,16 @@ /** \brief Fl_Preferences provides methods to store user - settings between application starts. + settings between application starts. It is similar to the Registry on WIN32 and Preferences on MacOS, and provides a simple configuration mechanism for UNIX. - + Fl_Preferences uses a hierarchy to store data. It bundles similar data into groups and manages entries into those groups as name/value pairs. - + Preferences are stored in text files that can be edited manually. The file format is easy to read and relatively forgiving. Preferences files are the same on all platforms. User @@ -45,16 +45,16 @@ scheme. The user must provide default values for all entries to ensure proper operation should preferences be corrupted or not yet exist. - + Entries can be of any length. However, the size of each preferences file should be kept small for performance reasons. One application can have multiple preferences files. Extensive binary data however should be stored in separate files: see getUserdataPath(). - - \note Starting with FLTK 1.3, preference databases are expected to - be in utf8 encoding. Previous databases were stored in the - current chracter set or code page which renders them incompatible + + \note Starting with FLTK 1.3, preference databases are expected to + be in UTF-8 encoding. Previous databases were stored in the + current character set or code page which renders them incompatible for text entries using international characters. */ class FL_EXPORT Fl_Preferences { @@ -101,7 +101,7 @@ public: */ const char *name() { return node->name(); } - /** Return the the full path to this entry. + /** Return the full path to this entry. */ const char *path() { return node->path(); } @@ -145,12 +145,13 @@ public: // char import( const char *filename ); /** - 'Name' provides a simple method to create numerical or more complex + 'Name' provides a simple method to create numerical or more complex procedural names for entries and groups on the fly. - Example: prefs.set(Fl_Preferences::Name("File%d",i),file[i]);. + Example: prefs.set(Fl_Preferences::Name("File%d",i),file[i]);. - See test/preferences.cxx as a sample for writing arrays into preferences.

+ See test/preferences.cxx as a sample for writing arrays into preferences. + 'Name' is actually implemented as a class inside Fl_Preferences. It casts into const char* and gets automatically destroyed after the enclosing call ends. diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index a9296dc40..c8f0771aa 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -330,7 +330,7 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, int groupIndex ) { An ID can be retrieved from any Fl_Preferences dataset, and can then be used to create multiple new references to the same dataset. - ID's can be put very helpful when put into the user_data() field of + ID's can be very helpful when put into the user_data() field of widget callbacks. */ Fl_Preferences::Fl_Preferences( Fl_Preferences::ID id ) { @@ -370,7 +370,7 @@ Fl_Preferences::~Fl_Preferences() { if (node && !node->parent()) delete rootNode; // DO NOT delete nodes! The root node will do that after writing the preferences // zero all pointer to avoid memory errors, even though - // Valgrind does not complain (Cygwind does though) + // Valgrind does not complain (Cygwin does though) node = 0L; rootNode = 0L; } @@ -657,7 +657,7 @@ static char *decodeText( const char *src ) { supplied. The return value indicates if the value was available (non-zero) or the default was used (0). 'maxSize' is the maximum length of text that will be read. - The text buffer must allow for one additional byte for a trailling zero. + The text buffer must allow for one additional byte for a trailing zero. \param[in] key name of entry \param[out] text returned from preferences or default value if none was set