|
Boost-Commit : |
From: hartmut.kaiser_at_[hidden]
Date: 2007-11-29 12:54:16
Author: hkaiser
Date: 2007-11-29 12:54:16 EST (Thu, 29 Nov 2007)
New Revision: 41467
URL: http://svn.boost.org/trac/boost/changeset/41467
Log:
Fixed tree_to_xml code for gcc3.4.4 (Cygwin).
Text files modified:
trunk/boost/spirit/tree/impl/tree_to_xml.ipp | 14 +++++++++-----
trunk/libs/spirit/test/tree_to_xml.cpp | 5 ++++-
2 files changed, 13 insertions(+), 6 deletions(-)
Modified: trunk/boost/spirit/tree/impl/tree_to_xml.ipp
==============================================================================
--- trunk/boost/spirit/tree/impl/tree_to_xml.ipp (original)
+++ trunk/boost/spirit/tree/impl/tree_to_xml.ipp 2007-11-29 12:54:16 EST (Thu, 29 Nov 2007)
@@ -19,13 +19,15 @@
#include <map>
#include <iostream>
#include <boost/config.hpp>
+#include <boost/assert.hpp>
+
#ifdef BOOST_NO_STRINGSTREAM
#include <strstream>
#define BOOST_SPIRIT_OSSTREAM std::ostrstream
inline
std::string BOOST_SPIRIT_GETSTRING(std::ostrstream& ss)
{
- ss << ends;
+ ss << std::ends;
std::string rval = ss.str();
ss.freeze(false);
return rval;
@@ -61,15 +63,17 @@
}
static std::basic_string<wchar_t> get(char const* source = "")
{
- typedef std::ctype<wchar_t> ctype_t;
-
using namespace std; // some systems have size_t in ns std
size_t len = strlen(source);
std::auto_ptr<wchar_t> result (new wchar_t[len+1]);
result.get()[len] = '\0';
- std::use_facet<ctype_t>(std::locale())
- .widen(source, source + len, result.get());
+ // working with wide character streams is supported only if the
+ // platform provides the std::ctype<wchar_t> facet
+ BOOST_ASSERT(std::has_facet<std::ctype<wchar_t> >(std::locale()));
+
+ std::use_facet<std::ctype<wchar_t> >(std::locale())
+ .widen(source, source + len, result.get());
return result.get();
}
};
Modified: trunk/libs/spirit/test/tree_to_xml.cpp
==============================================================================
--- trunk/libs/spirit/test/tree_to_xml.cpp (original)
+++ trunk/libs/spirit/test/tree_to_xml.cpp 2007-11-29 12:54:16 EST (Thu, 29 Nov 2007)
@@ -173,7 +173,10 @@
int main()
{
- BOOST_TEST(test(L"1+2"));
BOOST_TEST(test("1+2"));
+ if (std::has_facet<std::ctype<wchar_t> >(std::locale()))
+ {
+ BOOST_TEST(test(L"1+2"));
+ }
return boost::report_errors();
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk