summaryrefslogtreecommitdiff
path: root/xsd/libxsd
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/libxsd')
-rw-r--r--xsd/libxsd/INSTALL2
-rw-r--r--xsd/libxsd/makefile11
-rw-r--r--xsd/libxsd/xsd/cxx/auto-array.hxx25
-rw-r--r--xsd/libxsd/xsd/cxx/compilers/vc-7/post.hxx6
-rw-r--r--xsd/libxsd/xsd/cxx/compilers/vc-7/pre.hxx36
-rw-r--r--xsd/libxsd/xsd/cxx/compilers/vc-8/post.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/compilers/vc-8/pre.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/config.hxx38
-rw-r--r--xsd/libxsd/xsd/cxx/exceptions.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/document.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/document.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/elements.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/elements.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/error-handler.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/error-handler.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/exceptions.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/exceptions.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/exceptions.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/expat/elements.hxx30
-rw-r--r--xsd/libxsd/xsd/cxx/parser/expat/elements.txx11
-rw-r--r--xsd/libxsd/xsd/cxx/parser/map.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/map.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/map.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx9
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx11
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx11
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/schema-exceptions.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/schema-exceptions.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/schema-exceptions.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/substitution-map.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/substitution-map.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/exceptions.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/exceptions.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/exceptions.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/parser.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/parser.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.hxx13
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx19
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.hxx11
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/xerces/elements.hxx26
-rw-r--r--xsd/libxsd/xsd/cxx/parser/xerces/elements.txx73
-rw-r--r--xsd/libxsd/xsd/cxx/parser/xml-schema.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/xml-schema.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/parser/xml-schema.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/post.hxx6
-rw-r--r--xsd/libxsd/xsd/cxx/pre.hxx8
-rw-r--r--xsd/libxsd/xsd/cxx/ro-string.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/ro-string.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-common.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx41
-rw-r--r--xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-insertion.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/bits/literals.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/bits/literals.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/buffer.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/buffer.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/comparison-map.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/comparison-map.txx26
-rw-r--r--xsd/libxsd/xsd/cxx/tree/containers-wildcard.hxx7
-rw-r--r--xsd/libxsd/xsd/cxx/tree/containers.hxx374
-rw-r--r--xsd/libxsd/xsd/cxx/tree/containers.txx62
-rw-r--r--xsd/libxsd/xsd/cxx/tree/date-time-extraction.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/date-time-insertion.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/date-time-ostream.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/date-time.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/date-time.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/date-time.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/element-map.hxx13
-rw-r--r--xsd/libxsd/xsd/cxx/tree/element-map.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/elements.hxx596
-rw-r--r--xsd/libxsd/xsd/cxx/tree/elements.ixx253
-rw-r--r--xsd/libxsd/xsd/cxx/tree/elements.txx11
-rw-r--r--xsd/libxsd/xsd/cxx/tree/error-handler.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/error-handler.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/exceptions.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/exceptions.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/facet.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/istream-fwd.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/istream.hxx200
-rw-r--r--xsd/libxsd/xsd/cxx/tree/iterator-adapter.hxx270
-rw-r--r--xsd/libxsd/xsd/cxx/tree/list.hxx28
-rw-r--r--xsd/libxsd/xsd/cxx/tree/ostream.hxx52
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing.txx125
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx21
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/double.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx9
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/float.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/int.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/long.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/short.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization.txx44
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/boolean.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/byte.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/date-time.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/decimal.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/double.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/element-map.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/float.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/int.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/long.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/short.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/std-ostream-map.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/std-ostream-map.txx9
-rw-r--r--xsd/libxsd/xsd/cxx/tree/std-ostream-operators.hxx9
-rw-r--r--xsd/libxsd/xsd/cxx/tree/stream-extraction-map.hxx15
-rw-r--r--xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx42
-rw-r--r--xsd/libxsd/xsd/cxx/tree/stream-extraction.hxx26
-rw-r--r--xsd/libxsd/xsd/cxx/tree/stream-insertion-map.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx28
-rw-r--r--xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx11
-rw-r--r--xsd/libxsd/xsd/cxx/tree/text.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/text.txx17
-rw-r--r--xsd/libxsd/xsd/cxx/tree/type-factory-map.hxx21
-rw-r--r--xsd/libxsd/xsd/cxx/tree/type-factory-map.txx22
-rw-r--r--xsd/libxsd/xsd/cxx/tree/type-serializer-map.hxx8
-rw-r--r--xsd/libxsd/xsd/cxx/tree/type-serializer-map.txx13
-rw-r--r--xsd/libxsd/xsd/cxx/tree/types.hxx190
-rw-r--r--xsd/libxsd/xsd/cxx/tree/types.txx114
-rw-r--r--xsd/libxsd/xsd/cxx/tree/xdr-stream-common.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/tree/xdr-stream-extraction.hxx18
-rw-r--r--xsd/libxsd/xsd/cxx/tree/xdr-stream-insertion.hxx16
-rw-r--r--xsd/libxsd/xsd/cxx/version.hxx7
-rw-r--r--xsd/libxsd/xsd/cxx/xml/bits/literals.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/bits/literals.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/char-iso8859-1.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/char-iso8859-1.txx18
-rw-r--r--xsd/libxsd/xsd/cxx/xml/char-lcp.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/char-lcp.txx27
-rw-r--r--xsd/libxsd/xsd/cxx/xml/char-utf8.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/char-utf8.txx18
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx83
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx15
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/elements.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/elements.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/parsing-header.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/parsing-source.hxx45
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/parsing-source.txx226
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/serialization-header.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/serialization-header.txx17
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/serialization-source.hxx21
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/serialization-source.txx189
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.hxx5
-rw-r--r--xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.txx7
-rw-r--r--xsd/libxsd/xsd/cxx/xml/elements.hxx8
-rw-r--r--xsd/libxsd/xsd/cxx/xml/elements.txx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/error-handler.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/exceptions.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/qualified-name.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx14
-rw-r--r--xsd/libxsd/xsd/cxx/xml/sax/std-input-source.hxx32
-rw-r--r--xsd/libxsd/xsd/cxx/xml/std-memory-manager.hxx20
-rw-r--r--xsd/libxsd/xsd/cxx/xml/string.hxx39
-rw-r--r--xsd/libxsd/xsd/cxx/xml/string.ixx3
-rw-r--r--xsd/libxsd/xsd/cxx/xml/string.txx19
-rw-r--r--xsd/libxsd/xsd/cxx/zc-istream.hxx3
-rw-r--r--xsd/libxsd/xsd/cxx/zc-istream.txx3
180 files changed, 2538 insertions, 1669 deletions
diff --git a/xsd/libxsd/INSTALL b/xsd/libxsd/INSTALL
index 537f00a..c9b4625 100644
--- a/xsd/libxsd/INSTALL
+++ b/xsd/libxsd/INSTALL
@@ -2,7 +2,7 @@ Prerequisites
run-time:
- - libxerces-c >= 2.5.0 http://xerces.apache.org/xerces-c/
+ - libxerces-c >= 3.0.0 http://xerces.apache.org/xerces-c/
Building libxsd
diff --git a/xsd/libxsd/makefile b/xsd/libxsd/makefile
index b7fbb77..1deb770 100644
--- a/xsd/libxsd/makefile
+++ b/xsd/libxsd/makefile
@@ -1,6 +1,5 @@
# file : libxsd/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
@@ -34,12 +33,12 @@ $(dist): $(dist-common)
$(dist-win): $(dist-common)
$(call install-data,$(src_base)/GPLv2,$(dist_prefix)/libxsd/GPLv2.txt)
- $(call message,,unix2dos $(dist_prefix)/libxsd/GPLv2.txt)
+ $(call message,,todos $(dist_prefix)/libxsd/GPLv2.txt)
$(call install-data,$(src_base)/FLOSSE,$(dist_prefix)/libxsd/FLOSSE.txt)
- $(call message,,unix2dos $(dist_prefix)/libxsd/FLOSSE.txt)
+ $(call message,,todos $(dist_prefix)/libxsd/FLOSSE.txt)
$(call install-data,$(src_base)/LICENSE,$(dist_prefix)/libxsd/LICENSE.txt)
- $(call message,,unix2dos $(dist_prefix)/libxsd/LICENSE.txt)
+ $(call message,,todos $(dist_prefix)/libxsd/LICENSE.txt)
$(call install-data,$(src_base)/README,$(dist_prefix)/libxsd/README.txt)
- $(call message,,unix2dos $(dist_prefix)/libxsd/README.txt)
+ $(call message,,todos $(dist_prefix)/libxsd/README.txt)
$(call include,$(bld_root)/install.make)
diff --git a/xsd/libxsd/xsd/cxx/auto-array.hxx b/xsd/libxsd/xsd/cxx/auto-array.hxx
index 2b4e100..584785e 100644
--- a/xsd/libxsd/xsd/cxx/auto-array.hxx
+++ b/xsd/libxsd/xsd/cxx/auto-array.hxx
@@ -1,11 +1,16 @@
// file : xsd/cxx/auto-array.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_AUTO_ARRAY_HXX
#define XSD_CXX_AUTO_ARRAY_HXX
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# error use std::unique_ptr instead of non-standard auto_array
+#endif
+
#include <cstddef> // std::size_t
namespace xsd
@@ -13,20 +18,20 @@ namespace xsd
namespace cxx
{
template <typename T>
- struct std_deallocator
+ struct std_array_deleter
{
void
- deallocate (T* p)
+ operator() (T* p) const
{
delete[] p;
}
};
// Simple automatic array. The second template parameter is
- // an optional deallocator type. If not specified, delete[]
+ // an optional deleter type. If not specified, delete[]
// is used.
//
- template <typename T, typename D = std_deallocator<T> >
+ template <typename T, typename D = std_array_deleter<T> >
struct auto_array
{
auto_array (T a[])
@@ -34,7 +39,7 @@ namespace xsd
{
}
- auto_array (T a[], D& d)
+ auto_array (T a[], const D& d)
: a_ (a), d_ (&d)
{
}
@@ -42,7 +47,7 @@ namespace xsd
~auto_array ()
{
if (d_ != 0)
- d_->deallocate (a_);
+ (*d_) (a_);
else
delete[] a_;
}
@@ -73,7 +78,7 @@ namespace xsd
if (a_ != a)
{
if (d_ != 0)
- d_->deallocate (a_);
+ (*d_) (a_);
else
delete[] a_;
@@ -100,7 +105,7 @@ namespace xsd
private:
T* a_;
- D* d_;
+ const D* d_;
};
template <typename T, typename D>
diff --git a/xsd/libxsd/xsd/cxx/compilers/vc-7/post.hxx b/xsd/libxsd/xsd/cxx/compilers/vc-7/post.hxx
deleted file mode 100644
index 5357cd4..0000000
--- a/xsd/libxsd/xsd/cxx/compilers/vc-7/post.hxx
+++ /dev/null
@@ -1,6 +0,0 @@
-// file : xsd/cxx/compilers/vc-7/post.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
-
-#pragma warning (pop)
diff --git a/xsd/libxsd/xsd/cxx/compilers/vc-7/pre.hxx b/xsd/libxsd/xsd/cxx/compilers/vc-7/pre.hxx
deleted file mode 100644
index 6b9b5fb..0000000
--- a/xsd/libxsd/xsd/cxx/compilers/vc-7/pre.hxx
+++ /dev/null
@@ -1,36 +0,0 @@
-// file : xsd/cxx/compilers/vc-7/pre.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
-
-
-#if (_MSC_VER < 1310)
-# error Microsoft Visual C++ 7.0 (.NET 2002) is not supported.
-#endif
-
-
-// These warnings had to be disabled "for good".
-//
-#pragma warning (disable:4250) // inherits via dominance
-#pragma warning (disable:4505) // unreferenced local function has been removed
-#pragma warning (disable:4661) // no definition for explicit instantiation
-
-
-// Push warning state.
-//
-#pragma warning (push, 3)
-
-
-// Disabled warnings.
-//
-#pragma warning (disable:4355) // passing 'this' to a member
-#pragma warning (disable:4584) // is already a base-class
-#pragma warning (disable:4800) // forcing value to bool
-#pragma warning (disable:4275) // non dll-interface base
-#pragma warning (disable:4251) // base needs to have dll-interface
-#pragma warning (disable:4224) // nonstandard extension (/Za option)
-
-
-// Elevated warnings.
-//
-#pragma warning (2:4239) // standard doesn't allow this conversion
diff --git a/xsd/libxsd/xsd/cxx/compilers/vc-8/post.hxx b/xsd/libxsd/xsd/cxx/compilers/vc-8/post.hxx
index c7d3b3f..a8d25a6 100644
--- a/xsd/libxsd/xsd/cxx/compilers/vc-8/post.hxx
+++ b/xsd/libxsd/xsd/cxx/compilers/vc-8/post.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/compilers/vc-8/post.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#pragma warning (pop)
diff --git a/xsd/libxsd/xsd/cxx/compilers/vc-8/pre.hxx b/xsd/libxsd/xsd/cxx/compilers/vc-8/pre.hxx
index 02161a4..82ca41d 100644
--- a/xsd/libxsd/xsd/cxx/compilers/vc-8/pre.hxx
+++ b/xsd/libxsd/xsd/cxx/compilers/vc-8/pre.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/compilers/vc-8/pre.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
// These warnings had to be disabled "for good".
diff --git a/xsd/libxsd/xsd/cxx/config.hxx b/xsd/libxsd/xsd/cxx/config.hxx
index badfe03..076b107 100644
--- a/xsd/libxsd/xsd/cxx/config.hxx
+++ b/xsd/libxsd/xsd/cxx/config.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/config.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_CONFIG_HXX
@@ -8,7 +7,40 @@
#include <xsd/cxx/version.hxx>
-// Macro to suppress unused variable warning.
+// Available C++11 features.
+//
+#ifdef XSD_CXX11
+#ifdef _MSC_VER
+# if _MSC_VER >= 1600
+# define XSD_CXX11_NULLPTR
+# if _MSC_VER >= 1800
+# define XSD_CXX11_TEMPLATE_ALIAS
+# endif
+# endif
+#else
+# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
+# ifdef __GNUC__
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4
+# define XSD_CXX11_NULLPTR
+# endif
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || __GNUC__ > 4
+# define XSD_CXX11_TEMPLATE_ALIAS
+# endif
+# else
+# define XSD_CXX11_NULLPTR
+# define XSD_CXX11_TEMPLATE_ALIAS
+# endif
+# endif
+#endif
+#endif // XSD_CXX11
+
+#ifdef XSD_CXX11
+# define XSD_AUTO_PTR std::unique_ptr
+#else
+# define XSD_AUTO_PTR std::auto_ptr
+#endif
+
+// Macro to suppress the unused variable warning.
//
#define XSD_UNUSED(x) (void)x
diff --git a/xsd/libxsd/xsd/cxx/exceptions.hxx b/xsd/libxsd/xsd/cxx/exceptions.hxx
index d5f01c1..45f5dc6 100644
--- a/xsd/libxsd/xsd/cxx/exceptions.hxx
+++ b/xsd/libxsd/xsd/cxx/exceptions.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/exceptions.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_EXCEPTIONS_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/document.hxx b/xsd/libxsd/xsd/cxx/parser/document.hxx
index 992b800..731808b 100644
--- a/xsd/libxsd/xsd/cxx/parser/document.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/document.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/document.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_DOCUMENT_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/document.txx b/xsd/libxsd/xsd/cxx/parser/document.txx
index cad49ce..3c25574 100644
--- a/xsd/libxsd/xsd/cxx/parser/document.txx
+++ b/xsd/libxsd/xsd/cxx/parser/document.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/document.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <cassert>
diff --git a/xsd/libxsd/xsd/cxx/parser/elements.hxx b/xsd/libxsd/xsd/cxx/parser/elements.hxx
index 5f0bead..2f814d1 100644
--- a/xsd/libxsd/xsd/cxx/parser/elements.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/elements.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_ELEMENTS_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/elements.txx b/xsd/libxsd/xsd/cxx/parser/elements.txx
index 5706107..3aaf017 100644
--- a/xsd/libxsd/xsd/cxx/parser/elements.txx
+++ b/xsd/libxsd/xsd/cxx/parser/elements.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/elements.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/error-handler.hxx b/xsd/libxsd/xsd/cxx/parser/error-handler.hxx
index b83c0a8..1352bec 100644
--- a/xsd/libxsd/xsd/cxx/parser/error-handler.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/error-handler.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/error-handler.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_ERROR_HANDLER_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/error-handler.txx b/xsd/libxsd/xsd/cxx/parser/error-handler.txx
index 23751d2..db247a7 100644
--- a/xsd/libxsd/xsd/cxx/parser/error-handler.txx
+++ b/xsd/libxsd/xsd/cxx/parser/error-handler.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/error-handler.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/exceptions.hxx b/xsd/libxsd/xsd/cxx/parser/exceptions.hxx
index c0e90dd..04cf30f 100644
--- a/xsd/libxsd/xsd/cxx/parser/exceptions.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/exceptions.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/exceptions.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_EXCEPTIONS_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/exceptions.ixx b/xsd/libxsd/xsd/cxx/parser/exceptions.ixx
index d4e13f3..f7489f3 100644
--- a/xsd/libxsd/xsd/cxx/parser/exceptions.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/exceptions.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/exceptions.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR)
diff --git a/xsd/libxsd/xsd/cxx/parser/exceptions.txx b/xsd/libxsd/xsd/cxx/parser/exceptions.txx
index 5423cdd..d0e52b6 100644
--- a/xsd/libxsd/xsd/cxx/parser/exceptions.txx
+++ b/xsd/libxsd/xsd/cxx/parser/exceptions.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/exceptions.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx b/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx
index c9f3de0..86e7a73 100644
--- a/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/expat/elements.hxx
@@ -1,16 +1,21 @@
// file : xsd/cxx/parser/expat/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_EXPAT_ELEMENTS_HXX
#define XSD_CXX_PARSER_EXPAT_ELEMENTS_HXX
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
#include <string>
#include <iosfwd>
#include <cstddef> // std::size_t
#include <vector>
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#endif
+
#include <expat.h>
// We only support UTF-8 expat for now.
@@ -35,6 +40,19 @@ namespace xsd
{
namespace expat
{
+#ifdef XSD_CXX11
+ struct parser_deleter
+ {
+ void
+ operator() (XML_Parser p) const
+ {
+ if (p != 0)
+ XML_ParserFree (p);
+ }
+ };
+
+ typedef std::unique_ptr<XML_ParserStruct> parser_auto_ptr;
+#else
// Simple auto pointer for Expat's XML_Parser object.
//
struct parser_auto_ptr
@@ -61,8 +79,8 @@ namespace xsd
return *this;
}
- public:
- operator XML_Parser ()
+ XML_Parser
+ get () const
{
return parser_;
}
@@ -76,12 +94,12 @@ namespace xsd
private:
XML_Parser parser_;
};
-
+#endif // XSD_CXX11
//
//
template <typename C>
- struct document: cxx::parser::document<C> // VC 7.1 likes it qualified
+ struct document: cxx::parser::document<C> // VC likes it qualified
{
public:
document (parser_base<C>&,
diff --git a/xsd/libxsd/xsd/cxx/parser/expat/elements.txx b/xsd/libxsd/xsd/cxx/parser/expat/elements.txx
index 08ecf21..d3fc0d9 100644
--- a/xsd/libxsd/xsd/cxx/parser/expat/elements.txx
+++ b/xsd/libxsd/xsd/cxx/parser/expat/elements.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/expat/elements.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <new> // std::bad_alloc
@@ -334,18 +333,18 @@ namespace xsd
{
// First call.
//
- if (auto_xml_parser_ == 0)
+ if (auto_xml_parser_.get () == 0)
{
auto_xml_parser_ = XML_ParserCreateNS (0, XML_Char (' '));
- if (auto_xml_parser_ == 0)
+ if (auto_xml_parser_.get () == 0)
throw std::bad_alloc ();
if (system_id || public_id)
- parse_begin (auto_xml_parser_,
+ parse_begin (auto_xml_parser_.get (),
system_id ? *system_id : *public_id, eh);
else
- parse_begin (auto_xml_parser_, eh);
+ parse_begin (auto_xml_parser_.get (), eh);
}
bool r (XML_Parse (xml_parser_,
diff --git a/xsd/libxsd/xsd/cxx/parser/map.hxx b/xsd/libxsd/xsd/cxx/parser/map.hxx
index 663b178..d097f16 100644
--- a/xsd/libxsd/xsd/cxx/parser/map.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_MAP_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/map.ixx b/xsd/libxsd/xsd/cxx/parser/map.ixx
index 0b70680..96fc937 100644
--- a/xsd/libxsd/xsd/cxx/parser/map.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/map.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/map.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/map.txx b/xsd/libxsd/xsd/cxx/parser/map.txx
index aa7099d..3f85760 100644
--- a/xsd/libxsd/xsd/cxx/parser/map.txx
+++ b/xsd/libxsd/xsd/cxx/parser/map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx
index 9eda6f4..4ecc4f1 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/non-validating/parser.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_NON_VALIDATING_PARSER_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx
index c95b92e..79b6568 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/parser.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/non-validating/parser.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <cassert>
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx
index 397386d..fc1f838 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/non-validating/xml-schema-pimpl.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PIMPL_HXX
@@ -8,6 +7,8 @@
#include <string>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/parser/non-validating/xml-schema-pskel.hxx>
namespace xsd
@@ -564,7 +565,7 @@ namespace xsd
virtual void
_characters (const ro_string<C>&);
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_base64_binary ();
protected:
@@ -582,7 +583,7 @@ namespace xsd
virtual void
_characters (const ro_string<C>&);
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_hex_binary ();
protected:
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx
index db9a5d1..3555693 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/non-validating/xml-schema-pimpl.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR)
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx
index c430f49..28280f5 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pimpl.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/non-validating/xml-schema-pimpl.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <limits>
@@ -1157,7 +1156,7 @@ namespace xsd
}
template <typename C>
- std::auto_ptr<buffer> base64_binary_pimpl<C>::
+ XSD_AUTO_PTR<buffer> base64_binary_pimpl<C>::
post_base64_binary ()
{
typedef typename std::basic_string<C>::size_type size_type;
@@ -1199,7 +1198,7 @@ namespace xsd
size_type quad_count (size / 4);
size_type capacity (quad_count * 3 + 1);
- std::auto_ptr<buffer> buf (new buffer (capacity, capacity));
+ XSD_AUTO_PTR<buffer> buf (new buffer (capacity, capacity));
char* dst (buf->data ());
size_type si (0), di (0); // Source and destination indexes.
@@ -1309,7 +1308,7 @@ namespace xsd
}
template <typename C>
- std::auto_ptr<buffer> hex_binary_pimpl<C>::
+ XSD_AUTO_PTR<buffer> hex_binary_pimpl<C>::
post_hex_binary ()
{
typedef typename ro_string<C>::size_type size_type;
@@ -1318,7 +1317,7 @@ namespace xsd
size_type size (trim_right (tmp));
buffer::size_t n (size / 2);
- std::auto_ptr<buffer> buf (new buffer (n));
+ XSD_AUTO_PTR<buffer> buf (new buffer (n));
const C* src (tmp.data ());
char* dst (buf->data ());
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx
index 8e4972a..334be01 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.hxx
@@ -1,13 +1,14 @@
// file : xsd/cxx/parser/non-validating/xml-schema-pskel.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_HXX
#define XSD_CXX_PARSER_NON_VALIDATING_XML_SCHEMA_PSKEL_HXX
#include <string>
-#include <memory> // auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
+
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
#include <xsd/cxx/parser/xml-schema.hxx>
#include <xsd/cxx/parser/non-validating/parser.hxx>
@@ -494,7 +495,7 @@ namespace xsd
template <typename C>
struct base64_binary_pskel: simple_content<C>
{
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_base64_binary () = 0;
static const C*
@@ -507,7 +508,7 @@ namespace xsd
template <typename C>
struct hex_binary_pskel: simple_content<C>
{
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_hex_binary () = 0;
static const C*
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx
index 13b1fab..44cc6e4 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/non-validating/xml-schema-pskel.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR)
diff --git a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx
index b6352df..e2fd1b3 100644
--- a/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx
+++ b/xsd/libxsd/xsd/cxx/parser/non-validating/xml-schema-pskel.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/non-validating/xml-schema-pskel.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/schema-exceptions.hxx b/xsd/libxsd/xsd/cxx/parser/schema-exceptions.hxx
index 9af39d7..8fd2def 100644
--- a/xsd/libxsd/xsd/cxx/parser/schema-exceptions.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/schema-exceptions.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/schema-exceptions.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_SCHEMA_EXCEPTIONS_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/schema-exceptions.ixx b/xsd/libxsd/xsd/cxx/parser/schema-exceptions.ixx
index cfd2d18..71be381 100644
--- a/xsd/libxsd/xsd/cxx/parser/schema-exceptions.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/schema-exceptions.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/schema-exceptions.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR)
diff --git a/xsd/libxsd/xsd/cxx/parser/schema-exceptions.txx b/xsd/libxsd/xsd/cxx/parser/schema-exceptions.txx
index 7ac45ae..77c569a 100644
--- a/xsd/libxsd/xsd/cxx/parser/schema-exceptions.txx
+++ b/xsd/libxsd/xsd/cxx/parser/schema-exceptions.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/schema-exceptions.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/substitution-map.hxx b/xsd/libxsd/xsd/cxx/parser/substitution-map.hxx
index 416d1ec..d191e28 100644
--- a/xsd/libxsd/xsd/cxx/parser/substitution-map.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/substitution-map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/substitution-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_SUBSTITUTION_MAP_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/substitution-map.txx b/xsd/libxsd/xsd/cxx/parser/substitution-map.txx
index dad0ec6..45216cd 100644
--- a/xsd/libxsd/xsd/cxx/parser/substitution-map.txx
+++ b/xsd/libxsd/xsd/cxx/parser/substitution-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/substitution-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/exceptions.hxx b/xsd/libxsd/xsd/cxx/parser/validating/exceptions.hxx
index c0efda8..07086e3 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/exceptions.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/exceptions.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/exceptions.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_VALIDATING_EXCEPTIONS_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/exceptions.ixx b/xsd/libxsd/xsd/cxx/parser/validating/exceptions.ixx
index 74bb909..72bfe8d 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/exceptions.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/exceptions.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/exceptions.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR)
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/exceptions.txx b/xsd/libxsd/xsd/cxx/parser/validating/exceptions.txx
index 6205215..c2b8928 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/exceptions.txx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/exceptions.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/exceptions.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.hxx b/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.hxx
index d9307b4..b8ae938 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/inheritance-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_VALIDATING_INHERITANCE_MAP_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.txx b/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.txx
index 1a63e65..ba4803e 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.txx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/inheritance-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/inheritance-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/parser.hxx b/xsd/libxsd/xsd/cxx/parser/validating/parser.hxx
index da297d9..c305fe1 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/parser.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/parser.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/parser.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_VALIDATING_PARSER_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/parser.txx b/xsd/libxsd/xsd/cxx/parser/validating/parser.txx
index d447725..9a5800a 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/parser.txx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/parser.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/parser.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <cassert>
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.hxx b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.hxx
index 619a8c7..ae64d2b 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/xml-schema-pimpl.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_VALIDATING_XML_SCHEMA_PIMPL_HXX
@@ -8,6 +7,8 @@
#include <string>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/parser/validating/xml-schema-pskel.hxx>
namespace xsd
@@ -664,12 +665,12 @@ namespace xsd
virtual void
_post ();
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_base64_binary ();
protected:
std::basic_string<C> str_;
- std::auto_ptr<buffer> buf_;
+ XSD_AUTO_PTR<buffer> buf_;
};
// hexBinary
@@ -686,12 +687,12 @@ namespace xsd
virtual void
_post ();
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_hex_binary ();
protected:
std::basic_string<C> str_;
- std::auto_ptr<buffer> buf_;
+ XSD_AUTO_PTR<buffer> buf_;
};
// gday
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.ixx b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.ixx
index c6f8127..94a9b8e 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/xml-schema-pimpl.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR)
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx
index 55121c2..ad587c5 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx
@@ -1,11 +1,14 @@
// file : xsd/cxx/parser/validating/xml-schema-pimpl.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <limits>
#include <locale>
+#ifdef XSD_CXX11
+# include <utility> // std::move
+#endif
+
#include <xsd/cxx/zc-istream.hxx>
#include <xsd/cxx/parser/validating/exceptions.hxx>
@@ -1634,10 +1637,14 @@ namespace xsd
}
template <typename C>
- std::auto_ptr<buffer> base64_binary_pimpl<C>::
+ XSD_AUTO_PTR<buffer> base64_binary_pimpl<C>::
post_base64_binary ()
{
+#ifdef XSD_CXX11
+ return std::move (buf_);
+#else
return buf_;
+#endif
}
// hex_binary
@@ -1721,10 +1728,14 @@ namespace xsd
}
template <typename C>
- std::auto_ptr<buffer> hex_binary_pimpl<C>::
+ XSD_AUTO_PTR<buffer> hex_binary_pimpl<C>::
post_hex_binary ()
{
+#ifdef XSD_CXX11
+ return std::move (buf_);
+#else
return buf_;
+#endif
}
// time_zone
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.hxx b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.hxx
index 67c8057..ffc7de3 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.hxx
@@ -1,13 +1,14 @@
// file : xsd/cxx/parser/validating/xml-schema-pskel.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_VALIDATING_XML_SCHEMA_PSKEL_HXX
#define XSD_CXX_PARSER_VALIDATING_XML_SCHEMA_PSKEL_HXX
#include <string>
-#include <memory> // auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
+
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
#include <xsd/cxx/parser/xml-schema.hxx>
#include <xsd/cxx/parser/validating/parser.hxx>
@@ -494,7 +495,7 @@ namespace xsd
template <typename C>
struct base64_binary_pskel: simple_content<C>
{
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_base64_binary () = 0;
static const C*
@@ -507,7 +508,7 @@ namespace xsd
template <typename C>
struct hex_binary_pskel: simple_content<C>
{
- virtual std::auto_ptr<buffer>
+ virtual XSD_AUTO_PTR<buffer>
post_hex_binary () = 0;
static const C*
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.ixx b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.ixx
index 6958bea..b6da227 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/xml-schema-pskel.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#if defined(XSD_CXX_PARSER_USE_CHAR) || !defined(XSD_CXX_PARSER_USE_WCHAR)
diff --git a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.txx b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.txx
index 4ae50e3..49d53c5 100644
--- a/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.txx
+++ b/xsd/libxsd/xsd/cxx/parser/validating/xml-schema-pskel.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/validating/xml-schema-pskel.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/parser/xerces/elements.hxx b/xsd/libxsd/xsd/cxx/parser/xerces/elements.hxx
index e0439f3..da493f9 100644
--- a/xsd/libxsd/xsd/cxx/parser/xerces/elements.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/xerces/elements.hxx
@@ -1,12 +1,11 @@
// file : xsd/cxx/parser/xerces/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_XERCES_ELEMENTS_HXX
#define XSD_CXX_PARSER_XERCES_ELEMENTS_HXX
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <string>
#include <iosfwd>
#include <vector>
@@ -16,6 +15,10 @@
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
+#include <xercesc/util/XercesVersion.hpp>
+
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/xml/elements.hxx>
#include <xsd/cxx/xml/error-handler.hxx>
@@ -23,6 +26,10 @@
#include <xsd/cxx/parser/elements.hxx>
#include <xsd/cxx/parser/document.hxx>
+#if _XERCES_VERSION < 30000
+# error Xerces-C++ 2-series is not supported
+#endif
+
namespace xsd
{
namespace cxx
@@ -79,7 +86,7 @@ namespace xsd
//
//
template <typename C>
- struct document: cxx::parser::document<C> // VC 7.1 likes it qualified
+ struct document: cxx::parser::document<C> // VC likes it qualified
{
public:
document (parser_base<C>& root,
@@ -371,7 +378,7 @@ namespace xsd
const properties<C>&);
private:
- std::auto_ptr<xercesc::SAX2XMLReader>
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader>
create_sax_ (flags, const properties<C>&);
private:
@@ -386,8 +393,8 @@ namespace xsd
event_router (cxx::parser::document<C>&, bool polymorphic);
// I know, some of those consts are stupid. But that's what
- // Xerces folks put into their interfaces and VC 7.1 thinks
- // there are different signatures if one strips this fluff off.
+ // Xerces folks put into their interfaces and VC thinks there
+ // are different signatures if one strips this fluff off.
//
virtual void
setDocumentLocator (const xercesc::Locator* const);
@@ -403,13 +410,8 @@ namespace xsd
const XMLCh* const lname,
const XMLCh* const qname);
-#if _XERCES_VERSION >= 30000
virtual void
characters (const XMLCh* const s, const XMLSize_t length);
-#else
- virtual void
- characters (const XMLCh* const s, const unsigned int length);
-#endif
virtual void
startPrefixMapping (const XMLCh* const prefix,
diff --git a/xsd/libxsd/xsd/cxx/parser/xerces/elements.txx b/xsd/libxsd/xsd/cxx/parser/xerces/elements.txx
index 2c1e2a1..f41b074 100644
--- a/xsd/libxsd/xsd/cxx/parser/xerces/elements.txx
+++ b/xsd/libxsd/xsd/cxx/parser/xerces/elements.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/xerces/elements.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <istream>
@@ -12,6 +11,7 @@
#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <xercesc/validators/schema/SchemaSymbols.hpp>
#include <xercesc/util/XMLUni.hpp>
+#include <xercesc/util/XMLString.hpp>
#include <xsd/cxx/xml/string.hxx>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
@@ -94,7 +94,7 @@ namespace xsd
error_handler<C> eh;
xml::sax::bits::error_handler_proxy<C> eh_proxy (eh);
- std::auto_ptr<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
parse (uri, eh_proxy, *sax, f, p);
@@ -123,7 +123,7 @@ namespace xsd
xml::auto_initializer init ((f & flags::dont_initialize) == 0);
xml::sax::bits::error_handler_proxy<C> eh_proxy (eh);
- std::auto_ptr<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
parse (uri, eh_proxy, *sax, f, p);
@@ -152,7 +152,7 @@ namespace xsd
const properties<C>& p)
{
xml::sax::bits::error_handler_proxy<C> eh_proxy (eh);
- std::auto_ptr<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
parse (uri, eh_proxy, *sax, f, p);
@@ -389,7 +389,7 @@ namespace xsd
{
error_handler<C> eh;
xml::sax::bits::error_handler_proxy<C> eh_proxy (eh);
- std::auto_ptr<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
parse (is, eh_proxy, *sax, f, p);
@@ -404,7 +404,7 @@ namespace xsd
const properties<C>& p)
{
xml::sax::bits::error_handler_proxy<C> eh_proxy (eh);
- std::auto_ptr<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
parse (is, eh_proxy, *sax, f, p);
@@ -420,7 +420,7 @@ namespace xsd
const properties<C>& p)
{
xml::sax::bits::error_handler_proxy<C> eh_proxy (eh);
- std::auto_ptr<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader> sax (create_sax_ (f, p));
parse (is, eh_proxy, *sax, f, p);
@@ -527,14 +527,8 @@ namespace xsd
xml::string (e.message ()).c_str (),
id.c_str (),
id.c_str (),
-#if _XERCES_VERSION >= 30000
static_cast<XMLFileLoc> (e.line ()),
- static_cast<XMLFileLoc> (e.column ())
-#else
- static_cast<XMLSSize_t> (e.line ()),
- static_cast<XMLSSize_t> (e.column ())
-#endif
- );
+ static_cast<XMLFileLoc> (e.column ()));
eh.fatalError (se);
}
@@ -565,14 +559,8 @@ namespace xsd
xml::string (e.message ()).c_str (),
id.c_str (),
id.c_str (),
-#if _XERCES_VERSION >= 30000
static_cast<XMLFileLoc> (e.line ()),
- static_cast<XMLFileLoc> (e.column ())
-#else
- static_cast<XMLSSize_t> (e.line ()),
- static_cast<XMLSSize_t> (e.column ())
-#endif
- );
+ static_cast<XMLFileLoc> (e.column ()));
eh.fatalError (se);
}
@@ -580,16 +568,12 @@ namespace xsd
template <typename C>
- std::auto_ptr<xercesc::SAX2XMLReader> document<C>::
+ XSD_AUTO_PTR<xercesc::SAX2XMLReader> document<C>::
create_sax_ (flags f, const properties<C>& p)
{
- // HP aCC cannot handle using namespace xercesc;
- //
- using xercesc::SAX2XMLReader;
- using xercesc::XMLReaderFactory;
- using xercesc::XMLUni;
+ using namespace xercesc;
- std::auto_ptr<SAX2XMLReader> sax (
+ XSD_AUTO_PTR<SAX2XMLReader> sax (
XMLReaderFactory::createXMLReader ());
sax->setFeature (XMLUni::fgSAX2CoreNameSpaces, true);
@@ -670,6 +654,9 @@ namespace xsd
const XMLCh* const /*qname*/,
const xercesc::Attributes& attributes)
{
+ using xercesc::XMLUni;
+ using xercesc::XMLString;
+
typedef std::basic_string<C> string;
{
@@ -792,13 +779,19 @@ namespace xsd
}
}
-#if _XERCES_VERSION >= 30000
for (XMLSize_t i (0), end (attributes.getLength()); i < end; ++i)
-#else
- for (unsigned int i (0), end (attributes.getLength()); i < end; ++i)
-#endif
{
- string ns (xml::transcode<C> (attributes.getURI (i)));
+ const XMLCh* xns (attributes.getURI (i));
+
+ // When SAX2 reports the xmlns attribute, it does not include
+ // the proper attribute namespace. So we have to detect and
+ // rectify this case.
+ //
+ if (XMLString::equals (attributes.getQName (i),
+ XMLUni::fgXMLNSString))
+ xns = XMLUni::fgXMLNSURIName;
+
+ string ns (xml::transcode<C> (xns));
string name (xml::transcode<C> (attributes.getLocalName (i)));
string value (xml::transcode<C> (attributes.getValue (i)));
@@ -868,11 +861,7 @@ namespace xsd
template <typename C>
void event_router<C>::
-#if _XERCES_VERSION >= 30000
characters (const XMLCh* const s, const XMLSize_t n)
-#else
- characters (const XMLCh* const s, const unsigned int n)
-#endif
{
typedef std::basic_string<C> string;
@@ -949,16 +938,8 @@ namespace xsd
if (id != 0)
e.id (xml::transcode<C> (id));
-#if _XERCES_VERSION >= 30000
e.line (static_cast<unsigned long> (loc_->getLineNumber ()));
e.column (static_cast<unsigned long> (loc_->getColumnNumber ()));
-#else
- XMLSSize_t l (loc_->getLineNumber ());
- XMLSSize_t c (loc_->getColumnNumber ());
-
- e.line (l == -1 ? 0 : static_cast<unsigned long> (l));
- e.column (c == -1 ? 0: static_cast<unsigned long> (c));
-#endif
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/parser/xml-schema.hxx b/xsd/libxsd/xsd/cxx/parser/xml-schema.hxx
index 5d1f1c6..cc3dd5f 100644
--- a/xsd/libxsd/xsd/cxx/parser/xml-schema.hxx
+++ b/xsd/libxsd/xsd/cxx/parser/xml-schema.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/xml-schema.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_PARSER_XML_SCHEMA_HXX
diff --git a/xsd/libxsd/xsd/cxx/parser/xml-schema.ixx b/xsd/libxsd/xsd/cxx/parser/xml-schema.ixx
index 891bc6f..06ead34 100644
--- a/xsd/libxsd/xsd/cxx/parser/xml-schema.ixx
+++ b/xsd/libxsd/xsd/cxx/parser/xml-schema.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/xml-schema.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <new> // operator new/delete
diff --git a/xsd/libxsd/xsd/cxx/parser/xml-schema.txx b/xsd/libxsd/xsd/cxx/parser/xml-schema.txx
index 5f41a18..90e558d 100644
--- a/xsd/libxsd/xsd/cxx/parser/xml-schema.txx
+++ b/xsd/libxsd/xsd/cxx/parser/xml-schema.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/parser/xml-schema.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/post.hxx b/xsd/libxsd/xsd/cxx/post.hxx
index b119bb4..7a9c63e 100644
--- a/xsd/libxsd/xsd/cxx/post.hxx
+++ b/xsd/libxsd/xsd/cxx/post.hxx
@@ -1,13 +1,9 @@
// file : xsd/cxx/post.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
#ifdef _MSC_VER
# if (_MSC_VER >= 1400)
# include <xsd/cxx/compilers/vc-8/post.hxx>
-# elif (_MSC_VER >= 1300)
-# include <xsd/cxx/compilers/vc-7/post.hxx>
# endif
#endif
diff --git a/xsd/libxsd/xsd/cxx/pre.hxx b/xsd/libxsd/xsd/cxx/pre.hxx
index 845a854..f0633c9 100644
--- a/xsd/libxsd/xsd/cxx/pre.hxx
+++ b/xsd/libxsd/xsd/cxx/pre.hxx
@@ -1,15 +1,11 @@
// file : xsd/cxx/pre.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
#ifdef _MSC_VER
# if (_MSC_VER >= 1400)
# include <xsd/cxx/compilers/vc-8/pre.hxx>
-# elif (_MSC_VER >= 1300)
-# include <xsd/cxx/compilers/vc-7/pre.hxx>
# else
-# error Microsoft Visual C++ 6 is not supported.
+# error Microsoft Visual C++ 7.1 and earlier are not supported
# endif
#endif
diff --git a/xsd/libxsd/xsd/cxx/ro-string.hxx b/xsd/libxsd/xsd/cxx/ro-string.hxx
index fd80cac..2140e44 100644
--- a/xsd/libxsd/xsd/cxx/ro-string.hxx
+++ b/xsd/libxsd/xsd/cxx/ro-string.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/ro-string.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_RO_STRING_HXX
diff --git a/xsd/libxsd/xsd/cxx/ro-string.txx b/xsd/libxsd/xsd/cxx/ro-string.txx
index 58efef0..56d5bbd 100644
--- a/xsd/libxsd/xsd/cxx/ro-string.txx
+++ b/xsd/libxsd/xsd/cxx/ro-string.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/ro-string.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-common.hxx b/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-common.hxx
index 7c3fc96..7a9fbff 100644
--- a/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-common.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-common.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/ace-cdr-stream-common.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_ACE_CDR_STREAM_COMMON_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx b/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx
index 53e1f6c..b843ffa 100644
--- a/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-extraction.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/ace-cdr-stream-extraction.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_ACE_CDR_STREAM_EXTRACTION_HXX
@@ -12,7 +11,13 @@
#include <ace/ACE.h> // ACE::strdelete
#include <ace/CDR_Stream.h>
-#include <xsd/cxx/auto-array.hxx>
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
#include <xsd/cxx/tree/buffer.hxx>
#include <xsd/cxx/tree/istream.hxx>
@@ -258,11 +263,11 @@ namespace xsd
namespace bits
{
- template<typename C>
- struct ace_str_deallocator
+ template <typename C>
+ struct ace_str_deleter
{
void
- deallocate (C* s)
+ operator() (C* s) const
{
ACE::strdelete (s);
}
@@ -272,18 +277,22 @@ namespace xsd
inline istream<ACE_InputCDR>&
operator>> (istream<ACE_InputCDR>& s, std::basic_string<char>& x)
{
- typedef bits::ace_str_deallocator<char> deallocator;
+ typedef bits::ace_str_deleter<char> deleter;
- deallocator d;
+ deleter d;
char* r;
if (!s.impl ().read_string (r))
throw ace_cdr_stream_extraction ();
- auto_array<char, deallocator> ar (r, d);
+#ifdef XSD_CXX11
+ std::unique_ptr<char[], deleter&> ar (
+#else
+ auto_array<char, deleter> ar (
+#endif
+ r, d);
x = r;
-
return s;
}
@@ -291,18 +300,22 @@ namespace xsd
inline istream<ACE_InputCDR>&
operator>> (istream<ACE_InputCDR>& s, std::basic_string<wchar_t>& x)
{
- typedef bits::ace_str_deallocator<wchar_t> deallocator;
+ typedef bits::ace_str_deleter<wchar_t> deleter;
- deallocator d;
+ deleter d;
wchar_t* r;
if (!s.impl ().read_wstring (r))
throw ace_cdr_stream_extraction ();
- auto_array<wchar_t, deallocator> ar (r, d);
+#ifdef XSD_CXX11
+ std::unique_ptr<wchar_t[], deleter&> ar (
+#else
+ auto_array<wchar_t, deleter> ar (
+#endif
+ r, d);
x = r;
-
return s;
}
#endif
diff --git a/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-insertion.hxx b/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-insertion.hxx
index 0f723d0..3fa92ad 100644
--- a/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-insertion.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/ace-cdr-stream-insertion.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/ace-cdr-stream-insertion.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_ACE_CDR_STREAM_INSERTION_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/bits/literals.hxx b/xsd/libxsd/xsd/cxx/tree/bits/literals.hxx
index 49ac0ca..a690e76 100644
--- a/xsd/libxsd/xsd/cxx/tree/bits/literals.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/bits/literals.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/bits/literals.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_BITS_LITERALS_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/bits/literals.ixx b/xsd/libxsd/xsd/cxx/tree/bits/literals.ixx
index 260a9e7..9a27d99 100644
--- a/xsd/libxsd/xsd/cxx/tree/bits/literals.ixx
+++ b/xsd/libxsd/xsd/cxx/tree/bits/literals.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/bits/literals.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_BITS_LITERALS_IXX
diff --git a/xsd/libxsd/xsd/cxx/tree/buffer.hxx b/xsd/libxsd/xsd/cxx/tree/buffer.hxx
index 24da287..9ce568c 100644
--- a/xsd/libxsd/xsd/cxx/tree/buffer.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/buffer.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/buffer.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
/**
diff --git a/xsd/libxsd/xsd/cxx/tree/buffer.txx b/xsd/libxsd/xsd/cxx/tree/buffer.txx
index f88f140..c358e98 100644
--- a/xsd/libxsd/xsd/cxx/tree/buffer.txx
+++ b/xsd/libxsd/xsd/cxx/tree/buffer.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/buffer.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/comparison-map.hxx b/xsd/libxsd/xsd/cxx/tree/comparison-map.hxx
index b7794f4..a316b21 100644
--- a/xsd/libxsd/xsd/cxx/tree/comparison-map.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/comparison-map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/comparison-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_COMPARISON_MAP_HXX
@@ -27,7 +26,7 @@ namespace xsd
comparison_map ();
void
- register_type (const type_id&, comparator, bool override = true);
+ register_type (const type_id&, comparator, bool replace = true);
void
unregister_type (const type_id&);
diff --git a/xsd/libxsd/xsd/cxx/tree/comparison-map.txx b/xsd/libxsd/xsd/cxx/tree/comparison-map.txx
index e638ed4..af23d64 100644
--- a/xsd/libxsd/xsd/cxx/tree/comparison-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/comparison-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/comparison-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/tree/types.hxx>
@@ -20,18 +19,17 @@ namespace xsd
// anyType and anySimpleType.
//
- //register_type (
- // typeid (type),
- // &comparator_impl<type>,
- // false);
-
- typedef simple_type<type> simple_type;
+ register_type (
+ typeid (type),
+ &comparator_impl<type>,
+ false);
- //register_type (
- // typeid (simple_type),
- // &comparator_impl<simple_type>,
- // false);
+ typedef simple_type<C, type> simple_type;
+ register_type (
+ typeid (simple_type),
+ &comparator_impl<simple_type>,
+ false);
// Strings
//
@@ -212,9 +210,9 @@ namespace xsd
template <typename C>
void comparison_map<C>::
- register_type (const type_id& tid, comparator c, bool override)
+ register_type (const type_id& tid, comparator c, bool replace)
{
- if (override || type_map_.find (&tid) == type_map_.end ())
+ if (replace || type_map_.find (&tid) == type_map_.end ())
type_map_[&tid] = c;
}
diff --git a/xsd/libxsd/xsd/cxx/tree/containers-wildcard.hxx b/xsd/libxsd/xsd/cxx/tree/containers-wildcard.hxx
index 5313507..549df73 100644
--- a/xsd/libxsd/xsd/cxx/tree/containers-wildcard.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/containers-wildcard.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/containers-wildcard.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_CONTAINERS_WILDCARD_HXX
@@ -16,7 +15,7 @@
#include <xsd/cxx/xml/string.hxx>
-#include <xsd/cxx/tree/containers.hxx> // iterator_adapter
+#include <xsd/cxx/tree/iterator-adapter.hxx>
namespace xsd
{
@@ -936,7 +935,7 @@ namespace xsd
return r < 0
? true
- : (r > 0 ? false : XMLString::compareString (an, bn));
+ : (r > 0 ? false : XMLString::compareString (an, bn) < 0);
}
};
diff --git a/xsd/libxsd/xsd/cxx/tree/containers.hxx b/xsd/libxsd/xsd/cxx/tree/containers.hxx
index ba76eae..cafd79d 100644
--- a/xsd/libxsd/xsd/cxx/tree/containers.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/containers.hxx
@@ -1,20 +1,19 @@
// file : xsd/cxx/tree/containers.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_CONTAINERS_HXX
#define XSD_CXX_TREE_CONTAINERS_HXX
-#include <cstddef> // std::ptrdiff_t
-#include <string>
#include <vector>
-#include <memory> // std::auto_ptr
-#include <iterator> // std::iterator_traits
+#include <memory> // std::auto_ptr/unique_ptr
#include <algorithm> // std::equal, std::lexicographical_compare
#include <iosfwd>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/elements.hxx>
+#include <xsd/cxx/tree/iterator-adapter.hxx>
namespace xsd
{
@@ -132,11 +131,11 @@ namespace xsd
public:
~one ();
- one (flags, container*);
+ one (container*);
- one (const T&, flags, container*);
+ one (const T&, container*);
- one (std::auto_ptr<T>, flags, container*);
+ one (XSD_AUTO_PTR<T>, container*);
one (const one&, flags, container*);
@@ -157,10 +156,13 @@ namespace xsd
}
void
- set (const T&);
+ set (const T& x)
+ {
+ set (x, 0);
+ }
void
- set (std::auto_ptr<T>);
+ set (XSD_AUTO_PTR<T>);
bool
present () const
@@ -168,18 +170,21 @@ namespace xsd
return x_ != 0;
}
- std::auto_ptr<T>
+ XSD_AUTO_PTR<T>
detach ()
{
T* x (x_);
x->_container (0);
x_ = 0;
- return std::auto_ptr<T> (x);
+ return XSD_AUTO_PTR<T> (x);
}
protected:
+ void
+ set (const T&, flags);
+
+ protected:
T* x_;
- flags flags_;
container* container_;
};
@@ -188,12 +193,12 @@ namespace xsd
class one<T, true>
{
public:
- one (flags, container*)
+ one (container*)
: present_ (false)
{
}
- one (const T& x, flags, container*)
+ one (const T& x, container*)
: x_ (x), present_ (true)
{
}
@@ -246,9 +251,6 @@ namespace xsd
bool present_;
};
-
- // Note that I cannot get rid of fund because of HP aCC3.
- //
template <typename T, bool fund = fundamental_p<T>::r>
class optional;
@@ -259,13 +261,13 @@ namespace xsd
~optional ();
explicit
- optional (flags = 0, container* = 0);
+ optional (container* = 0);
explicit
- optional (const T&, flags = 0, container* = 0);
+ optional (const T&, container* = 0);
explicit
- optional (std::auto_ptr<T>, flags = 0, container* = 0);
+ optional (XSD_AUTO_PTR<T>, container* = 0);
optional (const optional&, flags = 0, container* = 0);
@@ -332,30 +334,35 @@ namespace xsd
}
void
- set (const T&);
+ set (const T& x)
+ {
+ set (x, 0);
+ }
void
- set (std::auto_ptr<T>);
+ set (XSD_AUTO_PTR<T>);
void
reset ();
- std::auto_ptr<T>
+ XSD_AUTO_PTR<T>
detach ()
{
T* x (x_);
x->_container (0);
x_ = 0;
- return std::auto_ptr<T> (x);
+ return XSD_AUTO_PTR<T> (x);
}
- private:
+ protected:
+ void
+ set (const T&, flags);
+
void
true_ ();
- private:
+ protected:
T* x_;
- flags flags_;
container* container_;
};
@@ -367,13 +374,13 @@ namespace xsd
{
public:
explicit
- optional (flags = 0, container* = 0)
+ optional (container* = 0)
: present_ (false)
{
}
explicit
- optional (const T&, flags = 0, container* = 0);
+ optional (const T&, container* = 0);
optional (const optional&, flags = 0, container* = 0);
@@ -506,7 +513,7 @@ namespace xsd
return !(a < b);
}
- // Provide an ostream insertion opretaor to prevent confusion from
+ // Provide an ostream insertion operator to prevent confusion from
// the implicit bool conversion.
//
template <typename C, typename T, bool fund>
@@ -516,264 +523,9 @@ namespace xsd
// Sequence.
//
-
- // Note that I cannot get rid of 'fund' because HP aCC3 likes it
- // this way.
- //
template <typename T, bool fund = fundamental_p<T>::r>
class sequence;
-
- // Sun CC's <iterator> does not have iterator_traits. To overcome
- // this, we will wrap std::iterator_traits into our own and also
- // specialize it for pointer types. Since Sun CC uses pointer
- // for vector::iterator, it will use the specialization and won't
- // notice the std::iterator_traits.
- //
-#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
- template <typename I>
- struct iterator_traits
- {
- typedef
- typename std::iterator_traits<I>::iterator_category
- iterator_category;
-
- typedef
- typename std::iterator_traits<I>::value_type
- value_type;
-
- typedef
- typename std::iterator_traits<I>::difference_type
- difference_type;
- };
-#else
- // The Pointer specialization does not work for reverse and
- // set iterators. But these iterators are user-dfined types
- // and have suitable typedefs that we can use.
- //
- template <typename I>
- struct iterator_traits
- {
- typedef typename I::iterator_category iterator_category;
- typedef typename I::value_type value_type;
- typedef typename I::difference_type difference_type;
- };
-
- template <typename T>
- struct iterator_traits<T*>
- {
- typedef std::random_access_iterator_tag iterator_category;
- typedef T value_type;
- typedef std::ptrdiff_t difference_type;
- };
-#endif
-
- // Iterator adapter for complex types. It expects I to point to
- // a smart pointer-like object that has operator*() that returns
- // a refernce to a type static_cast'able to T and get() that
- // returns a pointer to a type static_cast'able to T.
- //
-
- template <typename I, typename T>
- struct iterator_adapter
- {
- typedef T value_type;
- typedef value_type& reference;
- typedef value_type* pointer;
-
- typedef
- typename iterator_traits<I>::iterator_category
- iterator_category;
-
- typedef
- typename iterator_traits<I>::difference_type
- difference_type;
-
-
- public:
- iterator_adapter ()
- : i_ () // i_ can be of a pointer type.
- {
- }
-
- // Allow iterator to const_iterator conversion.
- //
- template <typename J, typename T2>
- iterator_adapter (const iterator_adapter<J, T2>& j)
- : i_ (j.base ())
- {
- }
-
- explicit
- iterator_adapter (const I& i)
- : i_ (i)
- {
- }
-
- public:
- // Forward iterator requirements.
- //
- reference
- operator* () const
- {
- return static_cast<reference> (**i_);
- }
-
- pointer
- operator-> () const
- {
- return static_cast<pointer> (i_->get ());
- }
-
- iterator_adapter&
- operator++ ()
- {
- ++i_;
- return *this;
- }
-
- iterator_adapter
- operator++ (int)
- {
- iterator_adapter r (*this);
- ++i_;
- return r;
- }
-
- // Bidirectional iterator requirements.
- //
- iterator_adapter&
- operator-- ()
- {
- --i_;
- return *this;
- }
-
- iterator_adapter
- operator-- (int)
- {
- iterator_adapter r (*this);
- --i_;
- return r;
- }
-
- // Random access iterator requirements.
- //
- reference
- operator[] (difference_type n) const
- {
- return static_cast<reference> (*(i_[n]));
- }
-
- iterator_adapter&
- operator+= (difference_type n)
- {
- i_ += n;
- return *this;
- }
-
- iterator_adapter
- operator+ (difference_type n) const
- {
- return iterator_adapter (i_ + n);
- }
-
- iterator_adapter&
- operator-= (difference_type n)
- {
- i_ -= n;
- return *this;
- }
-
- iterator_adapter
- operator- (difference_type n) const
- {
- return iterator_adapter (i_ - n);
- }
-
- public:
- const I&
- base () const
- {
- return i_;
- }
-
- private:
- I i_;
- };
-
- // Note: We use different types for left- and right-hand-side
- // arguments to allow comparison between iterator and const_iterator.
- //
-
- // Forward iterator requirements.
- //
- template <typename I, typename J, typename T1, typename T2>
- inline bool
- operator== (const iterator_adapter<I, T1>& i,
- const iterator_adapter<J, T2>& j)
- {
- return i.base () == j.base ();
- }
-
- template <typename I, typename J, typename T1, typename T2>
- inline bool
- operator!= (const iterator_adapter<I, T1>& i,
- const iterator_adapter<J, T2>& j)
- {
- return i.base () != j.base ();
- }
-
- // Random access iterator requirements
- //
- template <typename I, typename J, typename T1, typename T2>
- inline bool
- operator< (const iterator_adapter<I, T1>& i,
- const iterator_adapter<J, T2>& j)
- {
- return i.base () < j.base ();
- }
-
- template <typename I, typename J, typename T1, typename T2>
- inline bool
- operator> (const iterator_adapter<I, T1>& i,
- const iterator_adapter<J, T2>& j)
- {
- return i.base () > j.base ();
- }
-
- template <typename I, typename J, typename T1, typename T2>
- inline bool
- operator<= (const iterator_adapter<I, T1>& i,
- const iterator_adapter<J, T2>& j)
- {
- return i.base () <= j.base ();
- }
-
- template <typename I, typename J, typename T1, typename T2>
- inline bool
- operator>= (const iterator_adapter<I, T1>& i,
- const iterator_adapter<J, T2>& j)
- {
- return i.base () >= j.base ();
- }
-
- template <typename I, typename J, typename T1, typename T2>
- inline typename iterator_adapter<I, T1>::difference_type
- operator- (const iterator_adapter<I, T1>& i,
- const iterator_adapter<J, T2>& j)
- {
- return i.base () - j.base ();
- }
-
- template <typename I, typename T>
- inline iterator_adapter<I, T>
- operator+ (typename iterator_adapter<I, T>::difference_type n,
- const iterator_adapter<I, T>& i)
- {
- return iterator_adapter<I, T> (i.base () + n);
- }
-
//
//
class sequence_common
@@ -859,33 +611,33 @@ namespace xsd
typedef base_sequence::allocator_type allocator_type;
protected:
- sequence_common (flags f, container* c)
- : flags_ (f), container_ (c)
+ sequence_common (container* c)
+ : container_ (c)
{
}
sequence_common (size_type n, const type& x, container* c)
- : flags_ (0), container_ (c)
+ : container_ (c)
{
assign (n, x);
}
template <typename I>
sequence_common (const I& begin, const I& end, container* c)
- : flags_ (0), container_ (c)
+ : container_ (c)
{
assign (begin, end);
}
sequence_common (const sequence_common& v, flags f, container* c)
- : flags_ (f), container_ (c)
+ : container_ (c)
{
v_.reserve (v.v_.size ());
for (base_const_iterator i (v.v_.begin ()), e (v.v_.end ());
i != e; ++i)
{
- ptr p ((**i)._clone (flags_, container_));
+ ptr p ((**i)._clone (f, container_));
v_.push_back (p);
}
}
@@ -906,7 +658,7 @@ namespace xsd
{
// We have no ptr_ref.
//
- ptr p ((**si)._clone (flags_, container_));
+ ptr p ((**si)._clone (0, container_));
*di = p;
}
@@ -958,7 +710,7 @@ namespace xsd
for (base_iterator i (v_.begin ()), e (v_.end ()); i != e; ++i)
{
- ptr p (x._clone (flags_, container_));
+ ptr p (x._clone (0, container_));
*i = p;
}
}
@@ -974,7 +726,7 @@ namespace xsd
for (I i (begin); i != end; ++i)
{
- ptr p (i->_clone (flags_, container_));
+ ptr p (i->_clone (0, container_));
v_.push_back (p);
}
}
@@ -990,7 +742,7 @@ namespace xsd
for (base_iterator i (v_.begin () + old), e (v_.end ());
i != e; ++i)
{
- ptr p (x._clone (flags_, container_));
+ ptr p (x._clone (0, container_));
*i = p;
}
}
@@ -1004,7 +756,7 @@ namespace xsd
for (base_iterator i (v_.end () - d); n != 0; --n)
{
- ptr r (x._clone (flags_, container_));
+ ptr r (x._clone (0, container_));
*(--i) = r;
}
}
@@ -1021,7 +773,7 @@ namespace xsd
for (I i (end);;)
{
--i;
- ptr r (i->_clone (flags_, container_));
+ ptr r (i->_clone (0, container_));
p = v_.insert (p, r);
if (i == begin)
@@ -1031,7 +783,6 @@ namespace xsd
}
protected:
- flags flags_;
container* container_;
base_sequence v_;
};
@@ -1075,8 +826,8 @@ namespace xsd
public:
explicit
- sequence (flags f = 0, container* c = 0)
- : sequence_common (f, c)
+ sequence (container* c = 0)
+ : sequence_common (c)
{
}
@@ -1260,11 +1011,11 @@ namespace xsd
void
push_back (const T& x)
{
- v_.push_back (ptr (x._clone (flags_, container_)));
+ v_.push_back (ptr (x._clone (0, container_)));
}
void
- push_back (std::auto_ptr<T> x)
+ push_back (XSD_AUTO_PTR<T> x)
{
if (x->_container () != container_)
x->_container (container_);
@@ -1278,7 +1029,7 @@ namespace xsd
v_.pop_back ();
}
- std::auto_ptr<T>
+ XSD_AUTO_PTR<T>
detach_back (bool pop = true)
{
ptr& p (v_.back ());
@@ -1288,7 +1039,7 @@ namespace xsd
if (pop)
v_.pop_back ();
- return std::auto_ptr<T> (x);
+ return XSD_AUTO_PTR<T> (x);
}
iterator
@@ -1296,11 +1047,11 @@ namespace xsd
{
return iterator (
v_.insert (
- position.base (), ptr (x._clone (flags_, container_))));
+ position.base (), ptr (x._clone (0, container_))));
}
iterator
- insert (iterator position, std::auto_ptr<T> x)
+ insert (iterator position, XSD_AUTO_PTR<T> x)
{
if (x->_container () != container_)
x->_container (container_);
@@ -1334,12 +1085,11 @@ namespace xsd
}
iterator
- detach (iterator position, std::auto_ptr<T>& r, bool erase = true)
+ detach (iterator position, XSD_AUTO_PTR<T>& r, bool erase = true)
{
ptr& p (*position.base ());
p->_container (0);
- std::auto_ptr<T> tmp (static_cast<T*> (p.release ()));
- r = tmp;
+ r.reset (static_cast<T*> (p.release ()));
if (erase)
return iterator (v_.erase (position.base ()));
@@ -1368,7 +1118,7 @@ namespace xsd
public:
explicit
- sequence (flags = 0, container* = 0)
+ sequence (container* = 0)
{
}
diff --git a/xsd/libxsd/xsd/cxx/tree/containers.txx b/xsd/libxsd/xsd/cxx/tree/containers.txx
index fdc0bfd..2a3573f 100644
--- a/xsd/libxsd/xsd/cxx/tree/containers.txx
+++ b/xsd/libxsd/xsd/cxx/tree/containers.txx
@@ -1,9 +1,13 @@
// file : xsd/cxx/tree/containers.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <ostream>
+
+#ifdef XSD_CXX11
+# include <utility> // std::move
+#endif
+
#include <xsd/cxx/tree/bits/literals.hxx>
namespace xsd
@@ -23,34 +27,38 @@ namespace xsd
template<typename T>
one<T, false>::
- one (flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (container* c)
+ : x_ (0), container_ (c)
{
}
template<typename T>
one<T, false>::
- one (const T& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (const T& x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
template<typename T>
one<T, false>::
- one (std::auto_ptr<T> x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (XSD_AUTO_PTR<T> x, container* c)
+ : x_ (0), container_ (c)
{
+#ifdef XSD_CXX11
+ set (std::move (x));
+#else
set (x);
+#endif
}
template<typename T>
one<T, false>::
one (const one<T, false>& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ : x_ (0), container_ (c)
{
if (x.present ())
- set (x.get ());
+ set (x.get (), f);
}
template<typename T>
@@ -73,12 +81,12 @@ namespace xsd
template<typename T>
void one<T, false>::
- set (const T& x)
+ set (const T& x, flags f)
{
// We always do a fresh copy because T may not be x's
// dynamic type.
//
- T* r (x._clone (flags_, container_));
+ T* r (x._clone (f, container_));
delete x_;
x_ = r;
@@ -86,7 +94,7 @@ namespace xsd
template<typename T>
void one<T, false>::
- set (std::auto_ptr<T> x)
+ set (XSD_AUTO_PTR<T> x)
{
T* r (0);
@@ -113,34 +121,38 @@ namespace xsd
template <typename T>
optional<T, false>::
- optional (flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (container* c)
+ : x_ (0), container_ (c)
{
}
template <typename T>
optional<T, false>::
- optional (const T& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (const T& x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
template <typename T>
optional<T, false>::
- optional (std::auto_ptr<T> x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (XSD_AUTO_PTR<T> x, container* c)
+ : x_ (0), container_ (c)
{
+#ifdef XSD_CXX11
+ set (std::move (x));
+#else
set (x);
+#endif
}
template <typename T>
optional<T, false>::
optional (const optional<T, false>& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ : x_ (0), container_ (c)
{
if (x)
- set (*x);
+ set (*x, f);
}
template <typename T>
@@ -172,12 +184,12 @@ namespace xsd
template <typename T>
void optional<T, false>::
- set (const T& x)
+ set (const T& x, flags f)
{
// We always do a fresh copy because T may not be x's
// dynamic type.
//
- T* r (x._clone (flags_, container_));
+ T* r (x._clone (f, container_));
delete x_;
x_ = r;
@@ -185,7 +197,7 @@ namespace xsd
template <typename T>
void optional<T, false>::
- set (std::auto_ptr<T> x)
+ set (XSD_AUTO_PTR<T> x)
{
T* r (0);
@@ -220,7 +232,7 @@ namespace xsd
//
template <typename T>
optional<T, true>::
- optional (const T& y, flags, container*)
+ optional (const T& y, container*)
: present_ (false)
{
set (y);
diff --git a/xsd/libxsd/xsd/cxx/tree/date-time-extraction.txx b/xsd/libxsd/xsd/cxx/tree/date-time-extraction.txx
index 317b80f..4ada1a0 100644
--- a/xsd/libxsd/xsd/cxx/tree/date-time-extraction.txx
+++ b/xsd/libxsd/xsd/cxx/tree/date-time-extraction.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/date-time-extraction.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/date-time-insertion.txx b/xsd/libxsd/xsd/cxx/tree/date-time-insertion.txx
index db24ae1..b41ffce 100644
--- a/xsd/libxsd/xsd/cxx/tree/date-time-insertion.txx
+++ b/xsd/libxsd/xsd/cxx/tree/date-time-insertion.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/date-time-insertion.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/date-time-ostream.txx b/xsd/libxsd/xsd/cxx/tree/date-time-ostream.txx
index 90073f4..830cd49 100644
--- a/xsd/libxsd/xsd/cxx/tree/date-time-ostream.txx
+++ b/xsd/libxsd/xsd/cxx/tree/date-time-ostream.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/date-time-ostream.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <ostream>
diff --git a/xsd/libxsd/xsd/cxx/tree/date-time.hxx b/xsd/libxsd/xsd/cxx/tree/date-time.hxx
index abde516..9526f92 100644
--- a/xsd/libxsd/xsd/cxx/tree/date-time.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/date-time.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/date-time.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
/**
diff --git a/xsd/libxsd/xsd/cxx/tree/date-time.ixx b/xsd/libxsd/xsd/cxx/tree/date-time.ixx
index 5bc7200..00d7f8c 100644
--- a/xsd/libxsd/xsd/cxx/tree/date-time.ixx
+++ b/xsd/libxsd/xsd/cxx/tree/date-time.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/date-time.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/date-time.txx b/xsd/libxsd/xsd/cxx/tree/date-time.txx
index 34c6c84..f5b9b8e 100644
--- a/xsd/libxsd/xsd/cxx/tree/date-time.txx
+++ b/xsd/libxsd/xsd/cxx/tree/date-time.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/date-time.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/element-map.hxx b/xsd/libxsd/xsd/cxx/tree/element-map.hxx
index 2f12b0b..0f4883d 100644
--- a/xsd/libxsd/xsd/cxx/tree/element-map.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/element-map.hxx
@@ -1,16 +1,17 @@
// file : xsd/cxx/tree/element-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_ELEMENT_MAP_HXX
#define XSD_CXX_TREE_ELEMENT_MAP_HXX
#include <map>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
#include <string>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/xml/qualified-name.hxx>
#include <xsd/cxx/tree/elements.hxx>
@@ -44,7 +45,7 @@ namespace xsd
* @param f Flags to create the new element object with.
* @return An automatic pointer to the new element object.
*/
- static std::auto_ptr<element_type>
+ static XSD_AUTO_PTR<element_type>
parse (const xercesc::DOMElement& e, flags f = 0);
/**
@@ -61,7 +62,7 @@ namespace xsd
typedef xml::qualified_name<C> qualified_name;
- typedef std::auto_ptr<element_type>
+ typedef XSD_AUTO_PTR<element_type>
(*parser) (const xercesc::DOMElement&, flags f);
typedef void
@@ -113,7 +114,7 @@ namespace xsd
//
//
template<typename T, typename C, typename B>
- std::auto_ptr<element_type<C, B> >
+ XSD_AUTO_PTR<element_type<C, B> >
parser_impl (const xercesc::DOMElement&, flags);
template<typename T, typename C, typename B>
diff --git a/xsd/libxsd/xsd/cxx/tree/element-map.txx b/xsd/libxsd/xsd/cxx/tree/element-map.txx
index 0ff5d2a..32fe873 100644
--- a/xsd/libxsd/xsd/cxx/tree/element-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/element-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/element-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/elements.hxx b/xsd/libxsd/xsd/cxx/tree/elements.hxx
index 403fdb3..a3bbea4 100644
--- a/xsd/libxsd/xsd/cxx/tree/elements.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/elements.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
/**
@@ -17,25 +16,40 @@
#ifndef XSD_CXX_TREE_ELEMENTS_HXX
#define XSD_CXX_TREE_ELEMENTS_HXX
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR, XSD_CXX11
+
#include <map>
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cstddef> // std::size_t
#include <istream>
#include <sstream>
#include <cassert>
+#ifdef XSD_CXX11
+# include <utility> // std::move
+#endif
+
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOMAttr.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMNamedNodeMap.hpp>
+#include <xercesc/util/XercesVersion.hpp>
+
#include <xsd/cxx/xml/elements.hxx> // xml::properties
-#include <xsd/cxx/xml/dom/auto-ptr.hxx> // dom::auto_ptr
+#include <xsd/cxx/xml/dom/auto-ptr.hxx> // dom::auto_ptr/unique_ptr
+#include <xsd/cxx/xml/dom/wildcard-source.hxx> // dom::create_document()
#include <xsd/cxx/tree/facet.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/istream-fwd.hxx>
+#include <xsd/cxx/tree/containers-wildcard.hxx>
+
+#if _XERCES_VERSION < 30000
+# error Xerces-C++ 2-series is not supported
+#endif
namespace xsd
{
@@ -77,7 +91,7 @@ namespace xsd
*
* This flag only makes sense together with the @c keep_dom
* flag in the call to the %parsing function with the
- * @c dom::auto_ptr<DOMDocument> argument.
+ * @c dom::auto_ptr/unique_ptr<DOMDocument> argument.
*
*/
static const unsigned long own_dom = 0x00000200UL;
@@ -89,6 +103,12 @@ namespace xsd
static const unsigned long dont_validate = 0x00000400UL;
/**
+ * @brief Extract XML content for anyType or anySimpleType.
+ * Normally you don't need to specify this flag explicitly.
+ */
+ static const unsigned long extract_content = 0x00000800UL;
+
+ /**
* @brief Do not initialize the Xerces-C++ runtime.
*/
static const unsigned long dont_initialize = 0x00000001UL;
@@ -179,7 +199,6 @@ namespace xsd
unsigned long x_;
};
-
// Parsing properties. Refer to xsd/cxx/xml/elements.hxx for XML-
// related properties.
//
@@ -188,6 +207,44 @@ namespace xsd
{
};
+ /**
+ * @brief Content order sequence entry.
+ *
+ * @nosubgrouping
+ */
+ struct content_order
+ {
+ /**
+ * @brief Initialize an instance with passed id and index.
+ *
+ * @param id Content id.
+ * @param index Content index in the corresponding sequence.
+ */
+ content_order (std::size_t id, std::size_t index = 0)
+ : id (id), index (index)
+ {
+ }
+
+ /**
+ * @brief Content id.
+ */
+ std::size_t id;
+
+ /**
+ * @brief Content index.
+ */
+ std::size_t index;
+ };
+
+ bool
+ operator== (const content_order&, const content_order&);
+
+ bool
+ operator!= (const content_order&, const content_order&);
+
+ bool
+ operator< (const content_order&, const content_order&);
+
//@cond
// DOM user data keys.
@@ -202,12 +259,6 @@ namespace xsd
typedef user_data_keys_template<0> user_data_keys;
- // HP aCC3 complains about unresolved symbols without an explicit
- // instantiation.
- //
-#if defined(__HP_aCC) && __HP_aCC <= 39999
- template struct user_data_keys_template<0>;
-#endif
//
//
struct identity
@@ -284,10 +335,20 @@ namespace xsd
/**
* @brief Default constructor.
*/
- _type ()
- : container_ (0)
- {
- }
+ _type ();
+
+ /**
+ * @brief Create an instance from a C string.
+ *
+ * @param s A string to initialize the instance with.
+ *
+ * Note that this constructor ignores the string and creates an
+ * empty anyType instance. In particular, it will not convert the
+ * string into DOM content. The purpose of such a strange constructor
+ * is to allow statically-initialized default values of anyType type.
+ */
+ template <typename C>
+ _type (const C* s);
public:
/**
@@ -339,7 +400,9 @@ namespace xsd
* @param c A pointer to the object that will contain the new
* instance.
*/
- _type (const xercesc::DOMElement& e, flags f = 0, container* c = 0);
+ _type (const xercesc::DOMElement& e,
+ flags f = flags::extract_content,
+ container* c = 0);
/**
* @brief Create an instance from a DOM Attribute.
@@ -377,10 +440,150 @@ namespace xsd
type&
operator= (const type& x)
{
- while (&x == 0) /* unused */;
+ if (this != &x)
+ {
+ if (x.content_.get () == 0)
+ content_.reset ();
+ else
+ content_ = x.content_->clone ();
+
+ // Drop DOM association.
+ //
+ dom_info_.reset ();
+ }
+
return *this;
}
+ // anyType content API.
+ //
+ public:
+ typedef element_optional dom_content_optional;
+
+ /**
+ * @brief Return a read-only (constant) reference to the anyType
+ * DOM content.
+ *
+ * @return A constant reference to the optional container.
+ *
+ * The DOM content is returned as an optional element container,
+ * the same container as used for optional element wildcards.
+ */
+ const dom_content_optional&
+ dom_content () const;
+
+ /**
+ * @brief Return a read-write reference to the anyType DOM content.
+ *
+ * @return A reference to the optional container.
+ *
+ * The DOM content is returned as an optional element container,
+ * the same container as used for optional element wildcards.
+ */
+ dom_content_optional&
+ dom_content ();
+
+ /**
+ * @brief Set the anyType DOM content.
+ *
+ * @param e A new element to set.
+ *
+ * This function makes a copy of its argument and sets it as the
+ * new DOM content.
+ */
+ void
+ dom_content (const xercesc::DOMElement& e);
+
+ /**
+ * @brief Set the anyType DOM content.
+ *
+ * @param e A new element to use.
+ *
+ * This function will use the passed element directly instead
+ * of making a copy. For this to work the element should belong
+ * to the DOM document associated with this anyType instance.
+ *
+ * @see dom_content_document
+ */
+ void
+ dom_content (xercesc::DOMElement* e);
+
+ /**
+ * @brief Set the anyType DOM content.
+ *
+ * @param d An optional container with the new element to set.
+ *
+ * If the element is present in @a d then this function makes a
+ * copy of this element and sets it as the new wildcard content.
+ * Otherwise the element container is set the 'not present' state.
+ */
+ void
+ dom_content (const dom_content_optional& d);
+
+ /**
+ * @brief Return a read-only (constant) reference to the DOM
+ * document associated with this anyType instance.
+ *
+ * @return A constant reference to the DOM document.
+ *
+ * The DOM document returned by this function is used to store
+ * the raw XML content corresponding to the anyType instance.
+ */
+ const xercesc::DOMDocument&
+ dom_content_document () const;
+
+ /**
+ * @brief Return a read-write reference to the DOM document
+ * associated with this anyType instance.
+ *
+ * @return A reference to the DOM document.
+ *
+ * The DOM document returned by this function is used to store
+ * the raw XML content corresponding to the anyType instance.
+ */
+ xercesc::DOMDocument&
+ dom_content_document ();
+
+ /**
+ * @brief Check for absence of DOM (anyType) and text (anySimpleType)
+ * content.
+ *
+ * @return True if there is no content and false otherwise.
+ *
+ * This is an optimization function that allows us to check for the
+ * lack of content without actually creating its empty representation
+ * (that is, empty DOM document for DOM or empty string for text).
+ */
+ bool
+ null_content () const;
+
+ //
+ //
+ public:
+ /**
+ * @brief Comparison operator. It uses DOM (anyType) or text
+ * (anySimpleType) content if present. If the content is missing
+ * then the types are assumed unequal.
+ *
+ * @return True if the instances are equal, false otherwise.
+ */
+ friend bool
+ operator== (const type& x, const type& y)
+ {
+ return x.content_.get () != 0 &&
+ x.content_->compare (y.content_.get ());
+ }
+
+ /**
+ * @brief Comparison operator. It uses DOM (anyType) or text
+ * (anySimpleType) content if present. If the content is missing
+ * then the types are assumed unequal.
+ *
+ * @return True if the instances are not equal, false otherwise.
+ */
+ friend bool
+ operator!= (const type& x, const type& y) {return !(x == y);}
+
// Container API.
//
public:
@@ -429,7 +632,7 @@ namespace xsd
dr = c;
}
- std::auto_ptr<map>& m (dr ? dr->map_ : map_);
+ XSD_AUTO_PTR<map>& m (dr ? dr->map_ : map_);
if (container_ == 0)
{
@@ -440,11 +643,16 @@ namespace xsd
if (m.get () != 0)
{
m->insert (map_->begin (), map_->end ());
- std::auto_ptr<map> tmp (0);
- map_ = tmp;
+ map_.reset ();
}
else
+ {
+#ifdef XSD_CXX11
+ m = std::move (map_);
+#else
m = map_;
+#endif
+ }
}
}
else
@@ -466,10 +674,7 @@ namespace xsd
// Part of our subtree.
//
if (m.get () == 0)
- {
- std::auto_ptr<map> tmp (new map);
- m = tmp;
- }
+ m.reset (new map);
m->insert (*i);
sr->map_->erase (i++);
@@ -548,7 +753,7 @@ namespace xsd
* @brief Exception indicating that a DOM node cannot be associated
* with an object model node.
*/
- class bad_dom_node_type: public std::exception //@@ Inherit exception.
+ class bad_dom_node_type: public std::exception //@@ Inherit exception<C>.
{
public:
/**
@@ -584,37 +789,31 @@ namespace xsd
{
if (container_ != 0)
{
- // @@ Should be a throw.
- //
assert (_root ()->_node () != 0);
assert (_root ()->_node ()->getOwnerDocument () ==
n->getOwnerDocument ());
}
- std::auto_ptr<dom_info> r (
+ dom_info_ =
dom_info_factory::create (
*static_cast<xercesc::DOMElement*> (n),
*this,
- container_ == 0));
+ container_ == 0);
- dom_info_ = r;
break;
}
case xercesc::DOMNode::ATTRIBUTE_NODE:
{
- //@@ Should be a throw.
- //
assert (container_ != 0);
assert (_root ()->_node () != 0);
assert (_root ()->_node ()->getOwnerDocument () ==
n->getOwnerDocument ());
- std::auto_ptr<dom_info> r (
+ dom_info_ =
dom_info_factory::create (
*static_cast<xercesc::DOMAttr*> (n),
- *this));
+ *this);
- dom_info_ = r;
break;
}
default:
@@ -628,26 +827,23 @@ namespace xsd
//@cond
void
- _register_id (const identity& id, type* t)
+ _register_id (const identity& i, type* t)
{
// We should be the root.
//
assert (container_ == 0);
if (map_.get () == 0)
- {
- std::auto_ptr<map> tmp (new map);
- map_ = tmp;
- }
+ map_.reset (new map);
if (!map_->insert (
- std::pair<const identity*, type*> (&id, t)).second)
+ std::pair<const identity*, type*> (&i, t)).second)
{
- id.throw_duplicate_id ();
+ i.throw_duplicate_id ();
}
}
- //@@ Does not inherit from exception.
+ //@@ Does not inherit from exception<C>.
//
struct not_registered: std::exception
{
@@ -691,15 +887,11 @@ namespace xsd
struct dom_info
{
virtual
- ~dom_info ()
- {
- }
+ ~dom_info () {}
- dom_info ()
- {
- }
+ dom_info () {}
- virtual std::auto_ptr<dom_info>
+ virtual XSD_AUTO_PTR<dom_info>
clone (type& tree_node, container*) const = 0;
virtual xercesc::DOMNode*
@@ -707,41 +899,41 @@ namespace xsd
private:
dom_info (const dom_info&);
-
- dom_info&
- operator= (const dom_info&);
+ dom_info& operator= (const dom_info&);
};
-
struct dom_element_info: public dom_info
{
dom_element_info (xercesc::DOMElement& e, type& n, bool root)
- : doc_ (0), e_ (e)
+ : e_ (e)
{
e_.setUserData (user_data_keys::node, &n, 0);
if (root)
{
- // The caller should have associated a dom::auto_ptr object
- // that owns this document with the document node using the
- // xml_schema::dom::tree_node_key key.
+ // The caller should have associated a dom::auto/unique_ptr
+ // object that owns this document with the document node
+ // using the xml_schema::dom::tree_node_key key.
//
- xml::dom::auto_ptr<xercesc::DOMDocument>* pd (
- reinterpret_cast<xml::dom::auto_ptr<xercesc::DOMDocument>*> (
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>* pd (
+ reinterpret_cast<XSD_DOM_AUTO_PTR<xercesc::DOMDocument>*> (
e.getOwnerDocument ()->getUserData (user_data_keys::node)));
assert (pd != 0);
assert (pd->get () == e.getOwnerDocument ());
- doc_ = *pd; // Transfer ownership.
+ // Transfer ownership.
+#ifdef XSD_CXX11
+ doc_ = std::move (*pd);
+#else
+ doc_ = *pd;
+#endif
}
}
- virtual std::auto_ptr<dom_info>
+ virtual XSD_AUTO_PTR<dom_info>
clone (type& tree_node, container* c) const
{
- using std::auto_ptr;
-
// Check if we are a document root.
//
if (c == 0)
@@ -749,11 +941,10 @@ namespace xsd
// We preserver DOM associations only in complete
// copies from root.
//
- if (doc_.get () == 0)
- return auto_ptr<dom_info> (0);
-
- return auto_ptr<dom_info> (
- new dom_element_info (*doc_, tree_node));
+ return XSD_AUTO_PTR<dom_info> (
+ doc_.get () == 0
+ ? 0
+ : new dom_element_info (*doc_, tree_node));
}
// Check if our container does not have DOM association (e.g.,
@@ -764,8 +955,7 @@ namespace xsd
DOMNode* cn (c->_node ());
if (cn == 0)
- return auto_ptr<dom_info> (0);
-
+ return XSD_AUTO_PTR<dom_info> ();
// Now we are going to find the corresponding element in
// the new tree.
@@ -797,7 +987,7 @@ namespace xsd
assert (dn->getNodeType () == DOMNode::ELEMENT_NODE);
- return auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_element_info (static_cast<DOMElement&> (*dn),
tree_node,
false));
@@ -820,7 +1010,7 @@ namespace xsd
}
private:
- xml::dom::auto_ptr<xercesc::DOMDocument> doc_;
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc_;
xercesc::DOMElement& e_;
};
@@ -833,11 +1023,9 @@ namespace xsd
a_.setUserData (user_data_keys::node, &n, 0);
}
- virtual std::auto_ptr<dom_info>
+ virtual XSD_AUTO_PTR<dom_info>
clone (type& tree_node, container* c) const
{
- using std::auto_ptr;
-
// Check if we are a document root.
//
if (c == 0)
@@ -845,7 +1033,7 @@ namespace xsd
// We preserver DOM associations only in complete
// copies from root.
//
- return auto_ptr<dom_info> (0);
+ return XSD_AUTO_PTR<dom_info> ();
}
// Check if our container does not have DOM association (e.g.,
@@ -856,7 +1044,7 @@ namespace xsd
DOMNode* cn (c->_node ());
if (cn == 0)
- return auto_ptr<dom_info> (0);
+ return XSD_AUTO_PTR<dom_info> ();
// We are going to find the corresponding attribute in
// the new tree.
@@ -883,7 +1071,7 @@ namespace xsd
DOMNode& n (*cn->getAttributes ()->item (i));
assert (n.getNodeType () == DOMNode::ATTRIBUTE_NODE);
- return auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_attribute_info (static_cast<DOMAttr&> (n), tree_node));
}
@@ -904,18 +1092,18 @@ namespace xsd
struct dom_info_factory
{
- static std::auto_ptr<dom_info>
+ static XSD_AUTO_PTR<dom_info>
create (const xercesc::DOMElement& e, type& n, bool root)
{
- return std::auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_element_info (
const_cast<xercesc::DOMElement&> (e), n, root));
}
- static std::auto_ptr<dom_info>
+ static XSD_AUTO_PTR<dom_info>
create (const xercesc::DOMAttr& a, type& n)
{
- return std::auto_ptr<dom_info> (
+ return XSD_AUTO_PTR<dom_info> (
new dom_attribute_info (
const_cast<xercesc::DOMAttr&> (a), n));
}
@@ -923,7 +1111,7 @@ namespace xsd
//@endcond
- std::auto_ptr<dom_info> dom_info_;
+ XSD_AUTO_PTR<dom_info> dom_info_;
// ID/IDREF map.
@@ -946,23 +1134,77 @@ namespace xsd
std::map<const identity*, type*, identity_comparator>
map;
- std::auto_ptr<map> map_;
+ XSD_AUTO_PTR<map> map_;
- private:
- container* container_;
- };
+ // anyType and anySimpleType content.
+ //
+ protected:
- inline _type::
- _type (const type& x, flags, container* c)
- : container_ (c)
- {
- if (x.dom_info_.get ())
+ //@cond
+
+ struct content_type
{
- std::auto_ptr<dom_info> r (x.dom_info_->clone (*this, c));
- dom_info_ = r;
- }
- }
+ virtual
+ ~content_type () {}
+
+ content_type () {}
+ virtual XSD_AUTO_PTR<content_type>
+ clone () const = 0;
+
+ virtual bool
+ compare (const content_type*) const = 0;
+
+ private:
+ content_type (const content_type&);
+ content_type& operator= (const content_type&);
+ };
+
+ struct dom_content_type: content_type
+ {
+ dom_content_type ()
+ : doc (xml::dom::create_document<char> ()), dom (*doc) {}
+
+ explicit
+ dom_content_type (const xercesc::DOMElement& e)
+ : doc (xml::dom::create_document<char> ()), dom (e, *doc) {}
+
+ explicit
+ dom_content_type (xercesc::DOMElement* e)
+ : doc (xml::dom::create_document<char> ()), dom (e, *doc) {}
+
+ explicit
+ dom_content_type (const dom_content_optional& d)
+ : doc (xml::dom::create_document<char> ()), dom (d, *doc) {}
+
+ virtual XSD_AUTO_PTR<content_type>
+ clone () const
+ {
+ return XSD_AUTO_PTR<content_type> (new dom_content_type (dom));
+ }
+
+ virtual bool
+ compare (const content_type* c) const
+ {
+ if (const dom_content_type* dc =
+ dynamic_cast<const dom_content_type*> (c))
+ return dom == dc->dom;
+
+ return false;
+ }
+
+ public:
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc;
+ dom_content_optional dom;
+ };
+
+ //@endcond
+
+ mutable XSD_AUTO_PTR<content_type> content_;
+
+ private:
+ container* container_;
+ };
/**
* @brief Class corresponding to the XML Schema anySimpleType built-in
@@ -970,7 +1212,7 @@ namespace xsd
*
* @nosubgrouping
*/
- template <typename B>
+ template <typename C, typename B>
class simple_type: public B
{
public:
@@ -985,13 +1227,19 @@ namespace xsd
simple_type ();
/**
- * @brief Create an instance from a string.
+ * @brief Create an instance from a C string.
*
* @param s A string to initialize the instance with.
*/
- template <typename C>
simple_type (const C* s);
+ /**
+ * @brief Create an instance from a string.
+ *
+ * @param s A string to initialize the instance with.
+ */
+ simple_type (const std::basic_string<C>& s);
+
public:
/**
* @brief Copy constructor.
@@ -1029,7 +1277,9 @@ namespace xsd
* instance.
*/
template <typename S>
- simple_type (istream<S>& s, flags f = 0, container* c = 0);
+ simple_type (istream<S>& s,
+ flags f = flags::extract_content,
+ container* c = 0);
/**
* @brief Create an instance from a DOM element.
@@ -1040,7 +1290,7 @@ namespace xsd
* instance.
*/
simple_type (const xercesc::DOMElement& e,
- flags f = 0,
+ flags f = flags::extract_content,
container* c = 0);
/**
@@ -1052,7 +1302,7 @@ namespace xsd
* instance.
*/
simple_type (const xercesc::DOMAttr& a,
- flags f = 0,
+ flags f = flags::extract_content,
container* c = 0);
/**
@@ -1064,12 +1314,82 @@ namespace xsd
* @param c A pointer to the object that will contain the new
* instance.
*/
- template <typename C>
simple_type (const std::basic_string<C>& s,
const xercesc::DOMElement* e,
- flags f = 0,
+ flags f = flags::extract_content,
container* c = 0);
//@}
+
+ // anySimpleType content API.
+ //
+ public:
+ /**
+ * @brief Return a read-only (constant) reference to the anySimpleType
+ * text content.
+ *
+ * @return A constant reference to the text string.
+ */
+ const std::basic_string<C>&
+ text_content () const;
+
+ /**
+ * @brief Return a read-write reference to the anySimpleType text
+ * content.
+ *
+ * @return A reference to the text string.
+ */
+ std::basic_string<C>&
+ text_content ();
+
+ /**
+ * @brief Set the anySimpleType text content.
+ *
+ * @param e A new text string to set.
+ */
+ void
+ text_content (const std::basic_string<C>& t);
+
+ protected:
+ //@cond
+
+ typedef typename B::content_type content_type;
+
+ struct text_content_type: content_type
+ {
+ text_content_type () {}
+
+ explicit
+ text_content_type (const std::basic_string<C>& t): text (t) {}
+
+ explicit
+ text_content_type (const C* t): text (t) {}
+
+ virtual XSD_AUTO_PTR<content_type>
+ clone () const
+ {
+ return XSD_AUTO_PTR<content_type> (new text_content_type (text));
+ }
+
+ virtual bool
+ compare (const content_type* c) const
+ {
+ if (const text_content_type* tc =
+ dynamic_cast<const text_content_type*> (c))
+ return text == tc->text;
+
+ return false;
+ }
+
+ public:
+ // It would have been more elegant to store text content as DOMText.
+ // However, that would require Xerces-C++ initialization. Also
+ // having a separate DOMDocument for each text node seems like
+ // an overkill.
+ //
+ std::basic_string<C> text;
+ };
+
+ //@endcond
};
@@ -1168,28 +1488,77 @@ namespace xsd
{
typedef T type;
- static std::auto_ptr<T>
+ static XSD_AUTO_PTR<T>
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return std::auto_ptr<T> (new T (e, f, c));
+ return XSD_AUTO_PTR<T> (new T (e, f, c));
}
- static std::auto_ptr<T>
+ static XSD_AUTO_PTR<T>
create (const xercesc::DOMAttr& a, flags f, container* c)
{
- return std::auto_ptr<T> (new T (a, f, c));
+ return XSD_AUTO_PTR<T> (new T (a, f, c));
}
- static std::auto_ptr<T>
+ static XSD_AUTO_PTR<T>
create (const std::basic_string<C>& s,
const xercesc::DOMElement* e,
flags f,
container* c)
{
- return std::auto_ptr<T> (new T (s, e, f, c));
+ return XSD_AUTO_PTR<T> (new T (s, e, f, c));
+ }
+
+ // For now for istream we only go through traits for non-
+ // fundamental types.
+ //
+ template <typename S>
+ static XSD_AUTO_PTR<T>
+ create (istream<S>& s, flags f, container* c)
+ {
+ return XSD_AUTO_PTR<T> (new T (s, f, c));
}
};
+ template <typename B,
+ typename C,
+ schema_type::value ST>
+ struct traits<simple_type<C, B>, C, ST>
+ {
+ typedef simple_type<C, B> type;
+
+ static XSD_AUTO_PTR<type>
+ create (const xercesc::DOMElement& e, flags f, container* c)
+ {
+ return XSD_AUTO_PTR<type> (
+ new type (e, f | flags::extract_content, c));
+ }
+
+ static XSD_AUTO_PTR<type>
+ create (const xercesc::DOMAttr& a, flags f, container* c)
+ {
+ return XSD_AUTO_PTR<type> (
+ new type (a, f | flags::extract_content, c));
+ }
+
+ static XSD_AUTO_PTR<type>
+ create (const std::basic_string<C>& s,
+ const xercesc::DOMElement* e,
+ flags f,
+ container* c)
+ {
+ return XSD_AUTO_PTR<type> (
+ new type (s, e, f | flags::extract_content, c));
+ }
+
+ template <typename S>
+ static XSD_AUTO_PTR<type>
+ create (istream<S>& s, flags f, container* c)
+ {
+ return XSD_AUTO_PTR<type> (
+ new type (s, f | flags::extract_content, c));
+ }
+ };
//@endcond
@@ -1352,8 +1721,7 @@ namespace xsd
}
// The following extra conversion operators causes problems on
- // some compilers (notably VC 7.1 and 9.0) and are disabled by
- // default.
+ // some compilers (notably VC 9.0) and are disabled by default.
//
#ifdef XSD_TREE_EXTRA_FUND_CONV
/**
diff --git a/xsd/libxsd/xsd/cxx/tree/elements.ixx b/xsd/libxsd/xsd/cxx/tree/elements.ixx
index e4dd60a..844ccf7 100644
--- a/xsd/libxsd/xsd/cxx/tree/elements.ixx
+++ b/xsd/libxsd/xsd/cxx/tree/elements.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/elements.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
@@ -9,20 +8,258 @@ namespace xsd
{
namespace tree
{
+ // content_order_type
+ //
+
+ inline bool
+ operator== (const content_order& x, const content_order& y)
+ {
+ return x.id == y.id && x.index == y.index;
+ }
+
+ inline bool
+ operator!= (const content_order& x, const content_order& y)
+ {
+ return !(x == y);
+ }
+
+ inline bool
+ operator< (const content_order& x, const content_order& y)
+ {
+ return x.id < y.id || (x.id == y.id && x.index < y.index);
+ }
+
+ // type
+ //
+
+ inline _type::
+ _type ()
+ : container_ (0)
+ {
+ }
+
+ template <typename C>
+ inline _type::
+ _type (const C*)
+ : container_ (0)
+ {
+ }
+
+ inline _type::
+ _type (const type& x, flags f, container* c)
+ : container_ (c)
+ {
+ if (x.content_.get () != 0)
+ content_ = x.content_->clone ();
+
+ if (x.dom_info_.get () != 0 && (f & flags::keep_dom))
+ {
+ dom_info_ = x.dom_info_->clone (*this, c);
+ }
+ }
+
+ inline const _type::dom_content_optional& _type::
+ dom_content () const
+ {
+ const content_type* c (content_.get ());
+
+ if (c == 0)
+ {
+ content_.reset (new dom_content_type);
+ c = content_.get ();
+ }
+
+ // Accessing non-DOM content via the DOM API.
+ //
+ assert (dynamic_cast<const dom_content_type*> (c) != 0);
+
+ return static_cast<const dom_content_type*> (c)->dom;
+ }
+
+ inline _type::dom_content_optional& _type::
+ dom_content ()
+ {
+ content_type* c (content_.get ());
+
+ if (c == 0)
+ {
+ content_.reset (new dom_content_type);
+ c = content_.get ();
+ }
+
+ // Accessing non-DOM content via the DOM API.
+ //
+ assert (dynamic_cast<dom_content_type*> (c) != 0);
+
+ return static_cast<dom_content_type*> (c)->dom;
+ }
+
+ inline void _type::
+ dom_content (const xercesc::DOMElement& e)
+ {
+ content_type* c (content_.get ());
+
+ if (c == 0)
+ content_.reset (new dom_content_type (e));
+ else
+ {
+ // Accessing non-DOM content via the DOM API.
+ //
+ assert (dynamic_cast<dom_content_type*> (c) != 0);
+ static_cast<dom_content_type*> (c)->dom.set (e);
+ }
+ }
+
+ inline void _type::
+ dom_content (xercesc::DOMElement* e)
+ {
+ content_type* c (content_.get ());
+
+ if (c == 0)
+ content_.reset (new dom_content_type (e));
+ else
+ {
+ // Accessing non-DOM content via the DOM API.
+ //
+ assert (dynamic_cast<dom_content_type*> (c) != 0);
+ static_cast<dom_content_type*> (c)->dom.set (e);
+ }
+ }
+
+ inline void _type::
+ dom_content (const dom_content_optional& d)
+ {
+ content_type* c (content_.get ());
+
+ if (c == 0)
+ content_.reset (new dom_content_type (d));
+ else
+ {
+ // Accessing non-DOM content via the DOM API.
+ //
+ assert (dynamic_cast<dom_content_type*> (c) != 0);
+ static_cast<dom_content_type*> (c)->dom = d;
+ }
+ }
+
+ inline const xercesc::DOMDocument& _type::
+ dom_content_document () const
+ {
+ const content_type* c (content_.get ());
+
+ if (c == 0)
+ {
+ content_.reset (new dom_content_type);
+ c = content_.get ();
+ }
+
+ // Accessing non-DOM content via the DOM API.
+ //
+ assert (dynamic_cast<const dom_content_type*> (c) != 0);
+
+ return *static_cast<const dom_content_type*> (c)->doc;
+ }
+
+ inline xercesc::DOMDocument& _type::
+ dom_content_document ()
+ {
+ content_type* c (content_.get ());
+
+ if (c == 0)
+ {
+ content_.reset (new dom_content_type);
+ c = content_.get ();
+ }
+
+ // Accessing non-DOM content via the DOM API.
+ //
+ assert (dynamic_cast<dom_content_type*> (c) != 0);
+
+ return *static_cast<dom_content_type*> (c)->doc;
+ }
+
+ inline bool _type::
+ null_content () const
+ {
+ return content_.get () == 0;
+ }
+
// simple_type
//
- template <typename B>
- inline simple_type<B>::
+ template <typename C, typename B>
+ inline simple_type<C, B>::
simple_type ()
{
}
- template <typename B>
- template <typename C>
- inline simple_type<B>::
- simple_type (const C*)
+ template <typename C, typename B>
+ inline simple_type<C, B>::
+ simple_type (const C* s)
+ {
+ this->content_.reset (new text_content_type (s));
+ }
+
+ template <typename C, typename B>
+ inline simple_type<C, B>::
+ simple_type (const std::basic_string<C>& s)
+ {
+ this->content_.reset (new text_content_type (s));
+ }
+
+ template <typename C, typename B>
+ inline const std::basic_string<C>& simple_type<C, B>::
+ text_content () const
+ {
+ const content_type* c (this->content_.get ());
+
+ if (c == 0)
+ {
+ this->content_.reset (new text_content_type);
+ c = this->content_.get ();
+ }
+
+ // Accessing non-text content via the text API.
+ //
+ assert (dynamic_cast<const text_content_type*> (c) != 0);
+
+ return static_cast<const text_content_type*> (c)->text;
+ }
+
+ template <typename C, typename B>
+ inline std::basic_string<C>& simple_type<C, B>::
+ text_content ()
+ {
+ content_type* c (this->content_.get ());
+
+ if (c == 0)
+ {
+ this->content_.reset (new text_content_type);
+ c = this->content_.get ();
+ }
+
+ // Accessing non-text content via the text API.
+ //
+ assert (dynamic_cast<text_content_type*> (c) != 0);
+
+ return static_cast<text_content_type*> (c)->text;
+ }
+
+ template <typename C, typename B>
+ inline void simple_type<C, B>::
+ text_content (const std::basic_string<C>& t)
{
+ content_type* c (this->content_.get ());
+
+ if (c == 0)
+ this->content_.reset (new text_content_type (t));
+ else
+ {
+ // Accessing non-text content via the text API.
+ //
+ assert (dynamic_cast<text_content_type*> (c) != 0);
+ static_cast<text_content_type*> (c)->text = t;
+ }
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/tree/elements.txx b/xsd/libxsd/xsd/cxx/tree/elements.txx
index 084cb56..4a8ca6e 100644
--- a/xsd/libxsd/xsd/cxx/tree/elements.txx
+++ b/xsd/libxsd/xsd/cxx/tree/elements.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/elements.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xercesc/util/XMLUniDefs.hpp>
@@ -28,8 +27,8 @@ namespace xsd
// simple_type
//
- template <typename B>
- simple_type<B>::
+ template <typename C, typename B>
+ simple_type<C, B>::
simple_type (const simple_type& other,
flags f,
container* c)
@@ -37,8 +36,8 @@ namespace xsd
{
}
- template <typename B>
- simple_type<B>* simple_type<B>::
+ template <typename C, typename B>
+ simple_type<C, B>* simple_type<C, B>::
_clone (flags f, container* c) const
{
return new simple_type (*this, f, c);
diff --git a/xsd/libxsd/xsd/cxx/tree/error-handler.hxx b/xsd/libxsd/xsd/cxx/tree/error-handler.hxx
index 6e4426b..e520cce 100644
--- a/xsd/libxsd/xsd/cxx/tree/error-handler.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/error-handler.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/error-handler.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_ERROR_HANDLER_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/error-handler.txx b/xsd/libxsd/xsd/cxx/tree/error-handler.txx
index c19d354..8520856 100644
--- a/xsd/libxsd/xsd/cxx/tree/error-handler.txx
+++ b/xsd/libxsd/xsd/cxx/tree/error-handler.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/error-handler.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/tree/exceptions.hxx b/xsd/libxsd/xsd/cxx/tree/exceptions.hxx
index f6ddb15..d871416 100644
--- a/xsd/libxsd/xsd/cxx/tree/exceptions.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/exceptions.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/exceptions.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
/**
diff --git a/xsd/libxsd/xsd/cxx/tree/exceptions.txx b/xsd/libxsd/xsd/cxx/tree/exceptions.txx
index 8262fce..2544f42 100644
--- a/xsd/libxsd/xsd/cxx/tree/exceptions.txx
+++ b/xsd/libxsd/xsd/cxx/tree/exceptions.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/exceptions.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/tree/bits/literals.hxx>
diff --git a/xsd/libxsd/xsd/cxx/tree/facet.hxx b/xsd/libxsd/xsd/cxx/tree/facet.hxx
index c4fbcbe..e17ead1 100644
--- a/xsd/libxsd/xsd/cxx/tree/facet.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/facet.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/facet.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_FACET_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/istream-fwd.hxx b/xsd/libxsd/xsd/cxx/tree/istream-fwd.hxx
index a523952..bd20fff 100644
--- a/xsd/libxsd/xsd/cxx/tree/istream-fwd.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/istream-fwd.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/istream-fwd.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_ISTREAM_FWD_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/istream.hxx b/xsd/libxsd/xsd/cxx/tree/istream.hxx
index 2f8f8cb..45e334b 100644
--- a/xsd/libxsd/xsd/cxx/tree/istream.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/istream.hxx
@@ -1,13 +1,17 @@
// file : xsd/cxx/tree/istream.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_ISTREAM_HXX
#define XSD_CXX_TREE_ISTREAM_HXX
+#include <map>
+#include <string>
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/istream-fwd.hxx>
namespace xsd
@@ -138,13 +142,102 @@ namespace xsd
return s_;
}
+ // Add string to the pool. The application should add every
+ // potentially pooled string to correctly re-create the pool
+ // constructed during insertion.
+ //
+ template <typename C>
+ void
+ pool_add (const std::basic_string<C>& s)
+ {
+ typedef pool_impl<C> pool_type;
+
+ if (pool_.get () == 0)
+ pool_.reset (new pool_type);
+
+ pool_type& p (*static_cast<pool_type*> (pool_.get ()));
+ p.push_back (s);
+ }
+
+ // Get string from pool id. We return the result via an argument
+ // instead of as a return type to avoid difficulties some compilers
+ // (e.g., GCC) experience with calls like istream<S>::pool_string<C>.
+ //
+ template <typename C>
+ void
+ pool_string (std::size_t id, std::basic_string<C>& out)
+ {
+ typedef pool_impl<C> pool_type;
+ pool_type& p (*static_cast<pool_type*> (pool_.get ()));
+ out = p[id - 1];
+ }
+
+ public:
+ // 8-bit
+ //
+ signed char
+ read_char ();
+
+ unsigned char
+ read_uchar ();
+
+ // 16-bit
+ //
+ unsigned short
+ read_short ();
+
+ unsigned short
+ read_ushort ();
+
+ // 32-bit
+ //
+ unsigned int
+ read_int ();
+
+ unsigned int
+ read_uint ();
+
+ // 64-bit
+ //
+ unsigned long long
+ read_ulonglong ();
+
+ unsigned long long
+ read_longlong ();
+
+ // Boolean
+ //
+ bool
+ read_bool ();
+
+ // Floating-point
+ //
+ float
+ read_float ();
+
+ double
+ read_double ();
+
private:
istream (const istream&);
istream&
operator= (const istream&);
private:
+ struct pool
+ {
+ virtual
+ ~pool () {}
+ };
+
+ template <typename C>
+ struct pool_impl: pool, std::vector<std::basic_string<C> >
+ {
+ };
+
S& s_;
+ std::size_t seq_;
+ XSD_AUTO_PTR<pool> pool_;
};
@@ -251,6 +344,109 @@ namespace xsd
istream_common::as_float64<double> as_float64 (x);
return s >> as_float64;
}
+
+ //
+ // read_* functions.
+ //
+
+ template <typename S>
+ inline signed char istream<S>::
+ read_char ()
+ {
+ signed char r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline unsigned char istream<S>::
+ read_uchar ()
+ {
+ unsigned char r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline unsigned short istream<S>::
+ read_short ()
+ {
+ short r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline unsigned short istream<S>::
+ read_ushort ()
+ {
+ unsigned short r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline unsigned int istream<S>::
+ read_int ()
+ {
+ int r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline unsigned int istream<S>::
+ read_uint ()
+ {
+ unsigned int r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline unsigned long long istream<S>::
+ read_ulonglong ()
+ {
+ long long r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline unsigned long long istream<S>::
+ read_longlong ()
+ {
+ unsigned long long r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline bool istream<S>::
+ read_bool ()
+ {
+ bool r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline float istream<S>::
+ read_float ()
+ {
+ float r;
+ *this >> r;
+ return r;
+ }
+
+ template <typename S>
+ inline double istream<S>::
+ read_double ()
+ {
+ double r;
+ *this >> r;
+ return r;
+ }
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/tree/iterator-adapter.hxx b/xsd/libxsd/xsd/cxx/tree/iterator-adapter.hxx
new file mode 100644
index 0000000..0a54604
--- /dev/null
+++ b/xsd/libxsd/xsd/cxx/tree/iterator-adapter.hxx
@@ -0,0 +1,270 @@
+// file : xsd/cxx/tree/iterator-adapter.hxx
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSD_CXX_TREE_ITERATOR_ADAPTER_HXX
+#define XSD_CXX_TREE_ITERATOR_ADAPTER_HXX
+
+#include <cstddef> // std::ptrdiff_t
+#include <iterator> // std::iterator_traits
+
+namespace xsd
+{
+ namespace cxx
+ {
+ namespace tree
+ {
+ // Sun CC's <iterator> does not have iterator_traits. To overcome
+ // this, we will wrap std::iterator_traits into our own and also
+ // specialize it for pointer types. Since Sun CC uses pointer
+ // for vector::iterator, it will use the specialization and won't
+ // notice the std::iterator_traits.
+ //
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
+ template <typename I>
+ struct iterator_traits
+ {
+ typedef
+ typename std::iterator_traits<I>::iterator_category
+ iterator_category;
+
+ typedef
+ typename std::iterator_traits<I>::value_type
+ value_type;
+
+ typedef
+ typename std::iterator_traits<I>::difference_type
+ difference_type;
+ };
+#else
+ // The Pointer specialization does not work for reverse and
+ // set iterators. But these iterators are user-dfined types
+ // and have suitable typedefs that we can use.
+ //
+ template <typename I>
+ struct iterator_traits
+ {
+ typedef typename I::iterator_category iterator_category;
+ typedef typename I::value_type value_type;
+ typedef typename I::difference_type difference_type;
+ };
+
+ template <typename T>
+ struct iterator_traits<T*>
+ {
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef T value_type;
+ typedef std::ptrdiff_t difference_type;
+ };
+#endif
+
+ // Iterator adapter for complex types. It expects I to point to
+ // a smart pointer-like object that has operator*() that returns
+ // a refernce to a type static_cast'able to T and get() that
+ // returns a pointer to a type static_cast'able to T.
+ //
+
+ template <typename I, typename T>
+ struct iterator_adapter
+ {
+ typedef T value_type;
+ typedef value_type& reference;
+ typedef value_type* pointer;
+
+ typedef
+ typename iterator_traits<I>::iterator_category
+ iterator_category;
+
+ typedef
+ typename iterator_traits<I>::difference_type
+ difference_type;
+
+
+ public:
+ iterator_adapter ()
+ : i_ () // i_ can be of a pointer type.
+ {
+ }
+
+ // Allow iterator to const_iterator conversion.
+ //
+ template <typename J, typename T2>
+ iterator_adapter (const iterator_adapter<J, T2>& j)
+ : i_ (j.base ())
+ {
+ }
+
+ explicit
+ iterator_adapter (const I& i)
+ : i_ (i)
+ {
+ }
+
+ public:
+ // Forward iterator requirements.
+ //
+ reference
+ operator* () const
+ {
+ return static_cast<reference> (**i_);
+ }
+
+ pointer
+ operator-> () const
+ {
+ return static_cast<pointer> (i_->get ());
+ }
+
+ iterator_adapter&
+ operator++ ()
+ {
+ ++i_;
+ return *this;
+ }
+
+ iterator_adapter
+ operator++ (int)
+ {
+ iterator_adapter r (*this);
+ ++i_;
+ return r;
+ }
+
+ // Bidirectional iterator requirements.
+ //
+ iterator_adapter&
+ operator-- ()
+ {
+ --i_;
+ return *this;
+ }
+
+ iterator_adapter
+ operator-- (int)
+ {
+ iterator_adapter r (*this);
+ --i_;
+ return r;
+ }
+
+ // Random access iterator requirements.
+ //
+ reference
+ operator[] (difference_type n) const
+ {
+ return static_cast<reference> (*(i_[n]));
+ }
+
+ iterator_adapter&
+ operator+= (difference_type n)
+ {
+ i_ += n;
+ return *this;
+ }
+
+ iterator_adapter
+ operator+ (difference_type n) const
+ {
+ return iterator_adapter (i_ + n);
+ }
+
+ iterator_adapter&
+ operator-= (difference_type n)
+ {
+ i_ -= n;
+ return *this;
+ }
+
+ iterator_adapter
+ operator- (difference_type n) const
+ {
+ return iterator_adapter (i_ - n);
+ }
+
+ public:
+ const I&
+ base () const
+ {
+ return i_;
+ }
+
+ private:
+ I i_;
+ };
+
+ // Note: We use different types for left- and right-hand-side
+ // arguments to allow comparison between iterator and const_iterator.
+ //
+
+ // Forward iterator requirements.
+ //
+ template <typename I, typename J, typename T1, typename T2>
+ inline bool
+ operator== (const iterator_adapter<I, T1>& i,
+ const iterator_adapter<J, T2>& j)
+ {
+ return i.base () == j.base ();
+ }
+
+ template <typename I, typename J, typename T1, typename T2>
+ inline bool
+ operator!= (const iterator_adapter<I, T1>& i,
+ const iterator_adapter<J, T2>& j)
+ {
+ return i.base () != j.base ();
+ }
+
+ // Random access iterator requirements
+ //
+ template <typename I, typename J, typename T1, typename T2>
+ inline bool
+ operator< (const iterator_adapter<I, T1>& i,
+ const iterator_adapter<J, T2>& j)
+ {
+ return i.base () < j.base ();
+ }
+
+ template <typename I, typename J, typename T1, typename T2>
+ inline bool
+ operator> (const iterator_adapter<I, T1>& i,
+ const iterator_adapter<J, T2>& j)
+ {
+ return i.base () > j.base ();
+ }
+
+ template <typename I, typename J, typename T1, typename T2>
+ inline bool
+ operator<= (const iterator_adapter<I, T1>& i,
+ const iterator_adapter<J, T2>& j)
+ {
+ return i.base () <= j.base ();
+ }
+
+ template <typename I, typename J, typename T1, typename T2>
+ inline bool
+ operator>= (const iterator_adapter<I, T1>& i,
+ const iterator_adapter<J, T2>& j)
+ {
+ return i.base () >= j.base ();
+ }
+
+ template <typename I, typename J, typename T1, typename T2>
+ inline typename iterator_adapter<I, T1>::difference_type
+ operator- (const iterator_adapter<I, T1>& i,
+ const iterator_adapter<J, T2>& j)
+ {
+ return i.base () - j.base ();
+ }
+
+ template <typename I, typename T>
+ inline iterator_adapter<I, T>
+ operator+ (typename iterator_adapter<I, T>::difference_type n,
+ const iterator_adapter<I, T>& i)
+ {
+ return iterator_adapter<I, T> (i.base () + n);
+ }
+ }
+ }
+}
+
+#endif // XSD_CXX_TREE_ITERATOR_ADAPTER_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/list.hxx b/xsd/libxsd/xsd/cxx/tree/list.hxx
index 30636e9..d1fe907 100644
--- a/xsd/libxsd/xsd/cxx/tree/list.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/list.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/list.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_LIST_HXX
@@ -11,7 +10,7 @@
#include <xercesc/dom/DOMAttr.hpp>
#include <xercesc/dom/DOMElement.hpp>
-#include <xsd/cxx/tree/elements.hxx> // tree::istream
+#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/istream-fwd.hxx> // tree::istream
#include <xsd/cxx/tree/containers.hxx> // fundamental_p, sequence
@@ -22,8 +21,7 @@ namespace xsd
namespace tree
{
// Class template for xsd:list mapping. Based on the sequence
- // template. Note that I cannot get rid of 'fund' because HP
- // aCC3 likes it this way.
+ // template.
//
template <typename T,
typename C,
@@ -39,8 +37,8 @@ namespace xsd
{
public:
explicit
- list (flags f = 0, container* c = 0)
- : sequence<T> (f, c)
+ list (container* c = 0)
+ : sequence<T> (c)
{
}
@@ -60,8 +58,8 @@ namespace xsd
template <typename S>
list (istream<S>&, flags = 0, container* c = 0);
- list (const list<T, C, ST, false>& v, flags f = 0, container* c = 0)
- : sequence<T> (v, f, c)
+ list (const list<T, C, ST, false>& l, flags f = 0, container* c = 0)
+ : sequence<T> (l, f, c)
{
}
@@ -77,7 +75,9 @@ namespace xsd
private:
void
- init (const std::basic_string<C>&, const xercesc::DOMElement*);
+ init (const std::basic_string<C>&,
+ const xercesc::DOMElement*,
+ flags);
};
@@ -88,8 +88,8 @@ namespace xsd
{
public:
explicit
- list (flags f = 0, container* c = 0)
- : sequence<T> (f, c)
+ list (container* c = 0)
+ : sequence<T> (c)
{
}
@@ -108,8 +108,8 @@ namespace xsd
template <typename S>
list (istream<S>&, flags = 0, container* c = 0);
- list (const list<T, C, ST, true>& s, flags f = 0, container* c = 0)
- : sequence<T> (s, f, c)
+ list (const list<T, C, ST, true>& l, flags f = 0, container* c = 0)
+ : sequence<T> (l, f, c)
{
}
diff --git a/xsd/libxsd/xsd/cxx/tree/ostream.hxx b/xsd/libxsd/xsd/cxx/tree/ostream.hxx
index cf2d9ee..ec15c51 100644
--- a/xsd/libxsd/xsd/cxx/tree/ostream.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/ostream.hxx
@@ -1,13 +1,17 @@
// file : xsd/cxx/tree/ostream.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_OSTREAM_HXX
#define XSD_CXX_TREE_OSTREAM_HXX
+#include <map>
+#include <string>
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
namespace xsd
{
namespace cxx
@@ -126,7 +130,7 @@ namespace xsd
public:
explicit
ostream (S& s)
- : s_ (s)
+ : s_ (s), seq_ (1)
{
}
@@ -136,13 +140,55 @@ namespace xsd
return s_;
}
+ // If the string is not in the pool, add it and return 0. Otherwise
+ // return the string's pool id. In the former case the application
+ // should serialize the original string.
+ //
+ // The returned ids are sequential and start with 1. 0 is reserved
+ // as a special marker to be used by the application for the first
+ // encounter of the string.
+ //
+ template <typename C>
+ std::size_t
+ pool_string (const std::basic_string<C>& s)
+ {
+ typedef pool_impl<C> pool_type;
+
+ if (pool_.get () == 0)
+ pool_.reset (new pool_type);
+
+ pool_type& p (*static_cast<pool_type*> (pool_.get ()));
+
+ std::pair<typename pool_type::iterator, bool> r (
+ p.insert (std::pair<std::basic_string<C>, std::size_t> (s, seq_)));
+
+ if (!r.second)
+ return r.first->second;
+
+ seq_++;
+ return 0;
+ }
+
private:
ostream (const ostream&);
ostream&
operator= (const ostream&);
private:
+ struct pool
+ {
+ virtual
+ ~pool () {}
+ };
+
+ template <typename C>
+ struct pool_impl: pool, std::map<std::basic_string<C>, std::size_t>
+ {
+ };
+
S& s_;
+ std::size_t seq_;
+ XSD_AUTO_PTR<pool> pool_;
};
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing.hxx b/xsd/libxsd/xsd/cxx/tree/parsing.hxx
index 84b3898..f811788 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing.txx b/xsd/libxsd/xsd/cxx/tree/parsing.txx
index db50775..73e06f4 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing.txx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <string>
@@ -35,25 +34,23 @@ namespace xsd
//
inline _type::
_type (const xercesc::DOMElement& e, flags f, container* c)
- : dom_info_ (0), container_ (c)
+ : container_ (c)
{
+ if (f & flags::extract_content)
+ content_.reset (new dom_content_type (e));
+
if (f & flags::keep_dom)
- {
- std::auto_ptr<dom_info> r (
- dom_info_factory::create (e, *this, c == 0));
- dom_info_ = r;
- }
+ dom_info_ = dom_info_factory::create (e, *this, c == 0);
}
inline _type::
_type (const xercesc::DOMAttr& a, flags f, container* c)
- : dom_info_ (0), container_ (c)
+ : container_ (c)
{
+ // anyType cannot be an attribute type so no content extraction.
+
if (f & flags::keep_dom)
- {
- std::auto_ptr<dom_info> r (dom_info_factory::create (a, *this));
- dom_info_ = r;
- }
+ dom_info_ = dom_info_factory::create (a, *this);
}
template <typename C>
@@ -62,36 +59,43 @@ namespace xsd
const xercesc::DOMElement*,
flags,
container* c)
- : dom_info_ (0), // List elements don't have associated DOM nodes.
- container_ (c)
+ : container_ (c) // List elements don't have associated DOM nodes.
{
+ // anyType cannot be a list element type so no content extraction.
}
// simple_type
//
- template <typename B>
- inline simple_type<B>::
+ template <typename C, typename B>
+ inline simple_type<C, B>::
simple_type (const xercesc::DOMElement& e, flags f, container* c)
- : B (e, f, c)
+ : B (e, (f & ~flags::extract_content), c)
{
+ if (f & flags::extract_content)
+ this->content_.reset (
+ new text_content_type (tree::text_content<C> (e)));
}
- template <typename B>
- inline simple_type<B>::
+ template <typename C, typename B>
+ inline simple_type<C, B>::
simple_type (const xercesc::DOMAttr& a, flags f, container* c)
- : B (a, f, c)
+ : B (a, (f & ~flags::extract_content), c)
{
+ if (f & flags::extract_content)
+ this->content_.reset (new text_content_type (
+ xml::transcode<C> (a.getValue ())));
}
- template <typename B>
- template <typename C>
- inline simple_type<B>::
+ template <typename C, typename B>
+ inline simple_type<C, B>::
simple_type (const std::basic_string<C>& s,
const xercesc::DOMElement* e,
flags f,
container* c)
- : B (s, e, f, c)
+ : B (s, e, (f & ~flags::extract_content), c)
{
+ if (f & flags::extract_content)
+ this->content_.reset (new text_content_type (s));
}
// fundamental_base
@@ -170,23 +174,25 @@ namespace xsd
}
// Individual items of the list have no DOM association. Therefore
- // I clear keep_dom from flags.
+ // we clear keep_dom from flags.
//
template <typename T, typename C, schema_type::value ST>
list<T, C, ST, false>::
list (const xercesc::DOMElement& e, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
- init (text_content<C> (e), &e);
+ init (tree::text_content<C> (e), &e, f & ~flags::keep_dom);
}
template <typename T, typename C, schema_type::value ST>
list<T, C, ST, false>::
list (const xercesc::DOMAttr& a, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
- init (xml::transcode<C> (a.getValue ()), a.getOwnerElement ());
+ init (xml::transcode<C> (a.getValue ()),
+ a.getOwnerElement (),
+ f & ~flags::keep_dom);
}
template <typename T, typename C, schema_type::value ST>
@@ -195,20 +201,21 @@ namespace xsd
const xercesc::DOMElement* e,
flags f,
container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
- init (s, e);
+ init (s, e, f & ~flags::keep_dom);
}
template <typename T, typename C, schema_type::value ST>
void list<T, C, ST, false>::
- init (const std::basic_string<C>& s, const xercesc::DOMElement* parent)
+ init (const std::basic_string<C>& s,
+ const xercesc::DOMElement* parent,
+ flags f)
{
if (s.size () == 0)
return;
using std::basic_string;
- typedef typename sequence<T>::ptr ptr;
typedef typename basic_string<C>::size_type size_type;
const C* data (s.c_str ());
@@ -223,13 +230,12 @@ namespace xsd
if (j != basic_string<C>::npos)
{
- ptr r (
- new T (basic_string<C> (data + i, j - i),
- parent,
- this->flags_,
- this->container_));
-
- this->v_.push_back (r);
+ this->push_back (
+ traits<T, C, ST>::create (
+ basic_string<C> (data + i, j - i),
+ parent,
+ f,
+ this->container_));
i = bits::find_ns (data, size, j);
}
@@ -237,13 +243,12 @@ namespace xsd
{
// Last element.
//
- ptr r (
- new T (basic_string<C> (data + i, size - i),
- parent,
- this->flags_,
- this->container_));
-
- this->v_.push_back (r);
+ this->push_back (
+ traits<T, C, ST>::create (
+ basic_string<C> (data + i, size - i),
+ parent,
+ f,
+ this->container_));
break;
}
@@ -252,16 +257,16 @@ namespace xsd
template <typename T, typename C, schema_type::value ST>
list<T, C, ST, true>::
- list (const xercesc::DOMElement& e, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ list (const xercesc::DOMElement& e, flags, container* c)
+ : sequence<T> (c)
{
- init (text_content<C> (e), &e);
+ init (tree::text_content<C> (e), &e);
}
template <typename T, typename C, schema_type::value ST>
inline list<T, C, ST, true>::
- list (const xercesc::DOMAttr& a, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ list (const xercesc::DOMAttr& a, flags, container* c)
+ : sequence<T> (c)
{
init (xml::transcode<C> (a.getValue ()), a.getOwnerElement ());
}
@@ -270,9 +275,9 @@ namespace xsd
inline list<T, C, ST, true>::
list (const std::basic_string<C>& s,
const xercesc::DOMElement* parent,
- flags f,
+ flags,
container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
init (s, parent);
}
@@ -329,7 +334,7 @@ namespace xsd
string<C, B>::
string (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c),
- base_type (text_content<C> (e))
+ base_type (tree::text_content<C> (e))
{
}
@@ -696,7 +701,7 @@ namespace xsd
uri<C, B>::
uri (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c),
- base_type (trim (text_content<C> (e)))
+ base_type (trim (tree::text_content<C> (e)))
{
}
@@ -726,7 +731,7 @@ namespace xsd
qname (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- std::basic_string<C> v (trim (text_content<C> (e)));
+ std::basic_string<C> v (trim (tree::text_content<C> (e)));
ns_ = resolve (v, &e);
name_ = xml::uq_name (v);
}
@@ -797,7 +802,7 @@ namespace xsd
{
// This implementation is not optimal.
//
- std::basic_string<C> str (trim (text_content<C> (e)));
+ std::basic_string<C> str (trim (tree::text_content<C> (e)));
decode (xml::string (str).c_str ());
}
@@ -832,7 +837,7 @@ namespace xsd
{
// This implementation is not optimal.
//
- std::basic_string<C> str (trim (text_content<C> (e)));
+ std::basic_string<C> str (trim (tree::text_content<C> (e)));
decode (xml::string (str).c_str ());
}
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx
index 3dafdaa..8bbd3a8 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/boolean.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/boolean.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_BOOLEAN_HXX
@@ -42,7 +41,7 @@ namespace xsd
bool traits<bool, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx
index 0a127c9..d6cf1d3 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/byte.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/byte.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_BYTE_HXX
@@ -41,7 +40,7 @@ namespace xsd
signed char traits<signed char, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx b/xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx
index 913786c..29b12b6 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/date-time.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/date-time.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/ro-string.hxx>
@@ -60,7 +59,7 @@ namespace xsd
gday (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -110,7 +109,7 @@ namespace xsd
gmonth (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -160,7 +159,7 @@ namespace xsd
gyear (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -223,7 +222,7 @@ namespace xsd
gmonth_day (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -274,7 +273,7 @@ namespace xsd
gyear_month (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -338,7 +337,7 @@ namespace xsd
date (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -403,7 +402,7 @@ namespace xsd
time (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -470,7 +469,7 @@ namespace xsd
date_time (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
@@ -557,7 +556,7 @@ namespace xsd
duration (const xercesc::DOMElement& e, flags f, container* c)
: B (e, f, c)
{
- parse (text_content<C> (e));
+ parse (tree::text_content<C> (e));
}
template <typename C, typename B>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx
index 636c0f5..b615d3c 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/decimal.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/decimal.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_DECIMAL_HXX
@@ -45,7 +44,7 @@ namespace xsd
double traits<double, C, schema_type::decimal>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/double.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/double.hxx
index 1507ccf..4466f7d 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/double.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/double.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/double.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_DOUBLE_HXX
@@ -45,7 +44,7 @@ namespace xsd
double traits<double, C, schema_type::double_>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx b/xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx
index bb9a4c6..6ac9674 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/element-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/element-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_ELEMENT_MAP_TXX
@@ -17,7 +16,7 @@ namespace xsd
namespace tree
{
template <typename C, typename T>
- std::auto_ptr<element_type<C, T> > element_map<C, T>::
+ XSD_AUTO_PTR<element_type<C, T> > element_map<C, T>::
parse (const xercesc::DOMElement& e, flags f)
{
const qualified_name n (xml::dom::name<C> (e));
@@ -30,10 +29,10 @@ namespace xsd
}
template<typename T, typename C, typename B>
- std::auto_ptr<element_type<C, B> >
+ XSD_AUTO_PTR<element_type<C, B> >
parser_impl (const xercesc::DOMElement& e, flags f)
{
- return std::auto_ptr<element_type<C, B> > (new T (e, f));
+ return XSD_AUTO_PTR<element_type<C, B> > (new T (e, f));
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/float.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/float.hxx
index 3e34f93..ee582e5 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/float.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/float.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/float.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_FLOAT_HXX
@@ -45,7 +44,7 @@ namespace xsd
float traits<float, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/int.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/int.hxx
index d996d3a..b4eec88 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/int.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/int.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/int.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_INT_HXX
@@ -41,7 +40,7 @@ namespace xsd
int traits<int, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/long.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/long.hxx
index 742ade1..070e66d 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/long.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/long.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/long.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_LONG_HXX
@@ -41,7 +40,7 @@ namespace xsd
long long traits<long long, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/short.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/short.hxx
index 3a7ead8..90d5144 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/short.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/short.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/short.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_SHORT_HXX
@@ -41,7 +40,7 @@ namespace xsd
short traits<short, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx
index ce336be..c172e93 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-byte.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/unsigned-byte.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_UNSIGNED_BYTE_HXX
@@ -41,7 +40,7 @@ namespace xsd
unsigned char traits<unsigned char, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx
index e908dd0..07fb7f2 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-int.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/unsigned-int.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_UNSIGNED_INT_HXX
@@ -41,7 +40,7 @@ namespace xsd
unsigned int traits<unsigned int, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx
index 647b8dd..0036e0d 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-long.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/unsigned-long.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_UNSIGNED_LONG_HXX
@@ -41,7 +40,7 @@ namespace xsd
unsigned long long traits<unsigned long long, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx
index f53c724..838a2a8 100644
--- a/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/parsing/unsigned-short.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/parsing/unsigned-short.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_PARSING_UNSIGNED_SHORT_HXX
@@ -41,7 +40,7 @@ namespace xsd
unsigned short traits<unsigned short, C, schema_type::other>::
create (const xercesc::DOMElement& e, flags f, container* c)
{
- return create (text_content<C> (e), 0, f, c);
+ return create (tree::text_content<C> (e), 0, f, c);
}
template <typename C>
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization.hxx b/xsd/libxsd/xsd/cxx/tree/serialization.hxx
index 612185f..24b26e2 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization.txx b/xsd/libxsd/xsd/cxx/tree/serialization.txx
index 29364f4..055f603 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization.txx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <string>
@@ -92,9 +91,29 @@ namespace xsd
// Insertion operators for type.
//
inline void
- operator<< (xercesc::DOMElement& e, const type&)
+ operator<< (xercesc::DOMElement& e, const type& x)
{
xml::dom::clear<char> (e);
+
+ if (!x.null_content () && x.dom_content ().present ())
+ {
+ // Clone the contents of the element.
+ //
+ using namespace xercesc;
+
+ DOMDocument& doc (*e.getOwnerDocument ());
+ const DOMElement& se (x.dom_content ().get ());
+ DOMNamedNodeMap& sa (*se.getAttributes ());
+
+ for (XMLSize_t i (0), n (sa.getLength ()); i != n; ++i)
+ e.setAttributeNode (
+ static_cast<DOMAttr*> (doc.importNode (sa.item (i), true)));
+
+ for (DOMNode* sn (se.getFirstChild ());
+ sn != 0;
+ sn = sn->getNextSibling ())
+ e.appendChild (doc.importNode (sn, true));
+ }
}
inline void
@@ -110,23 +129,30 @@ namespace xsd
// Insertion operators for simple_type.
//
- template <typename B>
+ template <typename C, typename B>
inline void
- operator<< (xercesc::DOMElement& e, const simple_type<B>&)
+ operator<< (xercesc::DOMElement& e, const simple_type<C, B>& x)
{
- xml::dom::clear<char> (e);
+ if (x.null_content ())
+ xml::dom::clear<char> (e);
+ else
+ e << x.text_content ();
}
- template <typename B>
+ template <typename C, typename B>
inline void
- operator<< (xercesc::DOMAttr&, const simple_type<B>&)
+ operator<< (xercesc::DOMAttr& a, const simple_type<C, B>& x)
{
+ if (!x.null_content ())
+ a << x.text_content ();
}
template <typename C, typename B>
inline void
- operator<< (list_stream<C>&, const simple_type<B>&)
+ operator<< (list_stream<C>& ls, const simple_type<C, B>& x)
{
+ if (!x.null_content ())
+ ls << x.text_content ();
}
// Insertion operators for list.
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/boolean.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/boolean.hxx
index ce34560..90978c4 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/boolean.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/boolean.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/boolean.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_BOOLEAN_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/byte.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/byte.hxx
index 583eda9..bd7bceb 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/byte.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/byte.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/byte.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_BYTE_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/date-time.txx b/xsd/libxsd/xsd/cxx/tree/serialization/date-time.txx
index 1180e1c..c2a02d6 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/date-time.txx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/date-time.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/date-time.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <locale>
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/decimal.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/decimal.hxx
index 971622f..6e48809 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/decimal.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/decimal.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/decimal.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_DECIMAL_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/double.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/double.hxx
index 6d21536..bc4d5c4 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/double.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/double.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/double.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_DOUBLE_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/element-map.txx b/xsd/libxsd/xsd/cxx/tree/serialization/element-map.txx
index 9870ff2..63149f4 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/element-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/element-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/element-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_ELEMENT_MAP_TXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/float.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/float.hxx
index 2d37ae6..9aa79b0 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/float.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/float.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/float.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_FLOAT_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/int.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/int.hxx
index f88d6b8..f96124a 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/int.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/int.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/int.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_INT_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/long.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/long.hxx
index c37338b..98a4632 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/long.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/long.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/long.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_LONG_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/short.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/short.hxx
index 7d885c1..f8a9b94 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/short.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/short.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/short.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_SHORT_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx
index 114f1a1..f30c575 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-byte.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/unsigned-byte.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_BYTE_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx
index f91fe21..7dbb3a8 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-int.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/unsigned-int.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_INT_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx
index f5f12f3..8808e34 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-long.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/unsigned-long.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_LONG_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx
index 52437e0..ac3a448 100644
--- a/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/serialization/unsigned-short.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/serialization/unsigned-short.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_SERIALIZATION_UNSIGNED_SHORT_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/std-ostream-map.hxx b/xsd/libxsd/xsd/cxx/tree/std-ostream-map.hxx
index 28619a5..836ee30 100644
--- a/xsd/libxsd/xsd/cxx/tree/std-ostream-map.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/std-ostream-map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/std-ostream-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_STD_OSTREAM_MAP_HXX
@@ -28,7 +27,7 @@ namespace xsd
std_ostream_map ();
void
- register_type (const type_id&, inserter, bool override = true);
+ register_type (const type_id&, inserter, bool replace = true);
void
unregister_type (const type_id&);
diff --git a/xsd/libxsd/xsd/cxx/tree/std-ostream-map.txx b/xsd/libxsd/xsd/cxx/tree/std-ostream-map.txx
index 6a748ec..ef65ef2 100644
--- a/xsd/libxsd/xsd/cxx/tree/std-ostream-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/std-ostream-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/std-ostream-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/tree/types.hxx>
@@ -25,7 +24,7 @@ namespace xsd
&inserter_impl<C, type>,
false);
- typedef simple_type<type> simple_type;
+ typedef simple_type<C, type> simple_type;
register_type (
typeid (simple_type),
&inserter_impl<C, simple_type>,
@@ -211,9 +210,9 @@ namespace xsd
template <typename C>
void std_ostream_map<C>::
- register_type (const type_id& tid, inserter i, bool override)
+ register_type (const type_id& tid, inserter i, bool replace)
{
- if (override || type_map_.find (&tid) == type_map_.end ())
+ if (replace || type_map_.find (&tid) == type_map_.end ())
type_map_[&tid] = i;
}
diff --git a/xsd/libxsd/xsd/cxx/tree/std-ostream-operators.hxx b/xsd/libxsd/xsd/cxx/tree/std-ostream-operators.hxx
index a7ab357..9a8f976 100644
--- a/xsd/libxsd/xsd/cxx/tree/std-ostream-operators.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/std-ostream-operators.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/std-ostream-operators.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_STD_OSTREAM_OPERATORS_HXX
@@ -25,6 +24,7 @@ namespace xsd
inline std::basic_ostream<C>&
operator<< (std::basic_ostream<C>& os, const type&)
{
+ // Not printing DOM content even if it's there.
return os;
}
@@ -33,8 +33,11 @@ namespace xsd
//
template <typename C, typename B>
inline std::basic_ostream<C>&
- operator<< (std::basic_ostream<C>& os, const simple_type<B>&)
+ operator<< (std::basic_ostream<C>& os, const simple_type<C, B>& x)
{
+ if (!x.null_content ())
+ os << x.text_content ();
+
return os;
}
diff --git a/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.hxx b/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.hxx
index dd4c79a..f57c435 100644
--- a/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.hxx
@@ -1,15 +1,16 @@
// file : xsd/cxx/tree/stream-extraction-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_STREAM_EXTRACTION_MAP_HXX
#define XSD_CXX_TREE_STREAM_EXTRACTION_MAP_HXX
#include <map>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/istream.hxx>
#include <xsd/cxx/xml/qualified-name.hxx>
@@ -24,7 +25,7 @@ namespace xsd
struct stream_extraction_map
{
typedef xml::qualified_name<C> qualified_name;
- typedef std::auto_ptr<type> (*extractor) (
+ typedef XSD_AUTO_PTR<type> (*extractor) (
istream<S>&, flags, container*);
public:
@@ -33,12 +34,12 @@ namespace xsd
void
register_type (const qualified_name& name,
extractor,
- bool override = true);
+ bool replace = true);
void
unregister_type (const qualified_name& name);
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
extract (istream<S>&, flags, container*);
public:
@@ -82,7 +83,7 @@ namespace xsd
//
//
template<typename S, typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
extractor_impl (istream<S>&, flags, container*);
diff --git a/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx b/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx
index a4e429e..61dd306 100644
--- a/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/stream-extraction-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/stream-extraction-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/tree/types.hxx>
@@ -31,7 +30,7 @@ namespace xsd
&extractor_impl<S, type>,
false);
- typedef simple_type<type> simple_type;
+ typedef simple_type<C, type> simple_type;
register_type (
qualified_name (bits::any_simple_type<C> (), xsd),
&extractor_impl<S, simple_type>,
@@ -219,9 +218,9 @@ namespace xsd
void stream_extraction_map<S, C>::
register_type (const qualified_name& name,
extractor e,
- bool override)
+ bool replace)
{
- if (override || type_map_.find (name) == type_map_.end ())
+ if (replace || type_map_.find (name) == type_map_.end ())
type_map_[name] = e;
}
@@ -233,11 +232,34 @@ namespace xsd
}
template <typename S, typename C>
- std::auto_ptr<type> stream_extraction_map<S, C>::
+ XSD_AUTO_PTR<type> stream_extraction_map<S, C>::
extract (istream<S>& s, flags f, container* c)
{
- std::basic_string<C> name, ns;
- s >> ns >> name;
+ std::basic_string<C> ns, name;
+
+ // The namespace and name strings are pooled.
+ //
+ std::size_t id;
+ istream_common::as_size<std::size_t> as_size (id);
+ s >> as_size;
+
+ if (id != 0)
+ s.pool_string (id, ns);
+ else
+ {
+ s >> ns;
+ s.pool_add (ns);
+ }
+
+ s >> as_size;
+
+ if (id != 0)
+ s.pool_string (id, name);
+ else
+ {
+ s >> name;
+ s.pool_add (name);
+ }
if (extractor e = find (qualified_name (name, ns)))
{
@@ -280,10 +302,10 @@ namespace xsd
//
//
template<typename S, typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
extractor_impl (istream<S>& s, flags f, container* c)
{
- return std::auto_ptr<type> (new T (s, f, c));
+ return XSD_AUTO_PTR<type> (new T (s, f, c));
}
diff --git a/xsd/libxsd/xsd/cxx/tree/stream-extraction.hxx b/xsd/libxsd/xsd/cxx/tree/stream-extraction.hxx
index f82042f..ee39bcc 100644
--- a/xsd/libxsd/xsd/cxx/tree/stream-extraction.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/stream-extraction.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/stream-extraction.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_STREAM_EXTRACTION_HXX
@@ -29,12 +28,18 @@ namespace xsd
// simple_type
//
- template <typename B>
+ template <typename C, typename B>
template <typename S>
- inline simple_type<B>::
+ inline simple_type<C, B>::
simple_type (istream<S>& s, flags f, container* c)
- : type (s, f, c)
+ : type (s, f & ~flags::extract_content, c)
{
+ if (f & flags::extract_content)
+ {
+ std::basic_string<C> t;
+ s >> t;
+ this->content_.reset (new text_content_type (t));
+ }
}
// fundamental_base
@@ -55,7 +60,7 @@ namespace xsd
template <typename S>
list<T, C, ST, false>::
list (istream<S>& s, flags f, container* c)
- : sequence<T> (f, c)
+ : sequence<T> (c)
{
std::size_t size;
istream_common::as_size<std::size_t> as_size (size);
@@ -66,18 +71,15 @@ namespace xsd
this->reserve (size);
while (size--)
- {
- std::auto_ptr<T> p (new T (s, f, c));
- this->push_back (p);
- }
+ this->push_back (traits<T, C, ST>::create (s, f, c));
}
}
template <typename T, typename C, schema_type::value ST>
template <typename S>
list<T, C, ST, true>::
- list (istream<S>& s, flags f, container* c)
- : sequence<T> (f, c)
+ list (istream<S>& s, flags, container* c)
+ : sequence<T> (c)
{
std::size_t size;
istream_common::as_size<std::size_t> as_size (size);
diff --git a/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.hxx b/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.hxx
index e26a3da..c8a113b 100644
--- a/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/stream-insertion-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_STREAM_INSERTION_MAP_HXX
@@ -34,7 +33,7 @@ namespace xsd
register_type (const type_id&,
const qualified_name& name,
inserter,
- bool override = true);
+ bool replace = true);
void
unregister_type (const type_id&);
diff --git a/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx b/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx
index 07bfa8b..78fbacb 100644
--- a/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/stream-insertion-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/stream-insertion-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/tree/types.hxx>
@@ -32,7 +31,7 @@ namespace xsd
&inserter_impl<S, type>,
false);
- typedef simple_type<type> simple_type;
+ typedef simple_type<C, type> simple_type;
register_type (
typeid (simple_type),
qualified_name (bits::any_simple_type<C> (), xsd),
@@ -248,9 +247,9 @@ namespace xsd
register_type (const type_id& tid,
const qualified_name& name,
inserter i,
- bool override)
+ bool replace)
{
- if (override || type_map_.find (&tid) == type_map_.end ())
+ if (replace || type_map_.find (&tid) == type_map_.end ())
type_map_[&tid] = type_info (name, i);
}
@@ -269,7 +268,24 @@ namespace xsd
{
const qualified_name& qn (ti->name ());
- s << qn.namespace_ () << qn.name ();
+ // Pool the namespace and name strings.
+ //
+ const std::basic_string<C>& ns (qn.namespace_ ());
+ const std::basic_string<C>& n (qn.name ());
+
+ std::size_t ns_id (s.pool_string (ns));
+ std::size_t n_id (s.pool_string (n));
+
+ s << ostream_common::as_size<std::size_t> (ns_id);
+
+ if (ns_id == 0)
+ s << ns;
+
+ s << ostream_common::as_size<std::size_t> (n_id);
+
+ if (n_id == 0)
+ s << n;
+
ti->inserter () (s, x);
}
else
diff --git a/xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx b/xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx
index c345e80..b04846f 100644
--- a/xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/stream-insertion.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/stream-insertion.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_STREAM_INSERTION_HXX
@@ -24,15 +23,19 @@ namespace xsd
inline ostream<S>&
operator<< (ostream<S>& s, const type&)
{
+ // Not saving DOM content even if it's there.
return s;
}
// simple_type
//
- template <typename S, typename B>
+ template <typename S, typename C, typename B>
inline ostream<S>&
- operator<< (ostream<S>& s, const simple_type<B>&)
+ operator<< (ostream<S>& s, const simple_type<C, B>& x)
{
+ if (!x.null_content ())
+ s << x.text_content ();
+
return s;
}
diff --git a/xsd/libxsd/xsd/cxx/tree/text.hxx b/xsd/libxsd/xsd/cxx/tree/text.hxx
index 15f12dc..8808787 100644
--- a/xsd/libxsd/xsd/cxx/tree/text.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/text.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/text.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_TEXT_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/text.txx b/xsd/libxsd/xsd/cxx/tree/text.txx
index 2d83c71..6764d5c 100644
--- a/xsd/libxsd/xsd/cxx/tree/text.txx
+++ b/xsd/libxsd/xsd/cxx/tree/text.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/text.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xercesc/dom/DOMText.hpp>
@@ -31,14 +30,7 @@ namespace xsd
n->getNextSibling () == 0)
{
DOMText* t (static_cast<DOMText*> (n));
-
- // Berkeley DB XML DOM does not implement getLength().
- //
-#ifndef DBXML_DOM
return xml::transcode<C> (t->getData (), t->getLength ());
-#else
- return xml::transcode<C> (t->getData ());
-#endif
}
std::basic_string<C> r;
@@ -51,14 +43,7 @@ namespace xsd
case DOMNode::CDATA_SECTION_NODE:
{
DOMText* t (static_cast<DOMText*> (n));
-
- // Berkeley DB XML DOM does not implement getLength().
- //
-#ifndef DBXML_DOM
r += xml::transcode<C> (t->getData (), t->getLength ());
-#else
- r += xml::transcode<C> (t->getData ());
-#endif
break;
}
case DOMNode::ELEMENT_NODE:
diff --git a/xsd/libxsd/xsd/cxx/tree/type-factory-map.hxx b/xsd/libxsd/xsd/cxx/tree/type-factory-map.hxx
index 7e849db..b2558c7 100644
--- a/xsd/libxsd/xsd/cxx/tree/type-factory-map.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/type-factory-map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/type-factory-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_TYPE_FACTORY_MAP_HXX
@@ -8,11 +7,13 @@
#include <map>
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr/unique_ptr
#include <cstddef> // std::size_t
#include <xercesc/dom/DOMElement.hpp>
+#include <xsd/cxx/config.hxx> // XSD_AUTO_PTR
+
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/xml/qualified-name.hxx>
@@ -26,16 +27,16 @@ namespace xsd
struct type_factory_map
{
typedef xml::qualified_name<C> qualified_name;
- typedef std::auto_ptr<type> (*factory) (const xercesc::DOMElement&,
- flags,
- container*);
+ typedef XSD_AUTO_PTR<type> (*factory) (const xercesc::DOMElement&,
+ flags,
+ container*);
public:
type_factory_map ();
void
register_type (const qualified_name& name,
factory,
- bool override = true);
+ bool replace = true);
void
unregister_type (const qualified_name& name);
@@ -49,7 +50,7 @@ namespace xsd
unregister_element (const qualified_name& root,
const qualified_name& subst);
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
create (const C* name, // element name
const C* ns, // element namespace
factory static_type,
@@ -66,7 +67,7 @@ namespace xsd
private:
template <typename T>
- static std::auto_ptr<type>
+ static XSD_AUTO_PTR<type>
traits_adapter (const xercesc::DOMElement&, flags, container*);
private:
@@ -132,7 +133,7 @@ namespace xsd
//
//
template<typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
factory_impl (const xercesc::DOMElement&, flags, container*);
//
diff --git a/xsd/libxsd/xsd/cxx/tree/type-factory-map.txx b/xsd/libxsd/xsd/cxx/tree/type-factory-map.txx
index b9e0a06..e1fe0cc 100644
--- a/xsd/libxsd/xsd/cxx/tree/type-factory-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/type-factory-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/type-factory-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xercesc/validators/schema/SchemaSymbols.hpp>
@@ -38,7 +37,7 @@ namespace xsd
&factory_impl<type>,
false);
- typedef simple_type<type> simple_type;
+ typedef simple_type<C, type> simple_type;
register_type (
qualified_name (bits::any_simple_type<C> (), xsd),
&factory_impl<simple_type>,
@@ -226,9 +225,9 @@ namespace xsd
void type_factory_map<C>::
register_type (const qualified_name& name,
factory f,
- bool override)
+ bool replace)
{
- if (override || type_map_.find (name) == type_map_.end ())
+ if (replace || type_map_.find (name) == type_map_.end ())
type_map_[name] = f;
}
@@ -273,7 +272,7 @@ namespace xsd
}
template <typename C>
- std::auto_ptr<type> type_factory_map<C>::
+ XSD_AUTO_PTR<type> type_factory_map<C>::
create (const C* name,
const C* ns,
factory static_type,
@@ -307,7 +306,7 @@ namespace xsd
}
if (f == 0)
- return std::auto_ptr<type> (0); // No match.
+ return XSD_AUTO_PTR<type> (); // No match.
// Check for xsi:type
//
@@ -326,11 +325,10 @@ namespace xsd
template <typename C>
template <typename T>
- std::auto_ptr<type> type_factory_map<C>::
+ XSD_AUTO_PTR<type> type_factory_map<C>::
traits_adapter (const xercesc::DOMElement& e, flags f, container* c)
{
- std::auto_ptr<T> r (traits<T, C>::create (e, f, c));
- return std::auto_ptr<type> (r.release ());
+ return XSD_AUTO_PTR<type> (traits<T, C>::create (e, f, c));
}
template <typename C>
@@ -428,10 +426,10 @@ namespace xsd
//
//
template<typename T>
- std::auto_ptr<type>
+ XSD_AUTO_PTR<type>
factory_impl (const xercesc::DOMElement& e, flags f, container* c)
{
- return std::auto_ptr<type> (new T (e, f, c));
+ return XSD_AUTO_PTR<type> (new T (e, f, c));
}
//
diff --git a/xsd/libxsd/xsd/cxx/tree/type-serializer-map.hxx b/xsd/libxsd/xsd/cxx/tree/type-serializer-map.hxx
index 491ad3b..f461b7d 100644
--- a/xsd/libxsd/xsd/cxx/tree/type-serializer-map.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/type-serializer-map.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/type-serializer-map.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_TYPE_SERIALIZER_MAP_HXX
@@ -16,6 +15,7 @@
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/xml/qualified-name.hxx>
+#include <xsd/cxx/xml/dom/auto-ptr.hxx>
#include <xsd/cxx/xml/dom/serialization-header.hxx> // namespace_infomap
namespace xsd
@@ -35,7 +35,7 @@ namespace xsd
register_type (const type_id&,
const qualified_name& name,
serializer,
- bool override = true);
+ bool replace = true);
void
unregister_type (const type_id&);
@@ -70,7 +70,7 @@ namespace xsd
// Create DOMDocument with root element suitable for serializing
// x into it.
//
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
serialize (const C* name, // element name
const C* ns, // element namespace
const xml::dom::namespace_infomap<C>&,
diff --git a/xsd/libxsd/xsd/cxx/tree/type-serializer-map.txx b/xsd/libxsd/xsd/cxx/tree/type-serializer-map.txx
index 859331f..44a2204 100644
--- a/xsd/libxsd/xsd/cxx/tree/type-serializer-map.txx
+++ b/xsd/libxsd/xsd/cxx/tree/type-serializer-map.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/type-serializer-map.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xercesc/util/XMLUni.hpp>
@@ -12,8 +11,6 @@
#include <xsd/cxx/tree/types.hxx>
#include <xsd/cxx/tree/bits/literals.hxx>
-#include <iostream>
-
namespace xsd
{
namespace cxx
@@ -39,7 +36,7 @@ namespace xsd
&serializer_impl<type>,
false);
- typedef simple_type<type> simple_type;
+ typedef simple_type<C, type> simple_type;
register_type (
typeid (simple_type),
qualified_name (bits::any_simple_type<C> (), xsd),
@@ -255,9 +252,9 @@ namespace xsd
register_type (const type_id& tid,
const qualified_name& name,
serializer s,
- bool override)
+ bool replace)
{
- if (override || type_map_.find (&tid) == type_map_.end ())
+ if (replace || type_map_.find (&tid) == type_map_.end ())
type_map_[&tid] = type_info (name, s);
}
@@ -399,7 +396,7 @@ namespace xsd
}
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument> type_serializer_map<C>::
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument> type_serializer_map<C>::
serialize (const C* name,
const C* ns,
const xml::dom::namespace_infomap<C>& m,
diff --git a/xsd/libxsd/xsd/cxx/tree/types.hxx b/xsd/libxsd/xsd/cxx/tree/types.hxx
index 299824f..288a291 100644
--- a/xsd/libxsd/xsd/cxx/tree/types.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/types.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/types.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
/**
@@ -272,6 +271,29 @@ namespace xsd
}
};
+ /**
+ * @brief %string comparison operator.
+ *
+ * @return True if the strings are equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator== (const string<C, B>& a, const string<C, B>& b)
+ {
+ return static_cast<const std::basic_string<C>&> (a) == b;
+ }
+
+ /**
+ * @brief %string comparison operator.
+ *
+ * @return True if the strings are not equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator!= (const string<C, B>& a, const string<C, B>& b)
+ {
+ return !(a == b);
+ }
/**
* @brief Class corresponding to the XML Schema normalizedString
@@ -1014,7 +1036,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
nmtokens ()
- : base_type (0, this)
+ : base_type (this)
{
}
@@ -1120,6 +1142,31 @@ namespace xsd
//@}
};
+ /**
+ * @brief %nmtokens comparison operator.
+ *
+ * @return True if the lists of nmtokens are equal, false otherwise.
+ */
+ template <typename C, typename B, typename nmtoken>
+ inline bool
+ operator== (const nmtokens<C, B, nmtoken>& a,
+ const nmtokens<C, B, nmtoken>& b)
+ {
+ return static_cast<const list<nmtoken, C>&> (a) == b;
+ }
+
+ /**
+ * @brief %nmtokens comparison operator.
+ *
+ * @return True if the lists of nmtokens are not equal, false otherwise.
+ */
+ template <typename C, typename B, typename nmtoken>
+ inline bool
+ operator!= (const nmtokens<C, B, nmtoken>& a,
+ const nmtokens<C, B, nmtoken>& b)
+ {
+ return !(a == b);
+ }
/**
* @brief Class corresponding to the XML Schema Name built-in
@@ -2076,20 +2123,7 @@ namespace xsd
virtual void
_container (container*);
- // The above override also hides other _container versions. We
- // also cannot do using-declarations because of bugs in HP aCC3.
- //
- const container*
- _container () const
- {
- return B::_container ();
- }
-
- container*
- _container ()
- {
- return B::_container ();
- }
+ using B::_container;
//@endcond
@@ -2483,7 +2517,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
idrefs ()
- : base_type (0, this)
+ : base_type (this)
{
}
@@ -2589,6 +2623,29 @@ namespace xsd
//@}
};
+ /**
+ * @brief %idrefs comparison operator.
+ *
+ * @return True if the lists of idrefs are equal, false otherwise.
+ */
+ template <typename C, typename B, typename idref>
+ inline bool
+ operator== (const idrefs<C, B, idref>& a, const idrefs<C, B, idref>& b)
+ {
+ return static_cast<const list<idref, C>&> (a) == b;
+ }
+
+ /**
+ * @brief %idrefs comparison operator.
+ *
+ * @return True if the lists of idrefs are not equal, false otherwise.
+ */
+ template <typename C, typename B, typename idref>
+ inline bool
+ operator!= (const idrefs<C, B, idref>& a, const idrefs<C, B, idref>& b)
+ {
+ return !(a == b);
+ }
/**
* @brief Class corresponding to the XML Schema anyURI built-in
@@ -2825,6 +2882,29 @@ namespace xsd
friend class qname;
};
+ /**
+ * @brief %uri comparison operator.
+ *
+ * @return True if the uris are equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator== (const uri<C, B>& a, const uri<C, B>& b)
+ {
+ return static_cast<const std::basic_string<C>&> (a) == b;
+ }
+
+ /**
+ * @brief %uri comparison operator.
+ *
+ * @return True if the uris are not equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator!= (const uri<C, B>& a, const uri<C, B>& b)
+ {
+ return !(a == b);
+ }
/**
* @brief Class corresponding to the XML Schema QName built-in
@@ -3225,6 +3305,29 @@ namespace xsd
decode (const XMLCh*);
};
+ /**
+ * @brief %base64_binary comparison operator.
+ *
+ * @return True if the binaries are equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator== (const base64_binary<C, B>& a, const base64_binary<C, B>& b)
+ {
+ return static_cast<const buffer<C>&> (a) == b;
+ }
+
+ /**
+ * @brief %base64_binary comparison operator.
+ *
+ * @return True if the binaries are not equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator!= (const base64_binary<C, B>& a, const base64_binary<C, B>& b)
+ {
+ return !(a == b);
+ }
/**
* @brief Class corresponding to the XML Schema hexBinary
@@ -3418,6 +3521,29 @@ namespace xsd
decode (const XMLCh*);
};
+ /**
+ * @brief %hex_binary comparison operator.
+ *
+ * @return True if the binaries are equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator== (const hex_binary<C, B>& a, const hex_binary<C, B>& b)
+ {
+ return static_cast<const buffer<C>&> (a) == b;
+ }
+
+ /**
+ * @brief %hex_binary comparison operator.
+ *
+ * @return True if the binaries are not equal, false otherwise.
+ */
+ template <typename C, typename B>
+ inline bool
+ operator!= (const hex_binary<C, B>& a, const hex_binary<C, B>& b)
+ {
+ return !(a == b);
+ }
/**
* @brief Class corresponding to the XML Schema ENTITY built-in
@@ -3677,7 +3803,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
entities ()
- : base_type (0, this)
+ : base_type (this)
{
}
@@ -3782,6 +3908,32 @@ namespace xsd
container* c = 0);
//@}
};
+
+ /**
+ * @brief %entities comparison operator.
+ *
+ * @return True if the lists of entities are equal, false otherwise.
+ */
+ template <typename C, typename B, typename entity>
+ inline bool
+ operator== (const entities<C, B, entity>& a,
+ const entities<C, B, entity>& b)
+ {
+ return static_cast<const list<entity, C>&> (a) == b;
+ }
+
+ /**
+ * @brief %entities comparison operator.
+ *
+ * @return True if the lists of entities are not equal, false otherwise.
+ */
+ template <typename C, typename B, typename entity>
+ inline bool
+ operator!= (const entities<C, B, entity>& a,
+ const entities<C, B, entity>& b)
+ {
+ return !(a == b);
+ }
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/tree/types.txx b/xsd/libxsd/xsd/cxx/tree/types.txx
index 8d6d79f..8696171 100644
--- a/xsd/libxsd/xsd/cxx/tree/types.txx
+++ b/xsd/libxsd/xsd/cxx/tree/types.txx
@@ -1,13 +1,17 @@
// file : xsd/cxx/tree/types.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xercesc/util/Base64.hpp>
#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XercesVersion.hpp>
-#include <xsd/cxx/auto-array.hxx>
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
#include <xsd/cxx/xml/std-memory-manager.hxx>
@@ -168,11 +172,6 @@ namespace xsd
return *this;
}
- // It would have been cleaner to mention empty and _container
- // with the using-declaration but HP aCC3 can't handle it in
- // some non-trivial to track down cases. So we are going to use
- // the old-n-ugly this-> techniques.
- //
template <typename C, typename B>
void id<C, B>::
_container (container* c)
@@ -211,11 +210,6 @@ namespace xsd
return new idref (*this, f, c);
}
- // It would have been cleaner to mention empty, _root, etc. with
- // the using-declaration but HP aCC3 can't handle it in some
- // non-trivial to track down cases. So we are going to use the
- // old-n-ugly this-> techniques.
- //
template <typename C, typename B, typename T>
const _type* idref<C, B, T>::
get_ () const
@@ -321,52 +315,24 @@ namespace xsd
return new base64_binary (*this, f, c);
}
- // It would have been cleaner to mention size, and data with the
- // using-declaration but HP aCC3 can't handle it in some non-
- // trivial to track down cases. So we are going to use the
- // old-n- ugly this-> techniques.
- //
template <typename C, typename B>
std::basic_string<C> base64_binary<C, B>::
encode () const
{
- // HP aCC3 cannot handle using namespace xercesc;
- //
- using xercesc::Base64;
+ using namespace xercesc;
std::basic_string<C> str;
-#if _XERCES_VERSION >= 30000
XMLSize_t n;
-
xml::std_memory_manager mm;
- auto_array<XMLByte, xml::std_memory_manager> r (
- Base64::encode (
- reinterpret_cast<const XMLByte*> (this->data ()),
- static_cast<XMLSize_t> (this->size ()),
- &n,
- &mm),
- mm);
- if (r)
- {
- str.reserve (n + 1);
- str.resize (n);
-
- for (XMLSize_t i (0); i < n; ++i)
- str[i] = C (r[i]);
- }
- else
- {
- //@@ throw
- }
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLByte[], xml::std_memory_manager&> r (
#else
- unsigned int n;
-
- xml::std_memory_manager mm;
auto_array<XMLByte, xml::std_memory_manager> r (
+#endif
Base64::encode (
reinterpret_cast<const XMLByte*> (this->data ()),
- static_cast<unsigned int> (this->size ()),
+ static_cast<XMLSize_t> (this->size ()),
&n,
&mm),
mm);
@@ -376,14 +342,13 @@ namespace xsd
str.reserve (n + 1);
str.resize (n);
- for (unsigned int i (0); i < n; ++i)
+ for (XMLSize_t i (0); i < n; ++i)
str[i] = C (r[i]);
}
else
{
//@@ throw
}
-#endif
return str;
}
@@ -392,28 +357,18 @@ namespace xsd
void base64_binary<C, B>::
decode (const XMLCh* src)
{
- // HP aCC3 cannot handle using namespace xercesc;
- //
- using xercesc::Base64;
+ using namespace xercesc;
xml::std_memory_manager mm;
-
- // Xerces 2.6.0 and earlier do not have decodeToXMLByte which
- // makes my life harder and your code slower.
- //
-#if _XERCES_VERSION >= 20700
-
-#if _XERCES_VERSION >= 30000
XMLSize_t size;
- auto_array<XMLByte, xml::std_memory_manager> data (
- Base64::decodeToXMLByte (src, &size, &mm, Base64::Conf_RFC2045),
- mm);
+
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLByte[], xml::std_memory_manager&> data (
#else
- unsigned int size;
auto_array<XMLByte, xml::std_memory_manager> data (
+#endif
Base64::decodeToXMLByte (src, &size, &mm, Base64::Conf_RFC2045),
- mm);
-#endif // _XERCES_VERSION >= 30000
+ mm);
if (data)
{
@@ -425,30 +380,6 @@ namespace xsd
{
//@@ throw
}
-#else
- unsigned int size;
-
-#if _XERCES_VERSION >= 20600 // Xerces 2.5.0 does not have Conf_RFC2045.
- auto_array<XMLCh, xml::std_memory_manager> data (
- Base64::decode (src, &size, &mm, Base64::Conf_RFC2045),
- mm);
-#else
- auto_array<XMLCh, xml::std_memory_manager> data (
- Base64::decode (src, &size, &mm), mm);
-#endif // _XERCES_VERSION >= 20600
-
- if (data)
- {
- buffer<C> tmp (size);
- for (unsigned int i (0); i < size; ++i)
- tmp.data ()[i] = static_cast<char> (data[i]);
- this->swap (tmp); // g++ 4.1 likes it qualified, not sure why.
- }
- else
- {
- //@@ throw
- }
-#endif //_XERCES_VERSION >= 20700
}
@@ -496,11 +427,6 @@ namespace xsd
return new hex_binary (*this, f, c);
}
- // It would have been cleaner to mention size, and data with the
- // using-declaration but HP aCC3 can't handle it in some non-
- // trivial to track down cases. So we are going to use the
- // old-n-ugly this-> techniques.
- //
template <typename C, typename B>
std::basic_string<C> hex_binary<C, B>::
encode () const
diff --git a/xsd/libxsd/xsd/cxx/tree/xdr-stream-common.hxx b/xsd/libxsd/xsd/cxx/tree/xdr-stream-common.hxx
index ebc3d22..d3b6ce1 100644
--- a/xsd/libxsd/xsd/cxx/tree/xdr-stream-common.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/xdr-stream-common.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/xdr-stream-common.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_XDR_STREAM_COMMON_HXX
diff --git a/xsd/libxsd/xsd/cxx/tree/xdr-stream-extraction.hxx b/xsd/libxsd/xsd/cxx/tree/xdr-stream-extraction.hxx
index 012c1e4..d64825b 100644
--- a/xsd/libxsd/xsd/cxx/tree/xdr-stream-extraction.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/xdr-stream-extraction.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/xdr-stream-extraction.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_XDR_STREAM_EXTRACTION_HXX
@@ -9,6 +8,19 @@
#include <rpc/types.h>
#include <rpc/xdr.h>
+// Of course BSD has to be different and name its functions u_intXX
+// instead of uintXX. Plus it does not have XX == 8.
+//
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
+# if !defined(XSD_CXX_TREE_ASSUME_SUN_XDR) && !defined(xdr_int8_t)
+# define xdr_int8_t(x, y) xdr_char(x, reinterpret_cast<char*> (y))
+# define xdr_uint8_t(x, y) xdr_u_char(x, reinterpret_cast<unsigned char*> (y))
+# define xdr_uint16_t xdr_u_int16_t
+# define xdr_uint32_t xdr_u_int32_t
+# define xdr_uint64_t xdr_u_int64_t
+# endif
+#endif
+
#include <string>
#include <xsd/cxx/tree/buffer.hxx>
@@ -249,7 +261,7 @@ namespace xsd
// Dangerous but fast.
//
x.clear ();
-
+
if (n != 0)
{
x.resize (n);
diff --git a/xsd/libxsd/xsd/cxx/tree/xdr-stream-insertion.hxx b/xsd/libxsd/xsd/cxx/tree/xdr-stream-insertion.hxx
index 00031d2..113569f 100644
--- a/xsd/libxsd/xsd/cxx/tree/xdr-stream-insertion.hxx
+++ b/xsd/libxsd/xsd/cxx/tree/xdr-stream-insertion.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/tree/xdr-stream-insertion.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_TREE_XDR_STREAM_INSERTION_HXX
@@ -9,6 +8,19 @@
#include <rpc/types.h>
#include <rpc/xdr.h>
+// Of course BSD has to be different and name its functions u_intXX
+// instead of uintXX. Plus it does not have XX == 8.
+//
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
+# if !defined(XSD_CXX_TREE_ASSUME_SUN_XDR) && !defined(xdr_int8_t)
+# define xdr_int8_t(x, y) xdr_char(x, reinterpret_cast<char*> (y))
+# define xdr_uint8_t(x, y) xdr_u_char(x, reinterpret_cast<unsigned char*> (y))
+# define xdr_uint16_t xdr_u_int16_t
+# define xdr_uint32_t xdr_u_int32_t
+# define xdr_uint64_t xdr_u_int64_t
+# endif
+#endif
+
#include <string>
#include <xsd/cxx/tree/buffer.hxx>
diff --git a/xsd/libxsd/xsd/cxx/version.hxx b/xsd/libxsd/xsd/cxx/version.hxx
index 69bd1a1..2e2312f 100644
--- a/xsd/libxsd/xsd/cxx/version.hxx
+++ b/xsd/libxsd/xsd/cxx/version.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/version.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_VERSION_HXX
@@ -23,7 +22,7 @@
// 3.0.0.b2 02999952
//
-#define XSD_STR_VERSION "3.3.0"
-#define XSD_INT_VERSION 3030000L
+#define XSD_STR_VERSION "4.0.0"
+#define XSD_INT_VERSION 4000000L
#endif // XSD_CXX_VERSION_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/bits/literals.hxx b/xsd/libxsd/xsd/cxx/xml/bits/literals.hxx
index 5b9fe99..51d08ad 100644
--- a/xsd/libxsd/xsd/cxx/xml/bits/literals.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/bits/literals.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/bits/literals.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_BITS_LITERALS_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/bits/literals.ixx b/xsd/libxsd/xsd/cxx/xml/bits/literals.ixx
index f0ec6eb..bd8f4ed 100644
--- a/xsd/libxsd/xsd/cxx/xml/bits/literals.ixx
+++ b/xsd/libxsd/xsd/cxx/xml/bits/literals.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/bits/literals.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_BITS_LITERALS_IXX
diff --git a/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.hxx b/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.hxx
index c8ab507..309e8ef 100644
--- a/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/char-iso8859-1.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_TRANSCODER
diff --git a/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.txx b/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.txx
index cbf7cd8..acef18c 100644
--- a/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.txx
+++ b/xsd/libxsd/xsd/cxx/xml/char-iso8859-1.txx
@@ -1,9 +1,14 @@
// file : xsd/cxx/xml/char-iso8859-1.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <xsd/cxx/auto-array.hxx>
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
namespace xsd
{
@@ -87,7 +92,12 @@ namespace xsd
{
const C* end (s + len);
- auto_array<XMLCh> r (new XMLCh[len + 1]);
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLCh[]> r (
+#else
+ auto_array<XMLCh> r (
+#endif
+ new XMLCh[len + 1]);
XMLCh* ir (r.get ());
for (const C* p (s); p < end; ++p)
diff --git a/xsd/libxsd/xsd/cxx/xml/char-lcp.hxx b/xsd/libxsd/xsd/cxx/xml/char-lcp.hxx
index c100bab..ce46229 100644
--- a/xsd/libxsd/xsd/cxx/xml/char-lcp.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/char-lcp.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/char-lcp.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_TRANSCODER
diff --git a/xsd/libxsd/xsd/cxx/xml/char-lcp.txx b/xsd/libxsd/xsd/cxx/xml/char-lcp.txx
index 4603537..c71d92f 100644
--- a/xsd/libxsd/xsd/cxx/xml/char-lcp.txx
+++ b/xsd/libxsd/xsd/cxx/xml/char-lcp.txx
@@ -1,13 +1,19 @@
// file : xsd/cxx/xml/char-lcp.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <cstring> // std::memcpy
#include <xercesc/util/XMLString.hpp>
-#include <xsd/cxx/auto-array.hxx>
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
+
#include <xsd/cxx/xml/std-memory-manager.hxx>
namespace xsd
@@ -21,7 +27,11 @@ namespace xsd
to (const XMLCh* s)
{
std_memory_manager mm;
+#ifdef XSD_CXX11
+ std::unique_ptr<C[], std_memory_manager&> r (
+#else
auto_array<C, std_memory_manager> r (
+#endif
xercesc::XMLString::transcode (s, &mm), mm);
return std::basic_string<C> (r.get ());
}
@@ -30,12 +40,21 @@ namespace xsd
std::basic_string<C> char_lcp_transcoder<C>::
to (const XMLCh* s, std::size_t len)
{
- auto_array<XMLCh> tmp (new XMLCh[len + 1]);
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLCh[]> tmp (
+#else
+ auto_array<XMLCh> tmp (
+#endif
+ new XMLCh[len + 1]);
std::memcpy (tmp.get (), s, len * sizeof (XMLCh));
tmp[len] = XMLCh (0);
std_memory_manager mm;
+#ifdef XSD_CXX11
+ std::unique_ptr<C[], std_memory_manager&> r (
+#else
auto_array<C, std_memory_manager> r (
+#endif
xercesc::XMLString::transcode (tmp.get (), &mm), mm);
tmp.reset ();
diff --git a/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx b/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx
index 719881b..afc923a 100644
--- a/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/char-utf8.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_TRANSCODER
diff --git a/xsd/libxsd/xsd/cxx/xml/char-utf8.txx b/xsd/libxsd/xsd/cxx/xml/char-utf8.txx
index 9935daf..a6511be 100644
--- a/xsd/libxsd/xsd/cxx/xml/char-utf8.txx
+++ b/xsd/libxsd/xsd/cxx/xml/char-utf8.txx
@@ -1,9 +1,14 @@
// file : xsd/cxx/xml/char-utf8.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <xsd/cxx/auto-array.hxx>
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
namespace xsd
{
@@ -184,7 +189,12 @@ namespace xsd
if (!valid)
throw invalid_utf8_string ();
- auto_array<XMLCh> r (new XMLCh[rl + 1]);
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLCh[]> r (
+#else
+ auto_array<XMLCh> r (
+#endif
+ new XMLCh[rl + 1]);
XMLCh* ir (r.get ());
unsigned int u (0); // Four byte UCS-4 char.
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx b/xsd/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx
index f22e652..fc8f194 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx
@@ -1,11 +1,18 @@
// file : xsd/cxx/xml/dom/auto-ptr.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_AUTO_PTR_HXX
#define XSD_CXX_XML_DOM_AUTO_PTR_HXX
+#include <xsd/cxx/config.hxx> // XSD_CXX11_*
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+# include <utility> // std::move
+# include <type_traits> // std::remove_const
+#endif
+
namespace xsd
{
namespace cxx
@@ -14,9 +21,73 @@ namespace xsd
{
namespace dom
{
- // Simple auto_ptr version that calls release() instead of delete.
- //
+#ifdef XSD_CXX11
+ template <typename T>
+ struct deleter
+ {
+ void
+ operator() (T* p) const
+ {
+ if (p != 0)
+ const_cast<typename std::remove_const<T>::type*> (p)->release ();
+ }
+ };
+
+#ifdef XSD_CXX11_TEMPLATE_ALIAS
+ template <typename T>
+ using unique_ptr = std::unique_ptr<T, deleter<T>>;
+#else
+ template <typename T>
+ class unique_ptr: public std::unique_ptr<T, deleter<T>>
+ {
+ public:
+ typedef std::unique_ptr<T, deleter<T>> base;
+
+ typedef typename base::pointer pointer;
+ typedef T element_type;
+ typedef deleter<T> deleter_type;
+
+ unique_ptr (): base () {}
+ explicit unique_ptr (pointer p): base (p) {}
+ unique_ptr (pointer p, const deleter_type& d): base (p, d) {}
+ unique_ptr (pointer p, deleter_type&& d): base (p, std::move (d)) {}
+ unique_ptr (unique_ptr&& p): base (std::move (p)) {}
+ template <class T1>
+ unique_ptr (unique_ptr<T1>&& p): base (std::move (p)) {}
+ template <class T1>
+ unique_ptr (std::auto_ptr<T1>&& p): base (std::move (p)) {}
+
+ unique_ptr& operator= (unique_ptr&& p)
+ {
+ static_cast<base&> (*this) = std::move (p);
+ return *this;
+ }
+ template <class T1>
+ unique_ptr& operator= (unique_ptr<T1>&& p)
+ {
+ static_cast<base&> (*this) = std::move (p);
+ return *this;
+ }
+
+#ifdef XSD_CXX11_NULLPTR
+ unique_ptr (std::nullptr_t p): base (p) {}
+
+ unique_ptr& operator= (std::nullptr_t p)
+ {
+ static_cast<base&> (*this) = p;
+ return *this;
+ }
+#endif
+ };
+#endif // XSD_CXX11_TEMPLATE_ALIAS
+
+#define XSD_DOM_AUTO_PTR xsd::cxx::xml::dom::unique_ptr
+
+#else
+ // Simple auto_ptr version for C++98 that calls release() instead
+ // of delete.
+ //
template <typename T>
struct remove_c
{
@@ -150,6 +221,10 @@ namespace xsd
private:
T* x_;
};
+
+#define XSD_DOM_AUTO_PTR xsd::cxx::xml::dom::auto_ptr
+
+#endif // XSD_CXX11
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.hxx b/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.hxx
index 83e9a7e..01111e1 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/bits/error-handler-proxy.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_BITS_ERROR_HANDLER_PROXY_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx b/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx
index 23e71cd..7e5579b 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/bits/error-handler-proxy.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/bits/error-handler-proxy.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/xml/string.hxx>
@@ -53,24 +52,12 @@ namespace xsd
xercesc::DOMLocator* loc (e.getLocation ());
-#if _XERCES_VERSION >= 30000
return eh_->handle (
transcode<C> (loc->getURI ()),
static_cast<unsigned long> (loc->getLineNumber ()),
static_cast<unsigned long> (loc->getColumnNumber ()),
s,
transcode<C> (e.getMessage ()));
-#else
- XMLSSize_t l (loc->getLineNumber ());
- XMLSSize_t c (loc->getColumnNumber ());
-
- return eh_->handle (
- transcode<C> (loc->getURI ()),
- (l == -1 ? 0 : static_cast<unsigned long> (l)),
- (c == -1 ? 0 : static_cast<unsigned long> (c)),
- s,
- transcode<C> (e.getMessage ()));
-#endif
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/elements.hxx b/xsd/libxsd/xsd/cxx/xml/dom/elements.hxx
index e8ce8d2..613b978 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/elements.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/elements.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_ELEMENTS_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/elements.txx b/xsd/libxsd/xsd/cxx/xml/dom/elements.txx
index 540d0fb..c493676 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/elements.txx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/elements.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/elements.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/xml/string.hxx>
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/parsing-header.hxx b/xsd/libxsd/xsd/cxx/xml/dom/parsing-header.hxx
index d9a3695..f9ec033 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/parsing-header.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/parsing-header.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/parsing-header.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_PARSING_HEADER_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.hxx b/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.hxx
index 2c90cf3..fac1006 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/parsing-source.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_PARSING_SOURCE_HXX
@@ -19,7 +18,6 @@
#include <xsd/cxx/xml/elements.hxx> // properies
#include <xsd/cxx/xml/error-handler.hxx>
-
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
#include <xsd/cxx/xml/dom/elements.hxx> // name
#include <xsd/cxx/xml/dom/parsing-header.hxx>
@@ -32,30 +30,47 @@ namespace xsd
{
namespace dom
{
- // Parser state object. Can be used for parsing element, attributes,
- // or both.
+ // Parser state object. Can be used for parsing elements (and
+ // optionally text), attributes, or both.
//
template <typename C>
class parser
{
public:
- parser (const xercesc::DOMElement& e, bool ep, bool ap);
+ parser (const xercesc::DOMElement& e, bool ep, bool tp, bool ap);
+ // Content parsing.
+ //
bool
- more_elements ()
+ more_content ()
{
- return next_element_ != 0;
+ return next_content_ != 0;
}
const xercesc::DOMElement&
cur_element ()
{
- return *static_cast<const xercesc::DOMElement*> (next_element_);
+ return *static_cast<const xercesc::DOMElement*> (next_content_);
+ }
+
+ const xercesc::DOMText&
+ cur_text ()
+ {
+ return *static_cast<const xercesc::DOMText*> (next_content_);
+ }
+
+ bool
+ cur_is_text ()
+ {
+ return next_content_->getNodeType () !=
+ xercesc::DOMNode::ELEMENT_NODE;
}
void
- next_element ();
+ next_content (bool text);
+ // Attribute parsing.
+ //
bool
more_attributes ()
{
@@ -88,7 +103,7 @@ namespace xsd
private:
const xercesc::DOMElement& element_;
- const xercesc::DOMNode* next_element_;
+ const xercesc::DOMNode* next_content_;
const xercesc::DOMNamedNodeMap* a_;
XMLSize_t ai_; // Index of the next DOMAttr.
@@ -102,28 +117,28 @@ namespace xsd
const unsigned long no_muliple_imports = 0x00000800UL;
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (xercesc::InputSource&,
error_handler<C>&,
const properties<C>&,
unsigned long flags);
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (xercesc::InputSource&,
xercesc::DOMErrorHandler&,
const properties<C>&,
unsigned long flags);
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (const std::basic_string<C>& uri,
error_handler<C>&,
const properties<C>&,
unsigned long flags);
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (const std::basic_string<C>& uri,
xercesc::DOMErrorHandler&,
const properties<C>&,
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.txx b/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.txx
index 50fa285..c789fa6 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.txx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/parsing-source.txx
@@ -1,14 +1,10 @@
// file : xsd/cxx/xml/dom/parsing-source.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#if _XERCES_VERSION >= 30000
-# include <xercesc/dom/DOMLSParser.hpp>
-# include <xercesc/dom/DOMLSException.hpp>
-#else
-# include <xercesc/dom/DOMBuilder.hpp>
-#endif
+#include <xercesc/dom/DOMLSParser.hpp>
+#include <xercesc/dom/DOMLSException.hpp>
+
#include <xercesc/dom/DOMNamedNodeMap.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/dom/DOMImplementationRegistry.hpp>
@@ -33,9 +29,9 @@ namespace xsd
//
template <typename C>
parser<C>::
- parser (const xercesc::DOMElement& e, bool ep, bool ap)
+ parser (const xercesc::DOMElement& e, bool ep, bool tp, bool ap)
: element_ (e),
- next_element_ (0),
+ next_content_ (0),
a_ (0),
ai_ (0)
{
@@ -43,10 +39,21 @@ namespace xsd
if (ep)
{
- for (next_element_ = e.getFirstChild ();
- next_element_ != 0 &&
- next_element_->getNodeType () != DOMNode::ELEMENT_NODE;
- next_element_ = next_element_->getNextSibling ()) /*noop*/;
+ for (next_content_ = e.getFirstChild ();;
+ next_content_ = next_content_->getNextSibling ())
+ {
+ if (next_content_ == 0)
+ break;
+
+ DOMNode::NodeType t (next_content_->getNodeType ());
+
+ if (t == DOMNode::ELEMENT_NODE)
+ break;
+
+ if (tp && (t == DOMNode::TEXT_NODE ||
+ t == DOMNode::CDATA_SECTION_NODE))
+ break;
+ }
}
if (ap)
@@ -58,20 +65,31 @@ namespace xsd
template <typename C>
void parser<C>::
- next_element ()
+ next_content (bool tp)
{
using xercesc::DOMNode;
- for (next_element_ = next_element_->getNextSibling ();
- next_element_ != 0 &&
- next_element_->getNodeType () != DOMNode::ELEMENT_NODE;
- next_element_ = next_element_->getNextSibling ())/*noop*/;
+ for (next_content_ = next_content_->getNextSibling ();;
+ next_content_ = next_content_->getNextSibling ())
+ {
+ if (next_content_ == 0)
+ break;
+
+ DOMNode::NodeType t (next_content_->getNodeType ());
+
+ if (t == DOMNode::ELEMENT_NODE)
+ break;
+
+ if (tp && (t == DOMNode::TEXT_NODE ||
+ t == DOMNode::CDATA_SECTION_NODE))
+ break;
+ }
}
// parse()
//
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (xercesc::InputSource& is,
error_handler<C>& eh,
const properties<C>& prop,
@@ -82,28 +100,13 @@ namespace xsd
}
template <typename C>
- auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (xercesc::InputSource& is,
xercesc::DOMErrorHandler& eh,
const properties<C>& prop,
unsigned long flags)
{
- // HP aCC cannot handle using namespace xercesc;
- //
- using xercesc::DOMImplementationRegistry;
- using xercesc::DOMImplementationLS;
- using xercesc::DOMImplementation;
- using xercesc::DOMDocument;
-#if _XERCES_VERSION >= 30000
- using xercesc::DOMLSParser;
- using xercesc::DOMConfiguration;
-#else
- using xercesc::DOMBuilder;
-#endif
-
- using xercesc::Wrapper4InputSource;
- using xercesc::XMLUni;
-
+ using namespace xercesc;
// Instantiate the DOM parser.
//
@@ -116,8 +119,7 @@ namespace xsd
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
-#if _XERCES_VERSION >= 30000
- auto_ptr<DOMLSParser> parser (
+ XSD_DOM_AUTO_PTR<DOMLSParser> parser (
impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
DOMConfiguration* conf (parser->getDomConfig ());
@@ -163,7 +165,6 @@ namespace xsd
if (!(flags & no_muliple_imports))
conf->setParameter (XMLUni::fgXercesHandleMultipleImports, true);
#endif
-
// This feature checks the schema grammar for additional
// errors. We most likely do not need it when validating
// instances (assuming the schema is valid).
@@ -214,64 +215,9 @@ namespace xsd
bits::error_handler_proxy<C> ehp (eh);
conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- auto_ptr<DOMBuilder> parser (
- impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
-
- parser->setFeature (XMLUni::fgDOMComments, false);
- parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true);
- parser->setFeature (XMLUni::fgDOMEntities, false);
- parser->setFeature (XMLUni::fgDOMNamespaces, true);
- parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false);
-
- if (flags & dont_validate)
- {
- parser->setFeature (XMLUni::fgDOMValidation, false);
- parser->setFeature (XMLUni::fgXercesSchema, false);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- }
- else
- {
- parser->setFeature (XMLUni::fgDOMValidation, true);
- parser->setFeature (XMLUni::fgXercesSchema, true);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- }
-
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- if (!prop.schema_location ().empty ())
- {
- xml::string sl (prop.schema_location ());
- const void* v (sl.c_str ());
-
- parser->setProperty (
- XMLUni::fgXercesSchemaExternalSchemaLocation,
- const_cast<void*> (v));
- }
-
- if (!prop.no_namespace_schema_location ().empty ())
- {
- xml::string sl (prop.no_namespace_schema_location ());
- const void* v (sl.c_str ());
-
- parser->setProperty (
- XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
- const_cast<void*> (v));
- }
-
- bits::error_handler_proxy<C> ehp (eh);
- parser->setErrorHandler (&ehp);
-
-#endif // _XERCES_VERSION >= 30000
-
xercesc::Wrapper4InputSource wrap (&is, false);
-#if _XERCES_VERSION >= 30000
- auto_ptr<DOMDocument> doc;
-
+ XSD_DOM_AUTO_PTR<DOMDocument> doc;
try
{
doc.reset (parser->parse (&wrap));
@@ -279,9 +225,7 @@ namespace xsd
catch (const xercesc::DOMLSException&)
{
}
-#else
- auto_ptr<DOMDocument> doc (parser->parse (wrap));
-#endif
+
if (ehp.failed ())
doc.reset ();
@@ -289,7 +233,7 @@ namespace xsd
}
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (const std::basic_string<C>& uri,
error_handler<C>& eh,
const properties<C>& prop,
@@ -300,26 +244,13 @@ namespace xsd
}
template <typename C>
- auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
parse (const std::basic_string<C>& uri,
xercesc::DOMErrorHandler& eh,
const properties<C>& prop,
unsigned long flags)
{
- // HP aCC cannot handle using namespace xercesc;
- //
- using xercesc::DOMImplementationRegistry;
- using xercesc::DOMImplementationLS;
- using xercesc::DOMImplementation;
- using xercesc::DOMDocument;
-#if _XERCES_VERSION >= 30000
- using xercesc::DOMLSParser;
- using xercesc::DOMConfiguration;
-#else
- using xercesc::DOMBuilder;
-#endif
- using xercesc::XMLUni;
-
+ using namespace xercesc;
// Instantiate the DOM parser.
//
@@ -332,8 +263,7 @@ namespace xsd
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
-#if _XERCES_VERSION >= 30000
- auto_ptr<DOMLSParser> parser (
+ XSD_DOM_AUTO_PTR<DOMLSParser> parser (
impl->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0));
DOMConfiguration* conf (parser->getDomConfig ());
@@ -430,63 +360,7 @@ namespace xsd
bits::error_handler_proxy<C> ehp (eh);
conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
-#else // _XERCES_VERSION >= 30000
-
- // Same as above but for Xerces-C++ 2 series.
- //
- auto_ptr<DOMBuilder> parser (
- impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0));
-
- parser->setFeature (XMLUni::fgDOMComments, false);
- parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true);
- parser->setFeature (XMLUni::fgDOMEntities, false);
- parser->setFeature (XMLUni::fgDOMNamespaces, true);
- parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false);
-
- if (flags & dont_validate)
- {
- parser->setFeature (XMLUni::fgDOMValidation, false);
- parser->setFeature (XMLUni::fgXercesSchema, false);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- }
- else
- {
- parser->setFeature (XMLUni::fgDOMValidation, true);
- parser->setFeature (XMLUni::fgXercesSchema, true);
- parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
- }
-
- parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
-
- if (!prop.schema_location ().empty ())
- {
- xml::string sl (prop.schema_location ());
- const void* v (sl.c_str ());
-
- parser->setProperty (
- XMLUni::fgXercesSchemaExternalSchemaLocation,
- const_cast<void*> (v));
- }
-
- if (!prop.no_namespace_schema_location ().empty ())
- {
- xml::string sl (prop.no_namespace_schema_location ());
- const void* v (sl.c_str ());
-
- parser->setProperty (
- XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
- const_cast<void*> (v));
- }
-
- bits::error_handler_proxy<C> ehp (eh);
- parser->setErrorHandler (&ehp);
-
-#endif // _XERCES_VERSION >= 30000
-
-
-#if _XERCES_VERSION >= 30000
- auto_ptr<DOMDocument> doc;
-
+ XSD_DOM_AUTO_PTR<DOMDocument> doc;
try
{
doc.reset (parser->parseURI (string (uri).c_str ()));
@@ -494,10 +368,6 @@ namespace xsd
catch (const xercesc::DOMLSException&)
{
}
-#else
- auto_ptr<DOMDocument> doc (
- parser->parseURI (string (uri).c_str ()));
-#endif
if (ehp.failed ())
doc.reset ();
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.hxx b/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.hxx
index 3b879b1..a3cbff4 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/serialization-header.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_SERIALIZATION_HEADER_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.txx b/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.txx
index 3052b7e..6e58cfd 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.txx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/serialization-header.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/serialization-header.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <vector>
@@ -33,12 +32,8 @@ namespace xsd
prefix (const C* ns, xercesc::DOMElement& e, const C* hint)
{
string xns (ns);
-
-#if _XERCES_VERSION >= 30000
const XMLCh* p (e.lookupPrefix (xns.c_str ()));
-#else
- const XMLCh* p (e.lookupNamespacePrefix (xns.c_str (), false));
-#endif
+
if (p != 0)
return transcode<C> (p);
@@ -125,13 +120,7 @@ namespace xsd
void
clear (xercesc::DOMElement& e)
{
- // HP aCC cannot handle using namespace xercesc;
- //
- using xercesc::DOMNode;
- using xercesc::DOMAttr;
- using xercesc::DOMNamedNodeMap;
- using xercesc::XMLString;
- using xercesc::SchemaSymbols;
+ using namespace xercesc;
// Remove child nodes.
//
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.hxx b/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.hxx
index 325c1ec..9056917 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/serialization-source.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_SERIALIZATION_SOURCE_HXX
@@ -47,13 +46,19 @@ namespace xsd
xercesc::DOMElement&
create_element (const C* name, const C* ns, xercesc::DOMElement&);
+ // Add namespace declarations and schema locations.
+ //
+ template <typename C>
+ void
+ add_namespaces (xercesc::DOMElement&, const namespace_infomap<C>&);
+
// Serialization flags.
//
const unsigned long no_xml_declaration = 0x00010000UL;
const unsigned long dont_pretty_print = 0x00020000UL;
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
serialize (const std::basic_string<C>& root_element,
const std::basic_string<C>& root_element_namespace,
const namespace_infomap<C>& map,
@@ -62,7 +67,7 @@ namespace xsd
// This one helps Sun C++ to overcome its fears.
//
template <typename C>
- inline xml::dom::auto_ptr<xercesc::DOMDocument>
+ inline XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
serialize (const C* root_element,
const C* root_element_namespace,
const namespace_infomap<C>& map,
@@ -103,16 +108,12 @@ namespace xsd
public:
// I know, some of those consts are stupid. But that's what
- // Xerces folks put into their interfaces and VC-7.1 thinks
- // there are different signatures if one strips this fluff off.
+ // Xerces folks put into their interfaces and VC thinks there
+ // are different signatures if one strips this fluff off.
//
virtual void
writeChars (const XMLByte* const buf,
-#if _XERCES_VERSION >= 30000
const XMLSize_t size,
-#else
- const unsigned int size,
-#endif
xercesc::XMLFormatter* const)
{
// Ignore the write request if there was a stream failure and the
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.txx b/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.txx
index 2b27dd5..eed1196 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.txx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/serialization-source.txx
@@ -1,18 +1,14 @@
// file : xsd/cxx/xml/dom/serialization-source.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xercesc/util/XMLUni.hpp> // xercesc::fg*
#include <xercesc/util/XMLUniDefs.hpp> // chLatin_L, etc
#include <xercesc/validators/schema/SchemaSymbols.hpp>
-#if _XERCES_VERSION >= 30000
-# include <xercesc/dom/DOMLSOutput.hpp>
-# include <xercesc/dom/DOMLSSerializer.hpp>
-#else
-# include <xercesc/dom/DOMWriter.hpp>
-#endif
+#include <xercesc/dom/DOMLSOutput.hpp>
+#include <xercesc/dom/DOMLSSerializer.hpp>
+
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/dom/DOMImplementationRegistry.hpp>
@@ -109,70 +105,19 @@ namespace xsd
return *e;
}
-
- //
- //
template <typename C>
- auto_ptr<xercesc::DOMDocument>
- serialize (const std::basic_string<C>& el,
- const std::basic_string<C>& ns,
- const namespace_infomap<C>& map,
- unsigned long)
+ void
+ add_namespaces (xercesc::DOMElement& el,
+ const namespace_infomap<C>& map)
{
- // HP aCC cannot handle using namespace xercesc;
- //
- using xercesc::DOMImplementationRegistry;
- using xercesc::DOMImplementation;
- using xercesc::DOMDocument;
- using xercesc::DOMElement;
+ using namespace xercesc;
- //
- //
typedef std::basic_string<C> string;
typedef namespace_infomap<C> infomap;
typedef typename infomap::const_iterator infomap_iterator;
C colon (':'), space (' ');
- string prefix;
-
- if (!ns.empty ())
- {
- infomap_iterator i (map.begin ()), e (map.end ());
-
- for ( ;i != e; ++i)
- {
- if (i->second.name == ns)
- {
- prefix = i->first;
- break;
- }
- }
-
- // Since this is the first namespace in document we don't
- // need to worry about conflicts.
- //
- if (i == e)
- prefix = xml::bits::first_prefix<C> ();
- }
-
- const XMLCh ls[] = {xercesc::chLatin_L,
- xercesc::chLatin_S,
- xercesc::chNull};
-
- DOMImplementation* impl (
- DOMImplementationRegistry::getDOMImplementation (ls));
-
- auto_ptr<DOMDocument> doc (
- impl->createDocument (
- (ns.empty () ? 0 : xml::string (ns).c_str ()),
- xml::string ((prefix.empty ()
- ? el
- : prefix + colon + el)).c_str (),
- 0));
-
- DOMElement* root (doc->getDocumentElement ());
-
// Check if we need to provide xsi mapping.
//
bool xsi (false);
@@ -214,14 +159,14 @@ namespace xsd
// Empty prefix.
//
if (!i->second.name.empty ())
- root->setAttributeNS (
+ el.setAttributeNS (
xercesc::XMLUni::fgXMLNSURIName,
xml::string (xmlns_prefix).c_str (),
xml::string (i->second.name).c_str ());
}
else
{
- root->setAttributeNS (
+ el.setAttributeNS (
xercesc::XMLUni::fgXMLNSURIName,
xml::string (xmlns_prefix + colon + i->first).c_str (),
xml::string (i->second.name).c_str ());
@@ -233,7 +178,7 @@ namespace xsd
//
if (xsi)
xsi_prefix = dom::prefix (xml::bits::xsi_namespace<C> (),
- *root,
+ el,
xml::bits::xsi_prefix<C> ());
// Create xsi:schemaLocation and xsi:noNamespaceSchemaLocation
@@ -265,7 +210,7 @@ namespace xsd
if (!schema_location.empty ())
{
- root->setAttributeNS (
+ el.setAttributeNS (
xercesc::SchemaSymbols::fgURI_XSI,
xml::string (xsi_prefix + colon +
xml::bits::schema_location<C> ()).c_str (),
@@ -274,13 +219,68 @@ namespace xsd
if (!no_namespace_schema_location.empty ())
{
- root->setAttributeNS (
+ el.setAttributeNS (
xercesc::SchemaSymbols::fgURI_XSI,
xml::string (
xsi_prefix + colon +
xml::bits::no_namespace_schema_location<C> ()).c_str (),
xml::string (no_namespace_schema_location).c_str ());
}
+ }
+
+ //
+ //
+ template <typename C>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
+ serialize (const std::basic_string<C>& el,
+ const std::basic_string<C>& ns,
+ const namespace_infomap<C>& map,
+ unsigned long)
+ {
+ using namespace xercesc;
+
+ typedef std::basic_string<C> string;
+ typedef namespace_infomap<C> infomap;
+ typedef typename infomap::const_iterator infomap_iterator;
+
+ string prefix;
+
+ if (!ns.empty ())
+ {
+ infomap_iterator i (map.begin ()), e (map.end ());
+
+ for ( ;i != e; ++i)
+ {
+ if (i->second.name == ns)
+ {
+ prefix = i->first;
+ break;
+ }
+ }
+
+ // Since this is the first namespace in document we don't
+ // need to worry about conflicts.
+ //
+ if (i == e)
+ prefix = xml::bits::first_prefix<C> ();
+ }
+
+ const XMLCh ls[] = {xercesc::chLatin_L,
+ xercesc::chLatin_S,
+ xercesc::chNull};
+
+ DOMImplementation* impl (
+ DOMImplementationRegistry::getDOMImplementation (ls));
+
+ XSD_DOM_AUTO_PTR<DOMDocument> doc (
+ impl->createDocument (
+ (ns.empty () ? 0 : xml::string (ns).c_str ()),
+ xml::string ((prefix.empty ()
+ ? el
+ : prefix + C (':') + el)).c_str (),
+ 0));
+
+ add_namespaces (*doc->getDocumentElement (), map);
return doc;
}
@@ -294,18 +294,7 @@ namespace xsd
xercesc::DOMErrorHandler& eh,
unsigned long flags)
{
- // HP aCC cannot handle using namespace xercesc;
- //
- using xercesc::DOMImplementationRegistry;
- using xercesc::DOMImplementation;
-#if _XERCES_VERSION >= 30000
- using xercesc::DOMLSSerializer;
- using xercesc::DOMConfiguration;
- using xercesc::DOMLSOutput;
-#else
- using xercesc::DOMWriter;
-#endif
- using xercesc::XMLUni;
+ using namespace xercesc;
const XMLCh ls[] = {xercesc::chLatin_L,
xercesc::chLatin_S,
@@ -316,8 +305,7 @@ namespace xsd
bits::error_handler_proxy<C> ehp (eh);
-#if _XERCES_VERSION >= 30000
- xml::dom::auto_ptr<DOMLSSerializer> writer (
+ XSD_DOM_AUTO_PTR<DOMLSSerializer> writer (
impl->createLSSerializer ());
DOMConfiguration* conf (writer->getDomConfig ());
@@ -332,46 +320,27 @@ namespace xsd
if (!(flags & dont_pretty_print) &&
conf->canSetParameter (XMLUni::fgDOMWRTFormatPrettyPrint, true))
+ {
conf->setParameter (XMLUni::fgDOMWRTFormatPrettyPrint, true);
+ // Don't add extra new lines between first-level elements.
+ //
+ if (conf->canSetParameter (XMLUni::fgDOMWRTXercesPrettyPrint, true))
+ conf->setParameter (XMLUni::fgDOMWRTXercesPrettyPrint, false);
+ }
+
// See if we need to write XML declaration.
//
if ((flags & no_xml_declaration) &&
conf->canSetParameter (XMLUni::fgDOMXMLDeclaration, false))
conf->setParameter (XMLUni::fgDOMXMLDeclaration, false);
- xml::dom::auto_ptr<DOMLSOutput> out (impl->createLSOutput ());
+ XSD_DOM_AUTO_PTR<DOMLSOutput> out (impl->createLSOutput ());
out->setEncoding (xml::string (encoding).c_str ());
out->setByteStream (&target);
- bool r (writer->write (&doc, out.get ()));
-#else
- xml::dom::auto_ptr<DOMWriter> writer (impl->createDOMWriter ());
-
- writer->setErrorHandler (&ehp);
- writer->setEncoding (xml::string (encoding).c_str ());
-
- // Set some nice features if the serializer supports them.
- //
- if (writer->canSetFeature (
- XMLUni::fgDOMWRTDiscardDefaultContent, true))
- writer->setFeature (XMLUni::fgDOMWRTDiscardDefaultContent, true);
-
- if (!(flags & dont_pretty_print) &&
- writer->canSetFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true))
- writer->setFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true);
-
- // See if we need to write XML declaration.
- //
- if ((flags & no_xml_declaration) &&
- writer->canSetFeature (XMLUni::fgDOMXMLDeclaration, false))
- writer->setFeature (XMLUni::fgDOMXMLDeclaration, false);
-
- bool r (writer->writeNode (&target, doc));
-#endif
-
- if (!r || ehp.failed ())
+ if (!writer->write (&doc, out.get ()) || ehp.failed ())
return false;
return true;
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.hxx b/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.hxx
index 11d7114..95de764 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/wildcard-source.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_DOM_WILDCARD_SOURCE_HXX
@@ -19,7 +18,7 @@ namespace xsd
namespace dom
{
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
create_document ();
}
}
diff --git a/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.txx b/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.txx
index 32043c0..cce6922 100644
--- a/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.txx
+++ b/xsd/libxsd/xsd/cxx/xml/dom/wildcard-source.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/dom/wildcard-source.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xercesc/util/XMLUniDefs.hpp> // chLatin_L, etc
@@ -17,7 +16,7 @@ namespace xsd
namespace dom
{
template <typename C>
- xml::dom::auto_ptr<xercesc::DOMDocument>
+ XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
create_document ()
{
const XMLCh ls[] = {xercesc::chLatin_L,
@@ -29,7 +28,7 @@ namespace xsd
xercesc::DOMImplementation* impl (
xercesc::DOMImplementationRegistry::getDOMImplementation (ls));
- return xml::dom::auto_ptr<xercesc::DOMDocument> (
+ return XSD_DOM_AUTO_PTR<xercesc::DOMDocument> (
impl->createDocument ());
}
}
diff --git a/xsd/libxsd/xsd/cxx/xml/elements.hxx b/xsd/libxsd/xsd/cxx/xml/elements.hxx
index d9f8a50..107b36d 100644
--- a/xsd/libxsd/xsd/cxx/xml/elements.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/elements.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_ELEMENTS_HXX
@@ -8,8 +7,13 @@
#include <string>
+#include <xercesc/util/XercesVersion.hpp>
#include <xercesc/util/PlatformUtils.hpp>
+#if _XERCES_VERSION < 30000
+# error Xerces-C++ 2-series is not supported
+#endif
+
namespace xsd
{
namespace cxx
diff --git a/xsd/libxsd/xsd/cxx/xml/elements.txx b/xsd/libxsd/xsd/cxx/xml/elements.txx
index 8ba07df..37adcf0 100644
--- a/xsd/libxsd/xsd/cxx/xml/elements.txx
+++ b/xsd/libxsd/xsd/cxx/xml/elements.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/elements.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd
diff --git a/xsd/libxsd/xsd/cxx/xml/error-handler.hxx b/xsd/libxsd/xsd/cxx/xml/error-handler.hxx
index bf0b3d7..616d081 100644
--- a/xsd/libxsd/xsd/cxx/xml/error-handler.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/error-handler.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/error-handler.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_ERROR_HANDLER_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/exceptions.hxx b/xsd/libxsd/xsd/cxx/xml/exceptions.hxx
index 1ed93d8..ef1ec7a 100644
--- a/xsd/libxsd/xsd/cxx/xml/exceptions.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/exceptions.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/exceptions.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_EXCEPTIONS_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/qualified-name.hxx b/xsd/libxsd/xsd/cxx/xml/qualified-name.hxx
index 1a0e032..bfdf4f3 100644
--- a/xsd/libxsd/xsd/cxx/xml/qualified-name.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/qualified-name.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/qualified-name.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_QUALIFIED_NAME_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx b/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx
index f92b6ab..0cfacc2 100644
--- a/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/sax/bits/error-handler-proxy.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_SAX_ERROR_HANDLER_PROXY_HXX
diff --git a/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx b/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx
index f8ca26d..24b8a3d 100644
--- a/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx
+++ b/xsd/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/sax/bits/error-handler-proxy.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <xsd/cxx/xml/string.hxx>
@@ -65,22 +64,11 @@ namespace xsd
if (id == 0)
id = e.getSystemId ();
-#if _XERCES_VERSION >= 30000
eh_->handle (transcode<C> (id),
static_cast<unsigned long> (e.getLineNumber ()),
static_cast<unsigned long> (e.getColumnNumber ()),
s,
transcode<C> (e.getMessage ()));
-#else
- XMLSSize_t l (e.getLineNumber ());
- XMLSSize_t c (e.getColumnNumber ());
-
- eh_->handle (transcode<C> (id),
- (l == -1 ? 0 : static_cast<unsigned long> (l)),
- (c == -1 ? 0 : static_cast<unsigned long> (c)),
- s,
- transcode<C> (e.getMessage ()));
-#endif
}
}
}
diff --git a/xsd/libxsd/xsd/cxx/xml/sax/std-input-source.hxx b/xsd/libxsd/xsd/cxx/xml/sax/std-input-source.hxx
index 71760a9..00b2397 100644
--- a/xsd/libxsd/xsd/cxx/xml/sax/std-input-source.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/sax/std-input-source.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/sax/std-input-source.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_SAX_STD_INPUT_SOURCE_HXX
@@ -29,27 +28,14 @@ namespace xsd
{
}
-#if _XERCES_VERSION >= 30000
virtual XMLFilePos
curPos () const
{
return static_cast<XMLFilePos> (is_.tellg ());
}
-#else
- virtual unsigned int
- curPos () const
- {
- return static_cast<unsigned int> (is_.tellg ());
- }
-#endif
-#if _XERCES_VERSION >= 30000
virtual XMLSize_t
readBytes (XMLByte* const buf, const XMLSize_t size)
-#else
- virtual unsigned int
- readBytes (XMLByte* const buf, const unsigned int size)
-#endif
{
// Some implementations don't clear gcount if you
// call read() on a stream that is in the eof state.
@@ -78,25 +64,17 @@ namespace xsd
// Make sure that if we failed, readBytes won't be called
// again.
//
- if (!is_.fail ())
- {
-#if _XERCES_VERSION >= 30000
- return static_cast<XMLSize_t> (is_.gcount ());
-#else
- return static_cast<unsigned int> (is_.gcount ());
-#endif
- }
- else
- return 0;
+ return !is_.fail ()
+ ? static_cast<XMLSize_t> (is_.gcount ())
+ : 0;
}
-#if _XERCES_VERSION >= 30000
virtual const XMLCh*
getContentType () const
{
return 0;
}
-#endif
+
private:
std::istream& is_;
};
diff --git a/xsd/libxsd/xsd/cxx/xml/std-memory-manager.hxx b/xsd/libxsd/xsd/cxx/xml/std-memory-manager.hxx
index b5cfaf9..e4d6f5b 100644
--- a/xsd/libxsd/xsd/cxx/xml/std-memory-manager.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/std-memory-manager.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/std-memory-manager.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_STD_MEMORY_MANAGER_HXX
@@ -18,12 +17,10 @@ namespace xsd
class std_memory_manager: public xercesc::MemoryManager
{
public:
+ // Xerces-C++ MemoryManager interface.
+ //
virtual void*
-#if _XERCES_VERSION >= 30000
allocate(XMLSize_t size)
-#else
- allocate(size_t size)
-#endif
{
return operator new (size);
}
@@ -35,13 +32,20 @@ namespace xsd
operator delete (p);
}
-#if _XERCES_VERSION >= 30000
virtual xercesc::MemoryManager*
getExceptionMemoryManager()
{
return xercesc::XMLPlatformUtils::fgMemoryManager;
}
-#endif
+
+ // Standard deleter interface.
+ //
+ void
+ operator() (void* p) const
+ {
+ if (p)
+ operator delete (p);
+ }
};
}
}
diff --git a/xsd/libxsd/xsd/cxx/xml/string.hxx b/xsd/libxsd/xsd/cxx/xml/string.hxx
index f79e66e..9f4767b 100644
--- a/xsd/libxsd/xsd/cxx/xml/string.hxx
+++ b/xsd/libxsd/xsd/cxx/xml/string.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/string.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_STRING_HXX
@@ -9,9 +8,16 @@
#include <string>
#include <cstddef> // std::size_t
-#include <xsd/cxx/auto-array.hxx>
#include <xercesc/util/XercesDefs.hpp> // XMLCh
+#include <xsd/cxx/config.hxx> // XSD_CXX11
+
+#ifdef XSD_CXX11
+# include <memory> // std::unique_ptr
+#else
+# include <xsd/cxx/auto-array.hxx>
+#endif
+
namespace xsd
{
namespace cxx
@@ -31,9 +37,9 @@ namespace xsd
transcode (const XMLCh* s, std::size_t length);
- // For VC7.1 wchar_t and XMLCh are the same type so we cannot
- // overload the transcode name. You should not use these functions
- // anyway and instead use the xml::string class below.
+ // For VC wchar_t and XMLCh are the same type so we cannot overload
+ // the transcode name. You should not use these functions anyway and
+ // instead use the xml::string class below.
//
template <typename C>
XMLCh*
@@ -50,21 +56,16 @@ namespace xsd
public :
template <typename C>
string (const std::basic_string<C>& s)
- : s_ (transcode_to_xmlch<C> (s))
- {
- }
+ : s_ (transcode_to_xmlch<C> (s)) {}
template <typename C>
- string (const C* s)
- : s_ (transcode_to_xmlch<C> (s))
- {
- }
+ string (const C* s): s_ (transcode_to_xmlch<C> (s)) {}
const XMLCh*
- c_str () const
- {
- return s_.get ();
- }
+ c_str () const {return s_.get ();}
+
+ XMLCh*
+ release () {return s_.release ();}
private:
string (const string&);
@@ -73,7 +74,11 @@ namespace xsd
operator= (const string&);
private:
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLCh[]> s_;
+#else
auto_array<XMLCh> s_;
+#endif
};
}
}
diff --git a/xsd/libxsd/xsd/cxx/xml/string.ixx b/xsd/libxsd/xsd/cxx/xml/string.ixx
index 0f46f4d..ede125e 100644
--- a/xsd/libxsd/xsd/cxx/xml/string.ixx
+++ b/xsd/libxsd/xsd/cxx/xml/string.ixx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/string.ixx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_STRING_IXX
diff --git a/xsd/libxsd/xsd/cxx/xml/string.txx b/xsd/libxsd/xsd/cxx/xml/string.txx
index df0fb74..e6adb98 100644
--- a/xsd/libxsd/xsd/cxx/xml/string.txx
+++ b/xsd/libxsd/xsd/cxx/xml/string.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/xml/string.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_XML_STRING_TXX
@@ -47,7 +46,13 @@ namespace xsd
XMLCh* wchar_transcoder<W, 2>::
from (const W* s, std::size_t length)
{
- auto_array<XMLCh> r (new XMLCh[length + 1]);
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLCh[]> r (
+#else
+ auto_array<XMLCh> r (
+#endif
+ new XMLCh[length + 1]);
+
XMLCh* ir (r.get ());
for (std::size_t i (0); i < length; ++ir, ++i)
@@ -120,7 +125,13 @@ namespace xsd
rl += (*p & 0xFFFF0000) ? 2 : 1;
}
- auto_array<XMLCh> r (new XMLCh[rl + 1]);
+#ifdef XSD_CXX11
+ std::unique_ptr<XMLCh[]> r (
+#else
+ auto_array<XMLCh> r (
+#endif
+ new XMLCh[rl + 1]);
+
XMLCh* ir (r.get ());
for (const W* p (s); p < s + length; ++p)
diff --git a/xsd/libxsd/xsd/cxx/zc-istream.hxx b/xsd/libxsd/xsd/cxx/zc-istream.hxx
index 2ae345f..440fdd4 100644
--- a/xsd/libxsd/xsd/cxx/zc-istream.hxx
+++ b/xsd/libxsd/xsd/cxx/zc-istream.hxx
@@ -1,6 +1,5 @@
// file : xsd/cxx/zc-istream.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#ifndef XSD_CXX_ZC_ISTREAM_HXX
diff --git a/xsd/libxsd/xsd/cxx/zc-istream.txx b/xsd/libxsd/xsd/cxx/zc-istream.txx
index 8c00a5b..b37e067 100644
--- a/xsd/libxsd/xsd/cxx/zc-istream.txx
+++ b/xsd/libxsd/xsd/cxx/zc-istream.txx
@@ -1,6 +1,5 @@
// file : xsd/cxx/zc-istream.txx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
namespace xsd