Add double for xml node

This commit is contained in:
Benau 2018-05-17 10:28:46 +08:00
parent d2bf17e71a
commit fa61059ad2
2 changed files with 18 additions and 0 deletions

View File

@ -388,6 +388,23 @@ int XMLNode::get(const std::string &attribute, float *value) const
return 1; return 1;
} // get(int) } // get(int)
// ----------------------------------------------------------------------------
int XMLNode::get(const std::string &attribute, double *value) const
{
std::string s;
if (!get(attribute, &s)) return 0;
if (!StringUtils::parseString<double>(s, value))
{
Log::warn("[XMLNode]", "WARNING: Expected double but found '%s' for"
" attribute '%s' of node '%s' in file %s", s.c_str(),
attribute.c_str(), m_name.c_str(), m_file_name.c_str());
return 0;
}
return 1;
} // get(int)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
int XMLNode::get(const std::string &attribute, bool *value) const int XMLNode::get(const std::string &attribute, bool *value) const
{ {

View File

@ -81,6 +81,7 @@ public:
int get(const std::string &attribute, uint32_t *value) const; int get(const std::string &attribute, uint32_t *value) const;
int get(const std::string &attribute, int64_t *value) const; int get(const std::string &attribute, int64_t *value) const;
int get(const std::string &attribute, float *value) const; int get(const std::string &attribute, float *value) const;
int get(const std::string &attribute, double *value) const;
int get(const std::string &attribute, bool *value) const; int get(const std::string &attribute, bool *value) const;
int get(const std::string &attribute, Vec3 *value) const; int get(const std::string &attribute, Vec3 *value) const;
int get(const std::string &attribute, core::vector2df *value) const; int get(const std::string &attribute, core::vector2df *value) const;