fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Preferences::Name Class Reference

#include <Fl_Preferences.H>

Public Member Functions

 Name (unsigned int n)
 
 Name (const char *format,...)
 
 operator const char * ()
 
 ~Name ()
 

Private Attributes

char * data_
 

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.

Definition at line 159 of file Fl_Preferences.H.

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], "" );

Definition at line 918 of file Fl_Preferences.cxx.

References data_, and malloc().

◆ 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], "" );

Definition at line 936 of file Fl_Preferences.cxx.

References malloc(), and vsnprintf.

◆ ~Name()

Fl_Preferences::Name::~Name ( )

Definition at line 945 of file Fl_Preferences.cxx.

References free().

Member Function Documentation

◆ operator const char *()

Fl_Preferences::Name::operator const char * ( )
inline

Return the Name as a "C" string.

Definition at line 171 of file Fl_Preferences.H.

Member Data Documentation

◆ data_

char* Fl_Preferences::Name::data_
private

Definition at line 161 of file Fl_Preferences.H.

Referenced by Name().


The documentation for this class was generated from the following files:
Fl_Preferences::USER
Preferences apply only to the current user.
Definition: Fl_Preferences.H:68
Fl_Preferences::Name
Definition: Fl_Preferences.H:159
Fl_Preferences
Fl_Preferences provides methods to store user settings between application starts.
Definition: Fl_Preferences.H:60