FX::FXSettings Class Reference

#include <FXSettings.h>

Inheritance diagram for FX::FXSettings:

Inheritance graph
[legend]

List of all members.


Detailed Description

The Settings class manages a key-value database. This is normally used as part of Registry, but can also be used separately in applications that need to maintain a key-value database in a file of their own. String values can contain any character, and will be escaped when written to the file.

Public Member Functions

 FXSettings ()
 FXSettings (const FXSettings &orig)
FXSettingsoperator= (const FXSettings &orig)
bool parseFile (const FXString &filename, bool mark)
bool unparseFile (const FXString &filename)
FXStringDictdata (FXuint pos) const
FXStringDictfind (const FXchar *section) const
FXint readFormatEntry (const FXchar *section, const FXchar *key, const FXchar *fmt,...) FX_SCANF(4
FXint const FXchar * readStringEntry (const FXchar *section, const FXchar *key, const FXchar *def=NULL)
FXint readIntEntry (const FXchar *section, const FXchar *key, FXint def=0)
FXuint readUnsignedEntry (const FXchar *section, const FXchar *key, FXuint def=0)
FXdouble readRealEntry (const FXchar *section, const FXchar *key, FXdouble def=0.0)
FXColor readColorEntry (const FXchar *section, const FXchar *key, FXColor def=0)
FXbool readBoolEntry (const FXchar *section, const FXchar *key, FXbool def=FALSE)
FXint writeFormatEntry (const FXchar *section, const FXchar *key, const FXchar *fmt,...) FX_PRINTF(4
FXint bool writeStringEntry (const FXchar *section, const FXchar *key, const FXchar *val)
bool writeIntEntry (const FXchar *section, const FXchar *key, FXint val)
bool writeUnsignedEntry (const FXchar *section, const FXchar *key, FXuint val)
bool writeRealEntry (const FXchar *section, const FXchar *key, FXdouble val)
bool writeColorEntry (const FXchar *section, const FXchar *key, FXColor val)
bool writeBoolEntry (const FXchar *section, const FXchar *key, FXbool val)
bool deleteEntry (const FXchar *section, const FXchar *key)
bool existingEntry (const FXchar *section, const FXchar *key)
bool deleteSection (const FXchar *section)
bool existingSection (const FXchar *section)
bool clear ()
void setModified (bool mdfy=true)
bool isModified () const
virtual ~FXSettings ()
void size (FXint m)
FXint size () const
FXint no () const
void * insert (const FXchar *ky, const void *ptr, bool mrk=false)
void * replace (const FXchar *ky, const void *ptr, bool mrk=false)
bool empty (FXint pos) const
const FXchar * key (FXuint pos) const
bool mark (FXuint pos) const
FXint first () const
FXint last () const
FXint next (FXint pos) const
FXint prev (FXint pos) const
virtual long onDefault (FXObject *, FXSelector, void *)
const FXchar * getClassName () const
bool isMemberOf (const FXMetaClass *metaclass) const
virtual long tryHandle (FXObject *sender, FXSelector sel, void *ptr)
virtual void save (FXStream &store) const
virtual void load (FXStream &store)
QTransString tr (const char *text, const char *hint=0)
virtual void * getPythonObject () const
virtual void decouplePythonObject () const

Protected Member Functions

virtual void * createData (const void *)
virtual void deleteData (void *)
FXchar * dequote (FXchar *text) const
FXchar * enquote (FXchar *result, const FXchar *text)
FXStringDictinsert (const FXchar *ky)
FXStringDictreplace (const FXchar *ky, FXStringDict *section)
FXStringDictremove (const FXchar *ky)

Static Protected Member Functions

static FXint hash (const FXchar *str)

Protected Attributes

bool modified
FXDictEntry * dict
FXint total
FXint number

Constructor & Destructor Documentation

FX::FXSettings::FXSettings (  ) 

Construct settings database.

FX::FXSettings::FXSettings ( const FXSettings orig  ) 

Construct copy of existing database.

virtual FX::FXSettings::~FXSettings (  )  [virtual]

Cleanup.


Member Function Documentation

virtual void* FX::FXSettings::createData ( const void *   )  [protected, virtual]

Overload this function in a derived class to return the data pointer given an input pointer; the default implementation just returns the input pointer.

Reimplemented from FX::FXDict.

virtual void FX::FXSettings::deleteData ( void *   )  [protected, virtual]

Overload this function in a derived class to delete the pointer previously returned by createData(); the default implementation does nothing.

Reimplemented from FX::FXDict.

FXStringDict* FX::FXSettings::remove ( const FXchar *  ky  )  [inline, protected]

Remove data given key.

Reimplemented from FX::FXDict.

References FX::FXDict::remove().

FXSettings& FX::FXSettings::operator= ( const FXSettings orig  ) 

Assignment operator.

bool FX::FXSettings::parseFile ( const FXString filename,
bool  mark 
)

Parse a file containing a settings database.

bool FX::FXSettings::unparseFile ( const FXString filename  ) 

Unparse settings database into given file.

FXStringDict* FX::FXSettings::data ( FXuint  pos  )  const [inline]

Obtain the string dictionary for the given section.

Reimplemented from FX::FXDict.

References FX::FXDict::data().

FXStringDict* FX::FXSettings::find ( const FXchar *  section  )  const [inline]

Find string dictionary for the given section; may be NULL.

Reimplemented from FX::FXDict.

References FX::FXDict::find().

FXint FX::FXSettings::readFormatEntry ( const FXchar *  section,
const FXchar *  key,
const FXchar *  fmt,
  ... 
)

Read a formatted registry entry, using scanf-style format.

FXint const FXchar* FX::FXSettings::readStringEntry ( const FXchar *  section,
const FXchar *  key,
const FXchar *  def = NULL 
)

Read a string registry entry; if no value is found, the default value def is returned.

FXint FX::FXSettings::readIntEntry ( const FXchar *  section,
const FXchar *  key,
FXint  def = 0 
)

Read a integer registry entry; if no value is found, the default value def is returned.

FXuint FX::FXSettings::readUnsignedEntry ( const FXchar *  section,
const FXchar *  key,
FXuint  def = 0 
)

Read a unsigned integer registry entry; if no value is found, the default value def is returned.

FXdouble FX::FXSettings::readRealEntry ( const FXchar *  section,
const FXchar *  key,
FXdouble  def = 0.0 
)

Read a double-precision floating point registry entry; if no value is found, the default value def is returned.

FXColor FX::FXSettings::readColorEntry ( const FXchar *  section,
const FXchar *  key,
FXColor  def = 0 
)

Read a color value registry entry; if no value is found, the default value def is returned.

FXbool FX::FXSettings::readBoolEntry ( const FXchar *  section,
const FXchar *  key,
FXbool  def = FALSE 
)

Read a boolean registry entry.

FXint FX::FXSettings::writeFormatEntry ( const FXchar *  section,
const FXchar *  key,
const FXchar *  fmt,
  ... 
)

Write a formatted registry entry, using printf-style format.

FXint bool FX::FXSettings::writeStringEntry ( const FXchar *  section,
const FXchar *  key,
const FXchar *  val 
)

Write a string registry entry.

bool FX::FXSettings::writeIntEntry ( const FXchar *  section,
const FXchar *  key,
FXint  val 
)

Write a integer registry entry.

bool FX::FXSettings::writeUnsignedEntry ( const FXchar *  section,
const FXchar *  key,
FXuint  val 
)

Write a unsigned integer registry entry.

bool FX::FXSettings::writeRealEntry ( const FXchar *  section,
const FXchar *  key,
FXdouble  val 
)

Write a double-precision floating point registry entry.

bool FX::FXSettings::writeColorEntry ( const FXchar *  section,
const FXchar *  key,
FXColor  val 
)

Write a color value entry.

bool FX::FXSettings::writeBoolEntry ( const FXchar *  section,
const FXchar *  key,
FXbool  val 
)

Write a boolean value entry.

bool FX::FXSettings::deleteEntry ( const FXchar *  section,
const FXchar *  key 
)

Delete a registry entry.

bool FX::FXSettings::existingEntry ( const FXchar *  section,
const FXchar *  key 
)

See if entry exists.

bool FX::FXSettings::deleteSection ( const FXchar *  section  ) 

Delete section.

bool FX::FXSettings::existingSection ( const FXchar *  section  ) 

See if section exists.

bool FX::FXSettings::clear (  ) 

Clear all sections.

Reimplemented from FX::FXDict.

void FX::FXSettings::setModified ( bool  mdfy = true  )  [inline]

Mark as changed.

bool FX::FXSettings::isModified (  )  const [inline]

Is it modified.

void FX::FXDict::size ( FXint  m  )  [inherited]

Resize the table to the given size.

FXint FX::FXDict::size (  )  const [inline, inherited]

Return the size of the table, including the empty slots.

FXint FX::FXDict::no (  )  const [inline, inherited]

Return the total number of entries in the table.

void* FX::FXDict::insert ( const FXchar *  ky,
const void *  ptr,
bool  mrk = false 
) [inherited]

Insert a new entry into the table given key and mark. If there is already an entry with that key, leave it unchanged, otherwise insert the new entry.

Referenced by FX::FXStringDict::insert(), and FX::FXIconDict::insert().

void* FX::FXDict::replace ( const FXchar *  ky,
const void *  ptr,
bool  mrk = false 
) [inherited]

Replace data at key, if the entry's mark is less than or equal to the given mark. If there was no existing entry, a new entry is inserted with the given mark.

Referenced by FX::FXStringDict::replace().

bool FX::FXDict::empty ( FXint  pos  )  const [inline, inherited]

Return true if slot is empty.

const FXchar* FX::FXDict::key ( FXuint  pos  )  const [inline, inherited]

Return key at position pos.

bool FX::FXDict::mark ( FXuint  pos  )  const [inline, inherited]

Return mark flag of entry at position pos.

FXint FX::FXDict::first (  )  const [inherited]

Return position of first filled slot, or >= total

FXint FX::FXDict::last (  )  const [inherited]

Return position of last filled slot or -1

FXint FX::FXDict::next ( FXint  pos  )  const [inherited]

Return position of next filled slot in hash table or a value greater than or equal to total if no filled slot was found

FXint FX::FXDict::prev ( FXint  pos  )  const [inherited]

Return position of previous filled slot in hash table or a -1 if no filled slot was found

virtual long FX::FXObject::onDefault ( FXObject ,
FXSelector  ,
void *   
) [virtual, inherited]

Called for unhandled messages.

Reimplemented in FX::FXDelegator, FX::FXGLViewer, FX::FXMDIChild, and FX::FXMDIClient.

const FXchar* FX::FXObject::getClassName (  )  const [inherited]

Get class name of some object.

bool FX::FXObject::isMemberOf ( const FXMetaClass metaclass  )  const [inherited]

Check if object is member of metaclass.

virtual long FX::FXObject::tryHandle ( FXObject sender,
FXSelector  sel,
void *  ptr 
) [virtual, inherited]

Try handle message safely.

virtual void FX::FXObject::save ( FXStream store  )  const [virtual, inherited]

Save object to stream.

Reimplemented in FX::FX4Splitter, FX::FX7Segment, FX::FXAccelTable, FX::FXApp, FX::FXArrowButton, FX::FXBitmap, FX::FXBitmapFrame, FX::FXBitmapView, FX::FXCheckButton, FX::FXChoiceBox, FX::FXColorBar, FX::FXColorDialog, FX::FXColorRing, FX::FXColorSelector, FX::FXColorWell, FX::FXColorWheel, FX::FXComboBox, FX::FXCursor, FX::FXDial, FX::FXDirBox, FX::FXDirDialog, FX::FXDirList, FX::FXDirSelector, FX::FXDockBar, FX::FXDockHandler, FX::FXDockTitle, FX::FXDocument, FX::FXDragCorner, FX::FXDrawable, FX::FXDriveBox, FX::FXFileDialog, FX::FXFileDict, FX::FXFileList, FX::FXFileSelector, FX::FXFoldingItem, FX::FXFoldingList, FX::FXFont, FX::FXFontDialog, FX::FXFontSelector, FX::FXFrame, FX::FXGLCanvas, FX::FXGLCone, FX::FXGLContext, FX::FXGLCube, FX::FXGLCylinder, FX::FXGLGroup, FX::FXGLShape, FX::FXGLSphere, FX::FXGLTriangleMesh, FX::FXGLVertices, FX::FXGLViewer, FX::FXGLVisual, FX::FXGradientBar, FX::FXGroupBox, FX::FXHeaderItem, FX::FXHeader, FX::FXIconDict, FX::FXIconItem, FX::FXIconList, FX::FXIconSource, FX::FXId, FX::FXImage, FX::FXImageFrame, FX::FXImageView, FX::FXKnob, FX::FXLabel, FX::FXListItem, FX::FXList, FX::FXListBox, FX::FXMDIChild, FX::FXMDIClient, FX::FXMenuButton, FX::FXMenuCaption, FX::FXMenuCascade, FX::FXMenuCheck, FX::FXMenuCommand, FX::FXMenuRadio, FX::FXMenuSeparator, FX::FXMenuTitle, FX::FXOptionMenu, FX::FXPacker, FX::FXPrimaryButton, FX::FXPrintDialog, FX::FXProgressBar, FX::FXRadioButton, FX::FXRealSlider, FX::FXRealSpinner, FX::FXRecentFiles, FX::FXReplaceDialog, FX::FXRuler, FX::FXRulerView, FX::FXScrollBar, FX::FXSlider, FX::FXSpinner, FX::FXSplashWindow, FX::FXSplitter, FX::FXSpring, FX::FXStatusBar, FX::FXStatusLine, FX::FXSwitcher, FX::FXTabBar, FX::FXTableItem, FX::FXTable, FX::FXText, FX::FXTextField, FX::FXToggleButton, FX::FXToolBarGrip, FX::FXToolBarShell, FX::FXToolBarTab, FX::FXToolTip, FX::FXTopWindow, FX::FXTreeItem, FX::FXTreeList, FX::FXTreeListBox, FX::FXTriStateButton, FX::FXVisual, FX::FXWindow, and FX::FXWizard.

virtual void FX::FXObject::load ( FXStream store  )  [virtual, inherited]

Load object from stream.

Reimplemented in FX::FX4Splitter, FX::FX7Segment, FX::FXAccelTable, FX::FXApp, FX::FXArrowButton, FX::FXBitmap, FX::FXBitmapFrame, FX::FXBitmapView, FX::FXCheckButton, FX::FXChoiceBox, FX::FXColorBar, FX::FXColorDialog, FX::FXColorRing, FX::FXColorSelector, FX::FXColorWell, FX::FXColorWheel, FX::FXComboBox, FX::FXCursor, FX::FXDial, FX::FXDirBox, FX::FXDirDialog, FX::FXDirList, FX::FXDirSelector, FX::FXDockBar, FX::FXDockHandler, FX::FXDockTitle, FX::FXDocument, FX::FXDragCorner, FX::FXDrawable, FX::FXDriveBox, FX::FXFileDialog, FX::FXFileDict, FX::FXFileList, FX::FXFileSelector, FX::FXFoldingItem, FX::FXFoldingList, FX::FXFont, FX::FXFontDialog, FX::FXFontSelector, FX::FXFrame, FX::FXGLCanvas, FX::FXGLCone, FX::FXGLContext, FX::FXGLCube, FX::FXGLCylinder, FX::FXGLGroup, FX::FXGLShape, FX::FXGLSphere, FX::FXGLTriangleMesh, FX::FXGLVertices, FX::FXGLViewer, FX::FXGLVisual, FX::FXGradientBar, FX::FXGroupBox, FX::FXHeaderItem, FX::FXHeader, FX::FXIconDict, FX::FXIconItem, FX::FXIconList, FX::FXIconSource, FX::FXId, FX::FXImage, FX::FXImageFrame, FX::FXImageView, FX::FXKnob, FX::FXLabel, FX::FXListItem, FX::FXList, FX::FXListBox, FX::FXMDIChild, FX::FXMDIClient, FX::FXMenuButton, FX::FXMenuCaption, FX::FXMenuCascade, FX::FXMenuCheck, FX::FXMenuCommand, FX::FXMenuRadio, FX::FXMenuSeparator, FX::FXMenuTitle, FX::FXOptionMenu, FX::FXPacker, FX::FXPrimaryButton, FX::FXPrintDialog, FX::FXProgressBar, FX::FXRadioButton, FX::FXRealSlider, FX::FXRealSpinner, FX::FXRecentFiles, FX::FXReplaceDialog, FX::FXRuler, FX::FXRulerView, FX::FXScrollBar, FX::FXSlider, FX::FXSpinner, FX::FXSplashWindow, FX::FXSplitter, FX::FXSpring, FX::FXStatusBar, FX::FXStatusLine, FX::FXSwitcher, FX::FXTabBar, FX::FXTableItem, FX::FXTable, FX::FXText, FX::FXTextField, FX::FXToggleButton, FX::FXToolBarGrip, FX::FXToolBarShell, FX::FXToolBarTab, FX::FXToolTip, FX::FXTopWindow, FX::FXTreeItem, FX::FXTreeList, FX::FXTreeListBox, FX::FXTriStateButton, FX::FXVisual, FX::FXWindow, and FX::FXWizard.

QTransString FX::FXObject::tr ( const char *  text,
const char *  hint = 0 
) [inherited]

Returns a human translated version of the text to the locale language (warning: uses a virtual method call, so can't use before construction)

virtual void* FX::FXObject::getPythonObject (  )  const [inline, virtual, inherited]

Returns the python object representing this instance (if created in python).

virtual void FX::FXObject::decouplePythonObject (  )  const [inline, virtual, inherited]

Causes decoupling of python object from this object (deletes self).


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

(C) 2002-2008 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Jun 13 22:15:07 2008 for TnFOX by doxygen v1.5.6