improved XML generation for user config (noew contains all comments)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3629 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-06-21 17:13:54 +00:00
parent b15cd04c5f
commit 2e22e1c58a

View File

@ -67,10 +67,20 @@ GroupUserConfigParam::GroupUserConfigParam(const char* groupName, const char* co
}
void GroupUserConfigParam::write(std::ofstream& stream) const
{
if(comment.size() > 0) stream << " <!-- " << comment.c_str() << " -->\n";
stream << " <" << paramName << "\n";
const int children_amount = m_children.size();
// comments
if(comment.size() > 0) stream << " <!-- " << comment.c_str();
for(int n=0; n<children_amount; n++)
{
if(m_children[n]->comment.size() > 0)
stream << "\n " << m_children[n]->paramName << " : " << m_children[n]->comment.c_str();
}
stream << " -->\n <" << paramName << "\n";
// actual values
for(int n=0; n<children_amount; n++)
{
stream << " " << m_children[n]->paramName << "=\"" << m_children[n]->toString() << "\"\n";
@ -306,6 +316,11 @@ std::string FloatUserConfigParam::toString() const
// =====================================================================================
// =====================================================================================
#if 0
#pragma mark -
#pragma mark UserConfig
#endif
UserConfig *user_config;
UserConfig::UserConfig()
@ -527,7 +542,7 @@ void UserConfig::saveConfig(const std::string& filepath)
return;
}
configfile << "<stkconfig version=\"" << CURRENT_CONFIG_VERSION << "\" >\n";
configfile << "<stkconfig version=\"" << CURRENT_CONFIG_VERSION << "\" >\n\n";
const int paramAmount = all_params.size();
for(int i=0; i<paramAmount; i++)