mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 07:06:13 +00:00
Changed: Don't use CSString
--HG-- branch : develop
This commit is contained in:
parent
e94b06066f
commit
532a81f5cb
1 changed files with 31 additions and 17 deletions
|
@ -17,7 +17,6 @@
|
|||
#include "stdmisc.h"
|
||||
|
||||
#include "nel/misc/i_xml.h"
|
||||
#include "nel/misc/sstring.h"
|
||||
|
||||
#ifndef NL_DONT_USE_EXTERNAL_CODE
|
||||
|
||||
|
@ -1067,6 +1066,7 @@ bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const std::
|
|||
// Found
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1074,18 +1074,21 @@ bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const std::
|
|||
|
||||
int CIXml::getIntProperty(xmlNodePtr node, const std::string &property, int defaultValue)
|
||||
{
|
||||
CSString s;
|
||||
bool b;
|
||||
std::string s;
|
||||
|
||||
b=getPropertyString(s,node,property);
|
||||
if (b==false)
|
||||
bool b = getPropertyString(s, node, property);
|
||||
|
||||
if (!b)
|
||||
return defaultValue;
|
||||
|
||||
s=s.strip();
|
||||
sint val=s.atoi();
|
||||
if (val==0 && s!="0")
|
||||
// remove leading and trailing spaces
|
||||
s = trim(s);
|
||||
|
||||
sint val;
|
||||
|
||||
if (!fromString(s, val) || (val == 0 && s != "0"))
|
||||
{
|
||||
nlwarning("bad integer value: %s",s.c_str());
|
||||
nlwarning("Bad integer value: %s",s.c_str());
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
@ -1096,14 +1099,25 @@ int CIXml::getIntProperty(xmlNodePtr node, const std::string &property, int defa
|
|||
|
||||
double CIXml::getFloatProperty(xmlNodePtr node, const std::string &property, float defaultValue)
|
||||
{
|
||||
CSString s;
|
||||
bool b;
|
||||
std::string s;
|
||||
|
||||
b=getPropertyString(s,node,property);
|
||||
if (b==false)
|
||||
bool b = getPropertyString(s, node, property);
|
||||
|
||||
if (!b)
|
||||
return defaultValue;
|
||||
|
||||
return s.strip().atof();
|
||||
// remove leading and trailing spaces
|
||||
s = trim(s);
|
||||
|
||||
float val;
|
||||
|
||||
if (!fromString(s, val))
|
||||
{
|
||||
nlwarning("Bad float value: %s", s.c_str());
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -1111,10 +1125,10 @@ double CIXml::getFloatProperty(xmlNodePtr node, const std::string &property, flo
|
|||
std::string CIXml::getStringProperty(xmlNodePtr node, const std::string &property, const std::string& defaultValue)
|
||||
{
|
||||
std::string s;
|
||||
bool b;
|
||||
|
||||
b=getPropertyString(s,node,property);
|
||||
if (b==false)
|
||||
bool b = getPropertyString(s, node, property);
|
||||
|
||||
if (!b)
|
||||
return defaultValue;
|
||||
|
||||
return s;
|
||||
|
|
Loading…
Reference in a new issue