diff options
Diffstat (limited to 'libxsd')
25 files changed, 404 insertions, 145 deletions
diff --git a/libxsd/.gitignore b/libxsd/.gitignore index cece09c..1c363a0 100644 --- a/libxsd/.gitignore +++ b/libxsd/.gitignore @@ -3,10 +3,16 @@ *.d *.t *.i +*.i.* *.ii +*.ii.* *.o *.obj +*.gcm +*.pcm +*.ifc *.so +*.dylib *.dll *.a *.lib diff --git a/libxsd/INSTALL b/libxsd/INSTALL deleted file mode 100644 index 181de1b..0000000 --- a/libxsd/INSTALL +++ /dev/null @@ -1,6 +0,0 @@ -The easiest way to build this package is with the bpkg package manager: - -$ bpkg build libxsd - -But if you don't want to use the package manager, then you can also build it -manually using the standard build2 build system. diff --git a/libxsd/NEWS b/libxsd/NEWS index c51e267..0fae0f8 100644..120000 --- a/libxsd/NEWS +++ b/libxsd/NEWS @@ -1 +1 @@ -See the common NEWS file in the XSD compiler package. +../NEWS
\ No newline at end of file diff --git a/libxsd/PACKAGE-README.md b/libxsd/PACKAGE-README.md new file mode 120000 index 0000000..422e63f --- /dev/null +++ b/libxsd/PACKAGE-README.md @@ -0,0 +1 @@ +../PACKAGE-README.md
\ No newline at end of file diff --git a/libxsd/README b/libxsd/README deleted file mode 100644 index 00f8e1d..0000000 --- a/libxsd/README +++ /dev/null @@ -1,13 +0,0 @@ -libxsd is a runtime library for language mappings generated by CodeSynthesis -XSD, a W3C XML Schema to C++ data binding compiler. - -See the LICENSE file for distribution conditions. - -See the INSTALL file for prerequisites and installation instructions. - -See the doc/ directory for documentation. - -The project page is at https://www.codesynthesis.com/projects/xsd/ - -Send bug reports or any other feedback to the xsd-users@codesynthesis.com -mailing list. diff --git a/libxsd/README-GIT b/libxsd/README-GIT deleted file mode 100644 index bbc5b4c..0000000 --- a/libxsd/README-GIT +++ /dev/null @@ -1,4 +0,0 @@ -The checked out xsd/cxx/version.hxx will be overwritten during the build -process but these changes should be ignored. To do this automatically, run: - -git update-index --assume-unchanged xsd/cxx/version.hxx diff --git a/libxsd/README.md b/libxsd/README.md new file mode 100644 index 0000000..c0afe68 --- /dev/null +++ b/libxsd/README.md @@ -0,0 +1,12 @@ +# libxsd - runtime library for XML Schema to C++ data binding compiler + +XSD is an open-source, cross-platform XML Schema to C++ data binding +compiler. Provided with an XML document specification (XML Schema), it +generates C++ classes that represent the given vocabulary as well as XML +parsing and serialization code. You can then access the data stored in XML +using types and functions that semantically correspond to your application +domain rather than dealing with generic elements/attributes and raw strings. + +For further information, including licensing conditions, documentation, and +binary packages, refer to the [XSD project +page](https://codesynthesis.com/products/xsd/). diff --git a/libxsd/build/root.build b/libxsd/build/root.build index 82da455..1a5d8cc 100644 --- a/libxsd/build/root.build +++ b/libxsd/build/root.build @@ -1,6 +1,8 @@ # file : build/root.build # license : GNU GPL v2 + exceptions; see accompanying LICENSE file +config [bool] config.libxsd.doxygen ?= false + using in cxx.std = latest diff --git a/libxsd/buildfile b/libxsd/buildfile index abb2c7c..90a32e1 100644 --- a/libxsd/buildfile +++ b/libxsd/buildfile @@ -1,8 +1,7 @@ # file : buildfile # license : GNU GPL v2 + exceptions; see accompanying LICENSE file -./: {*/ -build/} doc{INSTALL NEWS README} legal{GPLv2 LICENSE FLOSSE} manifest - -# Don't the INSTALL file. -# -doc{INSTALL}@./: install = false +./: {*/ -build/} \ + doc{README.md PACKAGE-README.md NEWS} \ + legal{GPLv2 LICENSE FLOSSE} \ + manifest diff --git a/libxsd/doc/buildfile b/libxsd/doc/buildfile index c640a6c..1298db1 100644 --- a/libxsd/doc/buildfile +++ b/libxsd/doc/buildfile @@ -10,74 +10,83 @@ doxygen{*}: extension = doxygen define doxytag: file doxytag{*}: extension = doxytag -# Import the doxygen program only if present on the system. This way a -# distribution that includes pre-generated files can be built without -# installing this programs. -# -import? doxygen = doxygen%exe{doxygen} +doxygen_doc = $config.libxsd.doxygen -# Note that we include the doxygen-generated files into the distribution and -# don't remove them when cleaning in src (so that clean results in a state -# identical to distributed). +if $doxygen_doc + import! doxygen = doxygen%exe{doxygen} + +./: cxx/tree/reference/doxytag{libxsd}: include = $doxygen_doc cxx/tree/reference/ { - # @@ Currently, there are the following issues that can only be addressed - # on the build2 level: - # - # - The update recipe is not re-executed after html/ directory content - # has changed or it is removed. - # - # - The clean operation doesn't remove the html/ directory. - # - # - The html/ directory is not installed nor distributed regardless of - # the doxygen presence. - # - if ($doxygen != [null]) + headers = buffer types date-time elements element-map exceptions + + <doxytag{libxsd}>: doxygen{libxsd} \ + html{footer} \ + $src_root/xsd/cxx/tree/hxx{$headers} \ + $doxygen + % + if $doxygen_doc + {{ + o = $directory($>[0]) # Target output directory. + c = $path($<[0]) # Doxygen config file. + t = $path($>[0]).t # Temp dir. + tc = $t/"$leaf($c)" # Temp doxygen config file. + d = $t/$name($>[0]).d # Dep file (target list). + + # Describe the dynamic targets for better diagnostics. + # + dyndep_options = --target-what 'generated doxygen' + + # Doxygen doesn't provide any way to list the would-be-generated HTML + # files so the best we can do is to generate them, get their list, and + # throw them away. Note that this code is inspired by the hello-thrift + # example (see its buildfile for details). + # + # Note: fsdir{} could have been static prerequisite but let's keep it + # dynamic in case we want to turn this into a rule one day. + # + depdb dyndep --dyn-target $dyndep_options --format lines --file $d -- \ + mkdir -p $t && \ + sed -e "s%^\\s*\(HTML_OUTPUT\\s*=\).*\$%\\1 $t/html%" \ + -e "s%^\\s*\(GENERATE_TAGFILE\\s*=\).*\$%\\1%" $c >$tc && \ + $doxygen $tc &$t/html/*** && \ + find $t/html -type f >$d && \ + sed -e "s%[/\\\\]$path.leaf($t)%%g" -i $d && \ + echo '' >>$d && \ + echo $path.representation([dir_path] $o/html) >>$d + + diag doxygen ($<[0]) -> ($>[0]) $o/fsdir{html/} + + rm -rf $o/html # Note: doxygen doesn't clean it up itself. + + # @@ It's unclear if it would be beneficial (or even possible) to list + # relative inputs in doxygen{libxsd} and then adjust the CWD here. Note + # that while relative header paths are used in libxsd.doxygen for + # make-based build system, absolute paths still end up in + # libxsd.doxytag. + # + $doxygen $c + }} + + doxygen{libxsd}: in{libxsd} { - ../../../: doxytag{libxsd} - - headers = buffer types date-time elements element-map exceptions - - <doxytag{libxsd} fsdir{html}>: doxygen{libxsd} \ - html{footer} \ - $src_root/xsd/cxx/tree/hxx{$headers} \ - $doxygen - { - dist = true - clean = ($src_root != $out_root) - } - {{ - diag doxygen $> : ($<[0]) # @@ TMP: revise - - rm -r -f $directory($>[1]) - - $doxygen $path($<[0]) - }} - - doxygen{libxsd}: in{libxsd} - { - in.symbol = '%' - - input = $regex.merge($headers, \ - '^(.*)$', \ - "$src_root/xsd/cxx/tree/\\1.hxx", \ - ' ') - } - - html{footer}: in{footer} - { - # Extract the copyright notice from the LICENSE file. - # - # Note that cat is a builtin which means this is both portable and fast. - # - copyright = $process.run_regex(cat $src_root/LICENSE, \ - 'Copyright \(c\) (.+)\.', \ - '\1') - } + in.symbol = '%' + + input = $regex.merge($headers, \ + '^(.*)$', \ + "$src_root/xsd/cxx/tree/\\1.hxx", \ + ' ') } - else - ../../../: doxytag{+libxsd} -} -doc{*}: install.subdirs = true + html{footer}: in{footer} + { + # Extract the copyright notice from the LICENSE file. + # + # Note that cat is a builtin which means this is both portable and fast. + # + copyright = $process.run_regex(cat $src_root/LICENSE, \ + 'Copyright \(c\) (.+)\.', \ + '\1') + } +} diff --git a/libxsd/manifest b/libxsd/manifest index 6715e28..23a9848 100644 --- a/libxsd/manifest +++ b/libxsd/manifest @@ -1,17 +1,116 @@ : 1 name: libxsd -version: 4.2.0-b.1.z +version: 4.2.1-a.0.z project: xsd +type: lib,binless +language: c++ summary: XML Schema to C++ data binding compiler runtime library license: other: GPL-2.0-only with Xerces-C++ linking exception and FLOSS exception topics: C++, XML, XML Schema, XML parser -description-file: README +description-file: README.md +package-description-file: PACKAGE-README.md changes-file: NEWS -url: https://www.codesynthesis.com/projects/xsd/ -doc-url: https://www.codesynthesis.com/projects/xsd/ -src-url: https://git.codesynthesis.com/cgit/xsd/xsd/tree/libxsd/ +url: https://www.codesynthesis.com/products/xsd/ +doc-url: https://www.codesynthesis.com/products/xsd/ +src-url: https://git.codesynthesis.com/cgit/xsd/xsd/ email: xsd-users@codesynthesis.com ; Mailing list build-warning-email: builds@codesynthesis.com -depends: * build2 >= 0.13.0 -depends: * bpkg >= 0.13.0 +depends: * build2 >= 0.16.0 +depends: * bpkg >= 0.16.0 tests: libxsd-tests == $ + +# Binary distribution packages. Overall notes: +# +# - While the library itself doesn't depend on either libxerces-c of libexpat +# directly, the tests do and it makes sense to use the system versions where +# available. Similarly, we pass optimization options where appropriate. +# +# - Build as C++11 for maximum compatibility (this is a C++11 codebase). +# +# - For archives adjust metadata since this is a binless library. +# +# - We disable warning emails for configurations that build Xerces-C++. + +bindist-debian-builds: bindist +bindist-debian-build-include: linux_debian*-** +bindist-debian-build-include: linux_ubuntu*-** +bindist-debian-build-exclude: ** +bindist-debian-build-config: +\ ++bpkg.bindist.debian: ++bbot.bindist.upload: +b.create:config.cxx.std=c++11 +?sys:libxerces-c +?sys:libexpat +\ + +# Note that there is no Xerces-C++ package in RHEL (only in EPEL) so we +# have a separate configuration for RHEL. +# +bindist-fedora-builds: bindist +bindist-fedora-build-include: linux_fedora*-** +bindist-fedora-build-exclude: ** +bindist-fedora-build-config: +\ ++bpkg.bindist.fedora: ++bbot.bindist.upload: +b.create:config.cxx.std=c++11 +?sys:libxerces-c +?sys:libexpat +\ + +bindist-rhel-builds: bindist +bindist-rhel-build-include: linux_rhel*-** +bindist-rhel-build-exclude: ** +bindist-rhel-build-config: +\ ++bpkg.bindist.fedora: ++bbot.bindist.upload: +b.create:config.cxx.std=c++11 +?sys:libexpat +\ +#bindist-rhel-build-error-email: builds@codesynthesis.com + +bindist-windows-builds: bindist +bindist-windows-build-include: windows*-** +bindist-windows-build-exclude: ** +bindist-windows-build-config: +\ ++bpkg.bindist.archive: ++bbot.bindist.upload: +bpkg.bindist.archive:--archive-build-meta=windows +bpkg.bindist.archive:config.install.relocatable=true +b.create:config.cc.coptions="/W2 /O2" +b.create:config.cxx.std=c++11 +\ +#bindist-windows-build-error-email: builds@codesynthesis.com + +bindist-macos-builds: bindist +bindist-macos-build-include: macos*-** +bindist-macos-build-exclude: ** +bindist-macos-build-config: +\ ++bpkg.bindist.archive: ++bbot.bindist.upload: +bpkg.bindist.archive:--archive-build-meta=macos +bpkg.bindist.archive:config.install.relocatable=true +b.create:config.cc.coptions="-Wall -O3" +b.create:config.cxx.std=c++11 +\ +#bindist-macos-build-error-email: builds@codesynthesis.com + +# Generic linux package (built using oldest Debian we support). +# +bindist-linux-builds: bindist +bindist-linux-build-include: linux_debian_11-gcc_10.2-bindist +bindist-linux-build-exclude: ** +bindist-linux-build-config: +\ ++bpkg.bindist.archive: ++bbot.bindist.upload: +bpkg.bindist.archive:--archive-build-meta=linux +bpkg.bindist.archive:config.install.relocatable=true +b.create:config.cxx.std=c++11 +?sys:libxerces-c +?sys:libexpat +\ diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx index a7a4d10..3e26ca3 100644 --- a/libxsd/xsd/cxx/tree/containers.hxx +++ b/libxsd/xsd/cxx/tree/containers.hxx @@ -858,6 +858,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + sequence& + operator= (const sequence&) = default; +#endif + public: void assign (size_type n, const T& x) @@ -1132,6 +1137,11 @@ namespace xsd : base_sequence (s) { } + +#ifdef XSD_CXX11 + sequence& + operator= (const sequence&) = default; +#endif }; diff --git a/libxsd/xsd/cxx/tree/date-time.hxx b/libxsd/xsd/cxx/tree/date-time.hxx index eb9efce..d5d06ec 100644 --- a/libxsd/xsd/cxx/tree/date-time.hxx +++ b/libxsd/xsd/cxx/tree/date-time.hxx @@ -210,6 +210,11 @@ namespace xsd */ gday (const gday& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gday& + operator= (const gday&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -371,6 +376,11 @@ namespace xsd */ gmonth (const gmonth& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gmonth& + operator= (const gmonth&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -532,6 +542,11 @@ namespace xsd */ gyear (const gyear& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gyear& + operator= (const gyear&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -696,6 +711,11 @@ namespace xsd */ gmonth_day (const gmonth_day& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gmonth_day& + operator= (const gmonth_day&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -880,6 +900,11 @@ namespace xsd */ gyear_month (const gyear_month& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gyear_month& + operator= (const gyear_month&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1068,6 +1093,11 @@ namespace xsd */ date (const date& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + date& + operator= (const date&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1269,6 +1299,11 @@ namespace xsd */ time (const time& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + time& + operator= (const time&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1493,6 +1528,11 @@ namespace xsd virtual date_time* _clone (flags f = 0, container* c = 0) const; +#ifdef XSD_CXX11 + date_time& + operator= (const date_time&) = default; +#endif + /** * @brief Create an instance from a data representation * stream. @@ -1723,6 +1763,11 @@ namespace xsd */ duration (const duration& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + duration& + operator= (const duration&) = default; +#endif + /** * @brief Copy the instance polymorphically. * diff --git a/libxsd/xsd/cxx/tree/elements.hxx b/libxsd/xsd/cxx/tree/elements.hxx index be8fbeb..cff1ada 100644 --- a/libxsd/xsd/cxx/tree/elements.hxx +++ b/libxsd/xsd/cxx/tree/elements.hxx @@ -1254,6 +1254,11 @@ namespace xsd */ simple_type (const simple_type& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + simple_type& + operator= (const simple_type&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1617,6 +1622,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + fundamental_base& + operator= (const fundamental_base&) = default; +#endif + /** * @brief Copy the instance polymorphically. * diff --git a/libxsd/xsd/cxx/tree/list.hxx b/libxsd/xsd/cxx/tree/list.hxx index f83297a..c44c882 100644 --- a/libxsd/xsd/cxx/tree/list.hxx +++ b/libxsd/xsd/cxx/tree/list.hxx @@ -62,6 +62,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + list& + operator= (const list&) = default; +#endif + public: list (const xercesc::DOMElement&, flags = 0, container* c = 0); @@ -112,6 +117,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + list& + operator= (const list&) = default; +#endif + public: list (const xercesc::DOMElement&, flags = 0, container* c = 0); diff --git a/libxsd/xsd/cxx/tree/type-factory-map.hxx b/libxsd/xsd/cxx/tree/type-factory-map.hxx index e20acfe..d52982f 100644 --- a/libxsd/xsd/cxx/tree/type-factory-map.hxx +++ b/libxsd/xsd/cxx/tree/type-factory-map.hxx @@ -150,11 +150,14 @@ namespace xsd // // - template<unsigned long id, typename C, typename T> + template<unsigned long id, typename C> struct element_factory_initializer { + typedef typename type_factory_map<C>::factory factory; + element_factory_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns); + const C* subst_name, const C* subst_ns, + factory); ~element_factory_initializer (); diff --git a/libxsd/xsd/cxx/tree/type-factory-map.txx b/libxsd/xsd/cxx/tree/type-factory-map.txx index 1eddb25..5a9dc38 100644 --- a/libxsd/xsd/cxx/tree/type-factory-map.txx +++ b/libxsd/xsd/cxx/tree/type-factory-map.txx @@ -302,6 +302,9 @@ namespace xsd if (i != element_map_.end ()) { + // Note that we may find an abstract element in which case the + // returned factory will be NULL. + // f = find_substitution (i->second, qn); } } @@ -455,21 +458,22 @@ namespace xsd // // - template<unsigned long id, typename C, typename T> - element_factory_initializer<id, C, T>:: + template<unsigned long id, typename C> + element_factory_initializer<id, C>:: element_factory_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns) + const C* subst_name, const C* subst_ns, + factory f) : root_name_ (root_name), root_ns_ (root_ns), subst_name_ (subst_name), subst_ns_ (subst_ns) { type_factory_map_instance<id, C> ().register_element ( xml::qualified_name<C> (root_name, root_ns), xml::qualified_name<C> (subst_name, subst_ns), - &factory_impl<T>); + f); } - template<unsigned long id, typename C, typename T> - element_factory_initializer<id, C, T>:: + template<unsigned long id, typename C> + element_factory_initializer<id, C>:: ~element_factory_initializer () { type_factory_map_instance<id, C> ().unregister_element ( diff --git a/libxsd/xsd/cxx/tree/type-serializer-map.hxx b/libxsd/xsd/cxx/tree/type-serializer-map.hxx index 38b2fb9..50869b5 100644 --- a/libxsd/xsd/cxx/tree/type-serializer-map.hxx +++ b/libxsd/xsd/cxx/tree/type-serializer-map.hxx @@ -216,8 +216,11 @@ namespace xsd template<unsigned long id, typename C, typename T> struct element_serializer_initializer { + typedef typename type_serializer_map<C>::serializer serializer; + element_serializer_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns); + const C* subst_name, const C* subst_ns, + serializer); ~element_serializer_initializer (); diff --git a/libxsd/xsd/cxx/tree/type-serializer-map.txx b/libxsd/xsd/cxx/tree/type-serializer-map.txx index 1acdad2..a6c690a 100644 --- a/libxsd/xsd/cxx/tree/type-serializer-map.txx +++ b/libxsd/xsd/cxx/tree/type-serializer-map.txx @@ -550,14 +550,21 @@ namespace xsd template<unsigned long id, typename C, typename T> element_serializer_initializer<id, C, T>:: element_serializer_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns) + const C* subst_name, const C* subst_ns, + serializer s) : root_name_ (root_name), root_ns_ (root_ns) { + // Note that we still have to use real typeid (instead of, say, NULL) + // for abstract elements to make sure we have separate entries for + // each of them. We can assume that such a typeid can never be looked + // up (since it's impossible to instantiate the corresponding abstract + // type). + // type_serializer_map_instance<id, C> ().register_element ( xml::qualified_name<C> (root_name, root_ns), xml::qualified_name<C> (subst_name, subst_ns), typeid (T), - &serializer_impl<T>); + s); } template<unsigned long id, typename C, typename T> diff --git a/libxsd/xsd/cxx/tree/types.hxx b/libxsd/xsd/cxx/tree/types.hxx index 34eabd9..0790997 100644 --- a/libxsd/xsd/cxx/tree/types.hxx +++ b/libxsd/xsd/cxx/tree/types.hxx @@ -268,6 +268,18 @@ namespace xsd base () = x; return *this; } + + public: + /** + * @brief Explicitly "cast" to the base string type. + * + * @return A const reference to the instance as the base string type. + */ + const std::basic_string<C>& + base_string () const + { + return *this; + } }; /** @@ -1078,6 +1090,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + nmtokens& + operator= (const nmtokens&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -2559,6 +2576,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + idrefs& + operator= (const idrefs&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -2867,6 +2889,18 @@ namespace xsd return *this; } + public: + /** + * @brief Explicitly "cast" to the base string type. + * + * @return A const reference to the instance as the base string type. + */ + const std::basic_string<C>& + base_string () const + { + return *this; + } + protected: //@cond @@ -2967,6 +3001,11 @@ namespace xsd // } +#ifdef XSD_CXX11 + qname& + operator= (const qname&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -3849,6 +3888,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + entities& + operator= (const entities&) = default; +#endif + /** * @brief Copy the instance polymorphically. * diff --git a/libxsd/xsd/cxx/xml/char-utf8.txx b/libxsd/xsd/cxx/xml/char-utf8.txx index a571ce9..76bba86 100644 --- a/libxsd/xsd/cxx/xml/char-utf8.txx +++ b/libxsd/xsd/cxx/xml/char-utf8.txx @@ -220,7 +220,7 @@ namespace xsd // u = (c & 0x1F) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -235,7 +235,7 @@ namespace xsd // u = (c & 0x0F) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -243,7 +243,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -258,7 +258,7 @@ namespace xsd // u = (c & 0x07) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -266,7 +266,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -274,7 +274,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; diff --git a/libxsd/xsd/cxx/xml/dom/parsing-source.hxx b/libxsd/xsd/cxx/xml/dom/parsing-source.hxx index fc0bd71..e4cb37e 100644 --- a/libxsd/xsd/cxx/xml/dom/parsing-source.hxx +++ b/libxsd/xsd/cxx/xml/dom/parsing-source.hxx @@ -8,6 +8,7 @@ #include <xercesc/dom/DOMNode.hpp> #include <xercesc/dom/DOMAttr.hpp> +#include <xercesc/dom/DOMText.hpp> #include <xercesc/dom/DOMElement.hpp> #include <xercesc/dom/DOMDocument.hpp> #include <xercesc/dom/DOMNamedNodeMap.hpp> diff --git a/libxsd/xsd/cxx/xml/dom/parsing-source.txx b/libxsd/xsd/cxx/xml/dom/parsing-source.txx index 6543671..2a2d6e2 100644 --- a/libxsd/xsd/cxx/xml/dom/parsing-source.txx +++ b/libxsd/xsd/cxx/xml/dom/parsing-source.txx @@ -105,7 +105,10 @@ namespace xsd const properties<C>& prop, unsigned long flags) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; // Instantiate the DOM parser. // @@ -115,13 +118,14 @@ namespace xsd // Get an implementation of the Load-Store (LS) interface. // - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls_id)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls_id)); - XSD_DOM_AUTO_PTR<DOMLSParser> parser ( - impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + XSD_DOM_AUTO_PTR<xercesc::DOMLSParser> parser ( + impl->createLSParser ( + xercesc::DOMImplementationLS::MODE_SYNCHRONOUS, 0)); - DOMConfiguration* conf (parser->getDomConfig ()); + xercesc::DOMConfiguration* conf (parser->getDomConfig ()); // Discard comment nodes in the document. // @@ -216,7 +220,7 @@ namespace xsd xercesc::Wrapper4InputSource wrap (&is, false); - XSD_DOM_AUTO_PTR<DOMDocument> doc; + XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc; try { doc.reset (parser->parse (&wrap)); @@ -249,7 +253,10 @@ namespace xsd const properties<C>& prop, unsigned long flags) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; // Instantiate the DOM parser. // @@ -259,13 +266,14 @@ namespace xsd // Get an implementation of the Load-Store (LS) interface. // - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls_id)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls_id)); - XSD_DOM_AUTO_PTR<DOMLSParser> parser ( - impl->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + XSD_DOM_AUTO_PTR<xercesc::DOMLSParser> parser ( + impl->createLSParser( + xercesc::DOMImplementationLS::MODE_SYNCHRONOUS, 0)); - DOMConfiguration* conf (parser->getDomConfig ()); + xercesc::DOMConfiguration* conf (parser->getDomConfig ()); // Discard comment nodes in the document. // @@ -359,7 +367,7 @@ namespace xsd bits::error_handler_proxy<C> ehp (eh); conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); - XSD_DOM_AUTO_PTR<DOMDocument> doc; + XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc; try { doc.reset (parser->parseURI (string (uri).c_str ())); diff --git a/libxsd/xsd/cxx/xml/dom/serialization-header.txx b/libxsd/xsd/cxx/xml/dom/serialization-header.txx index 997dfe9..4b9ebdd 100644 --- a/libxsd/xsd/cxx/xml/dom/serialization-header.txx +++ b/libxsd/xsd/cxx/xml/dom/serialization-header.txx @@ -174,7 +174,9 @@ namespace xsd atts.push_back (a); } - for (std::vector<DOMAttr*>::iterator i (atts.begin ()), + // Qualify DOMAttr to work around MSVC 16.11 /std:c++20 issue. + // + for (std::vector<xercesc::DOMAttr*>::iterator i (atts.begin ()), end (atts.end ()); i != end; ++i) { e.removeAttributeNode (*i); diff --git a/libxsd/xsd/cxx/xml/dom/serialization-source.txx b/libxsd/xsd/cxx/xml/dom/serialization-source.txx index b59e109..e663d7b 100644 --- a/libxsd/xsd/cxx/xml/dom/serialization-source.txx +++ b/libxsd/xsd/cxx/xml/dom/serialization-source.txx @@ -109,7 +109,10 @@ namespace xsd add_namespaces (xercesc::DOMElement& el, const namespace_infomap<C>& map) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; typedef std::basic_string<C> string; typedef namespace_infomap<C> infomap; @@ -159,14 +162,14 @@ namespace xsd // if (!i->second.name.empty ()) el.setAttributeNS ( - xercesc::XMLUni::fgXMLNSURIName, + XMLUni::fgXMLNSURIName, xml::string (xmlns_prefix).c_str (), xml::string (i->second.name).c_str ()); } else { el.setAttributeNS ( - xercesc::XMLUni::fgXMLNSURIName, + XMLUni::fgXMLNSURIName, xml::string (xmlns_prefix + colon + i->first).c_str (), xml::string (i->second.name).c_str ()); } @@ -236,7 +239,8 @@ namespace xsd const namespace_infomap<C>& map, unsigned long) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. typedef std::basic_string<C> string; typedef namespace_infomap<C> infomap; @@ -268,10 +272,10 @@ namespace xsd xercesc::chLatin_S, xercesc::chNull}; - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls)); - XSD_DOM_AUTO_PTR<DOMDocument> doc ( + XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc ( impl->createDocument ( (ns.empty () ? 0 : xml::string (ns).c_str ()), xml::string ((prefix.empty () @@ -293,21 +297,24 @@ namespace xsd xercesc::DOMErrorHandler& eh, unsigned long flags) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; const XMLCh ls[] = {xercesc::chLatin_L, xercesc::chLatin_S, xercesc::chNull}; - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls)); bits::error_handler_proxy<C> ehp (eh); - XSD_DOM_AUTO_PTR<DOMLSSerializer> writer ( + XSD_DOM_AUTO_PTR<xercesc::DOMLSSerializer> writer ( impl->createLSSerializer ()); - DOMConfiguration* conf (writer->getDomConfig ()); + xercesc::DOMConfiguration* conf (writer->getDomConfig ()); conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); @@ -334,7 +341,7 @@ namespace xsd conf->canSetParameter (XMLUni::fgDOMXMLDeclaration, false)) conf->setParameter (XMLUni::fgDOMXMLDeclaration, false); - XSD_DOM_AUTO_PTR<DOMLSOutput> out (impl->createLSOutput ()); + XSD_DOM_AUTO_PTR<xercesc::DOMLSOutput> out (impl->createLSOutput ()); out->setEncoding (xml::string (encoding).c_str ()); out->setByteStream (&target); |