VICI  0.11.815
Visual Chart Interpreter
 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
VICI::cfi::XINI Class Reference

Load an XML configuration file. More...

#include <vici/xini.h>

Inheritance diagram for VICI::cfi::XINI:
VICI::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, VICI::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. More...
 

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,
VICI::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

Member Data Documentation

const string VICI::cfi::XINI::config
staticprotected
Initial value:
=
"PECHD:"
"-i:VICI_CONF:"
"vici.xml:"
".local/share/vici/vici.xml:"
"$VICI/share/vici/vici.xml:"
"/usr/local/share/vici/vici.xml:"
"/usr/share/vici/vici.xml:"

configuration string defined by the using application using the format specified.


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