diff options
Diffstat (limited to 'libxsde/xsde/cxx/parser/non-validating')
8 files changed, 187 insertions, 37 deletions
diff --git a/libxsde/xsde/cxx/parser/non-validating/any-simple-type-stl.cxx b/libxsde/xsde/cxx/parser/non-validating/any-simple-type-stl.cxx new file mode 100644 index 0000000..5ebccaf --- /dev/null +++ b/libxsde/xsde/cxx/parser/non-validating/any-simple-type-stl.cxx @@ -0,0 +1,38 @@ +// file : xsde/cxx/parser/non-validating/any-simple-type-stl.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsde/cxx/parser/non-validating/any-simple-type-stl.hxx> + +namespace xsde +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + void any_simple_type_pimpl:: + _pre () + { + str_.erase (); + } + + void any_simple_type_pimpl:: + _characters (const ro_string& s) + { + str_ += s; + } + + std::string any_simple_type_pimpl:: + post_any_simple_type () + { + std::string r; + r.swap (str_); + return r; + } + } + } + } +} diff --git a/libxsde/xsde/cxx/parser/non-validating/any-simple-type-stl.hxx b/libxsde/xsde/cxx/parser/non-validating/any-simple-type-stl.hxx new file mode 100644 index 0000000..94c061f --- /dev/null +++ b/libxsde/xsde/cxx/parser/non-validating/any-simple-type-stl.hxx @@ -0,0 +1,44 @@ +// file : xsde/cxx/parser/non-validating/any-simple-type-stl.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSDE_CXX_PARSER_NON_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX +#define XSDE_CXX_PARSER_NON_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX + +#include <string> + +#include <xsde/cxx/parser/non-validating/xml-schema-pskel.hxx> + +namespace xsde +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { +#ifdef XSDE_REUSE_STYLE_MIXIN + struct any_simple_type_pimpl: virtual any_simple_type_pskel +#else + struct any_simple_type_pimpl: any_simple_type_pskel +#endif + { + virtual void + _pre (); + + virtual void + _characters (const ro_string&); + + virtual std::string + post_any_simple_type (); + + protected: + std::string str_; + }; + } + } + } +} + +#endif // XSDE_CXX_PARSER_NON_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX diff --git a/libxsde/xsde/cxx/parser/non-validating/any-simple-type.cxx b/libxsde/xsde/cxx/parser/non-validating/any-simple-type.cxx new file mode 100644 index 0000000..342f98c --- /dev/null +++ b/libxsde/xsde/cxx/parser/non-validating/any-simple-type.cxx @@ -0,0 +1,48 @@ +// file : xsde/cxx/parser/non-validating/any-simple-type.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include <xsde/cxx/config.hxx> + +#include <xsde/cxx/parser/non-validating/any-simple-type.hxx> + +namespace xsde +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { + void any_simple_type_pimpl:: + _pre () + { +#ifdef XSDE_EXCEPTIONS + str_.assign ("", 0); +#else + if (str_.assign ("", 0)) + _sys_error (sys_error::no_memory); +#endif + } + + void any_simple_type_pimpl:: + _characters (const ro_string& s) + { +#ifdef XSDE_EXCEPTIONS + str_.append (s.data (), s.size ()); +#else + if (str_.append (s.data (), s.size ())) + _sys_error (sys_error::no_memory); +#endif + } + + char* any_simple_type_pimpl:: + post_any_simple_type () + { + return str_.detach (); + } + } + } + } +} diff --git a/libxsde/xsde/cxx/parser/non-validating/any-simple-type.hxx b/libxsde/xsde/cxx/parser/non-validating/any-simple-type.hxx new file mode 100644 index 0000000..612f976 --- /dev/null +++ b/libxsde/xsde/cxx/parser/non-validating/any-simple-type.hxx @@ -0,0 +1,44 @@ +// file : xsde/cxx/parser/non-validating/any-simple-type.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSDE_CXX_PARSER_NON_VALIDATING_ANY_SIMPLE_TYPE_HXX +#define XSDE_CXX_PARSER_NON_VALIDATING_ANY_SIMPLE_TYPE_HXX + +#include <xsde/cxx/string.hxx> + +#include <xsde/cxx/parser/non-validating/xml-schema-pskel.hxx> + +namespace xsde +{ + namespace cxx + { + namespace parser + { + namespace non_validating + { +#ifdef XSDE_REUSE_STYLE_MIXIN + struct any_simple_type_pimpl: virtual any_simple_type_pskel +#else + struct any_simple_type_pimpl: any_simple_type_pskel +#endif + { + virtual void + _pre (); + + virtual void + _characters (const ro_string&); + + virtual char* + post_any_simple_type (); + + protected: + string str_; + }; + } + } + } +} + +#endif // XSDE_CXX_PARSER_NON_VALIDATING_ANY_SIMPLE_TYPE_HXX diff --git a/libxsde/xsde/cxx/parser/non-validating/any-type.hxx b/libxsde/xsde/cxx/parser/non-validating/any-type.hxx index 3b7b68e..0587872 100644 --- a/libxsde/xsde/cxx/parser/non-validating/any-type.hxx +++ b/libxsde/xsde/cxx/parser/non-validating/any-type.hxx @@ -16,8 +16,6 @@ namespace xsde { namespace non_validating { - // any_type - // #ifdef XSDE_REUSE_STYLE_MIXIN struct any_type_pimpl: virtual any_type_pskel #else @@ -25,16 +23,6 @@ namespace xsde #endif { }; - - // any_simple_type - // -#ifdef XSDE_REUSE_STYLE_MIXIN - struct any_simple_type_pimpl: virtual any_simple_type_pskel -#else - struct any_simple_type_pimpl: any_simple_type_pskel -#endif - { - }; } } } diff --git a/libxsde/xsde/cxx/parser/non-validating/xml-schema-pimpl.hxx b/libxsde/xsde/cxx/parser/non-validating/xml-schema-pimpl.hxx index c150fdf..756e11a 100644 --- a/libxsde/xsde/cxx/parser/non-validating/xml-schema-pimpl.hxx +++ b/libxsde/xsde/cxx/parser/non-validating/xml-schema-pimpl.hxx @@ -9,6 +9,13 @@ #include <xsde/cxx/parser/non-validating/xml-schema-pskel.hxx> #include <xsde/cxx/parser/non-validating/any-type.hxx> + +#ifdef XSDE_STL +# include <xsde/cxx/parser/non-validating/any-simple-type-stl.hxx> +#else +# include <xsde/cxx/parser/non-validating/any-simple-type.hxx> +#endif + #include <xsde/cxx/parser/non-validating/boolean.hxx> #include <xsde/cxx/parser/non-validating/byte.hxx> #include <xsde/cxx/parser/non-validating/unsigned-byte.hxx> diff --git a/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.cxx b/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.cxx index 67ac5c8..e673a65 100644 --- a/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.cxx +++ b/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.cxx @@ -67,24 +67,6 @@ namespace xsde #endif } - // any_simple_type - // - - bool any_simple_type_pskel:: - _characters_impl (const ro_string&) - { - return false; - } - - void any_simple_type_pskel:: - post_any_simple_type () - { -#ifdef XSDE_REUSE_STYLE_TIEIN - if (any_simple_type_impl_) - any_simple_type_impl_->post_any_simple_type (); -#endif - } - // static/dynamic_type function implementations. // @@ -609,4 +591,3 @@ namespace xsde } } } - diff --git a/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.hxx b/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.hxx index 6b98277..17e4578 100644 --- a/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.hxx +++ b/libxsde/xsde/cxx/parser/non-validating/xml-schema-pskel.hxx @@ -74,11 +74,12 @@ namespace xsde struct any_simple_type_pskel: simple_content { - virtual bool - _characters_impl (const ro_string&); - - virtual void - post_any_simple_type (); +#ifdef XSDE_STL + virtual std::string +#else + virtual char* +#endif + post_any_simple_type () = 0; #ifdef XSDE_POLYMORPHIC static const char* @@ -97,7 +98,6 @@ namespace xsde #endif }; - // Boolean. // |