diff options
Diffstat (limited to 'libxsde/xsde/cxx/serializer')
18 files changed, 431 insertions, 58 deletions
diff --git a/libxsde/xsde/cxx/serializer/non-validating/any-simple-type-stl.cxx b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type-stl.cxx new file mode 100644 index 0000000..f7f16c9 --- /dev/null +++ b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type-stl.cxx @@ -0,0 +1,35 @@ +// file : xsde/cxx/serializer/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/serializer/non-validating/any-simple-type-stl.hxx> + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace non_validating + { + void any_simple_type_simpl:: + pre (const std::string& value) + { + value_ = value; + } + + void any_simple_type_simpl:: + _serialize_content () + { + // Make sure we don't hold any references to the string. + // + std::string tmp; + tmp.swap (value_); + + _characters (tmp.c_str (), tmp.size ()); + } + } + } + } +} diff --git a/libxsde/xsde/cxx/serializer/non-validating/any-simple-type-stl.hxx b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type-stl.hxx new file mode 100644 index 0000000..a97609d --- /dev/null +++ b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type-stl.hxx @@ -0,0 +1,41 @@ +// file : xsde/cxx/serializer/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_SERIALIZER_NON_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX +#define XSDE_CXX_SERIALIZER_NON_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX + +#include <string> + +#include <xsde/cxx/serializer/non-validating/xml-schema-sskel.hxx> + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace non_validating + { +#ifdef XSDE_REUSE_STYLE_MIXIN + struct any_simple_type_simpl: virtual any_simple_type_sskel +#else + struct any_simple_type_simpl: any_simple_type_sskel +#endif + { + virtual void + pre (const std::string&); + + virtual void + _serialize_content (); + + protected: + std::string value_; + }; + } + } + } +} + +#endif // XSDE_CXX_SERIALIZER_NON_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX diff --git a/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.cxx b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.cxx new file mode 100644 index 0000000..e81c9c6 --- /dev/null +++ b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.cxx @@ -0,0 +1,59 @@ +// file : xsde/cxx/serializer/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/serializer/non-validating/any-simple-type.hxx> + +#ifdef XSDE_CUSTOM_ALLOCATOR +# include <xsde/cxx/allocator.hxx> +#endif + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace non_validating + { + any_simple_type_simpl:: + ~any_simple_type_simpl () + { + if (free_ && value_) + { + char* v = const_cast<char*> (value_); +#ifndef XSDE_CUSTOM_ALLOCATOR + delete[] v; +#else + cxx::free (v); +#endif + } + } + + void any_simple_type_simpl:: + pre (const char* value) + { + value_ = value; + } + + void any_simple_type_simpl:: + _serialize_content () + { + _characters (value_); + + if (free_) + { + char* v = const_cast<char*> (value_); +#ifndef XSDE_CUSTOM_ALLOCATOR + delete[] v; +#else + cxx::free (v); +#endif + value_ = 0; + } + } + } + } + } +} diff --git a/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.hxx b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.hxx new file mode 100644 index 0000000..d41660c --- /dev/null +++ b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.hxx @@ -0,0 +1,47 @@ +// file : xsde/cxx/serializer/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_SERIALIZER_NON_VALIDATING_ANY_SIMPLE_TYPE_HXX +#define XSDE_CXX_SERIALIZER_NON_VALIDATING_ANY_SIMPLE_TYPE_HXX + +#include <xsde/cxx/serializer/non-validating/xml-schema-sskel.hxx> + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace non_validating + { +#ifdef XSDE_REUSE_STYLE_MIXIN + struct any_simple_type_simpl: virtual any_simple_type_sskel +#else + struct any_simple_type_simpl: any_simple_type_sskel +#endif + { + virtual + ~any_simple_type_simpl (); + + any_simple_type_simpl (bool free = false); + + virtual void + pre (const char*); + + virtual void + _serialize_content (); + + protected: + bool free_; + const char* value_; + }; + } + } + } +} + +#include <xsde/cxx/serializer/non-validating/any-simple-type.ixx> + +#endif // XSDE_CXX_SERIALIZER_NON_VALIDATING_ANY_SIMPLE_TYPE_HXX diff --git a/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.ixx b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.ixx new file mode 100644 index 0000000..e94c905 --- /dev/null +++ b/libxsde/xsde/cxx/serializer/non-validating/any-simple-type.ixx @@ -0,0 +1,22 @@ +// file : xsde/cxx/serializer/non-validating/any-simple-type.ixx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace non_validating + { + inline any_simple_type_simpl:: + any_simple_type_simpl (bool free) + : free_ (free), value_ (0) + { + } + } + } + } +} diff --git a/libxsde/xsde/cxx/serializer/non-validating/any-type.hxx b/libxsde/xsde/cxx/serializer/non-validating/any-type.hxx index 7eb966d..6795abc 100644 --- a/libxsde/xsde/cxx/serializer/non-validating/any-type.hxx +++ b/libxsde/xsde/cxx/serializer/non-validating/any-type.hxx @@ -25,16 +25,6 @@ namespace xsde #endif { }; - - // any_simple_type - // -#ifdef XSDE_REUSE_STYLE_MIXIN - struct any_simple_type_simpl: virtual any_simple_type_sskel -#else - struct any_simple_type_simpl: any_simple_type_sskel -#endif - { - }; } } } diff --git a/libxsde/xsde/cxx/serializer/non-validating/xml-schema-simpl.hxx b/libxsde/xsde/cxx/serializer/non-validating/xml-schema-simpl.hxx index 98b3d38..c8e8baf 100644 --- a/libxsde/xsde/cxx/serializer/non-validating/xml-schema-simpl.hxx +++ b/libxsde/xsde/cxx/serializer/non-validating/xml-schema-simpl.hxx @@ -9,6 +9,13 @@ #include <xsde/cxx/serializer/non-validating/xml-schema-sskel.hxx> #include <xsde/cxx/serializer/non-validating/any-type.hxx> + +#ifdef XSDE_STL +# include <xsde/cxx/serializer/non-validating/any-simple-type-stl.hxx> +#else +# include <xsde/cxx/serializer/non-validating/any-simple-type.hxx> +#endif + #include <xsde/cxx/serializer/non-validating/boolean.hxx> #include <xsde/cxx/serializer/non-validating/byte.hxx> #include <xsde/cxx/serializer/non-validating/unsigned-byte.hxx> diff --git a/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.cxx b/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.cxx index 0eda610..ab9dd98 100644 --- a/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.cxx +++ b/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.cxx @@ -24,17 +24,6 @@ namespace xsde #endif } - // any_simple_type_sskel - // - void any_simple_type_sskel:: - pre () - { -#ifdef XSDE_REUSE_STYLE_TIEIN - if (any_simple_type_impl_) - any_simple_type_impl_->pre (); -#endif - } - // static/dynamic_type function implementations. // #ifdef XSDE_POLYMORPHIC diff --git a/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.hxx b/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.hxx index 9a72338..508197a 100644 --- a/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.hxx +++ b/libxsde/xsde/cxx/serializer/non-validating/xml-schema-sskel.hxx @@ -61,14 +61,11 @@ namespace xsde struct any_simple_type_sskel: simple_content { virtual void - pre (); - - // Override the following function to implement your - // logic. - // - - // virtual void - // _serialize_content (); +#ifdef XSDE_STL + pre (const std::string&) = 0; +#else + pre (const char*) = 0; +#endif #ifdef XSDE_POLYMORPHIC static const char* diff --git a/libxsde/xsde/cxx/serializer/validating/any-simple-type-stl.cxx b/libxsde/xsde/cxx/serializer/validating/any-simple-type-stl.cxx new file mode 100644 index 0000000..f308e6c --- /dev/null +++ b/libxsde/xsde/cxx/serializer/validating/any-simple-type-stl.cxx @@ -0,0 +1,34 @@ +// file : xsde/cxx/serializer/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/serializer/validating/any-simple-type-stl.hxx> + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace validating + { + void any_simple_type_simpl:: + pre (const std::string& value) + { + value_ = value; + } + + void any_simple_type_simpl:: + _serialize_content () + { + // Make sure we don't hold any references to the string. + // + std::string tmp; + tmp.swap (value_); + _characters (tmp.c_str (), tmp.size ()); + } + } + } + } +} diff --git a/libxsde/xsde/cxx/serializer/validating/any-simple-type-stl.hxx b/libxsde/xsde/cxx/serializer/validating/any-simple-type-stl.hxx new file mode 100644 index 0000000..0990b85 --- /dev/null +++ b/libxsde/xsde/cxx/serializer/validating/any-simple-type-stl.hxx @@ -0,0 +1,41 @@ +// file : xsde/cxx/serializer/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_SERIALIZER_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX +#define XSDE_CXX_SERIALIZER_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX + +#include <string> + +#include <xsde/cxx/serializer/validating/xml-schema-sskel.hxx> + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace validating + { +#ifdef XSDE_REUSE_STYLE_MIXIN + struct any_simple_type_simpl: virtual any_simple_type_sskel +#else + struct any_simple_type_simpl: any_simple_type_sskel +#endif + { + virtual void + pre (const std::string&); + + virtual void + _serialize_content (); + + protected: + std::string value_; + }; + } + } + } +} + +#endif // XSDE_CXX_SERIALIZER_VALIDATING_ANY_SIMPLE_TYPE_STL_HXX diff --git a/libxsde/xsde/cxx/serializer/validating/any-simple-type.cxx b/libxsde/xsde/cxx/serializer/validating/any-simple-type.cxx new file mode 100644 index 0000000..6de1db8 --- /dev/null +++ b/libxsde/xsde/cxx/serializer/validating/any-simple-type.cxx @@ -0,0 +1,59 @@ +// file : xsde/cxx/serializer/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/serializer/validating/any-simple-type.hxx> + +#ifdef XSDE_CUSTOM_ALLOCATOR +# include <xsde/cxx/allocator.hxx> +#endif + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace validating + { + any_simple_type_simpl:: + ~any_simple_type_simpl () + { + if (free_ && value_) + { + char* v = const_cast<char*> (value_); +#ifndef XSDE_CUSTOM_ALLOCATOR + delete[] v; +#else + cxx::free (v); +#endif + } + } + + void any_simple_type_simpl:: + pre (const char* value) + { + value_ = value; + } + + void any_simple_type_simpl:: + _serialize_content () + { + _characters (value_); + + if (free_) + { + char* v = const_cast<char*> (value_); +#ifndef XSDE_CUSTOM_ALLOCATOR + delete[] v; +#else + cxx::free (v); +#endif + value_ = 0; + } + } + } + } + } +} diff --git a/libxsde/xsde/cxx/serializer/validating/any-simple-type.hxx b/libxsde/xsde/cxx/serializer/validating/any-simple-type.hxx new file mode 100644 index 0000000..7499a21 --- /dev/null +++ b/libxsde/xsde/cxx/serializer/validating/any-simple-type.hxx @@ -0,0 +1,47 @@ +// file : xsde/cxx/serializer/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_SERIALIZER_VALIDATING_ANY_SIMPLE_TYPE_HXX +#define XSDE_CXX_SERIALIZER_VALIDATING_ANY_SIMPLE_TYPE_HXX + +#include <xsde/cxx/serializer/validating/xml-schema-sskel.hxx> + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace validating + { +#ifdef XSDE_REUSE_STYLE_MIXIN + struct any_simple_type_simpl: virtual any_simple_type_sskel +#else + struct any_simple_type_simpl: any_simple_type_sskel +#endif + { + virtual + ~any_simple_type_simpl (); + + any_simple_type_simpl (bool free = false); + + virtual void + pre (const char*); + + virtual void + _serialize_content (); + + protected: + bool free_; + const char* value_; + }; + } + } + } +} + +#include <xsde/cxx/serializer/validating/any-simple-type.ixx> + +#endif // XSDE_CXX_SERIALIZER_VALIDATING_ANY_SIMPLE_TYPE_HXX diff --git a/libxsde/xsde/cxx/serializer/validating/any-simple-type.ixx b/libxsde/xsde/cxx/serializer/validating/any-simple-type.ixx new file mode 100644 index 0000000..f5fea6a --- /dev/null +++ b/libxsde/xsde/cxx/serializer/validating/any-simple-type.ixx @@ -0,0 +1,22 @@ +// file : xsde/cxx/serializer/validating/any-simple-type.ixx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +namespace xsde +{ + namespace cxx + { + namespace serializer + { + namespace validating + { + inline any_simple_type_simpl:: + any_simple_type_simpl (bool free) + : free_ (free), value_ (0) + { + } + } + } + } +} diff --git a/libxsde/xsde/cxx/serializer/validating/any-type.hxx b/libxsde/xsde/cxx/serializer/validating/any-type.hxx index dfa0b87..e1df6e1 100644 --- a/libxsde/xsde/cxx/serializer/validating/any-type.hxx +++ b/libxsde/xsde/cxx/serializer/validating/any-type.hxx @@ -25,16 +25,6 @@ namespace xsde #endif { }; - - // any_simple_type - // -#ifdef XSDE_REUSE_STYLE_MIXIN - struct any_simple_type_simpl: virtual any_simple_type_sskel -#else - struct any_simple_type_simpl: any_simple_type_sskel -#endif - { - }; } } } diff --git a/libxsde/xsde/cxx/serializer/validating/xml-schema-simpl.hxx b/libxsde/xsde/cxx/serializer/validating/xml-schema-simpl.hxx index 9a81eed..d2bc3a7 100644 --- a/libxsde/xsde/cxx/serializer/validating/xml-schema-simpl.hxx +++ b/libxsde/xsde/cxx/serializer/validating/xml-schema-simpl.hxx @@ -9,6 +9,13 @@ #include <xsde/cxx/serializer/validating/xml-schema-sskel.hxx> #include <xsde/cxx/serializer/validating/any-type.hxx> + +#ifdef XSDE_STL +# include <xsde/cxx/serializer/validating/any-simple-type-stl.hxx> +#else +# include <xsde/cxx/serializer/validating/any-simple-type.hxx> +#endif + #include <xsde/cxx/serializer/validating/boolean.hxx> #include <xsde/cxx/serializer/validating/byte.hxx> #include <xsde/cxx/serializer/validating/unsigned-byte.hxx> diff --git a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.cxx b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.cxx index 6ca2101..6154746 100644 --- a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.cxx +++ b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.cxx @@ -24,17 +24,6 @@ namespace xsde #endif } - // any_simple_type_sskel - // - void any_simple_type_sskel:: - pre () - { -#ifdef XSDE_REUSE_STYLE_TIEIN - if (any_simple_type_impl_) - any_simple_type_impl_->pre (); -#endif - } - // static/dynamic_type function implementations. // #ifdef XSDE_POLYMORPHIC diff --git a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx index c8e7466..7ccb233 100644 --- a/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx +++ b/libxsde/xsde/cxx/serializer/validating/xml-schema-sskel.hxx @@ -65,14 +65,11 @@ namespace xsde struct any_simple_type_sskel: simple_content { virtual void - pre (); - - // Override the following function to implement your - // logic. - // - - // virtual void - // _serialize_content (); +#ifdef XSDE_STL + pre (const std::string&) = 0; +#else + pre (const char*) = 0; +#endif #ifdef XSDE_POLYMORPHIC static const char* |