Commit 5a20a6f6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

UniXML: add getPropUtf8

parent 597fce8b
......@@ -80,6 +80,7 @@ public:
// name node
static std::string getProp(xmlNode* node, const std::string name);
static std::string getPropUtf8(xmlNode* node, const std::string name);
static int getIntProp(xmlNode* node, const std::string name);
/// if value if not positive ( <= 0 ), returns def
static int getPIntProp(xmlNode* node, const std::string name, int def);
......@@ -127,6 +128,7 @@ class UniXML_iterator
UniXML_iterator() {}
std::string getProp(const std::string name);
std::string getPropUtf8(const std::string name);
int getIntProp(const std::string name);
/// if value if not positive ( <= 0 ), returns def
int getPIntProp(const std::string name, int def);
......
......@@ -44,6 +44,8 @@ using namespace std;
, .
libxmlmm.
UniXML.
XML-
getPropUtf8
*/
const string UniXML::InternalEncoding("koi8-r");
const string UniXML::ExternalEncoding("koi8-r");
......@@ -126,8 +128,6 @@ string UniXML::xml2local(const xmlChar* xmlText)
return "";
}
#warning ...
size_t inl=strlen(text);
size_t outl=inl;
......@@ -163,8 +163,6 @@ static char tmpbuf_l2x[500];
const xmlChar* UniXML::local2xml(string text)
{
#warning ...
iconv_t frt;
frt = iconv_open(xmlEncoding.c_str(), InternalEncoding.c_str() );
if (frt == (iconv_t) -1)
......@@ -208,9 +206,14 @@ string UniXML::getProp(xmlNode* node, const string name)
return xml2local(::xmlGetProp(node, (const xmlChar*)name.c_str()));
}
string UniXML::getPropUtf8(xmlNode* node, const string name)
{
return (const char*)::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()));
return UniSetTypes::uni_atoi(getPropUtf8(node, name));
}
int UniXML::getPIntProp(xmlNode* node, const string name, int def )
......@@ -445,13 +448,20 @@ bool UniXML_iterator::goChildren()
}
return true;
}
// -------------------------------------------------------------------------
string UniXML_iterator::getProp( const string name )
{
return UniXML::xml2local(::xmlGetProp(curNode, (const xmlChar*)name.c_str()));
return UniXML::getProp(curNode, name);
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
string UniXML_iterator::getPropUtf8( const string name )
{
return UniXML::getPropUtf8(curNode, name);
}
// -------------------------------------------------------------------------
int UniXML_iterator::getIntProp( const string name )
{
return UniSetTypes::uni_atoi((char*)::xmlGetProp(curNode, (const xmlChar*)name.c_str()));
......
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