bool CSettings::SaveServerProfiles(SimpleXmlNode root) { for ( ServerProfilesMap::iterator it = ServerProfiles.begin(); it != ServerProfiles.end(); ++it) { SimpleXmlNode serverProfileNode = root.CreateChild("ServerProfile"); std::string profileName = WCstringToUtf8(it->first); //ServerProfile sp = ; SettingsManager mgr; it->second.bind(mgr.root()); mgr["@ServerProfileId"].bind(profileName); mgr.saveToXmlNode(serverProfileNode); } return true; }
bool CSettings::LoadServerProfiles(SimpleXmlNode root) { std::vector<SimpleXmlNode> servers; root.GetChilds("ServerProfile", servers); for (size_t i = 0; i < servers.size(); i++) { SimpleXmlNode serverProfileNode = servers[i]; std::string profileName = serverProfileNode.Attribute("ServerProfileId"); ServerProfile sp; SettingsManager mgr; sp.bind(mgr.root()); mgr.loadFromXmlNode(serverProfileNode); ServerProfiles[Utf8ToWCstring(profileName)] = sp; } return true; }