From 5e527213a2430bb3018e5eebd909aef294edf9b5 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- examples/cxx/parser/README | 45 --- examples/cxx/parser/generated/README | 32 -- examples/cxx/parser/generated/library.xml | 52 ---- examples/cxx/parser/generated/library.xsd | 78 ----- examples/cxx/parser/generated/makefile | 109 ------- examples/cxx/parser/hello/README | 28 -- examples/cxx/parser/hello/driver.cxx | 67 ---- examples/cxx/parser/hello/hello.xml | 19 -- examples/cxx/parser/hello/hello.xsd | 21 -- examples/cxx/parser/hello/makefile | 100 ------ examples/cxx/parser/library/README | 44 --- examples/cxx/parser/library/driver.cxx | 109 ------- examples/cxx/parser/library/library-pimpl.cxx | 183 ----------- examples/cxx/parser/library/library-pimpl.hxx | 135 -------- examples/cxx/parser/library/library.hxx | 241 --------------- examples/cxx/parser/library/library.map | 15 - examples/cxx/parser/library/library.xml | 52 ---- examples/cxx/parser/library/library.xsd | 78 ----- examples/cxx/parser/library/makefile | 109 ------- examples/cxx/parser/makefile | 55 ---- examples/cxx/parser/mixed/README | 49 --- examples/cxx/parser/mixed/anchor.hxx | 33 -- examples/cxx/parser/mixed/driver.cxx | 100 ------ examples/cxx/parser/mixed/makefile | 106 ------- examples/cxx/parser/mixed/text.map | 6 - examples/cxx/parser/mixed/text.xml | 17 - examples/cxx/parser/mixed/text.xsd | 28 -- examples/cxx/parser/mixin/README | 34 -- examples/cxx/parser/mixin/driver.cxx | 103 ------- examples/cxx/parser/mixin/instance.xml | 16 - examples/cxx/parser/mixin/makefile | 106 ------- examples/cxx/parser/mixin/schema.map | 7 - examples/cxx/parser/mixin/schema.xsd | 30 -- examples/cxx/parser/mixin/types.hxx | 43 --- examples/cxx/parser/multiroot/README | 51 --- examples/cxx/parser/multiroot/balance.xml | 16 - examples/cxx/parser/multiroot/deposit.xml | 17 - examples/cxx/parser/multiroot/driver.cxx | 161 ---------- examples/cxx/parser/multiroot/makefile | 112 ------- examples/cxx/parser/multiroot/protocol-pimpl.cxx | 46 --- examples/cxx/parser/multiroot/protocol-pimpl.hxx | 48 --- examples/cxx/parser/multiroot/protocol.hxx | 61 ---- examples/cxx/parser/multiroot/protocol.map | 11 - examples/cxx/parser/multiroot/protocol.xsd | 50 --- examples/cxx/parser/multiroot/withdraw.xml | 17 - examples/cxx/parser/performance/README | 42 --- examples/cxx/parser/performance/driver.cxx | 341 --------------------- examples/cxx/parser/performance/gen.cxx | 76 ----- examples/cxx/parser/performance/makefile | 108 ------- examples/cxx/parser/performance/test-50k.xml | 1 - examples/cxx/parser/performance/test.xsd | 49 --- examples/cxx/parser/performance/time.cxx | 46 --- examples/cxx/parser/performance/time.hxx | 110 ------- examples/cxx/parser/polymorphism/README | 30 -- examples/cxx/parser/polymorphism/driver.cxx | 70 ----- examples/cxx/parser/polymorphism/makefile | 105 ------- .../cxx/parser/polymorphism/supermen-pimpl.cxx | 85 ----- .../cxx/parser/polymorphism/supermen-pimpl.hxx | 68 ---- examples/cxx/parser/polymorphism/supermen.xml | 25 -- examples/cxx/parser/polymorphism/supermen.xsd | 48 --- examples/cxx/parser/polyroot/README | 36 --- examples/cxx/parser/polyroot/batman.xml | 16 - examples/cxx/parser/polyroot/driver.cxx | 138 --------- examples/cxx/parser/polyroot/makefile | 109 ------- examples/cxx/parser/polyroot/person.xml | 15 - examples/cxx/parser/polyroot/superman.xml | 16 - examples/cxx/parser/polyroot/supermen-pimpl.cxx | 85 ----- examples/cxx/parser/polyroot/supermen-pimpl.hxx | 64 ---- examples/cxx/parser/polyroot/supermen.xsd | 36 --- examples/cxx/parser/wildcard/README | 27 -- examples/cxx/parser/wildcard/driver.cxx | 239 --------------- examples/cxx/parser/wildcard/email.xml | 31 -- examples/cxx/parser/wildcard/email.xsd | 50 --- examples/cxx/parser/wildcard/makefile | 101 ------ 74 files changed, 5007 deletions(-) delete mode 100644 examples/cxx/parser/README delete mode 100644 examples/cxx/parser/generated/README delete mode 100644 examples/cxx/parser/generated/library.xml delete mode 100644 examples/cxx/parser/generated/library.xsd delete mode 100644 examples/cxx/parser/generated/makefile delete mode 100644 examples/cxx/parser/hello/README delete mode 100644 examples/cxx/parser/hello/driver.cxx delete mode 100644 examples/cxx/parser/hello/hello.xml delete mode 100644 examples/cxx/parser/hello/hello.xsd delete mode 100644 examples/cxx/parser/hello/makefile delete mode 100644 examples/cxx/parser/library/README delete mode 100644 examples/cxx/parser/library/driver.cxx delete mode 100644 examples/cxx/parser/library/library-pimpl.cxx delete mode 100644 examples/cxx/parser/library/library-pimpl.hxx delete mode 100644 examples/cxx/parser/library/library.hxx delete mode 100644 examples/cxx/parser/library/library.map delete mode 100644 examples/cxx/parser/library/library.xml delete mode 100644 examples/cxx/parser/library/library.xsd delete mode 100644 examples/cxx/parser/library/makefile delete mode 100644 examples/cxx/parser/makefile delete mode 100644 examples/cxx/parser/mixed/README delete mode 100644 examples/cxx/parser/mixed/anchor.hxx delete mode 100644 examples/cxx/parser/mixed/driver.cxx delete mode 100644 examples/cxx/parser/mixed/makefile delete mode 100644 examples/cxx/parser/mixed/text.map delete mode 100644 examples/cxx/parser/mixed/text.xml delete mode 100644 examples/cxx/parser/mixed/text.xsd delete mode 100644 examples/cxx/parser/mixin/README delete mode 100644 examples/cxx/parser/mixin/driver.cxx delete mode 100644 examples/cxx/parser/mixin/instance.xml delete mode 100644 examples/cxx/parser/mixin/makefile delete mode 100644 examples/cxx/parser/mixin/schema.map delete mode 100644 examples/cxx/parser/mixin/schema.xsd delete mode 100644 examples/cxx/parser/mixin/types.hxx delete mode 100644 examples/cxx/parser/multiroot/README delete mode 100644 examples/cxx/parser/multiroot/balance.xml delete mode 100644 examples/cxx/parser/multiroot/deposit.xml delete mode 100644 examples/cxx/parser/multiroot/driver.cxx delete mode 100644 examples/cxx/parser/multiroot/makefile delete mode 100644 examples/cxx/parser/multiroot/protocol-pimpl.cxx delete mode 100644 examples/cxx/parser/multiroot/protocol-pimpl.hxx delete mode 100644 examples/cxx/parser/multiroot/protocol.hxx delete mode 100644 examples/cxx/parser/multiroot/protocol.map delete mode 100644 examples/cxx/parser/multiroot/protocol.xsd delete mode 100644 examples/cxx/parser/multiroot/withdraw.xml delete mode 100644 examples/cxx/parser/performance/README delete mode 100644 examples/cxx/parser/performance/driver.cxx delete mode 100644 examples/cxx/parser/performance/gen.cxx delete mode 100644 examples/cxx/parser/performance/makefile delete mode 100644 examples/cxx/parser/performance/test-50k.xml delete mode 100644 examples/cxx/parser/performance/test.xsd delete mode 100644 examples/cxx/parser/performance/time.cxx delete mode 100644 examples/cxx/parser/performance/time.hxx delete mode 100644 examples/cxx/parser/polymorphism/README delete mode 100644 examples/cxx/parser/polymorphism/driver.cxx delete mode 100644 examples/cxx/parser/polymorphism/makefile delete mode 100644 examples/cxx/parser/polymorphism/supermen-pimpl.cxx delete mode 100644 examples/cxx/parser/polymorphism/supermen-pimpl.hxx delete mode 100644 examples/cxx/parser/polymorphism/supermen.xml delete mode 100644 examples/cxx/parser/polymorphism/supermen.xsd delete mode 100644 examples/cxx/parser/polyroot/README delete mode 100644 examples/cxx/parser/polyroot/batman.xml delete mode 100644 examples/cxx/parser/polyroot/driver.cxx delete mode 100644 examples/cxx/parser/polyroot/makefile delete mode 100644 examples/cxx/parser/polyroot/person.xml delete mode 100644 examples/cxx/parser/polyroot/superman.xml delete mode 100644 examples/cxx/parser/polyroot/supermen-pimpl.cxx delete mode 100644 examples/cxx/parser/polyroot/supermen-pimpl.hxx delete mode 100644 examples/cxx/parser/polyroot/supermen.xsd delete mode 100644 examples/cxx/parser/wildcard/README delete mode 100644 examples/cxx/parser/wildcard/driver.cxx delete mode 100644 examples/cxx/parser/wildcard/email.xml delete mode 100644 examples/cxx/parser/wildcard/email.xsd delete mode 100644 examples/cxx/parser/wildcard/makefile (limited to 'examples/cxx/parser') diff --git a/examples/cxx/parser/README b/examples/cxx/parser/README deleted file mode 100644 index 01906c7..0000000 --- a/examples/cxx/parser/README +++ /dev/null @@ -1,45 +0,0 @@ -This directory contains a number of examples that show how to use -the C++/Parser mapping. The following list gives an overview of -each example. See the README files in example directories for -more information on each example. - -hello - A simple "Hello, world!" example that shows how to parse XML - documents. - -generated - Shows how to use the sample implementation and test driver - generation feature. This example does not have any hand-written - C++ code; everything is generated by the XSD compiler. - -library - Shows how to handle more complex data structures and construct - a custom in-memory object model. - -mixin - Shows how to reuse implementations of base parsers in derived - parsers using the mixin C++ idiom. - -wildcard - Shows how to parse the XML data matched by XML Schema wildcards - (any and anyAttribute). - -multiroot - Shows how to handle XML vocabularies with multiple root elements. - -polymorphism - Shows how to use XML Schema polymorphism features such as the - xsi:type attribute and substitution groups. - -polyroot - Shows how to handle the xsi:type attribute when it is used on root - elements. - -performance - Measures the performance of XML parsing. This example also shows how - to structure your code to achieve the maximum performance for this - operation. - -mixed - Shows how to handle raw, "type-less content" such as mixed content - models, anyType/anySimpleType, and any/anyAttribute. \ No newline at end of file diff --git a/examples/cxx/parser/generated/README b/examples/cxx/parser/generated/README deleted file mode 100644 index ca56974..0000000 --- a/examples/cxx/parser/generated/README +++ /dev/null @@ -1,32 +0,0 @@ -This example shows how to use the sample implementation and test -driver generation feature of the C++/Parser mapping. This example -does not have any hand-written C++ code; everything is generated -by the XSD compiler. - -The example consists of the following files: - -library.xsd - XML Schema which describes a library of books. - -library.xml - Sample XML instance document. - -library-pskel.hxx -library-pskel.cxx - Parser skeletons generated by XSD from library.xsd. - -library-pimpl.hxx -library-pimpl.cxx - Sample parser implementations that print the XML data to STDOUT. - These are generated by XSD from library.xsd with the - --generate-print-impl option. - -library-driver.cxx - Sample driver for the example. It is generated by XSD from - library.xsd with the --generate-test-driver option. - - -To run the example on the sample XML instance document simply -execute: - -$ ./library-driver library.xml diff --git a/examples/cxx/parser/generated/library.xml b/examples/cxx/parser/generated/library.xml deleted file mode 100644 index b1ac98c..0000000 --- a/examples/cxx/parser/generated/library.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - 0679760806 - The Master and Margarita - fiction - - - Mikhail Bulgakov - 1891-05-15 - 1940-03-10 - - - - - - 0679600841 - War and Peace - history - - - Leo Tolstoy - 1828-09-09 - 1910-11-20 - - - - - - 0679420290 - Crime and Punishment - philosophy - - - Fyodor Dostoevsky - 1821-11-11 - 1881-02-09 - - - - diff --git a/examples/cxx/parser/generated/library.xsd b/examples/cxx/parser/generated/library.xsd deleted file mode 100644 index 71e4005..0000000 --- a/examples/cxx/parser/generated/library.xsd +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/generated/makefile b/examples/cxx/parser/generated/makefile deleted file mode 100644 index cfce1a7..0000000 --- a/examples/cxx/parser/generated/makefile +++ /dev/null @@ -1,109 +0,0 @@ -# file : examples/cxx/parser/generated/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := library.xsd - -obj := $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.o) $(xsd:.xsd=-pimpl.o) $(xsd:.xsd=-driver.o)) -dep := $(obj:.o=.o.d) - - -driver := $(out_base)/$(xsd:.xsd=-driver) -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) \ - $(xsd:.xsd=-pskel.ixx) \ - $(xsd:.xsd=-pskel.cxx) \ - $(xsd:.xsd=-pimpl.hxx) \ - $(xsd:.xsd=-pimpl.cxx) \ - $(xsd:.xsd=-driver.cxx) - -gen := $(addprefix $(out_base)/,$(genf)) - - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --generate-print-impl --generate-test-driver \ ---force-overwrite -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/library.xsd,$(install_doc_dir)/xsd/$(path)/library.xsd) - $(call install-data,$(src_base)/library.xml,$(install_doc_dir)/xsd/$(path)/library.xml) - -$(dist-common): - $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd) - $(call install-data,$(src_base)/library.xml,$(dist_prefix)/$(path)/library.xml) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pimpl.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := $(xsd:.xsd=-driver) $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) - -xsd_parser_impl_suffix := -pimpl -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/hello/README b/examples/cxx/parser/hello/README deleted file mode 100644 index 97449de..0000000 --- a/examples/cxx/parser/hello/README +++ /dev/null @@ -1,28 +0,0 @@ -This is a "Hello, world!" example that shows how to use the -C++/Parser mapping to parse XML instance documents. - -The example consists of the following files: - -hello.xsd - XML Schema which describes "hello" instance documents. - -hello.xml - Sample XML instance document. - -hello-pskel.hxx -hello-pskel.cxx - Parser skeletons generated by XSD from hello.xsd. - -driver.cxx - A parser implementation and a driver for the example. The - parser implementation simply prints the data to STDERR. - The driver first constructs a parser instance from the - parser implementation mentioned above and a couple of - predefined parsers for the XML Schema built-in types. - In then invokes this parser instance to parse the input - file. - -To run the example on the sample XML instance document simply -execute: - -$ ./driver hello.xml diff --git a/examples/cxx/parser/hello/driver.cxx b/examples/cxx/parser/hello/driver.cxx deleted file mode 100644 index e261e10..0000000 --- a/examples/cxx/parser/hello/driver.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// file : examples/cxx/parser/hello/driver.cxx -// copyright : not copyrighted - public domain - -#include -#include - -#include "hello-pskel.hxx" - -using namespace std; - -struct hello_pimpl: hello_pskel -{ - virtual void - greeting (const string& greeting) - { - greeting_ = greeting; - } - - virtual void - name (const string& name) - { - cout << greeting_ << ", " << name << "!" << endl; - } - -private: - string greeting_; -}; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " hello.xml" << endl; - return 1; - } - - try - { - // Construct the parser. - // - xml_schema::string_pimpl string_p; - hello_pimpl hello_p; - - hello_p.greeting_parser (string_p); - hello_p.name_parser (string_p); - - // Parse the XML instance document. The second argument to the - // document's constructor is the document's root element name. - // - xml_schema::document doc_p (hello_p, "hello"); - - hello_p.pre (); - doc_p.parse (argv[1]); - hello_p.post_hello (); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/hello/hello.xml b/examples/cxx/parser/hello/hello.xml deleted file mode 100644 index dd0c13d..0000000 --- a/examples/cxx/parser/hello/hello.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - Hello - - sun - moon - world - - diff --git a/examples/cxx/parser/hello/hello.xsd b/examples/cxx/parser/hello/hello.xsd deleted file mode 100644 index be69957..0000000 --- a/examples/cxx/parser/hello/hello.xsd +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/hello/makefile b/examples/cxx/parser/hello/makefile deleted file mode 100644 index 9317315..0000000 --- a/examples/cxx/parser/hello/makefile +++ /dev/null @@ -1,100 +0,0 @@ -# file : examples/cxx/parser/hello/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := hello.xsd -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/hello.xsd,$(install_doc_dir)/xsd/$(path)/hello.xsd) - $(call install-data,$(src_base)/hello.xml,$(install_doc_dir)/xsd/$(path)/hello.xml) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/hello.xsd,$(dist_prefix)/$(path)/hello.xsd) - $(call install-data,$(src_base)/hello.xml,$(dist_prefix)/$(path)/hello.xml) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/library/README b/examples/cxx/parser/library/README deleted file mode 100644 index 3f515f6..0000000 --- a/examples/cxx/parser/library/README +++ /dev/null @@ -1,44 +0,0 @@ -This example shows how to use the C++/Parser mapping to construct -a custom in-memory object model from XML instance documents. - -The example consists of the following files: - -library.xsd - XML Schema which describes a library of books. - -library.xml - Sample XML instance document. - -library.hxx - Types that describe a library of books in C++. These are - hand-written. - -library.map - Type map. It maps XML Schema types defined in library.xsd - to the C++ types defined in library.hxx. - -library-pskel.hxx -library-pskel.ixx -library-pskel.cxx - Parser skeletons generated by XSD from library.xsd and - library.map. - -library-pimpl.hxx -library-pimpl.cxx - Parser implementations that construct the custom in-memory - object model from an XML instance using the types from - library.hxx. These are hand-written implementations of - the parser skeletons defined in library-pskel.hxx. - -driver.cxx - Driver for the example. It first constructs a parser - instance from all the individual parsers found in - library-pimpl.hxx. In then invokes this parser instance - to parse the input file and produce the in-memory - object model. Finally, it prints the contents of the - in-memory object model to STDERR. - -To run the example on the sample XML instance document simply -execute: - -$ ./driver library.xml diff --git a/examples/cxx/parser/library/driver.cxx b/examples/cxx/parser/library/driver.cxx deleted file mode 100644 index 3b63801..0000000 --- a/examples/cxx/parser/library/driver.cxx +++ /dev/null @@ -1,109 +0,0 @@ -// file : examples/cxx/parser/library/driver.cxx -// copyright : not copyrighted - public domain - -#include - -#include "library.hxx" -#include "library-pimpl.hxx" - -using std::cerr; -using std::endl; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " library.xml" << endl; - return 1; - } - - try - { - using namespace library; - - - // Construct the parser. - // - xml_schema::id_pimpl id_p; - xml_schema::idref_pimpl idref_p; - xml_schema::string_pimpl string_p; - xml_schema::boolean_pimpl boolean_p; - - isbn_pimpl isbn_p; - - title_pimpl title_p; - title_p.lang_parser (string_p); - - genre_pimpl genre_p; - - author_pimpl author_p; - author_p.parsers (string_p, // name - string_p, // born - string_p, // died - idref_p); // recommends - - book_pimpl book_p; - book_p.parsers (isbn_p, // isbn - title_p, // title - genre_p, // genre - author_p, // author - boolean_p, // available - id_p); // id - - catalog_pimpl catalog_p; - catalog_p.book_parser (book_p); - - - // Parse the XML instance document. - // - xml_schema::document doc_p ( - catalog_p, - "http://www.codesynthesis.com/library", // root element namespace - "catalog"); // root element name - - catalog_p.pre (); - doc_p.parse (argv[1]); - catalog c (catalog_p.post_catalog ()); - - - // Let's print what we've got. - // - for (catalog::const_iterator bi (c.begin ()); bi != c.end (); ++bi) - { - cerr << endl - << "ID : " << bi->id () << endl - << "ISBN : " << bi->isbn () << endl - << "Title : " << bi->title () << endl - << "Genre : " << bi->genre () << endl; - - for (book::authors::const_iterator ai (bi->author ().begin ()); - ai != bi->author ().end (); - ++ai) - { - cerr << "Author : " << ai->name () << endl; - cerr << " Born : " << ai->born () << endl; - - if (!ai->died ().empty ()) - cerr << " Died : " << ai->died () << endl; - - if (!ai->recommends ().empty ()) - { - cerr << " Recommends : " << ai->recommends () << endl; - } - } - - cerr << "Available : " << std::boolalpha << bi->available () << endl; - } - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/library/library-pimpl.cxx b/examples/cxx/parser/library/library-pimpl.cxx deleted file mode 100644 index 7a1e484..0000000 --- a/examples/cxx/parser/library/library-pimpl.cxx +++ /dev/null @@ -1,183 +0,0 @@ -// file : examples/cxx/parser/library/library-pimpl.cxx -// copyright : not copyrighted - public domain - -#include "library-pimpl.hxx" - -namespace library -{ - // isbn_impl - // - isbn isbn_pimpl:: - post_isbn () - { - return post_unsigned_int (); - } - - // title_pimpl - // - void title_pimpl:: - _pre () - { - title_.lang (""); - } - - void title_pimpl:: - lang (const std::string& lang) - { - title_.lang (lang); - } - - title title_pimpl:: - post_title () - { - title_.assign (post_string ()); - return title_; - } - - // genre_pimpl - // - genre genre_pimpl:: - post_genre () - { - genre r (romance); - std::string v (post_string ()); - - if (v == "romance") r = romance; else - if (v == "fiction") r = fiction; else - if (v == "horror") r = horror; else - if (v == "history") r = history; else - if (v == "philosophy") r = philosophy; - - return r; - } - - // person_pimpl - // - void person_pimpl:: - _pre () - { - person_.died (""); - } - - void person_pimpl:: - name (const std::string& name) - { - person_.name (name); - } - - void person_pimpl:: - born (const std::string& born) - { - person_.born (born); - } - - void person_pimpl:: - died (const std::string& died) - { - person_.died (died); - } - - person person_pimpl:: - post_person () - { - return person_; - } - - // author_pimpl - // - void author_pimpl:: - _pre () - { - person_pimpl::_pre (); - author_.recommends (""); - } - - void author_pimpl:: - recommends (const std::string& recommends) - { - author_.recommends (recommends); - } - - author author_pimpl:: - post_author () - { - person p (post_person ()); - - author_.name (p.name ()); - author_.born (p.born ()); - author_.died (p.died ()); - - return author_; - } - - // book_pimpl - // - void book_pimpl:: - _pre () - { - book_.author ().clear (); - } - - void book_pimpl:: - isbn (library::isbn isbn) - { - book_.isbn (isbn); - } - - void book_pimpl:: - title (const library::title& title) - { - book_.title (title); - } - - void book_pimpl:: - genre (library::genre genre) - { - book_.genre (genre); - } - - void book_pimpl:: - author (const library::author& author) - { - book_.author ().push_back (author); - } - - void book_pimpl:: - available (bool available) - { - book_.available (available); - } - - void book_pimpl:: - id (const std::string& id) - { - book_.id (id); - } - - book book_pimpl:: - post_book () - { - return book_; - } - - // catalog_pimpl - // - void catalog_pimpl:: - _pre () - { - catalog_.clear (); - } - - void catalog_pimpl:: - book (const library::book& book) - { - catalog_.push_back (book); - } - - catalog catalog_pimpl:: - post_catalog () - { - return catalog_; - } -} - diff --git a/examples/cxx/parser/library/library-pimpl.hxx b/examples/cxx/parser/library/library-pimpl.hxx deleted file mode 100644 index 5d0dcc1..0000000 --- a/examples/cxx/parser/library/library-pimpl.hxx +++ /dev/null @@ -1,135 +0,0 @@ -// file : examples/cxx/parser/library/library-pimpl.hxx -// copyright : not copyrighted - public domain - -#ifndef LIBRARY_PIMPL_HXX -#define LIBRARY_PIMPL_HXX - -#include "library.hxx" -#include "library-pskel.hxx" - -namespace library -{ - // - // - struct isbn_pimpl: isbn_pskel, xml_schema::unsigned_int_pimpl - { - virtual isbn - post_isbn (); - }; - - // - // - struct title_pimpl: title_pskel, xml_schema::string_pimpl - { - virtual void - _pre (); - - virtual void - lang (const std::string&); - - virtual title - post_title (); - - private: - title title_; - }; - - // - // - struct genre_pimpl: genre_pskel, xml_schema::string_pimpl - { - virtual genre - post_genre (); - }; - - // - // - struct person_pimpl: virtual person_pskel - { - virtual void - _pre (); - - virtual void - name (const std::string&); - - virtual void - born (const std::string&); - - virtual void - died (const std::string&); - - virtual person - post_person (); - - private: - person person_; - }; - - // - // - struct author_pimpl: author_pskel, person_pimpl - { - virtual void - _pre (); - - virtual void - recommends (const std::string&); - - virtual author - post_author (); - - private: - author author_; - }; - - // - // - struct book_pimpl: book_pskel - { - virtual void - _pre (); - - virtual void - isbn (library::isbn); - - virtual void - title (const library::title&); - - virtual void - genre (library::genre); - - virtual void - author (const library::author&); - - virtual void - available (bool); - - virtual void - id (const std::string&); - - virtual book - post_book (); - - private: - book book_; - }; - - // - // - struct catalog_pimpl: catalog_pskel - { - virtual void - _pre (); - - virtual void - book (const library::book&); - - virtual catalog - post_catalog (); - - private: - catalog catalog_; - }; -} - -#endif // LIBRARY_PIMPL_HXX diff --git a/examples/cxx/parser/library/library.hxx b/examples/cxx/parser/library/library.hxx deleted file mode 100644 index 552e7a5..0000000 --- a/examples/cxx/parser/library/library.hxx +++ /dev/null @@ -1,241 +0,0 @@ -// file : examples/cxx/parser/library/library.hxx -// copyright : not copyrighted - public domain - -#ifndef LIBRARY_HXX -#define LIBRARY_HXX - -#include -#include - -namespace library -{ - // - // - typedef unsigned int isbn; - - - // - // - struct title: std::string - { - // lang - // - const std::string& - lang () const - { - return lang_; - } - - void - lang (const std::string& lang) - { - lang_ = lang; - } - - private: - std::string lang_; - }; - - - // - // - enum genre - { - romance, - fiction, - horror, - history, - philosophy - }; - - - // - // - struct person - { - // name - // - const std::string& - name () const - { - return name_; - } - - void - name (const std::string& name) - { - name_ = name; - } - - // born - // - const std::string& - born () const - { - return born_; - } - - void - born (const std::string& born) - { - born_ = born; - } - - - // died - // - const std::string& - died () const - { - return died_; - } - - void - died (const std::string& died) - { - died_ = died; - } - - private: - std::string name_; - std::string born_; - std::string died_; - }; - - - // - // - struct author: person - { - // recommends - // - const std::string& - recommends () const - { - return recommends_; - } - - void - recommends (const std::string& recommends) - { - recommends_ = recommends; - } - - private: - std::string recommends_; - }; - - - // - // - struct book - { - // isbn - // - library::isbn - isbn () const - { - return isbn_; - } - - void - isbn (const library::isbn& isbn) - { - isbn_ = isbn; - } - - - // title - // - library::title - title () const - { - return title_; - } - - void - title (const library::title& title) - { - title_ = title; - } - - - // genre - // - library::genre - genre () const - { - return genre_; - } - - void - genre (const library::genre& genre) - { - genre_ = genre; - } - - - // author - // - typedef std::vector authors; - - const authors& - author () const - { - return author_; - } - - authors& - author () - { - return author_; - } - - - // available - // - bool - available () const - { - return available_; - } - - void - available (bool available) - { - available_ = available; - } - - - // id - // - const std::string& - id () const - { - return id_; - } - - void - id (const std::string& id) - { - id_ = id; - } - - private: - library::isbn isbn_; - library::title title_; - library::genre genre_; - - authors author_; - - bool available_; - std::string id_; - }; - - - // - // - typedef std::vector catalog; -} - -#endif // LIBRARY_HXX diff --git a/examples/cxx/parser/library/library.map b/examples/cxx/parser/library/library.map deleted file mode 100644 index 3a49b49..0000000 --- a/examples/cxx/parser/library/library.map +++ /dev/null @@ -1,15 +0,0 @@ -# file : examples/cxx/parser/library/library.map -# copyright : not copyrighted - public domain - -namespace http://www.codesynthesis.com/library ::library -{ - include "library.hxx"; - - isbn isbn isbn; - title title; - genre genre genre; - person person; - author author; - book book; - catalog catalog; -} diff --git a/examples/cxx/parser/library/library.xml b/examples/cxx/parser/library/library.xml deleted file mode 100644 index b1ac98c..0000000 --- a/examples/cxx/parser/library/library.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - 0679760806 - The Master and Margarita - fiction - - - Mikhail Bulgakov - 1891-05-15 - 1940-03-10 - - - - - - 0679600841 - War and Peace - history - - - Leo Tolstoy - 1828-09-09 - 1910-11-20 - - - - - - 0679420290 - Crime and Punishment - philosophy - - - Fyodor Dostoevsky - 1821-11-11 - 1881-02-09 - - - - diff --git a/examples/cxx/parser/library/library.xsd b/examples/cxx/parser/library/library.xsd deleted file mode 100644 index 71e4005..0000000 --- a/examples/cxx/parser/library/library.xsd +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/library/makefile b/examples/cxx/parser/library/makefile deleted file mode 100644 index fc6cdaf..0000000 --- a/examples/cxx/parser/library/makefile +++ /dev/null @@ -1,109 +0,0 @@ -# file : examples/cxx/parser/library/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := library.xsd -cxx := driver.cxx library-pimpl.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --generate-inline --type-map $(src_base)/library.map -$(gen): $(out_root)/xsd/xsd $(src_base)/library.map - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/library.xsd,$(install_doc_dir)/xsd/$(path)/library.xsd) - $(call install-data,$(src_base)/library.xml,$(install_doc_dir)/xsd/$(path)/library.xml) - $(call install-data,$(src_base)/library.map,$(install_doc_dir)/xsd/$(path)/library.map) - $(call install-data,$(src_base)/library.hxx,$(install_doc_dir)/xsd/$(path)/library.hxx) - $(call install-data,$(src_base)/library-pimpl.hxx,$(install_doc_dir)/xsd/$(path)/library-pimpl.hxx) - $(call install-data,$(src_base)/library-pimpl.cxx,$(install_doc_dir)/xsd/$(path)/library-pimpl.cxx) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd) - $(call install-data,$(src_base)/library.xml,$(dist_prefix)/$(path)/library.xml) - $(call install-data,$(src_base)/library.map,$(dist_prefix)/$(path)/library.map) - $(call install-data,$(src_base)/library.hxx,$(dist_prefix)/$(path)/library.hxx) - $(call install-data,$(src_base)/library-pimpl.hxx,$(dist_prefix)/$(path)/library-pimpl.hxx) - $(call install-data,$(src_base)/library-pimpl.cxx,$(dist_prefix)/$(path)/library-pimpl.cxx) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/makefile b/examples/cxx/parser/makefile deleted file mode 100644 index 449557a..0000000 --- a/examples/cxx/parser/makefile +++ /dev/null @@ -1,55 +0,0 @@ -# file : examples/cxx/parser/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -examples := generated hello library mixin mixed multiroot performance \ -polymorphism polyroot wildcard - -default := $(out_base)/ -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - -# Build -# -$(default): $(addprefix $(out_base)/,$(addsuffix /,$(examples))) - - -# Install & Dist. -# -$(install) $(dist) $(dist-win): path := $(subst $(src_root)/,,$(src_base)) - -$(install): $(addprefix $(out_base)/,$(addsuffix /.install,$(examples))) - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - -$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(examples))) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): export dirs := $(examples) -$(dist-win): |$(out_root)/.dist-pre -$(dist-win): $(addprefix $(out_base)/,$(addsuffix /.dist-win,$(examples))) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - $(call meta-vc8sln,$(src_root)/dist/template-vc8.sln,parser-vc8.sln) - $(call meta-vc9sln,$(src_root)/dist/template-vc9.sln,parser-vc9.sln) - $(call meta-vc10sln,$(src_root)/dist/template-vc10.sln,parser-vc10.sln) - $(call meta-vc11sln,$(src_root)/dist/template-vc11.sln,parser-vc11.sln) - $(call meta-vc12sln,$(src_root)/dist/template-vc12.sln,parser-vc12.sln) - $(call meta-vctest,parser-vc8.sln,$(src_root)/dist/examples/test.bat,test.bat) - -# Clean -# -$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(examples))) - -$(call include,$(bld_root)/install.make) -$(call include,$(bld_root)/meta/vc8sln.make) -$(call include,$(bld_root)/meta/vc9sln.make) -$(call include,$(bld_root)/meta/vc10sln.make) -$(call include,$(bld_root)/meta/vc11sln.make) -$(call include,$(bld_root)/meta/vc12sln.make) -$(call include,$(bld_root)/meta/vctest.make) - - -$(foreach e,$(examples),$(call import,$(src_base)/$e/makefile)) diff --git a/examples/cxx/parser/mixed/README b/examples/cxx/parser/mixed/README deleted file mode 100644 index 23ace6f..0000000 --- a/examples/cxx/parser/mixed/README +++ /dev/null @@ -1,49 +0,0 @@ -This example shows how to handle raw, "type-less content" such as -mixed content models, anyType/anySimpleType, and any/anyAttribute -in the C++/Parser mapping. - -In this example we use mixed content model to describe text -with embedded links, e.g., - - This paragraph talks about time. - -The example transforms such text into plain text with -references, e.g., - - This paragraph talks about time[0]. - - [0] uri - -The example consists of the following files: - -text.xsd - XML Schema which describes "text with links" instance - documents. - -text.xml - Sample XML instance document. - -anchor.hxx - Anchor type that captures the information about a link. - -text.map - Type map. It maps XML Schema anchor types defined in - text.xsd to C++ anchor class defined in anchor.hxx. - -text-pskel.hxx -text-pskel.cxx - Parser skeletons generated by XSD from text.xsd and - text.map. - -driver.cxx - A parser implementation and a driver for the example. The - parser implementation prints the transformed text to STDOUT. - The driver first constructs a parser instance from the parser - implementation mentioned above and a couple of predefined - parsers for the XML Schema built-in types. In then invokes - this parser instance to parse the input file. - -To run the example on the sample XML instance document simply -execute: - -$ ./driver text.xml diff --git a/examples/cxx/parser/mixed/anchor.hxx b/examples/cxx/parser/mixed/anchor.hxx deleted file mode 100644 index 3adc90b..0000000 --- a/examples/cxx/parser/mixed/anchor.hxx +++ /dev/null @@ -1,33 +0,0 @@ -// file : examples/cxx/parser/mixed/anchor.hxx -// copyright : not copyrighted - public domain - -#ifndef ANCHOR_HXX -#define ANCHOR_HXX - -#include - -struct anchor -{ - anchor (const std::string& text, const std::string& uri) - : uri_ (uri), text_ (text) - { - } - - const std::string& - text () const - { - return text_; - } - - const std::string& - uri () const - { - return uri_; - } - -private: - std::string uri_; - std::string text_; -}; - -#endif // ANCHOR_HXX diff --git a/examples/cxx/parser/mixed/driver.cxx b/examples/cxx/parser/mixed/driver.cxx deleted file mode 100644 index 3f3cc65..0000000 --- a/examples/cxx/parser/mixed/driver.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// file : examples/cxx/parser/mixed/driver.cxx -// copyright : not copyrighted - public domain - -#include -#include -#include - -#include "anchor.hxx" -#include "text-pskel.hxx" - -using namespace std; - -struct anchor_pimpl: anchor_pskel, xml_schema::string_pimpl -{ - virtual void - href (const std::string& uri) - { - uri_ = uri; - } - - virtual anchor - post_anchor () - { - return anchor (post_string (), uri_); - } - -private: - std::string uri_; -}; - - -struct text_pimpl: text_pskel -{ - virtual void - a (const anchor& a) - { - cout << a.text () << "[" << anchors_.size () << "]"; - anchors_.push_back (a); - } - - virtual void - _any_characters (const xml_schema::ro_string& s) - { - cout << s; - } - - virtual void - post_text () - { - for (anchors::const_iterator i (anchors_.begin ()); - i != anchors_.end (); - ++i) - { - cout << "[" << i - anchors_.begin () << "] " << i->uri () << endl; - } - } - -private: - typedef vector anchors; - anchors anchors_; -}; - - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " text.xml" << endl; - return 1; - } - - try - { - // Construct the parser. - // - xml_schema::string_pimpl string_p; - anchor_pimpl anchor_p; - text_pimpl text_p; - - anchor_p.href_parser (string_p); - text_p.a_parser (anchor_p); - - xml_schema::document doc_p (text_p, "text"); - - text_p.pre (); - doc_p.parse (argv[1]); - text_p.post_text (); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/mixed/makefile b/examples/cxx/parser/mixed/makefile deleted file mode 100644 index 7104250..0000000 --- a/examples/cxx/parser/mixed/makefile +++ /dev/null @@ -1,106 +0,0 @@ -# file : examples/cxx/parser/mixed/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := text.xsd -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --type-map $(src_base)/text.map -$(gen): $(out_root)/xsd/xsd $(src_base)/text.map - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/text.xsd,$(install_doc_dir)/xsd/$(path)/text.xsd) - $(call install-data,$(src_base)/text.xml,$(install_doc_dir)/xsd/$(path)/text.xml) - $(call install-data,$(src_base)/text.map,$(install_doc_dir)/xsd/$(path)/text.map) - $(call install-data,$(src_base)/anchor.hxx,$(install_doc_dir)/xsd/$(path)/anchor.hxx) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/text.xsd,$(dist_prefix)/$(path)/text.xsd) - $(call install-data,$(src_base)/text.xml,$(dist_prefix)/$(path)/text.xml) - $(call install-data,$(src_base)/text.map,$(dist_prefix)/$(path)/text.map) - $(call install-data,$(src_base)/anchor.hxx,$(dist_prefix)/$(path)/anchor.hxx) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/mixed/text.map b/examples/cxx/parser/mixed/text.map deleted file mode 100644 index 85971c4..0000000 --- a/examples/cxx/parser/mixed/text.map +++ /dev/null @@ -1,6 +0,0 @@ -# file : examples/cxx/parser/mixed/text.map -# copyright : not copyrighted - public domain - -include "anchor.hxx"; - -anchor ::anchor; diff --git a/examples/cxx/parser/mixed/text.xml b/examples/cxx/parser/mixed/text.xml deleted file mode 100644 index bfdc881..0000000 --- a/examples/cxx/parser/mixed/text.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -The first paragraph of this text talks about time. - -And this paragraph talks about space. - - diff --git a/examples/cxx/parser/mixed/text.xsd b/examples/cxx/parser/mixed/text.xsd deleted file mode 100644 index 92e300c..0000000 --- a/examples/cxx/parser/mixed/text.xsd +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/mixin/README b/examples/cxx/parser/mixin/README deleted file mode 100644 index 343e379..0000000 --- a/examples/cxx/parser/mixin/README +++ /dev/null @@ -1,34 +0,0 @@ -This example shows how to reuse implementations of base parsers -in derived parsers using the mixin C++ idiom. - -The example consists of the following files: - -schema.xsd - XML Schema which defined two data types: base and - derived. - -instance.xml - Sample XML instance document. - -types.hxx - C++ classes that correspond to the base and derived - types in schema.xsd. - -schema.map - Type map. It maps XML Schema types defined in schema.xsd - to C++ types defined in types.hxx. - -schema-pskel.hxx -schema-pskel.cxx - Parser skeletons generated by XSD from schema.xsd and - schema.map. - -driver.cxx - Parser implementations and a driver for the example. It - shows how to mix the implementation of the base parser - into the derived parser. - -To run the example on the sample XML instance document simply -execute: - -$ ./driver instance.xml diff --git a/examples/cxx/parser/mixin/driver.cxx b/examples/cxx/parser/mixin/driver.cxx deleted file mode 100644 index 04466a1..0000000 --- a/examples/cxx/parser/mixin/driver.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// file : examples/cxx/parser/mixin/driver.cxx -// copyright : not copyrighted - public domain - -#include -#include - -#include "types.hxx" -#include "schema-pskel.hxx" - -using namespace std; - -struct base_pimpl: virtual base_pskel -{ - virtual void - pre () - { - base_.reset (new ::base); - } - - virtual void - a (bool v) - { - base_->a (v); - } - - virtual base* - post_base () - { - return base_.release (); - } - -protected: - auto_ptr base_; -}; - -// Implement derived parser by mixing-in base's implementation. -// -struct derived_pimpl: derived_pskel, base_pimpl -{ - virtual void - pre () - { - // Override base's pre() with the new implementation that - // instantiates derived instead of base. - // - base_.reset (new ::derived); - } - - virtual void - b (int v) - { - // We could also store a pointer to derived in derived_impl to - // avoid casting. - // - static_cast< ::derived* > (base_.get ())->b (v); - } - - virtual derived* - post_derived () - { - return static_cast (base_.release ()); - } -}; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " instance.xml" << endl; - return 1; - } - - try - { - // Construct the parser. - // - xml_schema::boolean_pimpl bool_p; - xml_schema::int_pimpl int_p; - derived_pimpl derived_p; - - derived_p.parsers (bool_p, int_p); - - xml_schema::document doc_p (derived_p, "root"); - - derived_p.pre (); - doc_p.parse (argv[1]); - auto_ptr d (derived_p.post_derived ()); - - cerr << "a: " << boolalpha << d->a () << endl; - cerr << "b: " << d->b () << endl; - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/mixin/instance.xml b/examples/cxx/parser/mixin/instance.xml deleted file mode 100644 index 253f348..0000000 --- a/examples/cxx/parser/mixin/instance.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - true - 1 - - diff --git a/examples/cxx/parser/mixin/makefile b/examples/cxx/parser/mixin/makefile deleted file mode 100644 index c4203d8..0000000 --- a/examples/cxx/parser/mixin/makefile +++ /dev/null @@ -1,106 +0,0 @@ -# file : examples/cxx/parser/mixin/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := schema.xsd -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --type-map $(src_base)/schema.map -$(gen): $(out_root)/xsd/xsd $(src_base)/schema.map - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/schema.xsd,$(install_doc_dir)/xsd/$(path)/schema.xsd) - $(call install-data,$(src_base)/instance.xml,$(install_doc_dir)/xsd/$(path)/instance.xml) - $(call install-data,$(src_base)/schema.map,$(install_doc_dir)/xsd/$(path)/schema.map) - $(call install-data,$(src_base)/types.hxx,$(install_doc_dir)/xsd/$(path)/types.hxx) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/schema.xsd,$(dist_prefix)/$(path)/schema.xsd) - $(call install-data,$(src_base)/instance.xml,$(dist_prefix)/$(path)/instance.xml) - $(call install-data,$(src_base)/schema.map,$(dist_prefix)/$(path)/schema.map) - $(call install-data,$(src_base)/types.hxx,$(dist_prefix)/$(path)/types.hxx) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/mixin/schema.map b/examples/cxx/parser/mixin/schema.map deleted file mode 100644 index a93c881..0000000 --- a/examples/cxx/parser/mixin/schema.map +++ /dev/null @@ -1,7 +0,0 @@ -# file : examples/cxx/parser/mixin/schema.map -# copyright : not copyrighted - public domain - -include "types.hxx"; - -base ::base*; -derived ::derived*; diff --git a/examples/cxx/parser/mixin/schema.xsd b/examples/cxx/parser/mixin/schema.xsd deleted file mode 100644 index d2d195d..0000000 --- a/examples/cxx/parser/mixin/schema.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/mixin/types.hxx b/examples/cxx/parser/mixin/types.hxx deleted file mode 100644 index 930033d..0000000 --- a/examples/cxx/parser/mixin/types.hxx +++ /dev/null @@ -1,43 +0,0 @@ -// file : examples/cxx/parser/mixin/types.hxx -// copyright : not copyrighted - public domain - -#ifndef TYPES_HXX -#define TYPES_HXX - -struct base -{ - bool - a () const - { - return a_; - } - - void - a (bool v) - { - a_ = v; - } - -private: - bool a_; -}; - -struct derived: base -{ - int - b () const - { - return b_; - } - - void - b (int v) - { - b_ = v; - } - -private: - int b_; -}; - -#endif // TYPES_HXX diff --git a/examples/cxx/parser/multiroot/README b/examples/cxx/parser/multiroot/README deleted file mode 100644 index 041dfec..0000000 --- a/examples/cxx/parser/multiroot/README +++ /dev/null @@ -1,51 +0,0 @@ -This example shows how to handle XML vocabularies with multiple -root elements using the C++/Parser mapping. - -The example consists of the following files: - -protocol.xsd - XML Schema which defines a simple bank account protocol with - requests such as withdraw and deposit. - -balance.xml -withdraw.xml -deposit.xml - Sample XML instances for the protocol requests. - -protocol.hxx - C++ types that describe the protocol requests. These are - hand-written. - -protocol.map - Type map. It maps XML Schema types defined in protocol.xsd - to the C++ types defined in protocol.hxx. - -protocol-pskel.hxx -protocol-pskel.cxx - Parser skeletons generated by XSD from protocol.xsd and - protocol.map. - -protocol-pimpl.hxx -protocol-pimpl.cxx - Parser implementations that construct the custom object - model from an XML instance using the types from protocol.hxx. - These are hand-written implementations of the parser skeletons - defined in protocol-pskel.hxx. - -driver.cxx - Driver for the example. It implements a custom document parser - that determines which request is being parsed and uses the - corresponding parser implementation. The document parser - intentionally does not support the deposit request to show - how to handle unknown documents. The driver first constructs - a parser instance from all the individual parsers found in - protocol-pimpl.hxx. In then invokes this parser instance to - parse the input file and produce the in-memory object model. - Finally, it prints the contents of the object model to STDERR. - -To run the example on the sample XML request documents simply -execute: - -$ ./driver balance.xml -$ ./driver withdraw.xml -$ ./driver deposit.xml diff --git a/examples/cxx/parser/multiroot/balance.xml b/examples/cxx/parser/multiroot/balance.xml deleted file mode 100644 index 71ed493..0000000 --- a/examples/cxx/parser/multiroot/balance.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - 123456789 - - diff --git a/examples/cxx/parser/multiroot/deposit.xml b/examples/cxx/parser/multiroot/deposit.xml deleted file mode 100644 index 70f0c77..0000000 --- a/examples/cxx/parser/multiroot/deposit.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - 123456789 - 1000000 - - diff --git a/examples/cxx/parser/multiroot/driver.cxx b/examples/cxx/parser/multiroot/driver.cxx deleted file mode 100644 index 3b32898..0000000 --- a/examples/cxx/parser/multiroot/driver.cxx +++ /dev/null @@ -1,161 +0,0 @@ -// file : examples/cxx/parser/multiroot/driver.cxx -// copyright : not copyrighted - public domain - -#include // std::auto_ptr -#include - -#include "protocol.hxx" -#include "protocol-pimpl.hxx" - -using std::cerr; -using std::endl; -using xml_schema::ro_string; - -namespace protocol -{ - // Customize the xml_schema::document object to handle our protocol - // vocabulary with multiple root elements. - // - class document: public xml_schema::document - { - public: - document (balance_pskel& balance_p, withdraw_pskel& withdraw_p) - : balance_p_ (balance_p), withdraw_p_ (withdraw_p) - { - } - - request* - result () - { - return result_.release (); - } - - protected: - // This function is called to obtain the root element type parser. - // If the returned pointed is 0 then the whole document content - // is ignored. The type argument is used to handle polymorphic - // XML documents and is not used in this example (see the polyroot - // example for more information on this argument). - // - virtual xml_schema::parser_base* - start_root_element (const ro_string& ns, - const ro_string& name, - const ro_string* /* type */) - { - if (ns == "http://www.codesynthesis.com/protocol") - { - if (name == "balance") - { - balance_p_.pre (); - - return &balance_p_; - } - else if (name == "withdraw") - { - balance_p_.pre (); - - return &withdraw_p_; - } - } - - cerr << "ignoring unknown request: " << ns << "#" << name << endl; - - return 0; - } - - // This function is called to indicate the completion of document - // parsing. The parser argument contains the pointer returned by - // start_root_element. - // - virtual void - end_root_element (const ro_string& /* ns */, - const ro_string& /* name */, - xml_schema::parser_base* parser) - { - // We could have handled the result directly in this function - // instead of storing it in the result_ variable. - // - if (parser == &balance_p_) - { - result_.reset (balance_p_.post_balance ()); - } - else if (parser == &withdraw_p_) - { - result_.reset (withdraw_p_.post_withdraw ()); - } - else - result_.reset (0); - } - - - private: - std::auto_ptr result_; - - balance_pskel& balance_p_; - withdraw_pskel& withdraw_p_; - }; -} - - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " request.xml" << endl; - return 1; - } - - try - { - using namespace protocol; - - // Construct the parser. - // - xml_schema::unsigned_int_pimpl unsigned_int_p; - - balance_pimpl balance_p; - withdraw_pimpl withdraw_p; - - balance_p.parsers (unsigned_int_p); // account - - withdraw_p.parsers (unsigned_int_p, // account - unsigned_int_p); // amount - - // Parse the XML instance document. - // - document doc_p (balance_p, withdraw_p); - - // pre() and post() will be called as part of the start_root_element() - // and end_root_element() calls. - // - doc_p.parse (argv[1]); - std::auto_ptr r (doc_p.result ()); - - // Let's print what we've got. - // - if (balance* b = dynamic_cast (r.get ())) - { - cerr << "balance request for acc# " << b->account () << endl; - } - else if (withdraw* w = dynamic_cast (r.get ())) - { - cerr << "withdrawal request for acc# " << w->account () << ", " - << "amount: " << w->amount () << endl; - } - else - { - cerr << "unknown request" << endl; - } - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/multiroot/makefile b/examples/cxx/parser/multiroot/makefile deleted file mode 100644 index a8557d6..0000000 --- a/examples/cxx/parser/multiroot/makefile +++ /dev/null @@ -1,112 +0,0 @@ -# file : examples/cxx/parser/multiroot/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := protocol.xsd -cxx := driver.cxx protocol-pimpl.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --type-map $(src_base)/protocol.map -$(gen): $(out_root)/xsd/xsd $(src_base)/protocol.map - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/protocol.xsd,$(install_doc_dir)/xsd/$(path)/protocol.xsd) - $(call install-data,$(src_base)/balance.xml,$(install_doc_dir)/xsd/$(path)/balance.xml) - $(call install-data,$(src_base)/deposit.xml,$(install_doc_dir)/xsd/$(path)/deposit.xml) - $(call install-data,$(src_base)/withdraw.xml,$(install_doc_dir)/xsd/$(path)/withdraw.xml) - $(call install-data,$(src_base)/protocol.map,$(install_doc_dir)/xsd/$(path)/protocol.map) - $(call install-data,$(src_base)/protocol.hxx,$(install_doc_dir)/xsd/$(path)/protocol.hxx) - $(call install-data,$(src_base)/protocol-pimpl.hxx,$(install_doc_dir)/xsd/$(path)/protocol-pimpl.hxx) - $(call install-data,$(src_base)/protocol-pimpl.cxx,$(install_doc_dir)/xsd/$(path)/protocol-pimpl.cxx) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/protocol.xsd,$(dist_prefix)/$(path)/protocol.xsd) - $(call install-data,$(src_base)/balance.xml,$(dist_prefix)/$(path)/balance.xml) - $(call install-data,$(src_base)/deposit.xml,$(dist_prefix)/$(path)/deposit.xml) - $(call install-data,$(src_base)/withdraw.xml,$(dist_prefix)/$(path)/withdraw.xml) - $(call install-data,$(src_base)/protocol.map,$(dist_prefix)/$(path)/protocol.map) - $(call install-data,$(src_base)/protocol.hxx,$(dist_prefix)/$(path)/protocol.hxx) - $(call install-data,$(src_base)/protocol-pimpl.hxx,$(dist_prefix)/$(path)/protocol-pimpl.hxx) - $(call install-data,$(src_base)/protocol-pimpl.cxx,$(dist_prefix)/$(path)/protocol-pimpl.cxx) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/multiroot/protocol-pimpl.cxx b/examples/cxx/parser/multiroot/protocol-pimpl.cxx deleted file mode 100644 index b5ec1b2..0000000 --- a/examples/cxx/parser/multiroot/protocol-pimpl.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// file : examples/cxx/parser/multiroot/protocol-pimpl.cxx -// copyright : not copyrighted - public domain - -#include "protocol-pimpl.hxx" - -namespace protocol -{ - // request_pimpl - // - void request_pimpl:: - account (unsigned int account) - { - account_ = account; - } - - request* request_pimpl:: - post_request () - { - // This parser is never used directly. - // - return 0; - } - - // balance_pimpl - // - balance* balance_pimpl:: - post_balance () - { - return new balance (account_); - } - - // withdraw_pimpl - // - void withdraw_pimpl:: - amount (unsigned int amount) - { - amount_ = amount; - } - - withdraw* withdraw_pimpl:: - post_withdraw () - { - return new withdraw (account_, amount_); - } -} - diff --git a/examples/cxx/parser/multiroot/protocol-pimpl.hxx b/examples/cxx/parser/multiroot/protocol-pimpl.hxx deleted file mode 100644 index c0693cb..0000000 --- a/examples/cxx/parser/multiroot/protocol-pimpl.hxx +++ /dev/null @@ -1,48 +0,0 @@ -// file : examples/cxx/parser/multiroot/protocol-pimpl.hxx -// copyright : not copyrighted - public domain - -#ifndef PROTOCOL_PIMPL_HXX -#define PROTOCOL_PIMPL_HXX - -#include "protocol.hxx" -#include "protocol-pskel.hxx" - -namespace protocol -{ - class request_pimpl: public virtual request_pskel - { - public: - virtual void - account (unsigned int); - - virtual request* - post_request (); - - protected: - unsigned int account_; - }; - - class balance_pimpl: public virtual balance_pskel, - public request_pimpl - { - public: - virtual balance* - post_balance (); - }; - - class withdraw_pimpl: public virtual withdraw_pskel, - public request_pimpl - { - public: - virtual void - amount (unsigned int); - - virtual withdraw* - post_withdraw (); - - private: - unsigned int amount_; - }; -} - -#endif // PROTOCOL_PIMPL_HXX diff --git a/examples/cxx/parser/multiroot/protocol.hxx b/examples/cxx/parser/multiroot/protocol.hxx deleted file mode 100644 index bbf5b56..0000000 --- a/examples/cxx/parser/multiroot/protocol.hxx +++ /dev/null @@ -1,61 +0,0 @@ -// file : examples/cxx/parser/multiroot/protocol.hxx -// copyright : not copyrighted - public domain - -#ifndef PROTOCOL_HXX -#define PROTOCOL_HXX - -namespace protocol -{ - class request - { - public: - virtual - ~request () - { - } - - unsigned int - account () const - { - return account_; - } - - protected: - request (unsigned int account) - : account_ (account) - { - } - - private: - unsigned int account_; - }; - - class balance: public request - { - public: - balance (unsigned int account) - : request (account) - { - } - }; - - class withdraw: public request - { - public: - withdraw (unsigned int account, unsigned int amount) - : request (account), amount_ (amount) - { - } - - unsigned int - amount () const - { - return amount_; - } - - private: - unsigned int amount_; - }; -} - -#endif // PROTOCOL_HXX diff --git a/examples/cxx/parser/multiroot/protocol.map b/examples/cxx/parser/multiroot/protocol.map deleted file mode 100644 index 8d8ac9f..0000000 --- a/examples/cxx/parser/multiroot/protocol.map +++ /dev/null @@ -1,11 +0,0 @@ -# file : examples/cxx/parser/multiroot/protocol.map -# copyright : not copyrighted - public domain - -namespace http://www.codesynthesis.com/protocol ::protocol -{ - include "protocol.hxx"; - - request request*; - balance balance*; - withdraw withdraw*; -} diff --git a/examples/cxx/parser/multiroot/protocol.xsd b/examples/cxx/parser/multiroot/protocol.xsd deleted file mode 100644 index e0ecc29..0000000 --- a/examples/cxx/parser/multiroot/protocol.xsd +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/multiroot/withdraw.xml b/examples/cxx/parser/multiroot/withdraw.xml deleted file mode 100644 index 6d5cb39..0000000 --- a/examples/cxx/parser/multiroot/withdraw.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - 123456789 - 1000000 - - diff --git a/examples/cxx/parser/performance/README b/examples/cxx/parser/performance/README deleted file mode 100644 index 39aecca..0000000 --- a/examples/cxx/parser/performance/README +++ /dev/null @@ -1,42 +0,0 @@ -This example measures the performance of XML parsing in the C++/Parser -mapping. It also shows how to structure your code to achieve the maximum -performance for this operation. - -The example consists of the following files: - -test.xsd - XML Schema which describes the test vocabulary. - -test-50k.xml - Test XML document. - -gen.cxx - Program to generate a test document of desired size. - -time.hxx -time.cxx - Class definition that represents time. - -test-pskel.hxx -test-pskel.ixx -test-pskel.cxx - Parser skeletons generated by the XSD compiler from test.xsd. - -driver.cxx - Driver for the example. It first parses the command line arguments - and reads the entire document into a memory buffer. It then creates - a SAX parser and pre-parses and caches the schema if validation is - enabled (Xerces-C++ only). Finally, it runs the performance - measurement loop which on each iteration parses the XML document - from the in-memory buffer. - -To run the example on a test XML document simply execute: - -$ ./driver test-50k.xml - -The -v option can be used to turn on validation in the underlying XML -parser (only makes sense for Xerces-C++, off by default). The -i option -can be used to specify the number of parsing iterations (1000 by default). -For example: - -$ ./driver -v -i 100 test-50k.xml diff --git a/examples/cxx/parser/performance/driver.cxx b/examples/cxx/parser/performance/driver.cxx deleted file mode 100644 index 302464e..0000000 --- a/examples/cxx/parser/performance/driver.cxx +++ /dev/null @@ -1,341 +0,0 @@ -// file : examples/cxx/parser/performance/driver.cxx -// copyright : not copyrighted - public domain - -#include -#include // std::auto_ptr -#include // std::size_t -#include -#include -#include - -#include "time.hxx" -#include "test-pskel.hxx" - -#ifdef _XERCES_VERSION -# include -# include -# include -# include -# include -# include - -# include -# include -#endif - -// No-op parser implementation. -// -namespace test -{ - struct enum_pimpl: enum_pskel, xml_schema::string_pimpl - { - virtual void - post_enum () - { - } - }; - - struct record_pimpl: record_pskel - { - virtual void - int_ (unsigned int) - { - } - - virtual void - double_ (double) - { - } - - virtual void - name (const std::string&) - { - } - - virtual void - string (const std::string&) - { - } - - virtual void - choice1 (const std::string&) - { - } - - virtual void - choice2 (const std::string&) - { - } - - virtual void - choice3 (const std::string&) - { - } - - virtual void - choice4 (const std::string&) - { - } - - virtual void - apple (bool) - { - } - - virtual void - orange (unsigned long long) - { - } - }; - - struct root_pimpl: root_pskel - { - }; -} - -using namespace std; - -int -main (int argc, char* argv[]) -{ - if (argc < 2) - { - cerr << "usage: " << argv[0] << " [-v] [-i ] test.xml" << endl - << "\t -v turn on validation (default is off)" << endl - << "\t -i number of iterations to perform (default is 1000)" << endl; - return 1; - } - - bool validate (false); - unsigned long iter (1000); - const char* file (0); - - // Parse command line arguments. - // - for (int i (1); i < argc; ++i) - { - string arg (argv[i]); - - if (arg == "-v") - { - validate = true; - } - else if (arg == "-i") - { - if (++i == argc) - { - cerr << "argument expected for the -i option" << endl; - return 1; - } - - iter = 0; - istringstream is (argv[i]); - is >> iter; - - if (iter == 0) - { - cerr << "invalid argument for the -i option" << endl; - return 1; - } - } - else - { - file = argv[i]; - break; - } - } - - if (file == 0) - { - cerr << "no input file specified" << endl; - return 1; - } - - try - { - // Instantiate and connect parsers. - // - xml_schema::unsigned_int_pimpl unsigned_int_p; - xml_schema::double_pimpl double_p; - xml_schema::ncname_pimpl ncname_p; - xml_schema::string_pimpl string_p; - xml_schema::boolean_pimpl boolean_p; - xml_schema::unsigned_long_pimpl unsigned_long_p; - - test::enum_pimpl enum_p; - test::record_pimpl record_p; - test::root_pimpl root_p; - - record_p.parsers (unsigned_int_p, - double_p, - ncname_p, - string_p, - string_p, - string_p, - string_p, - string_p, - enum_p, - boolean_p, - unsigned_long_p); - - root_p.parsers (record_p); - - // Read the fine into in-memory buffer. - // - ifstream ifs; - ifs.exceptions (ios_base::failbit); - ifs.open (file, ios::in | ios::ate); - - size_t size (ifs.tellg ()); - ifs.seekg (0, ios::beg); - - char* buf = new char[size]; - ifs.read (buf, size); - ifs.close (); - - cerr << "document size: " << size << " bytes" << endl - << "iterations: " << iter << endl; - - os::time time (0); - xml_schema::document doc (root_p, "test", "root"); - -#ifdef _XERCES_VERSION - - // Xerces-C++ as the underlying XML parser. - // - using namespace xercesc; - - namespace xml = xsd::cxx::xml; - namespace parser = xsd::cxx::parser; - - XMLPlatformUtils::Initialize (); - - { - MemBufInputSource is ( - reinterpret_cast (buf), size, file, false); - is.setCopyBufToStream (false); - - auto_ptr parser (XMLReaderFactory::createXMLReader ()); - - parser->setFeature (XMLUni::fgSAX2CoreNameSpaces, true); - parser->setFeature (XMLUni::fgSAX2CoreNameSpacePrefixes, true); - parser->setFeature (XMLUni::fgXercesValidationErrorAsFatal, true); - - if (validate) - { - parser->setFeature (XMLUni::fgSAX2CoreValidation, true); - parser->setFeature (XMLUni::fgXercesSchema, true); - parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); - - // Xerces-C++ 3.1.0 is the first version with working multi import - // support. - // -#if _XERCES_VERSION >= 30100 - parser->setFeature (XMLUni::fgXercesHandleMultipleImports, true); -#endif - - // Initialize the schema cache. To detect schema errors we will - // need an error handler. - // - parser::error_handler eh; - xml::sax::bits::error_handler_proxy ehp (eh); - parser->setErrorHandler (&ehp); - - if (!parser->loadGrammar ("test.xsd", Grammar::SchemaGrammarType, true)) - { - // In Xerces-C++ grammar loading failure results in just a warning. - // Make it a fatal error. - // - eh.handle ("test.xsd", 0, 0, - parser::error_handler::severity::fatal, - "unable to load schema"); - } - - eh.throw_if_failed (); - parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true); - -#if _XERCES_VERSION >= 30100 - parser->setFeature (XMLUni::fgXercesLoadSchema, false); -#endif - } - else - { - parser->setFeature (XMLUni::fgSAX2CoreValidation, false); - parser->setFeature (XMLUni::fgXercesSchema, false); - parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); - } - - os::time start; - - for (unsigned long i (0); i < iter; ++i) - { - root_p.pre (); - doc.parse (is, *parser); - root_p.post_root (); - } - - os::time end; - time = end - start; - } - - XMLPlatformUtils::Terminate (); - -#else - - // Expat as the underlying XML parser. - // - XML_Parser xml_parser (XML_ParserCreateNS (0, ' ')); - string public_id (file); - - os::time start; - - for (unsigned long i (0); i < iter; ++i) - { - // Using the low-level Expat-specific API to parse the memory - // buffer. - // - root_p.pre (); - doc.parse_begin (xml_parser, public_id); - - XML_Parse (xml_parser, buf, size, 1); - - doc.parse_end (); - root_p.post_root (); - - XML_ParserReset (xml_parser, 0); - } - - os::time end; - time = end - start; - - XML_ParserFree (xml_parser); - -#endif - - delete[] buf; - - cerr << "time: " << time << " sec" << endl; - - double ms (time.sec () * 1000000ULL + time.nsec () / 1000ULL); - - // Calculate throughput in documents/sec. - // - double tpd ((iter / ms) * 1000000); - cerr << "throughput: " << tpd << " documents/sec" << endl; - - // Calculate throughput in MBytes/sec. - // - double tpb (((size * iter) / ms) * 1000000/(1024*1024)); - cerr << "throughput: " << tpb << " MBytes/sec" << endl; - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (std::ios_base::failure const&) - { - cerr << "io failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/performance/gen.cxx b/examples/cxx/parser/performance/gen.cxx deleted file mode 100644 index b6392c0..0000000 --- a/examples/cxx/parser/performance/gen.cxx +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include - -using namespace std; - -static const char* enums[] = -{ - "romance", - "fiction", - "horror", - "history", - "philosophy" -}; - -int -main (int argc, char* argv[]) -{ - if (argc != 3) - { - cerr << "usage: " << argv[0] << " " << endl; - return 1; - } - - unsigned long n (0); - istringstream is (argv[1]); - is >> n; - - if (n == 0) - { - cerr << "record count argument should be a positive number" << endl; - return 1; - } - - ofstream ofs (argv[2]); - - if (!ofs.is_open ()) - { - cerr << "unable to open '" << argv[2] << "' in write mode" << endl; - return 1; - } - - ofs << ""; - - unsigned short ch (1), en (0); - - for (unsigned long i (0); i < n; ++i) - { - ofs << "" - << "42" - << "42345.4232" - << "name123_45"; - - if (i % 2 == 1) - ofs << "one two three"; - - ofs << "" << ch << " choice" - << "" << enums[en] << "" - << ""; - - if (++ch > 4) - ch = 1; - - if (++en > 4) - en = 0; - } - - ofs << ""; -} diff --git a/examples/cxx/parser/performance/makefile b/examples/cxx/parser/performance/makefile deleted file mode 100644 index 9a7a26b..0000000 --- a/examples/cxx/parser/performance/makefile +++ /dev/null @@ -1,108 +0,0 @@ -# file : examples/cxx/parser/performance/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := test.xsd -cxx := driver.cxx time.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --generate-inline -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/test.xsd,$(install_doc_dir)/xsd/$(path)/test.xsd) - $(call install-data,$(src_base)/test-50k.xml,$(install_doc_dir)/xsd/$(path)/test-50k.xml) - $(call install-data,$(src_base)/time.hxx,$(install_doc_dir)/xsd/$(path)/time.hxx) - $(call install-data,$(src_base)/time.cxx,$(install_doc_dir)/xsd/$(path)/time.cxx) - $(call install-data,$(src_base)/gen.cxx,$(install_doc_dir)/xsd/$(path)/gen.cxx) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/test.xsd,$(dist_prefix)/$(path)/test.xsd) - $(call install-data,$(src_base)/test-50k.xml,$(dist_prefix)/$(path)/test-50k.xml) - $(call install-data,$(src_base)/time.hxx,$(dist_prefix)/$(path)/time.hxx) - $(call install-data,$(src_base)/time.cxx,$(dist_prefix)/$(path)/time.cxx) - $(call install-data,$(src_base)/gen.cxx,$(dist_prefix)/$(path)/gen.cxx) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/performance/test-50k.xml b/examples/cxx/parser/performance/test-50k.xml deleted file mode 100644 index 42e22f3..0000000 --- a/examples/cxx/parser/performance/test-50k.xml +++ /dev/null @@ -1 +0,0 @@ -4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction \ No newline at end of file diff --git a/examples/cxx/parser/performance/test.xsd b/examples/cxx/parser/performance/test.xsd deleted file mode 100644 index bb59c2a..0000000 --- a/examples/cxx/parser/performance/test.xsd +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/performance/time.cxx b/examples/cxx/parser/performance/time.cxx deleted file mode 100644 index aca5c74..0000000 --- a/examples/cxx/parser/performance/time.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// file : examples/cxx/parser/performance/time.cxx -// copyright : not copyrighted - public domain - -#include "time.hxx" - -#if defined (WIN32) || defined (__WIN32__) -# define WIN32_LEAN_AND_MEAN -# include // GetSystemTimeAsFileTime -#else -# include // gettimeofday -# include // timeval -#endif - -#include // std::ostream -#include // std::setfill, std::setw - -namespace os -{ - time:: - time () - { -#if defined (WIN32) || defined (__WIN32__) - FILETIME ft; - GetSystemTimeAsFileTime (&ft); - unsigned long long v ( - ((unsigned long long) (ft.dwHighDateTime) << 32) + ft.dwLowDateTime); - - sec_ = static_cast (v / 10000000ULL); - nsec_ = static_cast ((v % 10000000ULL) * 100); -#else - timeval tv; - if (gettimeofday(&tv, 0) != 0) - throw failed (); - - sec_ = static_cast (tv.tv_sec); - nsec_ = static_cast (tv.tv_usec * 1000); -#endif - } - - std::ostream& - operator<< (std::ostream& o, time const& t) - { - return o << t.sec () << '.' - << std::setfill ('0') << std::setw (9) << t.nsec (); - } -} diff --git a/examples/cxx/parser/performance/time.hxx b/examples/cxx/parser/performance/time.hxx deleted file mode 100644 index 3b2f040..0000000 --- a/examples/cxx/parser/performance/time.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// file : examples/cxx/parser/performance/time.hxx -// copyright : not copyrighted - public domain - -#ifndef TIME_HXX -#define TIME_HXX - -#include // std::ostream& - -namespace os -{ - class time - { - public: - class failed {}; - - // Create a time object representing the current time. - // - time (); - - time (unsigned long long nsec) - { - sec_ = static_cast (nsec / 1000000000ULL); - nsec_ = static_cast (nsec % 1000000000ULL); - } - - time (unsigned long sec, unsigned long nsec) - { - sec_ = sec; - nsec_ = nsec; - } - - public: - unsigned long - sec () const - { - return sec_; - } - - unsigned long - nsec () const - { - return nsec_; - } - - public: - class overflow {}; - class underflow {}; - - time - operator+= (time const& b) - { - unsigned long long tmp = 0ULL + nsec_ + b.nsec_; - - sec_ += static_cast (b.sec_ + tmp / 1000000000ULL); - nsec_ = static_cast (tmp % 1000000000ULL); - - return *this; - } - - time - operator-= (time const& b) - { - if (*this < b) - throw underflow (); - - sec_ -= b.sec_; - - if (nsec_ < b.nsec_) - { - --sec_; - nsec_ += 1000000000ULL - b.nsec_; - } - else - nsec_ -= b.nsec_; - - return *this; - } - - friend time - operator+ (time const& a, time const& b) - { - time r (a); - r += b; - return r; - } - - friend time - operator- (time const& a, time const& b) - { - time r (a); - r -= b; - return r; - } - - friend bool - operator < (time const& a, time const& b) - { - return (a.sec_ < b.sec_) || (a.sec_ == b.sec_ && a.nsec_ < b.nsec_); - } - - private: - unsigned long sec_; - unsigned long nsec_; - }; - - std::ostream& - operator<< (std::ostream&, time const&); -} - -#endif // TIME_HXX diff --git a/examples/cxx/parser/polymorphism/README b/examples/cxx/parser/polymorphism/README deleted file mode 100644 index 60a97e9..0000000 --- a/examples/cxx/parser/polymorphism/README +++ /dev/null @@ -1,30 +0,0 @@ -This example shows how to handle XML Schema polymorphism features such -as xsi:type attributes and substitution groups in the C++/Parser mapping. -The case when xsi:type is used on root elements is covered in the -polyroot examples. - -The example consists of the following files: - -supermen.xsd - XML Schema which describes the "supermen" instance documents. - -supermen.xml - Sample XML instance document. - -supermen-pskel.hxx -supermen-pskel.cxx - Parser skeletons generated by the XSD compiler from supermen.xsd. - Note the use of the --generate-polymorphic command line option. - -supermen-pimpl.hxx -supermen-pimpl.cxx - Parser implementations that print the XML data to STDOUT. - -driver.cxx - Driver for the example. It first constructs a parser instance from - all the individual parsers found in supermen-pimpl.hxx. It then invokes - this parser instance to parse the input file. - -To run the example on the sample XML instance document simply execute: - -$ ./driver supermen.xml diff --git a/examples/cxx/parser/polymorphism/driver.cxx b/examples/cxx/parser/polymorphism/driver.cxx deleted file mode 100644 index ffbe48b..0000000 --- a/examples/cxx/parser/polymorphism/driver.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// file : examples/cxx/parser/polymorphism/driver.cxx -// copyright : not copyrighted - public domain - -#include - -#include "supermen-pimpl.hxx" - -using std::cerr; -using std::endl; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " supermen.xml" << endl; - return 1; - } - - try - { - // Construct the parser. - // - xml_schema::string_pimpl string_p; - xml_schema::boolean_pimpl boolean_p; - xml_schema::unsigned_int_pimpl unsigned_int_p; - - person_pimpl person_p; - superman_pimpl superman_p; - batman_pimpl batman_p; - - xml_schema::parser_map_impl person_map; - - supermen_pimpl supermen_p; - - - person_p.parsers (string_p); - superman_p.parsers (string_p, boolean_p); - batman_p.parsers (string_p, boolean_p, unsigned_int_p); - - // Here we are specifying a parser map which containes several parsers - // that can be used to parse the person element. - // - person_map.insert (person_p); - person_map.insert (superman_p); - person_map.insert (batman_p); - - supermen_p.person_parser (person_map); - - // Parse the XML document. The last argument to the document's - // constructor indicates that we are parsing polymorphic XML - // documents. - // - xml_schema::document doc_p (supermen_p, "supermen", true); - - supermen_p.pre (); - doc_p.parse (argv[1]); - supermen_p.post_supermen (); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/polymorphism/makefile b/examples/cxx/parser/polymorphism/makefile deleted file mode 100644 index 918c283..0000000 --- a/examples/cxx/parser/polymorphism/makefile +++ /dev/null @@ -1,105 +0,0 @@ -# file : examples/cxx/parser/polymorphism/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := supermen.xsd -cxx := driver.cxx supermen-pimpl.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --generate-polymorphic -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/supermen.xsd,$(install_doc_dir)/xsd/$(path)/supermen.xsd) - $(call install-data,$(src_base)/supermen.xml,$(install_doc_dir)/xsd/$(path)/supermen.xml) - $(call install-data,$(src_base)/supermen-pimpl.hxx,$(install_doc_dir)/xsd/$(path)/supermen-pimpl.hxx) - $(call install-data,$(src_base)/supermen-pimpl.cxx,$(install_doc_dir)/xsd/$(path)/supermen-pimpl.cxx) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/supermen.xsd,$(dist_prefix)/$(path)/supermen.xsd) - $(call install-data,$(src_base)/supermen.xml,$(dist_prefix)/$(path)/supermen.xml) - $(call install-data,$(src_base)/supermen-pimpl.hxx,$(dist_prefix)/$(path)/supermen-pimpl.hxx) - $(call install-data,$(src_base)/supermen-pimpl.cxx,$(dist_prefix)/$(path)/supermen-pimpl.cxx) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/polymorphism/supermen-pimpl.cxx b/examples/cxx/parser/polymorphism/supermen-pimpl.cxx deleted file mode 100644 index f4b3bc6..0000000 --- a/examples/cxx/parser/polymorphism/supermen-pimpl.cxx +++ /dev/null @@ -1,85 +0,0 @@ -// file : examples/cxx/parser/polymorphism/supermen-pimpl.cxx -// copyright : not copyrighted - public domain -// - -#include - -#include "supermen-pimpl.hxx" - -using std::cout; -using std::endl; - -// person_pimpl -// -void person_pimpl:: -pre () -{ - cout << "starting to parse person" << endl; -} - -void person_pimpl:: -name (const std::string& v) -{ - cout << "name: " << v << endl; -} - -void person_pimpl:: -post_person () -{ - cout << "finished parsing person" << endl - << endl; -} - -// superman_pimpl -// -void superman_pimpl:: -pre () -{ - cout << "starting to parse superman" << endl; -} - -void superman_pimpl:: -can_fly (bool v) -{ - cout << "can-fly: " << v << endl; -} - -void superman_pimpl:: -post_person () -{ - post_superman (); -} - -void superman_pimpl:: -post_superman () -{ - cout << "finished parsing superman" << endl - << endl; -} - -// batman_pimpl -// -void batman_pimpl:: -pre () -{ - cout << "starting to parse batman" << endl; -} - -void batman_pimpl:: -wing_span (unsigned int v) -{ - cout << "wing-span: " << v << endl; -} - -void batman_pimpl:: -post_superman () -{ - post_batman (); -} - -void batman_pimpl:: -post_batman () -{ - cout << "finished parsing batman" << endl - << endl; -} diff --git a/examples/cxx/parser/polymorphism/supermen-pimpl.hxx b/examples/cxx/parser/polymorphism/supermen-pimpl.hxx deleted file mode 100644 index eaf81e5..0000000 --- a/examples/cxx/parser/polymorphism/supermen-pimpl.hxx +++ /dev/null @@ -1,68 +0,0 @@ -// file : examples/cxx/parser/polymorphism/supermen-pimpl.hxx -// copyright : not copyrighted - public domain - -#ifndef SUPERMEN_PIMPL_HXX -#define SUPERMEN_PIMPL_HXX - -#include "supermen-pskel.hxx" - -class person_pimpl: public virtual person_pskel -{ -public: - virtual void - pre (); - - virtual void - name (const std::string&); - - virtual void - post_person (); -}; - -class superman_pimpl: public virtual superman_pskel, - public person_pimpl -{ -public: - virtual void - pre (); - - virtual void - can_fly (bool); - - // By default, post_superman() calls post_person(). In case of - // polymorphic parsing we want the opposite: post_person() calls - // post_superman(). - // - virtual void - post_person (); - - virtual void - post_superman (); -}; - -class batman_pimpl: public virtual batman_pskel, - public superman_pimpl -{ -public: - virtual void - pre (); - - virtual void - wing_span (unsigned int); - - // By default, post_batman() calls post_superman(). In case of - // polymorphic parsing we want the opposite: post_superman() - // calls post_batman(). - // - virtual void - post_superman (); - - virtual void - post_batman (); -}; - -class supermen_pimpl: public supermen_pskel -{ -}; - -#endif // SUPERMEN_PIMPL_HXX diff --git a/examples/cxx/parser/polymorphism/supermen.xml b/examples/cxx/parser/polymorphism/supermen.xml deleted file mode 100644 index 15054fa..0000000 --- a/examples/cxx/parser/polymorphism/supermen.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - John Doe - - - - James "007" Bond - - - - Bruce Wayne - - - diff --git a/examples/cxx/parser/polymorphism/supermen.xsd b/examples/cxx/parser/polymorphism/supermen.xsd deleted file mode 100644 index c9029da..0000000 --- a/examples/cxx/parser/polymorphism/supermen.xsd +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/polyroot/README b/examples/cxx/parser/polyroot/README deleted file mode 100644 index f41b91c..0000000 --- a/examples/cxx/parser/polyroot/README +++ /dev/null @@ -1,36 +0,0 @@ -This example shows how to handle the xsi:type attributes when it is used -on root elements. For general coverage of XML Schema polymorphism handling -in the C++/Parser mapping see the polymorphism example. - -The example consists of the following files: - -supermen.xsd - XML Schema which describes the "supermen" instance documents. - -person.xml -superman.xml -batman.xml - Sample XML instance documents. - -supermen-pskel.hxx -supermen-pskel.cxx - Parser skeletons generated by the XSD compiler from supermen.xsd. - Note the use of the --generate-polymorphic command line option. - -supermen-pimpl.hxx -supermen-pimpl.cxx - Parser implementations that print the XML data to STDOUT. - -driver.cxx - Driver for the example. It implements a custom document parser - that determines which XML Schema type is being parsed and uses - the corresponding parser implementation. The driver first - constructs a parser instance from all the individual parsers - found in supermen-pimpl.hxx. In then invokes this parser instance - to parse the input file. - -To run the example on the sample XML instance documents simply execute: - -$ ./driver person.xml -$ ./driver superman.xml -$ ./driver batman.xml diff --git a/examples/cxx/parser/polyroot/batman.xml b/examples/cxx/parser/polyroot/batman.xml deleted file mode 100644 index fad0b71..0000000 --- a/examples/cxx/parser/polyroot/batman.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - Bruce Wayne - - diff --git a/examples/cxx/parser/polyroot/driver.cxx b/examples/cxx/parser/polyroot/driver.cxx deleted file mode 100644 index 1c9c778..0000000 --- a/examples/cxx/parser/polyroot/driver.cxx +++ /dev/null @@ -1,138 +0,0 @@ -// file : examples/cxx/parser/polyroot/driver.cxx -// copyright : not copyrighted - public domain - -#include -#include -#include - -#include "supermen-pimpl.hxx" - -using std::cerr; -using std::endl; -using xml_schema::ro_string; - -// Customize the xml_schema::document object to handle polymorphic -// root element. For more information see the multiroot example. -// -class document: public xml_schema::document -{ -public: - document (const xml_schema::parser_map& parser_map) - : xml_schema::document (true), // Indicate polymorphic parsing. - parser_map_ (parser_map) - { - } - -protected: - // This function is called to obtain the root element type parser. - // If the returned pointer is 0 then the whole document content - // is ignored. The type argument contains the XML Schema type - // if xsi:type attribute was specified for this element and 0 - // otherwise. - // - virtual xml_schema::parser_base* - start_root_element (const ro_string& ns, - const ro_string& name, - const ro_string* type) - { - if (name != "person" || !ns.empty ()) - return 0; - - xml_schema::parser_base* base; - - // Search the parser map. - // - if (type == 0) - { - // No xsi:type. Static type should be used. - // - ro_string st (person_pskel::_static_type ()); - base = parser_map_.find (st); - } - else - { - base = parser_map_.find (*type); - } - - if (base != 0) - { - parser_used_ = dynamic_cast (base); - parser_used_->pre (); - } - else - parser_used_ = 0; // No parser for this type. - - return parser_used_; - } - - // This function is called to indicate the completion of document - // parsing. The parser argument contains the pointer returned by - // start_root_element. - // - virtual void - end_root_element (const ro_string& /* ns */, - const ro_string& /* name */, - xml_schema::parser_base* /* parser */) - { - // Instead of caching the current parser in parser_used_, we - // could also dynamic_cast the parser argument to the person_pskel - // type. - // - if (parser_used_) - parser_used_->post_person (); - } - - -private: - const xml_schema::parser_map& parser_map_; - person_pskel* parser_used_; -}; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " instance.xml" << endl; - return 1; - } - - try - { - // Construct the parser. - // - xml_schema::string_pimpl string_p; - xml_schema::boolean_pimpl boolean_p; - xml_schema::unsigned_int_pimpl unsigned_int_p; - - person_pimpl person_p; - superman_pimpl superman_p; - batman_pimpl batman_p; - - person_p.parsers (string_p); - superman_p.parsers (string_p, boolean_p); - batman_p.parsers (string_p, boolean_p, unsigned_int_p); - - // Parse the XML document. - // - xml_schema::parser_map_impl person_map; - - person_map.insert (person_p); - person_map.insert (superman_p); - person_map.insert (batman_p); - - document doc_p (person_map); - - doc_p.parse (argv[1]); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/polyroot/makefile b/examples/cxx/parser/polyroot/makefile deleted file mode 100644 index 08ceec3..0000000 --- a/examples/cxx/parser/polyroot/makefile +++ /dev/null @@ -1,109 +0,0 @@ -# file : examples/cxx/parser/polyroot/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := supermen.xsd -cxx := driver.cxx supermen-pimpl.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --generate-polymorphic -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/supermen.xsd,$(install_doc_dir)/xsd/$(path)/supermen.xsd) - $(call install-data,$(src_base)/batman.xml,$(install_doc_dir)/xsd/$(path)/batman.xml) - $(call install-data,$(src_base)/person.xml,$(install_doc_dir)/xsd/$(path)/person.xml) - $(call install-data,$(src_base)/superman.xml,$(install_doc_dir)/xsd/$(path)/superman.xml) - $(call install-data,$(src_base)/supermen-pimpl.hxx,$(install_doc_dir)/xsd/$(path)/supermen-pimpl.hxx) - $(call install-data,$(src_base)/supermen-pimpl.cxx,$(install_doc_dir)/xsd/$(path)/supermen-pimpl.cxx) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/supermen.xsd,$(dist_prefix)/$(path)/supermen.xsd) - $(call install-data,$(src_base)/batman.xml,$(dist_prefix)/$(path)/batman.xml) - $(call install-data,$(src_base)/person.xml,$(dist_prefix)/$(path)/person.xml) - $(call install-data,$(src_base)/superman.xml,$(dist_prefix)/$(path)/superman.xml) - $(call install-data,$(src_base)/supermen-pimpl.hxx,$(dist_prefix)/$(path)/supermen-pimpl.hxx) - $(call install-data,$(src_base)/supermen-pimpl.cxx,$(dist_prefix)/$(path)/supermen-pimpl.cxx) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/parser/polyroot/person.xml b/examples/cxx/parser/polyroot/person.xml deleted file mode 100644 index f463bea..0000000 --- a/examples/cxx/parser/polyroot/person.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - John Doe - - diff --git a/examples/cxx/parser/polyroot/superman.xml b/examples/cxx/parser/polyroot/superman.xml deleted file mode 100644 index c831f6c..0000000 --- a/examples/cxx/parser/polyroot/superman.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - James "007" Bond - - diff --git a/examples/cxx/parser/polyroot/supermen-pimpl.cxx b/examples/cxx/parser/polyroot/supermen-pimpl.cxx deleted file mode 100644 index 62289e9..0000000 --- a/examples/cxx/parser/polyroot/supermen-pimpl.cxx +++ /dev/null @@ -1,85 +0,0 @@ -// file : examples/cxx/parser/polyroot/supermen-pimpl.cxx -// copyright : not copyrighted - public domain -// - -#include - -#include "supermen-pimpl.hxx" - -using std::cout; -using std::endl; - -// person_pimpl -// -void person_pimpl:: -pre () -{ - cout << "starting to parse person" << endl; -} - -void person_pimpl:: -name (const std::string& v) -{ - cout << "name: " << v << endl; -} - -void person_pimpl:: -post_person () -{ - cout << "finished parsing person" << endl - << endl; -} - -// superman_pimpl -// -void superman_pimpl:: -pre () -{ - cout << "starting to parse superman" << endl; -} - -void superman_pimpl:: -can_fly (bool v) -{ - cout << "can-fly: " << v << endl; -} - -void superman_pimpl:: -post_person () -{ - post_superman (); -} - -void superman_pimpl:: -post_superman () -{ - cout << "finished parsing superman" << endl - << endl; -} - -// batman_pimpl -// -void batman_pimpl:: -pre () -{ - cout << "starting to parse batman" << endl; -} - -void batman_pimpl:: -wing_span (unsigned int v) -{ - cout << "wing-span: " << v << endl; -} - -void batman_pimpl:: -post_superman () -{ - post_batman (); -} - -void batman_pimpl:: -post_batman () -{ - cout << "finished parsing batman" << endl - << endl; -} diff --git a/examples/cxx/parser/polyroot/supermen-pimpl.hxx b/examples/cxx/parser/polyroot/supermen-pimpl.hxx deleted file mode 100644 index 49e8c74..0000000 --- a/examples/cxx/parser/polyroot/supermen-pimpl.hxx +++ /dev/null @@ -1,64 +0,0 @@ -// file : examples/cxx/parser/polyroot/supermen-pimpl.hxx -// copyright : not copyrighted - public domain - -#ifndef SUPERMEN_PIMPL_HXX -#define SUPERMEN_PIMPL_HXX - -#include "supermen-pskel.hxx" - -class person_pimpl: public virtual person_pskel -{ -public: - virtual void - pre (); - - virtual void - name (const std::string&); - - virtual void - post_person (); -}; - -class superman_pimpl: public virtual superman_pskel, - public person_pimpl -{ -public: - virtual void - pre (); - - virtual void - can_fly (bool); - - // By default, post_superman() calls post_person(). In case of - // polymorphic parsing we want the opposite: post_person() calls - // post_superman(). - // - virtual void - post_person (); - - virtual void - post_superman (); -}; - -class batman_pimpl: public virtual batman_pskel, - public superman_pimpl -{ -public: - virtual void - pre (); - - virtual void - wing_span (unsigned int); - - // By default, post_batman() calls post_superman(). In case of - // polymorphic parsing we want the opposite: post_superman() - // calls post_batman(). - // - virtual void - post_superman (); - - virtual void - post_batman (); -}; - -#endif // SUPERMEN_PIMPL_HXX diff --git a/examples/cxx/parser/polyroot/supermen.xsd b/examples/cxx/parser/polyroot/supermen.xsd deleted file mode 100644 index dc5d439..0000000 --- a/examples/cxx/parser/polyroot/supermen.xsd +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/wildcard/README b/examples/cxx/parser/wildcard/README deleted file mode 100644 index 89f9aa9..0000000 --- a/examples/cxx/parser/wildcard/README +++ /dev/null @@ -1,27 +0,0 @@ -This example shows how to parse the XML data matched by XML Schema -wildcards (any and anyAttribute) in the C++/Parser mapping. The -example consists of the following files: - -email.xsd - XML Schema which describes a simple email format with the - extensible envelope type. - -email.xml - Sample email message. - -email-pskel.hxx -email-pskel.cxx - Parser skeletons generated by XSD from email.xsd. - -driver.cxx - Parser implementations and a driver for the example. The - parser implementations simply print the data to STDERR. - The driver first constructs parser instances from the - parser implementations mentioned above and a couple of - predefined parsers for the XML Schema built-in types. - In then invokes the parser instances to parse the input - file. - -To run the example on the sample XML instance document simply execute: - -$ ./driver email.xml diff --git a/examples/cxx/parser/wildcard/driver.cxx b/examples/cxx/parser/wildcard/driver.cxx deleted file mode 100644 index fa82ec0..0000000 --- a/examples/cxx/parser/wildcard/driver.cxx +++ /dev/null @@ -1,239 +0,0 @@ -// file : examples/cxx/parser/wildcard/driver.cxx -// copyright : not copyrighted - public domain - -#include -#include -#include - -#include "email-pskel.hxx" - -using namespace std; -using xml_schema::ro_string; - -class binary_pimpl: public email::binary_pskel, - public xml_schema::base64_binary_pimpl -{ -public: - virtual void - name (const string& n) - { - cerr << "binary: " << n << endl; - } - - virtual void - mime (const string& t) - { - cerr << "type: " << t << endl - << endl; - } - - virtual void - post_binary () - { - auto_ptr buf (post_base64_binary ()); - - cerr << "size: " << buf->size () << endl - << endl; - } -}; - -class envelope_pimpl: public email::envelope_pskel -{ -public: - envelope_pimpl (xml_schema::unsigned_int_pskel& uint_p, - xml_schema::string_pskel& string_p, - email::binary_pskel& binary_p) - : depth_ (0), cur_ (0), - uint_p_ (uint_p), string_p_ (string_p), binary_p_ (binary_p) - { - } - - virtual void - to (const string& addr) - { - cerr << "To: " << addr << endl; - } - - virtual void - from (const string& addr) - { - cerr << "From: " << addr << endl; - } - - virtual void - subject (const string& s) - { - cerr << "Subject: " << s << endl; - } - - // Wildcard handling. All wildcard events are routed to these - // four functions. It is our job to dispatch them to the right - // parsers. - // - virtual void - _start_any_element (const ro_string& ns, - const ro_string& name, - const ro_string* type) - { - if (depth_++ > 0) - { - // Nested wildcard element. - // - if (cur_) - cur_->_start_element (ns, name, type); - } - else - { - // Top-level element matched by the any wildcard. - // - if (ns == "http://www.codesynthesis.com/email") - { - if (name == "text") - { - cur_ = &string_p_; - string_p_.pre (); - string_p_._pre_impl (); - } - else if (name == "binary") - { - cur_ = &binary_p_; - binary_p_.pre (); - binary_p_._pre_impl (); - } - } - - if (cur_ == 0) - { - cerr << "Unknown wildcard content: " << ns << "#" << name << endl; - } - } - } - - virtual void - _end_any_element (const ro_string& ns, const ro_string& name) - { - if (--depth_ > 0) - { - if (cur_) - cur_->_end_element (ns, name); - } - else - { - if (ns == "http://www.codesynthesis.com/email") - { - if (name == "text") - { - string_p_._post_impl (); - string text (string_p_.post_string ()); - - cerr << text << endl - << endl; - } - else if (name == "binary") - { - binary_p_._post_impl (); - binary_p_.post_binary (); - } - } - - cur_ = 0; - } - } - - virtual void - _any_attribute (const ro_string& ns, - const ro_string& name, - const ro_string& value) - { - if (depth_ > 0) - { - // Nested wildcard attribute. - // - if (cur_) - cur_->_attribute (ns, name, value); - } - else - { - // Top-level attribute matched by the anyAttribute wildcard. - // - if (ns == "http://www.codesynthesis.com/email" && name == "thread-id") - { - uint_p_.pre (); - uint_p_._pre_impl (); - uint_p_._characters (value); - uint_p_._post_impl (); - unsigned int tid (uint_p_.post_unsigned_int ()); - - cerr << "Thread-id: " << tid << endl; - } - } - } - - virtual void - _any_characters (const ro_string& s) - { - if (depth_ > 0) - { - if (cur_) - cur_->_characters (s); - } - } - -private: - size_t depth_; - xml_schema::parser_base* cur_; - - // Parsers for the unsigned int, string and binary types. - // -private: - xml_schema::unsigned_int_pskel& uint_p_; - xml_schema::string_pskel& string_p_; - email::binary_pskel& binary_p_; -}; - - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " email.xml" << endl; - return 1; - } - - try - { - // Construct the parser. - // - xml_schema::unsigned_int_pimpl unsigned_int_p; - xml_schema::string_pimpl string_p; - binary_pimpl binary_p; - envelope_pimpl envelope_p (unsigned_int_p, string_p, binary_p); - - binary_p.parsers (string_p, // name - string_p); // mime - - envelope_p.parsers (string_p, // to - string_p, // from - string_p); // subject - - // Parse the XML instance document. - // - xml_schema::document doc_p (envelope_p, - "http://www.codesynthesis.com/email", - "message"); - envelope_p.pre (); - doc_p.parse (argv[1]); - envelope_p.post_envelope (); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } - catch (const std::ios_base::failure&) - { - cerr << argv[1] << ": unable to open or read failure" << endl; - return 1; - } -} diff --git a/examples/cxx/parser/wildcard/email.xml b/examples/cxx/parser/wildcard/email.xml deleted file mode 100644 index f5d0359..0000000 --- a/examples/cxx/parser/wildcard/email.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - Jane Doe <jane@doe.com> - John Doe <john@doe.com> - Surfing pictures - - -Hi Jane, - -Here are cool pictures of me surfing. - -Cheers, -John - - - YmFzZTY0IGJpbmFyeQ== - YmFzZTY0IGJpbmFyeQ== - - diff --git a/examples/cxx/parser/wildcard/email.xsd b/examples/cxx/parser/wildcard/email.xsd deleted file mode 100644 index 087fc7e..0000000 --- a/examples/cxx/parser/wildcard/email.xsd +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/parser/wildcard/makefile b/examples/cxx/parser/wildcard/makefile deleted file mode 100644 index 5887375..0000000 --- a/examples/cxx/parser/wildcard/makefile +++ /dev/null @@ -1,101 +0,0 @@ -# file : examples/cxx/parser/wildcard/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make - -xsd := email.xsd -cxx := driver.cxx - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o)) -dep := $(obj:.o=.o.d) - -driver := $(out_base)/driver -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -clean := $(out_base)/.clean - - -# Import. -# -$(call import,\ - $(scf_root)/import/libxerces-c/stub.make,\ - l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) - - -# Build. -# -$(driver): $(obj) $(xerces_c.l) - -$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd -$(obj) $(dep): $(xerces_c.l.cpp-options) - -genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep),$(obj),$(gen)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/email.xsd,$(install_doc_dir)/xsd/$(path)/email.xsd) - $(call install-data,$(src_base)/email.xml,$(install_doc_dir)/xsd/$(path)/email.xml) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/email.xsd,$(dist_prefix)/$(path)/email.xsd) - $(call install-data,$(src_base)/email.xml,$(dist_prefix)/$(path)/email.xml) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,todos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.make) -$(call include,$(scf_root)/xsd/parser/xsd-cxx.make) - - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) -- cgit v1.1