From 0bce70a0e483294b83b8bf9d5468838a63405612 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 8 Mar 2009 17:23:30 +0200 Subject: Add support for binary representations xsde/cxx/hybrid/insertion-*: insertion operators generator xsde/cxx/hybrid/extraction-*: extraction operators generator libxsde/xsde/cxx/hybrid/cdr/: CDR support code libxsde/xsde/cxx/hybrid/xdr/: XDR support code tests/cxx/hybrid/binary/: new tests examples/cxx/hybrid/binary/: new examples documentation/cxx/hybrid/guide/: new chapter --- examples/cxx/hybrid/binary/custom/README | 77 ++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 examples/cxx/hybrid/binary/custom/README (limited to 'examples/cxx/hybrid/binary/custom/README') diff --git a/examples/cxx/hybrid/binary/custom/README b/examples/cxx/hybrid/binary/custom/README new file mode 100644 index 0000000..b7475d8 --- /dev/null +++ b/examples/cxx/hybrid/binary/custom/README @@ -0,0 +1,77 @@ +This example shows how to save/load the C++/Hybrid object model to/from +a custom format using the raw binary representation as an example. Note +that if you would like to use this format in your applications, make sure +that all the targets use exactly the same base type sizes (e.g., int, long, +float, double, size_t, etc.) and byte order. + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +library.xml + Sample XML instance document. + +xml-schema.hxx +xml-schema-pskel.hxx +xml-schema-sskel.hxx + Base object model types (the first file), parser skeletons (the second + file), and serializer skeletons (the third file) for the XML Schema + built-in types. These header files are generated by the XSD/e compiler + using the --generate-xml-schema option. The --generate-parser and + --generate-serializer options were also specified. + +irawstream.hxx +irawstream.ixx +irawstream.txx +irawstream.cxx + +orawstream.hxx +orawstream.ixx +orawstream.txx +orawstream.cxx + Implementation of the raw binary representation streams. The header + files include xml-schema.hxx to gain access to the base object model + types. You can use this implementation as a base for your custom + format. + +library.hxx +library.cxx + +library-pskel.hxx +library-pskel.cxx +library-pimpl.hxx +library-pimpl.cxx + +library-pskel.hxx +library-pskel.cxx +library-pimpl.hxx +library-pimpl.cxx + Object model (the first pair of files), parser skeletons (the second + pair), parser implementations (the third pair), serializer skeletons + (the fourth pair), and serializer implementations (the fifth pair). + These files are generated by the XSD/e compiler from library.xsd. The + --generate-parser, --generate-serializer, and --generate-aggregate + options were used to request the generation of the parsing and + serialization code. The --generate-insertion and --generate-extraction + options were used to generate the insertion and extraction operations + for the orawstream and irawstream, respectively. The --hxx-prologue + option was used to include the orawstream.hxx and irawstream.hxx + header files at the beginning of library.hxx. Finally, the + --extern-xml-schema option was used to include xml-schema* files + instead of generating the same code directly. + +driver.cxx + Driver for the example. It first calls the parser that constructs + the object model from the input XML file. It then saves the object + model to the raw binary representation and loads it back. Finally, + the driver calls the serializer to serialize the loaded object model + back to XML. + +To run the example on the sample XML instance document simply execute: + +$ ./driver library.xml + +The example reads from STDIN if input file is not specified: + +$ ./driver