From 6f395f9f769866a04f6949cb7ed14f93d90cf728 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 13 Oct 2010 15:38:11 +0200 Subject: Map anySimpleType to a string --- tests/cxx/hybrid/built-in/driver.cxx | 2 +- tests/cxx/hybrid/built-in/test-000.std | 30 +++++++++-- tests/cxx/hybrid/built-in/test-000.xml | 6 +-- tests/cxx/parser/built-in/driver.cxx | 37 ++++++-------- tests/cxx/parser/built-in/test-001.std | 5 +- tests/cxx/parser/generated-impl/test-000.std | 1 + .../parser/validation/built-in/any-type/driver.cxx | 58 ++++++++++++---------- .../validation/built-in/any-type/test-000.std | 10 +--- tests/cxx/serializer/built-in/driver.cxx | 17 ++++++- 9 files changed, 94 insertions(+), 72 deletions(-) (limited to 'tests') diff --git a/tests/cxx/hybrid/built-in/driver.cxx b/tests/cxx/hybrid/built-in/driver.cxx index ddffcfa..0993bc9 100644 --- a/tests/cxx/hybrid/built-in/driver.cxx +++ b/tests/cxx/hybrid/built-in/driver.cxx @@ -49,7 +49,7 @@ main (int argc, char* argv[]) doc_s.add_prefix ("t", "test"); root_s.pre (*r); - doc_s.serialize (cout); + doc_s.serialize (cout, xml_schema::document_simpl::pretty_print); root_s.post (); delete r; diff --git a/tests/cxx/hybrid/built-in/test-000.std b/tests/cxx/hybrid/built-in/test-000.std index 6798590..c9a79c7 100644 --- a/tests/cxx/hybrid/built-in/test-000.std +++ b/tests/cxx/hybrid/built-in/test-000.std @@ -1,5 +1,25 @@ -123abc123456789123YmFzZTY0IGJpbmFyeQ== -YmFzZTY0IGJpbmFyeQ== -YmFzZTY0IGJpbmFyeQ== -YmFzZTY0IGJpbmFyeQ== -abcdefghijkl \ No newline at end of file + + + + 123 + abc + + abc123 + abc123 + 123 + 456 + 789 + 123 + YmFzZTY0IGJpbmFyeQ== + + YmFzZTY0IGJpbmFyeQ== + + YmFzZTY0IGJpbmFyeQ== + + YmFzZTY0IGJpbmFyeQ== + + abc + def + ghi + jkl + \ No newline at end of file diff --git a/tests/cxx/hybrid/built-in/test-000.xml b/tests/cxx/hybrid/built-in/test-000.xml index ae72e80..cc9b8c8 100644 --- a/tests/cxx/hybrid/built-in/test-000.xml +++ b/tests/cxx/hybrid/built-in/test-000.xml @@ -1,10 +1,10 @@ - + 123abc - - + abc123 + abc123 123 456 diff --git a/tests/cxx/parser/built-in/driver.cxx b/tests/cxx/parser/built-in/driver.cxx index 1ec5e15..1ac8823 100644 --- a/tests/cxx/parser/built-in/driver.cxx +++ b/tests/cxx/parser/built-in/driver.cxx @@ -64,28 +64,6 @@ struct any_type_pimpl: xml_schema::any_type_pimpl } }; -struct any_simple_type_pimpl: xml_schema::any_simple_type_pimpl -{ - virtual void - pre () - { - cout << "{" << endl; - } - - virtual void - _any_characters (ro_string const& s) - { - cout << " any text: '" << s << "'" << endl; - } - - virtual void - post_any_simple_type () - { - cout << "}" << endl - << endl; - } -}; - struct type_pimpl: type_pskel { virtual void @@ -208,6 +186,12 @@ struct type_pimpl: type_pskel #ifdef XSDE_STL virtual void + any_simple_type (std::string const& v) + { + cout << "'" << v << "'" << endl; + } + + virtual void string (std::string const& v) { cout << "'" << v << "'" << endl; @@ -302,6 +286,13 @@ struct type_pimpl: type_pskel #else // XSDE_STL virtual void + any_simple_type (char* v) + { + cout << "'" << v << "'" << endl; + delete[] v; + } + + virtual void string (char* v) { cout << "'" << v << "'" << endl; @@ -571,7 +562,7 @@ main (int argc, char* argv[]) try { any_type_pimpl any_type_p; - any_simple_type_pimpl any_simple_type_p; + xml_schema::any_simple_type_pimpl any_simple_type_p; xml_schema::boolean_pimpl boolean_p; diff --git a/tests/cxx/parser/built-in/test-001.std b/tests/cxx/parser/built-in/test-001.std index 3b80787..7f1990e 100644 --- a/tests/cxx/parser/built-in/test-001.std +++ b/tests/cxx/parser/built-in/test-001.std @@ -22,10 +22,7 @@ any text: ' ' } -{ - any text: '123abc' -} - +'123abc' 1 0 1 diff --git a/tests/cxx/parser/generated-impl/test-000.std b/tests/cxx/parser/generated-impl/test-000.std index 7c58647..8fd9e30 100644 --- a/tests/cxx/parser/generated-impl/test-000.std +++ b/tests/cxx/parser/generated-impl/test-000.std @@ -19,6 +19,7 @@ x: x y: y a: aaa b: bbb +any-simple-type: abc123 boolean: 1 boolean: 0 boolean: 1 diff --git a/tests/cxx/parser/validation/built-in/any-type/driver.cxx b/tests/cxx/parser/validation/built-in/any-type/driver.cxx index b60beed..3ffffa6 100644 --- a/tests/cxx/parser/validation/built-in/any-type/driver.cxx +++ b/tests/cxx/parser/validation/built-in/any-type/driver.cxx @@ -61,28 +61,6 @@ struct any_type_pimpl: xml_schema::any_type_pimpl } }; -struct any_simple_type_pimpl: xml_schema::any_simple_type_pimpl -{ - virtual void - pre () - { - cout << "{" << endl; - } - - virtual void - _any_characters (ro_string const& s) - { - cout << " any text: '" << s << "'" << endl; - } - - virtual void - post_any_simple_type () - { - cout << "}" << endl - << endl; - } -}; - struct any_extension_pimpl: any_extension_pskel { any_extension_pimpl () @@ -103,7 +81,7 @@ struct any_extension_pimpl: any_extension_pskel cout << " x = " << v << endl; delete[] v; } -#endif +#endif private: any_type_pimpl base_impl_; @@ -122,6 +100,12 @@ struct any_simple_extension_pimpl: any_simple_extension_pskel { cout << " x = " << v << endl; } + + virtual void + post_any_simple_extension () + { + cout << "'" << post_any_simple_type () << "'" << endl; + } #else virtual void x (char* v) @@ -129,14 +113,36 @@ struct any_simple_extension_pimpl: any_simple_extension_pskel cout << " x = " << v << endl; delete[] v; } -#endif + + virtual void + post_any_simple_extension () + { + char& v = post_any_simple_type (); + cout << "'" << b << "'" << endl; + delete[] v; + } +#endif private: - any_simple_type_pimpl base_impl_; + xml_schema::any_simple_type_pimpl base_impl_; }; struct type_pimpl: type_pskel { +#ifdef XSDE_STL + virtual void + as (std::string const& v) + { + cout << "'" << v << "'" << endl; + } +#else // XSDE_STL + virtual void + as (char* v) + { + cout << "'" << v << "'" << endl; + delete[] v; + } +#endif }; int @@ -153,7 +159,7 @@ main (int argc, char* argv[]) xml_schema::string_pimpl string_p; any_type_pimpl any_type_p; - any_simple_type_pimpl any_simple_type_p; + xml_schema::any_simple_type_pimpl any_simple_type_p; any_extension_pimpl any_extension_p; any_simple_extension_pimpl any_simple_extension_p; diff --git a/tests/cxx/parser/validation/built-in/any-type/test-000.std b/tests/cxx/parser/validation/built-in/any-type/test-000.std index 9e263c0..c1996cb 100644 --- a/tests/cxx/parser/validation/built-in/any-type/test-000.std +++ b/tests/cxx/parser/validation/built-in/any-type/test-000.std @@ -1,7 +1,4 @@ -{ - any text: '123abc' -} - +'123abc' { any text: ' ' @@ -106,8 +103,5 @@ any text: ' ' } -{ x = x - any text: 'abc123' -} - +'abc123' diff --git a/tests/cxx/serializer/built-in/driver.cxx b/tests/cxx/serializer/built-in/driver.cxx index f7ea95f..c2ddea0 100644 --- a/tests/cxx/serializer/built-in/driver.cxx +++ b/tests/cxx/serializer/built-in/driver.cxx @@ -33,7 +33,7 @@ struct any_type_simpl: xml_schema::any_type_simpl _end_element (); } }; - +/* struct any_simple_type_simpl: xml_schema::any_simple_type_simpl { virtual void @@ -42,6 +42,7 @@ struct any_simple_type_simpl: xml_schema::any_simple_type_simpl _characters ("hello"); } }; +*/ struct root_simpl: root_sskel { @@ -401,6 +402,12 @@ struct root_simpl: root_sskel #ifdef XSDE_STL + virtual std::string + any_simple_type () + { + return "hello"; + } + virtual bool string_next () { @@ -615,6 +622,12 @@ struct root_simpl: root_sskel #else + virtual const char* + any_simple_type () + { + return "hello"; + } + virtual bool string_next () { @@ -1242,7 +1255,7 @@ main (int argc, char* argv[]) } any_type_simpl any_type_s; - any_simple_type_simpl any_simple_type_s; + xml_schema::any_simple_type_simpl any_simple_type_s; xml_schema::boolean_simpl boolean_s; -- cgit v1.1