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. --- libxsde/xsde/cxx/parser/non-validating/string-stl.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libxsde/xsde/cxx/parser/non-validating/string-stl.cxx') diff --git a/libxsde/xsde/cxx/parser/non-validating/string-stl.cxx b/libxsde/xsde/cxx/parser/non-validating/string-stl.cxx index cd82550..4e979d8 100644 --- a/libxsde/xsde/cxx/parser/non-validating/string-stl.cxx +++ b/libxsde/xsde/cxx/parser/non-validating/string-stl.cxx @@ -4,6 +4,7 @@ // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #include +#include namespace xsde { @@ -22,12 +23,22 @@ namespace xsde void 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; } std::string string_pimpl:: post_string () { + string_common::process_facets (str_, _facets ()); + std::string r; r.swap (str_); return r; -- cgit v1.1