From a8ce5c380c69539fe0c7c62c397634d9d0c9fde2 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/tree/library/README | 32 --------- examples/cxx/tree/library/driver.cxx | 130 ---------------------------------- examples/cxx/tree/library/library.xml | 52 -------------- examples/cxx/tree/library/library.xsd | 72 ------------------- examples/cxx/tree/library/makefile | 101 -------------------------- 5 files changed, 387 deletions(-) delete mode 100644 examples/cxx/tree/library/README delete mode 100644 examples/cxx/tree/library/driver.cxx delete mode 100644 examples/cxx/tree/library/library.xml delete mode 100644 examples/cxx/tree/library/library.xsd delete mode 100644 examples/cxx/tree/library/makefile (limited to 'examples/cxx/tree/library') diff --git a/examples/cxx/tree/library/README b/examples/cxx/tree/library/README deleted file mode 100644 index 0b8638c..0000000 --- a/examples/cxx/tree/library/README +++ /dev/null @@ -1,32 +0,0 @@ -This example shows how to use the C++/Tree mapping to parse XML documents -into a tree-like in-memory object model, modify this object model, and -finally serialize it back to XML. - -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 -library.ixx -library.cxx - C++ types that represent the given vocabulary, a set of parsing - functions that convert XML documents to a tree-like in-memory object - model, and a set of serialization functions that convert the object - model back to XML. These are generated by XSD from library.xsd. - -driver.cxx - Driver for the example. It first calls one of the parsing functions - that constructs the object model from the input file. It then prints - the content of the object model to STDERR. Finally, the driver modifies - the object model and serializes it back to XML. - -To run the example on the sample XML instance document simply execute: - -$ ./driver library.xml - -This example also shows how to use the ID/IDREF cross-referencing -mechanism and the xsd:enumeration to C++ enum mapping. diff --git a/examples/cxx/tree/library/driver.cxx b/examples/cxx/tree/library/driver.cxx deleted file mode 100644 index 5913ddf..0000000 --- a/examples/cxx/tree/library/driver.cxx +++ /dev/null @@ -1,130 +0,0 @@ -// file : examples/cxx/tree/library/driver.cxx -// copyright : not copyrighted - public domain - -#include // std::auto_ptr -#include - -#include "library.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; - - // Read in the XML file and obtain its object model. - // - std::auto_ptr c (catalog_ (argv[1])); - - - // Let's print what we've got. - // - for (catalog::book_const_iterator bi (c->book ().begin ()); - bi != c->book ().end (); - ++bi) - { - cerr << endl - << "ID : " << bi->id () << endl - << "ISBN : " << bi->isbn () << endl - << "Title : " << bi->title () << endl - << "Genre : " << bi->genre () << endl; - - for (book::author_const_iterator ai (bi->author ().begin ()); - ai != bi->author ().end (); - ++ai) - { - cerr << "Author : " << ai->name () << endl; - cerr << " Born : " << ai->born () << endl; - - if (ai->died ()) - cerr << " Died : " << *ai->died () << endl; - - if (ai->recommends ()) - cerr << " Recommends : " << (*ai->recommends ())->title () << endl; - } - - cerr << "Available : " << std::boolalpha << bi->available () << endl; - } - - - // Now we are going to modify the object model and serialize it - // back to XML. - // - - catalog::book_sequence& books (c->book ()); - - - // Get rid of all unavailable books. - // - for (catalog::book_iterator bi (books.begin ()); bi != books.end ();) - { - if (!bi->available ()) - bi = books.erase (bi); - else - ++bi; - } - - - // Insert a new book. - // - book b (679776443, // ISBN - "Dead Souls", // Title - genre::philosophy, // Genre - "DS"); // ID - - b.author ().push_back (author ("Nikolai Gogol", - xml_schema::date (1809, 3, 31))); - - books.insert (books.begin (), b); - - - // Because we removed all unavailable books, some IDREFs might be - // broken. Let's fix this. - // - for (catalog::book_iterator bi (books.begin ()); bi != books.end (); ++bi) - { - for (book::author_iterator ai (bi->author ().begin ()); - ai != bi->author ().end (); - ++ai) - { - author::recommends_optional& c (ai->recommends ()); - - if (c.present ()) - { - author::recommends_type& ref (c.get ()); - - if (!ref) - c.reset (); - } - } - } - - - // Prepare namespace mapping and schema location information. - // - xml_schema::namespace_infomap map; - - map["lib"].name = "http://www.codesynthesis.com/library"; - map["lib"].schema = "library.xsd"; - - - // Write it out. - // - catalog_ (std::cout, *c, map); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - return 1; - } -} diff --git a/examples/cxx/tree/library/library.xml b/examples/cxx/tree/library/library.xml deleted file mode 100644 index ca4ca9c..0000000 --- a/examples/cxx/tree/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/tree/library/library.xsd b/examples/cxx/tree/library/library.xsd deleted file mode 100644 index b183efc..0000000 --- a/examples/cxx/tree/library/library.xsd +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/tree/library/makefile b/examples/cxx/tree/library/makefile deleted file mode 100644 index ea9bfed..0000000 --- a/examples/cxx/tree/library/makefile +++ /dev/null @@ -1,101 +0,0 @@ -# file : examples/cxx/tree/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 - -obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.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=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options += --generate-inline --generate-ostream \ ---generate-serialization -$(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)/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)/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) - -$(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=.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/tree/xsd-cxx.make) - -# Dependencies. -# -$(call import,$(src_root)/xsd/makefile) -- cgit v1.1