1 // file      : tests/cxx/parser/polymorphism/same-type/driver.cxx
2 // copyright : Copyright (c) 2006-2017 Code Synthesis Tools CC
3 // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
4 
5 // Test substitution group and xsi:type that don't change the type.
6 //
7 
8 #include <string>
9 #include <iostream>
10 
11 #include "test-pskel.hxx"
12 
13 using namespace std;
14 using namespace test;
15 
16 struct base_pimpl: base_pskel
17 {
18   virtual void
abase_pimpl19   a (string const& v)
20   {
21     cout << v << endl;
22   }
23 };
24 
25 struct type_pimpl: type_pskel
26 {
27 };
28 
29 int
main(int argc,char * argv[])30 main (int argc, char* argv[])
31 {
32   if (argc != 2)
33   {
34     cerr << "usage: " << argv[0] << " test.xml" << endl;
35     return 1;
36   }
37 
38   try
39   {
40     xml_schema::string_pimpl string_p;
41     base_pimpl base_p;
42     type_pimpl type_p;
43 
44     base_p.parsers (string_p);
45     type_p.parsers (base_p);
46 
47     xml_schema::document doc_p (type_p, "test", "root", true);
48 
49     type_p.pre ();
50     doc_p.parse (argv[1]);
51     type_p.post_type ();
52   }
53   catch (xml_schema::exception const& e)
54   {
55     cerr << e << endl;
56     return 1;
57   }
58   catch (std::ios_base::failure const&)
59   {
60     cerr << "io failure" << endl;
61     return 1;
62   }
63 }
64