code::W2Config Class Reference

List of all members.

Detailed Description

Find configuration files from user- and system- defined locations.

When searching for configuration files, W2Config will look in:

  1. The $W2_CONFIG_LOCATION environmental variable, if set
  2. The executable's directory
  3. The $HOME environmental variable, if set
  4. /etc/w2config

Author:
Russell Cole, Charles Kerr, Lakshman
Version:
Id
code_W2Config.h,v 1.33 2009/06/02 20:17:40 lakshman Exp


Public Member Functions

void useEnglishUnits (bool useEnglish)
 When enabled, look for PATH/englishUnits/file before trying PATH/file.
bool isEnglishUnits () const
SmartPtr< XML::DocumentgetXMLDocument (const std::string &directory, const std::string &filename) const
 Return XML document corresponding to the file identified by the class (e.g: icons) and file name (e.g: SCIT) passed in.
SmartPtr< XML::DocumentgetXMLDocument (const std::string &path) const
 Convenience function equivalent to getXMLDocument(dir+"/"+file);.
SmartPtr< XML::DocumentgetAbsoluteXMLDocument (const URL &) const
 Read the URL and return its contents parsed into an XML::Document.
URL getConfigFile (const std::string &pathToFile) const
 Returns the absolute location of this file.
void getConfigFiles (const std::string &pathToFile, std::vector< URL > *inhere) const
 Populates `inhere' with all the places we found pathToFile.
URL getAbsoluteForRelative (const std::string &relativePath) const
 Finds the absolute path of the given relative path.
void getAbsoluteForRelative (const std::string &relativePath, std::vector< URL > *inhere) const
 Finds all absolute paths that match this given relative path.
virtual ~W2Config ()
 Virtual destructor.

Static Public Member Functions

static W2Configinstance ()
static std::string getEnvVar (const std::string &envVarName)
 Find and return an environment variable.


Constructor & Destructor Documentation

virtual code::W2Config::~W2Config (  )  [inline, virtual]

Virtual destructor.


Member Function Documentation

void code::W2Config::getAbsoluteForRelative ( const std::string &  relativePath,
std::vector< URL > *  inhere 
) const

Finds all absolute paths that match this given relative path.

URL code::W2Config::getAbsoluteForRelative ( const std::string &  relativePath  )  const

Finds the absolute path of the given relative path.

SmartPtr< XML::Document > code::W2Config::getAbsoluteXMLDocument ( const URL  )  const

Read the URL and return its contents parsed into an XML::Document.

URL code::W2Config::getConfigFile ( const std::string &  pathToFile  )  const

Returns the absolute location of this file.

The first match in our search paths is returned.

Returns:
empty url if the file doesn't exist in the search paths.

void code::W2Config::getConfigFiles ( const std::string &  pathToFile,
std::vector< URL > *  inhere 
) const

Populates `inhere' with all the places we found pathToFile.

static std::string code::W2Config::getEnvVar ( const std::string &  envVarName  )  [static]

Find and return an environment variable.

This string is empty if there is no such environment variable. Wrapper to the getenv method.

SmartPtr<XML::Document> code::W2Config::getXMLDocument ( const std::string &  path  )  const

Convenience function equivalent to getXMLDocument(dir+"/"+file);.

See also:
getXMLDocument (const std::string&, const std::string&) const;

SmartPtr< XML::Document > code::W2Config::getXMLDocument ( const std::string &  directory,
const std::string &  filename 
) const

Return XML document corresponding to the file identified by the class (e.g: icons) and file name (e.g: SCIT) passed in.

Parameters:
directory relative to standard locations (e.g: W2Config::Icons)
filename 

static W2Config& code::W2Config::instance (  )  [inline, static]

bool code::W2Config::isEnglishUnits (  )  const [inline]

void code::W2Config::useEnglishUnits ( bool  useEnglish  )  [inline]

When enabled, look for PATH/englishUnits/file before trying PATH/file.


Generated on Fri May 4 13:40:13 2012 for WDSS-IIw2 by  doxygen 1.4.7