Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

XANAConfigParser Class Reference

#include <XANAConfigParser.h>

List of all members.

Public Methods

 XANAConfigParser ()
bool init (const char *fileName=0)
virtual ~XANAConfigParser ()
void appendLine (XANAConfigFileLine *line)
bool deleteLine (const char *name, const char *scope=0)
bool overrideOption (const char *name, std::list< std::string > &values, const char *scope=0)
bool isDefined (const char *name) const
int readIntOption (const char *name) const throw (const char *)
double readDoubleOption (const char *name) const throw (const char *)
const char * readStringOption (const char *name) const throw (const char *)
std::vector< int > readIntListOption (const char *name) const throw (const char *)
std::vector< double > readDoubleListOption (const char *name) const throw (const char *)
const std::list< std::string > readStringListOption (const char *name) const throw (const char *)
int getOptionListSize (const char *name) const
 Return the dimension of a list of options. More...

bool readIntOption (const char *name, int &value, int entry=0) const
 entries in the option list, otherwise false. More...

bool readDoubleOption (const char *name, double &value, int entry=0) const
 entries in the option list, otherwise false. More...

bool readStringOption (const char *name, const char *value, int entry=0) const
 entries in the option list, otherwise false You must provide enough space in value;. More...

void print () const

Public Attributes

FILE * config_file

Private Types

typedef std::list< XANAConfigFileLine
* >::const_iterator 
LineIterator
 For convinience a ValueIterator type is defined which walks along the list of option strings. More...


Private Attributes

std::list< XANAConfigFileLine * > configLines
 A list of configuration file lines. More...


Member Typedef Documentation

typedef std::list<XANAConfigFileLine *>::const_iterator XANAConfigParser::LineIterator [private]
 

For convinience a ValueIterator type is defined which walks along the list of option strings.

Definition at line 135 of file XANAConfigParser.h.

Referenced by getOptionListSize.


Constructor & Destructor Documentation

XANAConfigParser::XANAConfigParser  
 

virtual XANAConfigParser::~XANAConfigParser   [virtual]
 


Member Function Documentation

void XANAConfigParser::appendLine XANAConfigFileLine   line
 

bool XANAConfigParser::deleteLine const char *    name,
const char *    scope = 0
 

int XANAConfigParser::getOptionListSize const char *    name const [inline]
 

Return the dimension of a list of options.

Definition at line 75 of file XANAConfigParser.h.

References configLines, and LineIterator.

Referenced by readDoubleOption, readIntOption, and readStringOption.

00075                                                {
00076     std::string s(name);
00077     LineIterator I=configLines.begin();
00078     while (I != configLines.end()) {
00079       if((*I)->isOption(s)){
00080         return (*I)->getValues().size();
00081       }
00082       I++;
00083     }
00084     return 0;
00085   }

bool XANAConfigParser::init const char *    fileName = 0
 

bool XANAConfigParser::isDefined const char *    name const
 

bool XANAConfigParser::overrideOption const char *    name,
std::list< std::string > &    values,
const char *    scope = 0
 

void XANAConfigParser::print   const
 

std::vector<double> XANAConfigParser::readDoubleListOption const char *    name const throw (const char *)
 

Referenced by readDoubleOption.

bool XANAConfigParser::readDoubleOption const char *    name,
double &    value,
int    entry = 0
const [inline]
 

entries in the option list, otherwise false.

Definition at line 104 of file XANAConfigParser.h.

References getOptionListSize, and readDoubleListOption.

00104                                                                            {
00105     value=0;
00106     if(entry>=getOptionListSize(name)) return false;
00107     value=readDoubleListOption(name)[entry];
00108     return true;
00109   }

double XANAConfigParser::readDoubleOption const char *    name const throw (const char *)
 

std::vector<int> XANAConfigParser::readIntListOption const char *    name const throw (const char *)
 

Referenced by readIntOption.

bool XANAConfigParser::readIntOption const char *    name,
int &    value,
int    entry = 0
const [inline]
 

entries in the option list, otherwise false.

Definition at line 92 of file XANAConfigParser.h.

References getOptionListSize, and readIntListOption.

00092                                                                      {
00093     value=0;
00094     if(entry>=getOptionListSize(name)) return false;
00095     value=readIntListOption(name)[entry];
00096     return true;
00097   }

int XANAConfigParser::readIntOption const char *    name const throw (const char *)
 

const std::list<std::string> XANAConfigParser::readStringListOption const char *    name const throw (const char *)
 

Referenced by readStringOption.

bool XANAConfigParser::readStringOption const char *    name,
const char *    value,
int    entry = 0
const [inline]
 

entries in the option list, otherwise false You must provide enough space in value;.

Definition at line 117 of file XANAConfigParser.h.

References getOptionListSize, and readStringListOption.

00117                                                                               {
00118     if(entry>=getOptionListSize(name)) return false;
00119     const std::list<std::string> l=readStringListOption(name);
00120     std::list<std::string>::const_iterator I=l.begin();
00121     for(int i=0; i<entry; i++) I++;
00122     strcpy(value, (const char *)((*I).c_str()));
00123     return true;
00124   }

const char* XANAConfigParser::readStringOption const char *    name const throw (const char *)
 


Member Data Documentation

FILE* XANAConfigParser::config_file
 

Definition at line 26 of file XANAConfigParser.h.

std::list<XANAConfigFileLine *> XANAConfigParser::configLines [private]
 

A list of configuration file lines.

Definition at line 131 of file XANAConfigParser.h.

Referenced by getOptionListSize.


The documentation for this class was generated from the following file:
Generated on Tue May 10 10:01:37 2005 for XANADOO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002