Created
November 16, 2010 21:08
-
-
Save secretrobotron/702515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CXMLConfigurator::ParseXML(TiXmlElement const* root_element, std::string const* root_prefix) { | |
if (root_element) { | |
const TiXmlElement* child_element = root_element->FirstChildElement(); | |
while(child_element) { | |
std::string prefix; | |
prefix = *root_prefix + "."; | |
const char* tag = child_element->Value(); | |
const char* text = child_element->GetText(); | |
if (tag) { | |
std::string key(prefix + tag); | |
if (text) { | |
std::string value(text); | |
CBaseDator* dator = new CDator<std::string>(value); | |
CBaseDatorPtr sptr(dator); | |
Register(key, sptr); | |
} //if | |
ParseXML(child_element, &key); | |
child_element = child_element->NextSiblingElement(); | |
} //if | |
} //while | |
} //if | |
} | |
std::string* CXMLConfigurator::GetStr(std::string const& key) { | |
CBaseDatorPtr* ptr = CConfigurator::Get(key); | |
if (ptr) { | |
CDator<std::string>* dator = (CDator<std::string>* )(ptr->get()); | |
return new std::string(*dator); | |
} //if | |
return new std::string(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment