| 1009 | \return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE |
| 1010 | */ |
| 1011 | template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const |
| 1012 | { |
| 1013 | const TiXmlAttribute* node = attributeSet.Find( name ); |
| 1014 | if ( !node ) |
| 1015 | return TIXML_NO_ATTRIBUTE; |
| 1016 | |
| 1017 | std::stringstream sstream( node->ValueStr() ); |
| 1018 | sstream >> *outValue; |
| 1019 | if ( !sstream.fail() ) |
| 1020 | return TIXML_SUCCESS; |
| 1021 | return TIXML_WRONG_TYPE; |
| 1022 | } |
| 1023 | /* |
| 1024 | This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string" |
| 1025 | but template specialization is hard to get working cross-compiler. Leaving the bug for now. |