diff --git a/code/OgreXmlSerializer.cpp b/code/OgreXmlSerializer.cpp index 51a7c293b..51b3a5607 100644 --- a/code/OgreXmlSerializer.cpp +++ b/code/OgreXmlSerializer.cpp @@ -72,11 +72,11 @@ AI_WONT_RETURN void ThrowAttibuteError(const XmlReader* reader, const std::strin } template<> -int32_t OgreXmlSerializer::ReadAttribute(const std::string &name) const +int32_t OgreXmlSerializer::ReadAttribute(const char *name) const { - if (HasAttribute(name.c_str())) + if (HasAttribute(name)) { - return static_cast(m_reader->getAttributeValueAsInt(name.c_str())); + return static_cast(m_reader->getAttributeValueAsInt(name)); } else { @@ -86,9 +86,9 @@ int32_t OgreXmlSerializer::ReadAttribute(const std::string &name) const } template<> -uint32_t OgreXmlSerializer::ReadAttribute(const std::string &name) const +uint32_t OgreXmlSerializer::ReadAttribute(const char *name) const { - if (HasAttribute(name.c_str())) + if (HasAttribute(name)) { /** @note This is hackish. But we are never expecting unsigned values that go outside the int32_t range. Just monitor for negative numbers and kill the import. */ @@ -110,9 +110,9 @@ uint32_t OgreXmlSerializer::ReadAttribute(const std::string &name) con } template<> -uint16_t OgreXmlSerializer::ReadAttribute(const std::string &name) const +uint16_t OgreXmlSerializer::ReadAttribute(const char *name) const { - if (HasAttribute(name.c_str())) + if (HasAttribute(name)) { return static_cast(ReadAttribute(name)); } @@ -124,11 +124,11 @@ uint16_t OgreXmlSerializer::ReadAttribute(const std::string &name) con } template<> -float OgreXmlSerializer::ReadAttribute(const std::string &name) const +float OgreXmlSerializer::ReadAttribute(const char *name) const { - if (HasAttribute(name.c_str())) + if (HasAttribute(name)) { - return m_reader->getAttributeValueAsFloat(name.c_str()); + return m_reader->getAttributeValueAsFloat(name); } else { @@ -138,9 +138,9 @@ float OgreXmlSerializer::ReadAttribute(const std::string &name) const } template<> -std::string OgreXmlSerializer::ReadAttribute(const std::string &name) const +std::string OgreXmlSerializer::ReadAttribute(const char *name) const { - const char* value = m_reader->getAttributeValue(name.c_str()); + const char* value = m_reader->getAttributeValue(name); if (value) { return std::string(value); @@ -153,7 +153,7 @@ std::string OgreXmlSerializer::ReadAttribute(const std::string &nam } template<> -bool OgreXmlSerializer::ReadAttribute(const std::string &name) const +bool OgreXmlSerializer::ReadAttribute(const char *name) const { std::string value = Ogre::ToLower(ReadAttribute(name)); if (ASSIMP_stricmp(value, "true") == 0) diff --git a/code/OgreXmlSerializer.h b/code/OgreXmlSerializer.h index 487bb65fa..c0f09096c 100644 --- a/code/OgreXmlSerializer.h +++ b/code/OgreXmlSerializer.h @@ -98,7 +98,7 @@ private: void ReadAnimationKeyFrames(Animation *anim, VertexAnimationTrack *dest); template - T ReadAttribute(const std::string &name) const; + T ReadAttribute(const char *name) const; bool HasAttribute(const char *name) const; std::string &NextNode();