123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- inline ConfigurationElement::ConfigurationElement(const char* Name) :
- myName(string(Name)),
- myParent(NULL),
- myLine(0),
- myIndex(0),
- myLength(0),
- myCleanFlag(true),
- myInitOnInterpretFlag(false) {
- }
-
- inline ConfigurationElement::ConfigurationElement(const string Name) :
- myName(Name),
- myParent(NULL),
- myLine(0),
- myIndex(0),
- myLength(0),
- myCleanFlag(true),
- myInitOnInterpretFlag(false) {
- }
-
- inline ConfigurationElement::ConfigurationElement(
- const char* Name,
- ConfigurationElement& Parent) :
-
- myName(string(Name)),
- myParent(&Parent),
- myLine(0),
- myIndex(0),
- myLength(0),
- myCleanFlag(true),
- myInitOnInterpretFlag(false) {
- }
-
- inline ConfigurationElement::ConfigurationElement(
- const string Name,
- ConfigurationElement& Parent) :
-
- myName(Name),
- myParent(&Parent),
- myLine(0),
- myIndex(0),
- myLength(0),
- myCleanFlag(true),
- myInitOnInterpretFlag(false) {
- }
-
- inline string ConfigurationElement::Name() { return myName; }
-
- inline ConfigurationElement& ConfigurationElement::Parent() {
- if(NULL != myParent) {
- return (*myParent);
- }
- return (*this);
- }
-
- inline ConfigurationElement& ConfigurationElement::Parent(
- ConfigurationElement& Parent) {
- myParent = &Parent;
- return (*myParent);
- }
-
- inline int ConfigurationElement::Line() { return myLine; }
-
- inline int ConfigurationElement::Index() { return myIndex; }
-
- inline int ConfigurationElement::Length() { return myLength; }
-
- inline void ConfigurationElement::notifyDirty() { myCleanFlag = false; }
-
- inline ConfigurationElement& ConfigurationElement::Element(const char* Name) {
- return Element(string(Name));
- }
-
- inline ConfigurationElement& ConfigurationElement::Element(const string Name) {
- ConfigurationElement* N = new ConfigurationElement(
- Name,
- (*this));
-
- myElements.push_back(N);
- return (*N);
- }
-
- inline ConfigurationElement& ConfigurationElement::Element(
- const char* Name,
- ConfigurationTranslator& newTranslator) {
- return Element(string(Name), newTranslator);
- }
-
- inline ConfigurationElement& ConfigurationElement::Element(
- const char* Name,
- string& x, string init) {
- return Element(string(Name), x, init);
- }
-
- inline ConfigurationElement& ConfigurationElement::Element(
- const char* Name,
- int& x, int init, int radix) {
- return Element(string(Name), x, init, radix);
- }
-
- inline ConfigurationElement& ConfigurationElement::Element(
- const char* Name,
- double& x, double init) {
- return Element(string(Name), x, init);
- }
-
- inline ConfigurationElement& ConfigurationElement::Element(
- const char* Name,
- bool& x, bool init) {
- return Element(string(Name), x, init);
- }
-
- inline ConfigurationElement& ConfigurationElement::End() {
- return Parent();
- }
-
- inline ConfigurationElement& ConfigurationElement::End(const char* Name) {
- return End(string(Name));
- }
-
- inline ConfigurationElement& ConfigurationElement::End(const string Name) {
- if(0 != Name.compare(myName)) {
- throw EndNameDoesNotMatch();
- }
- return Parent();
- }
-
- inline ConfigurationAttribute& ConfigurationElement::Attribute(
- const char* Name) {
- return Attribute(string(Name));
- }
-
- inline ConfigurationAttribute& ConfigurationElement::Attribute(
- const char* Name,
- ConfigurationTranslator& newTranslator) {
- return Attribute(string(Name), newTranslator);
- }
-
- inline ConfigurationAttribute& ConfigurationElement::Attribute(
- const char* Name,
- string& x, string init) {
- return Attribute(string(Name), x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationElement::Attribute(
- const char* Name,
- int& x, int init, int radix) {
- return Attribute(string(Name), x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationElement::Attribute(
- const char* Name,
- double& x, double init) {
- return Attribute(string(Name), x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationElement::Attribute(
- const char* Name,
- bool& x, bool init) {
- return Attribute(string(Name), x, init);
- }
-
- inline ConfigurationElement& ConfigurationElement::setInitOnInterpret() {
- myInitOnInterpretFlag = true;
- return(*this);
- }
-
- inline ConfigurationElement& ConfigurationElement::atStartCall(
- Configurator& Functor) {
- myStartConfigurators.push_back(&Functor);
- return(*this);
- }
-
- inline ConfigurationElement& ConfigurationElement::atEndCall(
- Configurator& Functor) {
- myEndConfigurators.push_back(&Functor);
- return(*this);
- }
-
- inline ConfigurationElement& ConfigurationElement::Mnemonic(
- const char* name, const char* value) {
- return Mnemonic(string(name), string(value));
- }
-
- inline ConfigurationElement& ConfigurationElement::Mnemonic(
- const char* name, const string value) {
- return Mnemonic(string(name), value);
- }
-
- inline ConfigurationElement& ConfigurationElement::Mnemonic(
- const string name, const char* value) {
- return Mnemonic(name, string(value));
- }
-
- inline ConfigurationElement& ConfigurationElement::Mnemonic(
- const string name, const string value) {
- ConfigurationMnemonic* N =
- new ConfigurationMnemonic(name, value);
- myMnemonics.push_back(N);
- return(*this);
- }
-
-
-
- inline ConfigurationAttribute::ConfigurationAttribute(
- const char* Name, ConfigurationElement& Parent) :
- myName(string(Name)),
- myParent(Parent),
- myLine(0),
- myIndex(0),
- myLength(0) {
- }
-
- inline ConfigurationAttribute::ConfigurationAttribute(
- const string Name, ConfigurationElement& Parent) :
- myName(Name),
- myParent(Parent),
- myLine(0),
- myIndex(0),
- myLength(0) {
- }
-
- inline string ConfigurationAttribute::Name() {
- return myName;
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Parent() {
- return myParent;
- }
-
- inline int ConfigurationAttribute::Line() {
- return myLine;
- }
-
- inline int ConfigurationAttribute::Index() {
- return myIndex;
- }
-
- inline int ConfigurationAttribute::Length() {
- return myLength;
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const char* Name) {
- return myParent.Element(Name);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const string Name) {
- return myParent.Element(Name);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const char* Name,
- ConfigurationTranslator& newTranslator) {
- return myParent.Element(Name, newTranslator);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const char* Name,
- string& x, string init) {
- return myParent.Element(Name, x, init);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const char* Name,
- int& x, int init, int radix) {
- return myParent.Element(Name, x, init, radix);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const char* Name,
- double& x, double init) {
- return myParent.Element(Name, x, init);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const char* Name,
- bool& x, bool init) {
- return myParent.Element(Name, x, init);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const string Name,
- ConfigurationTranslator& newTranslator) {
- return myParent.Element(Name, newTranslator);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const string Name,
- string& x, string init) {
- return myParent.Element(Name, x, init);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const string Name,
- int& x, int init, int radix) {
- return myParent.Element(Name, x, init, radix);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const string Name,
- double& x, double init) {
- return myParent.Element(Name, x, init);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::Element(
- const string Name,
- bool& x, bool init) {
- return myParent.Element(Name, x, init);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::End() {
- return myParent.End();
- }
-
- inline ConfigurationElement& ConfigurationAttribute::End(const char* Name) {
- return myParent.End(Name);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::End(const string Name) {
- return myParent.End(Name);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const char* Name) {
- return myParent.Attribute(Name);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const string Name) {
- return myParent.Attribute(Name);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const char* Name,
- ConfigurationTranslator& newTranslator) {
- return myParent.Attribute(Name, newTranslator);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const char* Name,
- string& x, string init) {
- return myParent.Attribute(Name, x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const char* Name,
- int& x, int init, int radix) {
- return myParent.Attribute(Name, x, init, radix);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const char* Name,
- double& x, double init) {
- return myParent.Attribute(Name, x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const char* Name,
- bool& x, bool init) {
- return myParent.Attribute(Name, x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const string Name,
- ConfigurationTranslator& newTranslator) {
- return myParent.Attribute(Name, newTranslator);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const string Name,
- string& x, string init) {
- return myParent.Attribute(Name, x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const string Name,
- int& x, int init, int radix) {
- return myParent.Attribute(Name, x, init, radix);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const string Name,
- double& x, double init) {
- return myParent.Attribute(Name, x, init);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Attribute(
- const string Name,
- bool& x, bool init) {
- return myParent.Attribute(Name, x, init);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::setInitOnInterpret() {
- return myParent.setInitOnInterpret();
- }
-
- inline ConfigurationElement& ConfigurationAttribute::atStartCall(
- Configurator& Functor) {
- return myParent.atStartCall(Functor);
- }
-
- inline ConfigurationElement& ConfigurationAttribute::atEndCall(
- Configurator& Functor) {
- return myParent.atEndCall(Functor);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Mnemonic(
- const char* name, const char* value) {
- return Mnemonic(string(name), string(value));
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Mnemonic(
- const char* name, const string value) {
- return Mnemonic(string(name), value);
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Mnemonic(
- const string name, const char* value) {
- return Mnemonic(name, string(value));
- }
-
- inline ConfigurationAttribute& ConfigurationAttribute::Mnemonic(
- const string name, const string value) {
- ConfigurationMnemonic* N =
- new ConfigurationMnemonic(name, value);
- myMnemonics.push_back(N);
- return(*this);
- }
-
-
-
- inline char ConfigurationData::Data(int Index) {
- if(0 > Index || Index >= myBufferSize) {
- return 0;
- }
- return myDataBuffer[Index];
- }
-
- inline int ConfigurationData::Index() {
- return myIndex;
- }
-
- inline int ConfigurationData::Index(int i) {
- if(0 > i || i >= myBufferSize) {
- return myIndex;
- }
- myIndex = i;
- return myIndex;
- }
-
- inline int ConfigurationData::Line() {
- return myLine;
- }
-
- inline int ConfigurationData::addNewLines(int Count) {
- myLine += Count;
- return myLine;
- }
-
-
-
- inline StringTranslator::StringTranslator(
- string& Variable,
- string Initializer) :
- myVariable(Variable),
- myInitializer(Initializer) {
- }
-
- inline void StringTranslator::translate(const char* Value) {
- myVariable = string(Value);
- }
-
- inline void StringTranslator::initialize() {
- myVariable = myInitializer;
- }
-
- inline IntegerTranslator::IntegerTranslator(
- int& Variable,
- int Initializer,
- int Radix) :
- myVariable(Variable),
- myInitializer(Initializer),
- myRadix(Radix) {
- }
-
- inline void IntegerTranslator::translate(const char* Value) {
- char* dummy;
- myVariable = strtol(Value, &dummy, myRadix);
- }
-
- inline void IntegerTranslator::initialize() {
- myVariable = myInitializer;
- }
-
- inline DoubleTranslator::DoubleTranslator(
- double& Variable,
- double Initializer) :
- myVariable(Variable),
- myInitializer(Initializer) {
- }
-
- inline void DoubleTranslator::translate(const char* Value) {
- char* dummy;
- myVariable = strtod(Value, &dummy);
- }
-
- inline void DoubleTranslator::initialize() {
- myVariable = myInitializer;
- }
-
- inline BoolTranslator::BoolTranslator(
- bool& Variable,
- bool Initializer) :
- myVariable(Variable),
- myInitializer(Initializer) {
- }
-
- inline void BoolTranslator::translate(const char* Value) {
- if(
- (0 == strcmp(Value,"on")) ||
- (0 == strcmp(Value,"true")) ||
- (0 == strcmp(Value, "yes")) ||
- (0 == strcmp(Value, "1"))
- ) {
- myVariable = true;
- } else {
- myVariable = false;
- }
- }
-
- inline void BoolTranslator::initialize() {
- myVariable = myInitializer;
- }
-
-
-
- inline ConfigurationMnemonic::ConfigurationMnemonic(
- string Name, string Value) :
- myName(Name),
- myValue(Value) {
- }
-
- inline bool ConfigurationMnemonic::test(string Name) {
- return (0 == Name.compare(myName));
- }
-
- inline string ConfigurationMnemonic::Value() {
- return myValue;
- }
|