diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-02-24 15:16:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-02-24 15:16:26 +0200 |
commit | 707cc94fe52463870a9c6c8e2e66eaaa389e601d (patch) | |
tree | 13e10ff28bf4455d915f9d59b401bdbb62a393cb /examples/cxx/serializer/library |
Start tracking XSD/e with git after version 3.0.03.0.0
Diffstat (limited to 'examples/cxx/serializer/library')
-rw-r--r-- | examples/cxx/serializer/library/README | 44 | ||||
-rw-r--r-- | examples/cxx/serializer/library/driver.cxx | 140 | ||||
-rw-r--r-- | examples/cxx/serializer/library/library-simpl-mixin.cxx | 184 | ||||
-rw-r--r-- | examples/cxx/serializer/library/library-simpl-mixin.hxx | 138 | ||||
-rw-r--r-- | examples/cxx/serializer/library/library-simpl-tiein.cxx | 208 | ||||
-rw-r--r-- | examples/cxx/serializer/library/library-simpl-tiein.hxx | 154 | ||||
-rw-r--r-- | examples/cxx/serializer/library/library.hxx | 270 | ||||
-rw-r--r-- | examples/cxx/serializer/library/library.map | 22 | ||||
-rw-r--r-- | examples/cxx/serializer/library/library.xsd | 79 | ||||
-rw-r--r-- | examples/cxx/serializer/library/makefile | 72 |
10 files changed, 1311 insertions, 0 deletions
diff --git a/examples/cxx/serializer/library/README b/examples/cxx/serializer/library/README new file mode 100644 index 0000000..82ca09c --- /dev/null +++ b/examples/cxx/serializer/library/README @@ -0,0 +1,44 @@ +This example shows how to use the Embedded C++/Serializer +mapping to create XML documents from a custom in-memory +object model. + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +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 C++ types defined in library.hxx. + +library-sskel.hxx +library-sskel.ixx +library-sskel.cxx + Serializer skeletons generated by XSD/e from library.xsd + and library.map. + +library-simpl-mixin.hxx +library-simpl-mixin.cxx + +library-simpl-tiein.hxx +library-simpl-tiein.cxx + Serializer implementations (using either mixin or tiein + parser reuse style) that serialize the custom in-memory + object model to XML. These are hand-written implementations + of the serializer skeletons defined in library-sskel.hxx. + +driver.cxx + Driver for the example. It first constructs a sample + object model using the types from library.hxx. It then + creates a serializer instance using all the individual + serializers found in one of library-simpl-*.hxx. Finally, + it invokes this serializer instance to serialize the sample + object model to an XML document which is printed to STDOUT. + +To run the example simply execute: + +$ ./driver diff --git a/examples/cxx/serializer/library/driver.cxx b/examples/cxx/serializer/library/driver.cxx new file mode 100644 index 0000000..2790028 --- /dev/null +++ b/examples/cxx/serializer/library/driver.cxx @@ -0,0 +1,140 @@ +// file : examples/cxx/serializer/library/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#include <iostream> + +#include "library.hxx" + +#include "library-sskel.hxx" // Get the configuration macros (XSDE_*). + +#if defined(XSDE_REUSE_STYLE_MIXIN) +# include "library-simpl-mixin.hxx" +#elif defined(XSDE_REUSE_STYLE_TIEIN) +# include "library-simpl-tiein.hxx" +#else +# error this example requires mixin or tiein serializer reuse support +#endif + +using std::cerr; +using std::endl; + +int +main () +{ + try + { + using namespace library; + + // Create a sample library catalog. + // + catalog cat; + + { + book b (679760806, + title ("The Master and Margarita"), + fiction, + false, + "MM"); + + author a ("Mikhail Bulgakov", "1891-05-15"); + a.died ("1940-03-10"); + a.recommends ("WP"); + + b.author ().push_back (a); + + cat.push_back (b); + } + + { + book b (679600841, + title ("War and Peace"), + history, + true, + "WP"); + + author a ("Leo Tolstoy", "1828-09-09"); + a.died ("1910-11-20"); + a.recommends ("CP"); + + b.author ().push_back (a); + + cat.push_back (b); + } + + { + book b (679420290, + title ("Crime and Punishment"), + philosophy, + false, + "CP"); + + author a ("Fyodor Dostoevsky", "1821-11-11"); + a.died ("1881-02-09"); + + b.author ().push_back (a); + + cat.push_back (b); + } + + + // Construct the serializer. + // + xml_schema::id_simpl id_s; + xml_schema::idref_simpl idref_s; + xml_schema::string_simpl string_s; + xml_schema::boolean_simpl boolean_s; + + isbn_simpl isbn_s; + + title_simpl title_s; + title_s.lang_serializer (string_s); + + genre_simpl genre_s; + + author_simpl author_s; + author_s.serializers (string_s, // name + string_s, // born + string_s, // died + idref_s); // recommends + + book_simpl book_s; + book_s.serializers (boolean_s, // available + id_s, // id + isbn_s, // isbn + title_s, // title + genre_s, // genre + author_s); // author + + + catalog_simpl catalog_s; + catalog_s.book_serializer (book_s); + + + // Create the XML instance document. + // + xml_schema::document_simpl doc_s ( + catalog_s, + "http://www.codesynthesis.com/library", // root element namespace + "catalog"); // root element name + + doc_s.add_prefix ("lib", "http://www.codesynthesis.com/library"); + doc_s.add_schema ("http://www.codesynthesis.com/library", "library.xsd"); + + catalog_s.pre (cat); + doc_s.serialize (std::cout); + catalog_s.post (); + } + catch (const xml_schema::serializer_exception& e) + { + cerr << "error: " << e.text () << endl; + return 1; + } + catch (const std::ios_base::failure&) + { + cerr << "error: write failure" << endl; + return 1; + } + + return 0; +} diff --git a/examples/cxx/serializer/library/library-simpl-mixin.cxx b/examples/cxx/serializer/library/library-simpl-mixin.cxx new file mode 100644 index 0000000..7e82fe6 --- /dev/null +++ b/examples/cxx/serializer/library/library-simpl-mixin.cxx @@ -0,0 +1,184 @@ +// file : examples/cxx/serializer/library/library-simpl-mixin.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#include "library-simpl-mixin.hxx" + +namespace library +{ + using namespace xml_schema; + + // isbn_simpl + // + void isbn_simpl:: + pre (isbn n) + { + unsigned_int_simpl::pre (n); + } + + // title_simpl + // + void title_simpl:: + pre (const title& t) + { + string_simpl::pre (t); + title_ = &t; + } + + bool title_simpl:: + lang_present () + { + return !title_->lang ().empty (); + } + + std::string title_simpl:: + lang () + { + return title_->lang (); + } + + // genre_simpl + // + const char* genre_strings[] = + { + "romance", + "fiction", + "horror", + "history", + "philosophy" + }; + + void genre_simpl:: + pre (genre g) + { + string_simpl::pre (genre_strings[g]); + } + + // person_simpl + // + void person_simpl:: + pre (const person& p) + { + person_ = &p; + } + + std::string person_simpl:: + name () + { + return person_->name (); + } + + std::string person_simpl:: + born () + { + return person_->born (); + } + + bool person_simpl:: + died_present () + { + return !person_->died ().empty (); + } + + std::string person_simpl:: + died () + { + return person_->died (); + } + + // author_simpl + // + void author_simpl:: + pre (const author& a) + { + person_simpl::pre (a); + author_ = &a; + } + + bool author_simpl:: + recommends_present () + { + return !author_->recommends ().empty (); + } + + std::string author_simpl:: + recommends () + { + return author_->recommends (); + } + + // book_simpl + // + + void book_simpl:: + pre (const book& b) + { + book_ = &b; + ai_ = b.author ().begin (); + } + + library::isbn book_simpl:: + isbn () + { + return book_->isbn (); + } + + const library::title& book_simpl:: + title () + { + return book_->title (); + } + + + library::genre book_simpl:: + genre () + { + return book_->genre (); + } + + bool book_simpl:: + author_next () + { + return ai_ != book_->author ().end (); + } + + const library::author& book_simpl:: + author () + { + return *ai_++; + } + + bool book_simpl:: + available () + { + return book_->available (); + } + + std::string book_simpl:: + id () + { + return book_->id (); + } + + // catalog_simpl + // + void catalog_simpl:: + pre (const catalog& c) + { + catalog_ = &c; + ci_ = c.begin (); + } + + bool catalog_simpl:: + book_next () + { + return ci_ != catalog_->end (); + } + + const library::book& catalog_simpl:: + book () + { + return *ci_++; + } +} + diff --git a/examples/cxx/serializer/library/library-simpl-mixin.hxx b/examples/cxx/serializer/library/library-simpl-mixin.hxx new file mode 100644 index 0000000..c4438d4 --- /dev/null +++ b/examples/cxx/serializer/library/library-simpl-mixin.hxx @@ -0,0 +1,138 @@ +// file : examples/cxx/serializer/library/library-simpl-mixin.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#ifndef LIBRARY_SIMPL_HXX +#define LIBRARY_SIMPL_HXX + +#include "library.hxx" +#include "library-sskel.hxx" + +namespace library +{ + // + // + struct isbn_simpl: virtual isbn_sskel, xml_schema::unsigned_int_simpl + { + virtual void + pre (isbn); + }; + + // + // + struct title_simpl: virtual title_sskel, xml_schema::string_simpl + { + virtual void + pre (const title&); + + virtual bool + lang_present (); + + virtual std::string + lang (); + + private: + const title* title_; + }; + + // + // + struct genre_simpl: virtual genre_sskel, xml_schema::string_simpl + { + virtual void + pre (genre); + }; + + // + // + struct person_simpl: virtual person_sskel + { + virtual void + pre (const person&); + + virtual std::string + name (); + + virtual std::string + born (); + + virtual bool + died_present (); + + virtual std::string + died (); + + private: + const person* person_; + }; + + // + // + struct author_simpl: virtual author_sskel, person_simpl + { + virtual void + pre (const author&); + + virtual bool + recommends_present (); + + virtual std::string + recommends (); + + private: + const author* author_; + }; + + // + // + struct book_simpl: virtual book_sskel + { + virtual void + pre (const book&); + + virtual library::isbn + isbn (); + + virtual const library::title& + title (); + + virtual library::genre + genre (); + + virtual bool + author_next (); + + virtual const library::author& + author (); + + virtual bool + available (); + + virtual std::string + id (); + + private: + const book* book_; + book::authors::const_iterator ai_; + }; + + // + // + struct catalog_simpl: virtual catalog_sskel + { + virtual void + pre (const catalog&); + + virtual bool + book_next (); + + virtual const library::book& + book (); + + private: + const catalog* catalog_; + catalog::const_iterator ci_; + }; +} + +#endif // LIBRARY_SIMPL_HXX diff --git a/examples/cxx/serializer/library/library-simpl-tiein.cxx b/examples/cxx/serializer/library/library-simpl-tiein.cxx new file mode 100644 index 0000000..91a5c23 --- /dev/null +++ b/examples/cxx/serializer/library/library-simpl-tiein.cxx @@ -0,0 +1,208 @@ +// file : examples/cxx/serializer/library/library-simpl-tiein.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#include "library-simpl-tiein.hxx" + +namespace library +{ + using namespace xml_schema; + + // isbn_simpl + // + isbn_simpl:: + isbn_simpl () + : isbn_sskel (&base_impl_) + { + } + + void isbn_simpl:: + pre (isbn n) + { + base_impl_.pre (n); + } + + // title_simpl + // + title_simpl:: + title_simpl () + : title_sskel (&base_impl_) + { + } + + void title_simpl:: + pre (const title& t) + { + base_impl_.pre (t); + title_ = &t; + } + + bool title_simpl:: + lang_present () + { + return !title_->lang ().empty (); + } + + std::string title_simpl:: + lang () + { + return title_->lang (); + } + + // genre_simpl + // + genre_simpl:: + genre_simpl () + : genre_sskel (&base_impl_) + { + } + + const char* genre_strings[] = + { + "romance", + "fiction", + "horror", + "history", + "philosophy" + }; + + void genre_simpl:: + pre (genre g) + { + base_impl_.pre (genre_strings[g]); + } + + // person_simpl + // + void person_simpl:: + pre (const person& p) + { + person_ = &p; + } + + std::string person_simpl:: + name () + { + return person_->name (); + } + + std::string person_simpl:: + born () + { + return person_->born (); + } + + bool person_simpl:: + died_present () + { + return !person_->died ().empty (); + } + + std::string person_simpl:: + died () + { + return person_->died (); + } + + // author_simpl + // + author_simpl:: + author_simpl () + : author_sskel (&base_impl_) + { + } + + void author_simpl:: + pre (const author& a) + { + base_impl_.pre (a); + author_ = &a; + } + + bool author_simpl:: + recommends_present () + { + return !author_->recommends ().empty (); + } + + std::string author_simpl:: + recommends () + { + return author_->recommends (); + } + + // book_simpl + // + + void book_simpl:: + pre (const book& b) + { + book_ = &b; + ai_ = b.author ().begin (); + } + + library::isbn book_simpl:: + isbn () + { + return book_->isbn (); + } + + const library::title& book_simpl:: + title () + { + return book_->title (); + } + + + library::genre book_simpl:: + genre () + { + return book_->genre (); + } + + bool book_simpl:: + author_next () + { + return ai_ != book_->author ().end (); + } + + const library::author& book_simpl:: + author () + { + return *ai_++; + } + + bool book_simpl:: + available () + { + return book_->available (); + } + + std::string book_simpl:: + id () + { + return book_->id (); + } + + // catalog_simpl + // + void catalog_simpl:: + pre (const catalog& c) + { + catalog_ = &c; + ci_ = c.begin (); + } + + bool catalog_simpl:: + book_next () + { + return ci_ != catalog_->end (); + } + + const library::book& catalog_simpl:: + book () + { + return *ci_++; + } +} + diff --git a/examples/cxx/serializer/library/library-simpl-tiein.hxx b/examples/cxx/serializer/library/library-simpl-tiein.hxx new file mode 100644 index 0000000..15abe74 --- /dev/null +++ b/examples/cxx/serializer/library/library-simpl-tiein.hxx @@ -0,0 +1,154 @@ +// file : examples/cxx/serializer/library/library-simpl-tiein.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#ifndef LIBRARY_SIMPL_HXX +#define LIBRARY_SIMPL_HXX + +#include "library.hxx" +#include "library-sskel.hxx" + +namespace library +{ + // + // + struct isbn_simpl: isbn_sskel + { + isbn_simpl (); + + virtual void + pre (isbn); + + private: + xml_schema::unsigned_int_simpl base_impl_; + }; + + // + // + struct title_simpl: title_sskel + { + title_simpl (); + + virtual void + pre (const title&); + + virtual bool + lang_present (); + + virtual std::string + lang (); + + private: + xml_schema::string_simpl base_impl_; + const title* title_; + }; + + // + // + struct genre_simpl: genre_sskel + { + genre_simpl (); + + virtual void + pre (genre); + + private: + xml_schema::string_simpl base_impl_; + }; + + // + // + struct person_simpl: person_sskel + { + virtual void + pre (const person&); + + virtual std::string + name (); + + virtual std::string + born (); + + virtual bool + died_present (); + + virtual std::string + died (); + + private: + const person* person_; + }; + + // + // + struct author_simpl: author_sskel + { + author_simpl (); + + virtual void + pre (const author&); + + virtual bool + recommends_present (); + + virtual std::string + recommends (); + + private: + person_simpl base_impl_; + const author* author_; + }; + + // + // + struct book_simpl: book_sskel + { + virtual void + pre (const book&); + + virtual library::isbn + isbn (); + + virtual const library::title& + title (); + + virtual library::genre + genre (); + + virtual bool + author_next (); + + virtual const library::author& + author (); + + virtual bool + available (); + + virtual std::string + id (); + + private: + const book* book_; + book::authors::const_iterator ai_; + }; + + // + // + struct catalog_simpl: catalog_sskel + { + virtual void + pre (const catalog&); + + virtual bool + book_next (); + + virtual const library::book& + book (); + + private: + const catalog* catalog_; + catalog::const_iterator ci_; + }; +} + +#endif // LIBRARY_SIMPL_HXX diff --git a/examples/cxx/serializer/library/library.hxx b/examples/cxx/serializer/library/library.hxx new file mode 100644 index 0000000..9f8e250 --- /dev/null +++ b/examples/cxx/serializer/library/library.hxx @@ -0,0 +1,270 @@ +// file : examples/cxx/serializer/library/library.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : not copyrighted - public domain + +#ifndef LIBRARY_HXX +#define LIBRARY_HXX + +#include <string> +#include <vector> + +namespace library +{ + // + // + typedef unsigned int isbn; + + + // + // + struct title: std::string + { + title (const std::string& s) + : std::string (s) + { + } + + // 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 + { + person (const std::string& name, const std::string& born) + : name_ (name), born_ (born) + { + } + + // 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 + { + author (const std::string& name, const std::string& born) + : person (name, born) + { + } + + // recommends + // + const std::string& + recommends () const + { + return recommends_; + } + + void + recommends (const std::string& recommends) + { + recommends_ = recommends; + } + + private: + std::string recommends_; + }; + + + // + // + struct book + { + book (library::isbn isbn, + const library::title& title, + library::genre genre, + bool available, + const std::string& id) + : isbn_ (isbn), + title_ (title), + genre_ (genre), + available_ (available), + id_ (id) + { + } + + // isbn + // + library::isbn + isbn () const + { + return isbn_; + } + + void + isbn (const library::isbn& isbn) + { + isbn_ = isbn; + } + + + // title + // + const 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<library::author> 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<book> catalog; +} + +#endif // LIBRARY_HXX diff --git a/examples/cxx/serializer/library/library.map b/examples/cxx/serializer/library/library.map new file mode 100644 index 0000000..901fb7d --- /dev/null +++ b/examples/cxx/serializer/library/library.map @@ -0,0 +1,22 @@ +# file : examples/cxx/serializer/library/library.map +# author : Boris Kolpackov <boris@codesynthesis.com> +# copyright : not copyrighted - public domain + +namespace http://www.codesynthesis.com/library +{ + include "library.hxx"; + + # Use the actual type instead of a typedef. The compiler + # has no way of knowing that isbn and unsigned int are + # the same C++ types and may generate clashing function + # signatures if we use the typedef alias here. + # + isbn "unsigned int" "unsigned int"; + + title "const library::title&"; + genre library::genre library::genre; + person "const library::person&"; + author "const library::author&"; + book "const library::book&"; + catalog "const library::catalog&"; +} diff --git a/examples/cxx/serializer/library/library.xsd b/examples/cxx/serializer/library/library.xsd new file mode 100644 index 0000000..05ae2de --- /dev/null +++ b/examples/cxx/serializer/library/library.xsd @@ -0,0 +1,79 @@ +<?xml version="1.0"?> + +<!-- + +file : examples/cxx/serializer/library/library.xsd +author : Boris Kolpackov <boris@codesynthesis.com> +copyright : not copyrighted - public domain + +--> + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:lib="http://www.codesynthesis.com/library" + targetNamespace="http://www.codesynthesis.com/library"> + + <xsd:simpleType name="isbn"> + <xsd:restriction base="xsd:unsignedInt"/> + </xsd:simpleType> + + + <xsd:complexType name="title"> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="lang" type="xsd:string"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + + <xsd:simpleType name="genre"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="romance"/> + <xsd:enumeration value="fiction"/> + <xsd:enumeration value="horror"/> + <xsd:enumeration value="history"/> + <xsd:enumeration value="philosophy"/> + </xsd:restriction> + </xsd:simpleType> + + + <xsd:complexType name="person"> + <xsd:sequence> + <xsd:element name="name" type="xsd:string"/> + <xsd:element name="born" type="xsd:string"/> + <xsd:element name="died" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + + + <xsd:complexType name="author"> + <xsd:complexContent> + <xsd:extension base="lib:person"> + <xsd:attribute name="recommends" type="xsd:IDREF"/> <!-- Book --> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + + <xsd:complexType name="book"> + <xsd:sequence> + <xsd:element name="isbn" type="lib:isbn"/> + <xsd:element name="title" type="lib:title"/> + <xsd:element name="genre" type="lib:genre"/> + <xsd:element name="author" type="lib:author" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="available" type="xsd:boolean" use="required"/> + <xsd:attribute name="id" type="xsd:ID" use="required"/> + </xsd:complexType> + + + <xsd:complexType name="catalog"> + <xsd:sequence> + <xsd:element name="book" type="lib:book" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + + <xsd:element name="catalog" type="lib:catalog"/> + +</xsd:schema> diff --git a/examples/cxx/serializer/library/makefile b/examples/cxx/serializer/library/makefile new file mode 100644 index 0000000..ba58e96 --- /dev/null +++ b/examples/cxx/serializer/library/makefile @@ -0,0 +1,72 @@ +# file : examples/cxx/serializer/library/makefile +# author : Boris Kolpackov <boris@codesynthesis.com> +# copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make + +xsd := library.xsd +cxx := driver.cxx + +ifeq ($(xsde_reuse_style),mixin) +cxx += library-simpl-mixin.cxx +else +cxx += library-simpl-tiein.cxx +endif + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-sskel.o)) +dep := $(obj:.o=.o.d) + +xsde.l := $(out_root)/libxsde/xsde/xsde.l +xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Build. +# +$(driver): $(obj) $(xsde.l) + +$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) +$(obj) $(dep): $(xsde.l.cpp-options) + +skel := $(out_base)/$(xsd:.xsd=-sskel.hxx) \ + $(out_base)/$(xsd:.xsd=-sskel.ixx) \ + $(out_base)/$(xsd:.xsd=-sskel.cxx) + +$(skel): xsde := $(out_root)/xsde/xsde +$(skel): xsde_options += --generate-inline --type-map $(src_base)/library.map + +$(skel): $(out_root)/xsde/xsde $(src_base)/library.map + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=-sskel.cxx.xsd.clean)) + + +# 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,$(scf_root)/xsde/serializer/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsde/makefile) +$(call import,$(src_root)/libxsde/xsde/makefile) |