Commit 22e725e8 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add getIntProp to Configuration, UniXML, UniXML_iterator

parent 7c4f0c19
......@@ -69,6 +69,9 @@ namespace UniSetTypes
/// ԣ path
std::string getField(const std::string path);
/// ԣ path
int getIntField(const std::string path);
xmlNode* findNode(xmlNode* node, const std::string searchnode, const std::string name = "" );
//
......
......@@ -80,6 +80,7 @@ public:
// name node
static std::string getProp(xmlNode* node, const std::string name);
static int getIntProp(xmlNode* node, const std::string name);
// name node
static void setProp(xmlNode* node, const std::string name, const std::string text);
......@@ -124,6 +125,7 @@ class UniXML_iterator
UniXML_iterator() {}
std::string getProp(const std::string name);
int getIntProp(const std::string name);
void setProp(const std::string name, const std::string text);
/*! . false, */
......
......@@ -571,6 +571,12 @@ string Configuration::getField(const string path)
return getProp(getNode(path),"name");
}
// -------------------------------------------------------------------------
int Configuration::getIntField(const std::string path)
{
return unixml.getIntProp(getNode(path), "name");
}
// -------------------------------------------------------------------------
xmlNode* Configuration::findNode(xmlNode* node, const std::string snode, const std::string sname)
{
if( !unixml.isOpen() )
......
......@@ -32,6 +32,7 @@
#include <iostream>
#include <string>
#include "UniSetTypes.h"
#include "UniXML.h"
#include "Exceptions.h"
......@@ -201,6 +202,11 @@ string UniXML::getProp(xmlNode* node, const string name)
return xml2local(::xmlGetProp(node, (const xmlChar*)name.c_str()));
}
int UniXML::getIntProp(xmlNode* node, const string name )
{
return UniSetTypes::uni_atoi((const char*)::xmlGetProp(node, (const xmlChar*)name.c_str()));
}
void UniXML::setProp(xmlNode* node, string name, string text)
{
xmlSetProp(node, (const xmlChar*)name.c_str(), local2xml(text));
......@@ -430,6 +436,12 @@ string UniXML_iterator::getProp( const string name )
{
return UniXML::xml2local(::xmlGetProp(curNode, (const xmlChar*)name.c_str()));
}
// -------------------------------------------------------------------------
int UniXML_iterator::getIntProp( const string name )
{
return UniSetTypes::uni_atoi((char*)::xmlGetProp(curNode, (const xmlChar*)name.c_str()));
}
// -------------------------------------------------------------------------
void UniXML_iterator::setProp( const string name, const string text )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment