10#ifndef xmlBase_IFile_h
11#define xmlBase_IFile_h
20#include <xercesc/util/XercesDefs.hpp>
22XERCES_CPP_NAMESPACE_BEGIN
25XERCES_CPP_NAMESPACE_END
31 XERCES_CPP_NAMESPACE_USE
32 class IFileException {
45 IFile_Item(std::string name, std::string value):itemname(name),
47 std::string&
title() {
return itemname; };
48 std::string&
comment(){
return itemcomment; };
49 std::string&
mystring() {
return itemstring; };
53 std::string itemstring;
54 std::string itemcomment;
60 public std::map<std::string, IFile_Item*, std::less<std::string> > {
67 std::string&
title() {
return sectionname; };
70 bool contains(std::string name){
return find(name)!= end(); }
72 IFile_Item* lookUp(std::string name){
73 iterator it = find(name);
74 return (it==end())? 0 : (*it).second;
76 std::string sectionname;
82 protected std::map<std::string, IFile_Section*, std::less<std::string> >
88 IFile (
const DOMDocument* instrument);
90 IFile (
const DOMElement* instrument);
97 virtual bool contains (
const char *section,
const char *item);
100 virtual int getInt (
const char *section,
const char *item);
101 virtual double getDouble (
const char *section,
const char *item);
102 virtual int getBool (
const char *section,
const char *item);
103 virtual const char *
getString (
const char *section,
const char *item);
109 virtual int getInt (
const char *section,
const char *item,
111 virtual double getDouble (
const char *section,
const char *item,
113 virtual int getBool (
const char *section,
const char *item,
115 virtual const char *
getString (
const char *section,
const char *item,
116 const char *defValue);
125 const char* newString);
129 virtual void printOn (std::ostream& out = std::cout );
140 static void stripBlanks (
char *str1,
const char *str2,
int flags);
141 static int stricmp (
const char *str1,
const char *str2);
150 void addSection(
const DOMElement* elt);
151 void domToIni(
const DOMDocument* doc);
152 void domToIni(
const DOMElement* doc);
153 virtual const char *_getstring (
const char *section,
const char *item,
154 int failIfNotFoundFlag=1);
IFileException(std::string err)
IFile_Item(std::string name, std::string value)
friend class IFile_Section
IFile_Section(std::string name)
virtual int getInt(const char *section, const char *item, int defValue)
virtual int getInt(const char *section, const char *item)
std::vector< double > doubleVector
void setString(const char *section, const char *item, const char *newString)
static void stripBlanks(char *str1, const char *str2, int flags)
virtual doubleVector getDoubleVector(const char *section, const char *item)
virtual const char * getString(const char *section, const char *item, const char *defValue)
std::vector< int > intVector
IFile(const DOMDocument *instrument)
virtual const char * getString(const char *section, const char *item)
virtual intVector getIntVector(const char *section, const char *item)
virtual int getBool(const char *section, const char *item, int defValue)
IFile(const DOMElement *instrument)
static int stricmp(const char *str1, const char *str2)
virtual double getDouble(const char *section, const char *item)
virtual int getBool(const char *section, const char *item)
virtual doubleVector getDoubleVector(const char *section, const char *item, doubleVector defValues)
IFile(const char *filename)
virtual bool contains(const char *section, const char *item)
virtual void printOn(std::ostream &out=std::cout)
virtual double getDouble(const char *section, const char *item, double defValue)
virtual intVector getIntVector(const char *section, const char *item, intVector defValues)