Fix istringtream type declaration.

This commit is contained in:
Aymeric PELLÉ 2017-03-09 12:24:37 -05:00
parent 90eeacf606
commit 39d814d417
2 changed files with 9 additions and 8 deletions

View File

@ -5169,9 +5169,9 @@ namespace pugi
#endif
#ifndef PUGIXML_NO_STL
PUGI__FN std::istringstream xml_attribute::as_stringstream() const
PUGI__FN istringstream_t xml_attribute::as_stringstream() const
{
return (_attr && _attr->value) ? std::istringstream(std::string(static_cast<char_t*>(_attr->value))) : std::istringstream();
return (_attr && _attr->value) ? istringstream_t(string_t(static_cast<char_t*>(_attr->value))) : istringstream_t();
}
#endif
@ -6426,11 +6426,11 @@ namespace pugi
#endif
#ifndef PUGIXML_NO_STL
PUGI__FN std::istringstream xml_text::as_stringstream() const
PUGI__FN istringstream_t xml_text::as_stringstream() const
{
xml_node_struct* d = _data();
return (d && d->value) ? std::istringstream(std::string(static_cast<char_t*>(d->value))) : std::istringstream();
return (d && d->value) ? istringstream_t(string_t(static_cast<char_t*>(d->value))) : istringstream_t();
}
#endif

View File

@ -108,6 +108,7 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
typedef std::basic_istringstream<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > istringstream_t;
#endif
}
@ -376,13 +377,13 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// Get attribute value as std::istringstream, an empty std::istringstream if the attribute is empty
std::istringstream as_stringstream() const;
istringstream_t as_stringstream() const;
// Get attribute value as Type (template parameter: try to read a Type value from the attribute value string)
template <typename Type>
Type as() const
{
std::istringstream stream = as_stringstream();
istringstream_t stream = as_stringstream();
Type value;
stream >> value;
return value;
@ -753,13 +754,13 @@ namespace pugi
#ifndef PUGIXML_NO_STL
// Get attribute value as std::istringstream, an empty std::istringstream if the attribute is empty
std::istringstream as_stringstream() const;
istringstream_t as_stringstream() const;
// Get attribute value as Type (template parameter: try to read a Type value from the attribute value string)
template <typename Type>
Type as() const
{
std::istringstream stream = as_stringstream();
istringstream_t stream = as_stringstream();
Type value;
stream >> value;
return value;