FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Preferences::Name Class Reference

'Name' provides a simple method to create numerical or more complex procedural names for entries and groups on the fly. More...

`#include <Fl_Preferences.H>`

## Public Member Functions
| Name (const char *format,...)
| Creates a group name or entry name on the fly.
| Name (unsigned int n)
| Creates a group name or entry name on the fly.
| operator const char * ()
| Return the Name as a "C" string.

## Detailed Description

'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]);.

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.

## Constructor & Destructor Documentation

## ◆ Name() [1/2]

Fl_Preferences::Name::Name | ( | unsigned int | n | ) |

Creates a group name or entry name on the fly.

This version creates a simple unsigned integer as an entry name.

int n, i;
Fl_Preferences prev( appPrefs, "PreviousFiles" );
prev.get( "n", 0 );
for ( i=0; i<n; i++ )
prev.get( Fl_Preferences::Name(i), prevFile[i], "" );
Fl_Preferences::Name
'Name' provides a simple method to create numerical or more complex procedural names for entries and ...
Definition Fl_Preferences.H:297
Fl_Preferences::Fl_Preferences
Fl_Preferences(Root root, const char *vendor, const char *application)
The constructor creates a group that manages key/value pairs and child groups.
Definition Fl_Preferences.cxx:365

## ◆ Name() [2/2]

Fl_Preferences::Name::Name | ( | const char * | format,
|  |  | ... )

Creates a group name or entry name on the fly.

This version creates entry names as in 'printf'.

int n, i;
Fl_Preferences prefs( USER, "matthiasm.com", "test" );
prev.get( "nFiles", 0 );
for ( i=0; i<n; i++ )
prev.get( Fl_Preferences::Name( "File%d", i ), prevFile[i], "" );
Fl_Preferences::USER
@ USER
Preferences apply only to the current user. Deprecated, see USER_L.
Definition Fl_Preferences.H:134

The documentation for this class was generated from the following files:

- Fl_Preferences.H
- Fl_Preferences.cxx