mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
allow setting/getting nodes in g_configs
This commit is contained in:
@@ -112,3 +112,21 @@ void ConfigManager::remove(const std::string& key)
|
||||
if(child)
|
||||
m_confsDoc->removeChild(child);
|
||||
}
|
||||
|
||||
void ConfigManager::setNode(const std::string& key, const OTMLNodePtr& node)
|
||||
{
|
||||
remove(key);
|
||||
addNode(key, node);
|
||||
}
|
||||
|
||||
void ConfigManager::addNode(const std::string& key, const OTMLNodePtr& node)
|
||||
{
|
||||
OTMLNodePtr clone = node->clone();
|
||||
node->setTag(key);
|
||||
m_confsDoc->addChild(node);
|
||||
}
|
||||
|
||||
OTMLNodePtr ConfigManager::getNode(const std::string& key)
|
||||
{
|
||||
return m_confsDoc->get(key);
|
||||
}
|
||||
|
@@ -37,6 +37,11 @@ public:
|
||||
void setList(const std::string& key, const std::vector<std::string>& list);
|
||||
std::string get(const std::string& key);
|
||||
std::vector<std::string> getList(const std::string& key);
|
||||
|
||||
void setNode(const std::string& key, const OTMLNodePtr& node);
|
||||
void addNode(const std::string& key, const OTMLNodePtr& node);
|
||||
OTMLNodePtr getNode(const std::string& key);
|
||||
|
||||
bool exists(const std::string& key);
|
||||
void remove(const std::string& key);
|
||||
|
||||
|
Reference in New Issue
Block a user