From 7db026e8056914d113ac0bbfd9bdc4908a9e7874 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Oct 2010 15:35:23 +0200 Subject: Add support for the whiteSpace facet Use the same mechanism to handle whitespace processing for build-in types and enumerations. --- .../parser/validating/normalized-string-stl.cxx | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'libxsde/xsde/cxx/parser/validating/normalized-string-stl.cxx') diff --git a/libxsde/xsde/cxx/parser/validating/normalized-string-stl.cxx b/libxsde/xsde/cxx/parser/validating/normalized-string-stl.cxx index f93ecf8..dcbe588 100644 --- a/libxsde/xsde/cxx/parser/validating/normalized-string-stl.cxx +++ b/libxsde/xsde/cxx/parser/validating/normalized-string-stl.cxx @@ -23,24 +23,21 @@ namespace xsde void normalized_string_pimpl:: _characters (const ro_string& s) { - str_ += s; + if (_facets ().whitespace_ == 2 && str_.size () == 0) + { + ro_string tmp (s.data (), s.size ()); + + if (trim_left (tmp) != 0) + str_ += tmp; + } + else + str_ += s; } void normalized_string_pimpl:: _post () { - std::string::size_type size = str_.size (); - - for (std::string::size_type i = 0; i < size; ++i) - { - char& c = str_[i]; - - if (c == 0x0A || c == 0x0D || c == 0x09) - c = 0x20; - } - - string_common::validate_facets ( - str_.c_str (), str_.size (), _facets (), _context ()); + string_common::validate_facets (str_, _facets (), _context ()); } std::string normalized_string_pimpl:: -- cgit v1.1