SASSY  0.0
Software Architecture Support System
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Friends | List of all members
SASSY::cfi::XINI Class Reference

Load an XML configuration file. More...

#include <cfi/xini.h>

Inheritance diagram for SASSY::cfi::XINI:
SASSY::cfi::Xml

Public Member Functions

bool getVal (const std::string &xpath_expression, std::string &val)
 get a value from the config file. More...
 
int getVals (const std::string &xpath_expr, std::vector< std::string > &results)
 get a set of values More...
 
void getPath (const std::string &xpath_expr, SASSY::Path &path)
 get a path from a set of paths More...
 
const PathgetConfigFilename () const
 get the name of the config file being used More...
 

Static Public Member Functions

static void configure (const Path &p)
 Configure XINI to use the specified path. More...
 
static void configure (int c, char **v)
 Configure XINI to use the command line args. More...
 
static XINIinstance ()
 get a reference to the single instance of the class.
 

Protected Member Functions

 XINI ()
 constructor
 

Static Protected Attributes

static int argc = 0
 number of command line args
 
static char ** argv = NULL
 command line args
 
static Path configFile
 path to config file
 
static const std::string config
 configuration string defined by the using application using the format specified.
 

Friends

class ::XiniTestCase
 

Detailed Description

Load an XML configuration file.

Ini file, XML format, loaded by looking in the following locations:

Containing application must provide a string containing the keys for the above search locations:

const string ini::config = "PECHD:-i:QM_CONF:qmd.xml:.qmd.xml:/etc/qmd/qmd.xml";

The above will first look for a command line parameter following -i, then it will look in the environment for a variable QM_CONF, then in the current directory for a file called qmd.xml, then for a file $HOME/.qmd.xml, and finally for /etc/qmd/qmd.xml

Any further paths added at the end are checked in sequence.

Member Function Documentation

void XINI::configure ( const Path p)
static

Configure XINI to use the specified path.

Parameters
pThe path to the XML config file to use
void XINI::configure ( int  c,
char **  v 
)
static

Configure XINI to use the command line args.

Parameters
cThe number of command line args
vthe command line args
const Path & XINI::getConfigFilename ( ) const

get the name of the config file being used

Returns
path of the configuration file that was found.
void XINI::getPath ( const std::string &  xpath_expr,
SASSY::Path path 
)

get a path from a set of paths

Parameters
xpath_exprAn expression returning a set of paths to search
pathThe first path that points to an existing file
bool XINI::getVal ( const std::string &  xpath_expression,
std::string &  val 
)

get a value from the config file.

Parameters
xpath_expressionan expression to find in the config file.
valvalue is returned into this
Returns
true if the value exists, and is unique
int XINI::getVals ( const std::string &  xpath_expr,
std::vector< std::string > &  results 
)

get a set of values

Parameters
xpath_expran expression to find in the config file.
resultsset of values returned in this
Returns
the size of the set

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