diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-27 10:10:46 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-27 10:10:46 +0200 |
commit | 3dcdc88b14aec626c87f8f480a1d07781a27c069 (patch) | |
tree | 3d64d4701e07441545ffaf3afe0050c4c9e35b41 /tests/cxx/hybrid/polymorphism/enumeration/driver.cxx | |
parent | 8161144e7f3182d9dc66a811b4618a81232d4af3 (diff) |
Implement schema enumeration to C++ enum mapping in C++/Hybrid
Diffstat (limited to 'tests/cxx/hybrid/polymorphism/enumeration/driver.cxx')
-rw-r--r-- | tests/cxx/hybrid/polymorphism/enumeration/driver.cxx | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/cxx/hybrid/polymorphism/enumeration/driver.cxx b/tests/cxx/hybrid/polymorphism/enumeration/driver.cxx new file mode 100644 index 0000000..b2c9429 --- /dev/null +++ b/tests/cxx/hybrid/polymorphism/enumeration/driver.cxx @@ -0,0 +1,67 @@ +// file : tests/cxx/hybrid/polymorphism/enumeration/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test XML Schema enumeration to C++ enum mapping. +// + +#include <iostream> + +#include "test.hxx" +#include "test-pimpl.hxx" +#include "test-simpl.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + // Parse. + // + root_paggr root_p; + + xml_schema::document_pimpl doc_p ( + root_p.root_parser (), + root_p.root_namespace (), + root_p.root_name (), + true); + + root_p.pre (); + doc_p.parse (argv[1]); + type* r = root_p.post (); + + // Test the mapping. + // + simple s (simple::a); + s.value (simple::b); + + complex c; + c.value (complex::a); + + // Serialize. + // + root_saggr root_s; + + xml_schema::document_simpl doc_s ( + root_s.root_serializer (), + root_s.root_namespace (), + root_s.root_name (), + true); + + doc_s.add_prefix ("t", "test"); + doc_s.add_prefix ("xsi", "http://www.w3.org/2001/XMLSchema-instance"); + + root_s.pre (*r); + doc_s.serialize (cout); + root_s.post (); + + delete r; +} |