Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

PreferencesTool Class Reference

#include <preferencestool.h>

List of all members.

Public Member Functions

bool setPreferencesFile (const char *filePath, const char *version)
bool setPreference (const char *key, const char *attribute, bool flushLater=false)
bool setPreference (const char *key, const int attribute, bool flushLater=false)
const char * getPreference (const char *key, const char *defaultValue)
const int getPreference (const char *key, const int defaultValue)
void removePreference (const char *key)
bool flushPreferences ()

Static Public Member Functions

static PreferencesToolget ()

Protected Member Functions

 PreferencesTool ()
 ~PreferencesTool ()


Detailed Description

A xml based tool for adding, changing and removing of various preferences. Everything is saved to a xml organized file and can be readed by the tool for later usage.

Author:
Bjoern Erik Nilsen & Fredrik Berg Kjoelstad


Constructor & Destructor Documentation

PreferencesTool::PreferencesTool  )  [protected]
 

Protected constructor to deny external instanciation of the singleton.

PreferencesTool::~PreferencesTool  )  [protected]
 

Cleans up after the preferencestool.


Member Function Documentation

bool PreferencesTool::flushPreferences  ) 
 

Flushes the preferences to the file specified with setPreferencesFile(..).

Returns:
true if the preferences were succesfully saved.

PreferencesTool * PreferencesTool::get  )  [static]
 

Retrieves the instance of the PreferencesTool class.

Returns:
the PreferencesTool singleton instance.

const int PreferencesTool::getPreference const char *  key,
const int  defaultValue
 

Retrieves an int preference.

Parameters:
key the key of the preference to retrieve.
defaultValue a default value for preferences which aren't set by the user yet.
Returns:
the attribute for the given key or "defaultValue" if the key wasn't found.

const char * PreferencesTool::getPreference const char *  key,
const char *  defaultValue
 

Retrieves a string preference.

Parameters:
key the key of the preference to retrieve.
defaultValue a default value for preferences which aren't set by the user yet.
Returns:
the attribute for the given key or "defaultValue" if the key wasn't found.

void PreferencesTool::removePreference const char *  key  ) 
 

Removes the preference with the key "key". (Which, in practice, means setting it to default).

Parameters:
key the key of the preference to remove.

bool PreferencesTool::setPreference const char *  key,
const int  attribute,
bool  flushLater = false
 

Adds an int preference.

Parameters:
key the key for retrieving the preference.
attribute the attribute for the preference.
flushLater true if you don't want the preferencesTool to flush the preferences to disk at once. This is given for to allow optimalization when several preferences ar saved at the same time. flushPreferences() should be called at once after the preferences are set to store them to disk.
Returns:
true if the preference was succesfully saved. If flushLater is set to true this function will return true automaticaly.

bool PreferencesTool::setPreference const char *  key,
const char *  attribute,
bool  flushLater = false
 

Adds a string preference.

Parameters:
key the key for retrieving the preference.
attribute the attribute for the preference.
flushLater true if you don't want the preferencesTool to flush the preferences to disk at once. This is given for to allow optimalization when several preferences ar saved at the same time. flushPreferences() should be called at once after the preferences are set to store them to disk.
Returns:
true if the preference was succesfully saved. If flushLater is set to true this function will return true automaticaly.

bool PreferencesTool::setPreferencesFile const char *  filePath,
const char *  version
 

Sets the file to store preferences in.

Parameters:
filePath the path to the file where the preferences are stored.
version the version of the program
Returns:
true if file exists. false if the file doesn't exists and the preferencesTool makes it.


The documentation for this class was generated from the following files:
Generated on Thu May 19 01:51:22 2005 for stopmotion.kdevelop by  doxygen 1.4.2