rtVTK  0.6.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Static Public Attributes | Private Member Functions
rtVTK::Configuration Class Reference

The class object that stores configuration data. More...

List of all members.

Public Member Functions

 Configuration ()
QDir & operator[] (const string &option)
void setDefaultScene (const QString &newDfltScene)
const QString & getDefaultScene () const
bool read ()
bool write ()

Static Public Attributes

static const string filename

Private Member Functions

string getQualifiedFilename ()

Private Attributes

Stored configuration data
map< string, QDir > config
QString dfltScene

Detailed Description

The class object that stores configuration data.

The data stored by this struct includes the working directory, the scenes directory, the plugins directory, the icon directory, the documentation directory, and the default scene residing in the scenes directory. The default scene file setting can be changed to be a different file, but the default scene chosen still must reside in the scenes directory. This class also determines where the configuration file is stored on various operating systems.


Constructor & Destructor Documentation

If no configuration file exists, initializes <key, value> pairs to default values; otherwise, load from the configuration file.

References config, read(), and write().


Member Function Documentation

const QString& rtVTK::Configuration::getDefaultScene ( ) const [inline]

This function is responsible for fetching the location of the .rtVTK configuration file. In Windows, the file is stored in the local (i.e. non-roaming) appdata of the current user account (CSIDL_LOCAL_APPDATA a.k.a. LOCALAPPDATA%). In the event that path length is not under 1024 chars long, bad things might happen.

CSIDL values are legacy for supporting Pre-Windows Vista OS. Microsoft has replaced CSIDL with FOLDERID_LocalAppData, but that only is supported by Widows Vista and later.

In *NIX land, .rtVTK is just placed in the home directory. The . will make the file "hidden".

Author:
GribbleCP
Returns:
Returns the full path with filename.

References filename.

Referenced by read(), and write().

QDir& rtVTK::Configuration::operator[] ( const string &  option) [inline]

References config.

Loads default scene from configuration file. If no configuration file is found, initializes to default value and then creates a configuration file containing the default data.

Returns:
Answers the question "Was reading the file successful?"

References dfltScene, and getQualifiedFilename().

Referenced by Configuration().

void rtVTK::Configuration::setDefaultScene ( const QString &  newDfltScene) [inline]

Saves the current default scene filename to the configuration file. The path is not written because the default scene is assumed to reside in the scenes directory.

Returns:
Answers the question "Was writing to the file successful?"

References dfltScene, and getQualifiedFilename().

Referenced by Configuration(), and setDefaultScene().


Member Data Documentation

map<string, QDir> rtVTK::Configuration::config [private]

Referenced by Configuration(), and operator[]().

const string rtVTK::Configuration::filename [static]

Referenced by getQualifiedFilename().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends