aboutsummaryrefslogtreecommitdiff
path: root/tests/type-map/driver.cxx
blob: ce54b86c3e010b39c6126efcc98d810b9292f211 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
      std::ifstream is (argv[1]);
      TypeMap::Lexer l (is, argv[1]);

      /*
        for (TypeMap::Lexer::Token t (l.next ());
             t.type () != TypeMap::Lexer::Token::eos;
             t = l.next ())
        {
          e << t.line () << ": " << t.lexeme () << endl;
        }
      */

      TypeMap::Parser p (l, argv[1]);

      TypeMap::Namespaces ns;

      if (!p.parse (ns))
      {
        e << "failed" << endl;
        return 1;
      }

      for (TypeMap::Namespaces::ConstIterator n (type_map.begin ());
           n != type_map.end (); ++n)
      {
        wcerr << "namespace " << n->xsd_name () << " " << n->cxx_name () << endl
              << "{" << endl;

        for (TypeMap::Namespace::IncludesIterator i (n->includes_begin ());
             i != n->includes_end (); ++i)
        {
          wcerr << "include " << *i << ";" << endl;
        }

        for (TypeMap::Namespace::TypesIterator t (n->types_begin ());
             t != n->types_end (); ++t)
        {
          wcerr << "type " << t->xsd_name () << " " << t->cxx_ret_name ();

          if (t->cxx_arg_name ())
            wcerr << " " << t->cxx_arg_name ();

          wcerr << ";" << endl;
        }

        wcerr << "}" << endl;
      }