summaryrefslogtreecommitdiff
path: root/libxsd-frontend/tests/dump/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsd-frontend/tests/dump/driver.cxx')
-rw-r--r--libxsd-frontend/tests/dump/driver.cxx93
1 files changed, 42 insertions, 51 deletions
diff --git a/libxsd-frontend/tests/dump/driver.cxx b/libxsd-frontend/tests/dump/driver.cxx
index 5217ebf..dd925a9 100644
--- a/libxsd-frontend/tests/dump/driver.cxx
+++ b/libxsd-frontend/tests/dump/driver.cxx
@@ -1,10 +1,8 @@
// file : tests/dump/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-#include <cult/types.hxx>
-
+#include <xsd-frontend/types.hxx>
#include <xsd-frontend/parser.hxx>
#include <xsd-frontend/transformations/anonymous.hxx>
#include <xsd-frontend/transformations/enum-synthesis.hxx>
@@ -14,19 +12,15 @@
#include <iostream>
-using namespace Cult::Types;
+using namespace std;
using namespace XSDFrontend;
-using std::wcerr;
-using std::wcout;
-using std::endl;
-
-UnsignedLong indent = 0;
+static unsigned long indent;
std::wostream&
ind (std::wostream& os)
{
- for (UnsignedLong n (0); n < indent; ++n)
+ for (unsigned long n (0); n < indent; ++n)
os << L" ";
return os;
@@ -34,8 +28,6 @@ ind (std::wostream& os)
namespace
{
- typedef Cult::Types::WideString String;
-
// Nameable which is named in the namespace scope.
//
String
@@ -48,7 +40,7 @@ namespace
struct List: Traversal::List
{
- virtual Void
+ virtual void
traverse (Type& l)
{
if (l.annotated_p ())
@@ -78,7 +70,7 @@ namespace
struct Union: Traversal::Union
{
- virtual Void
+ virtual void
traverse (Type& u)
{
if (u.annotated_p ())
@@ -114,7 +106,7 @@ namespace
struct Enumerator: Traversal::Enumerator
{
- virtual Void
+ virtual void
traverse (Type& e)
{
if (e.annotated_p ())
@@ -127,7 +119,7 @@ namespace
struct Enumeration: Traversal::Enumeration
{
- virtual Void
+ virtual void
traverse (Type& e)
{
if (e.annotated_p ())
@@ -149,7 +141,7 @@ namespace
struct ContainsParticle: Traversal::ContainsParticle
{
- virtual Void
+ virtual void
traverse (Type& cp)
{
wcout << ind << "[" << cp.min () << ", ";
@@ -165,7 +157,7 @@ namespace
struct ContainsCompositor: Traversal::ContainsCompositor
{
- virtual Void
+ virtual void
traverse (Type& cc)
{
wcout << ind << "[" << cc.min () << ", ";
@@ -183,7 +175,7 @@ namespace
Traversal::Choice,
Traversal::Sequence
{
- virtual Void
+ virtual void
traverse (SemanticGraph::All& a)
{
wcout << "all" << endl
@@ -198,7 +190,7 @@ namespace
wcout << ind << "}" << endl;
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Choice& c)
{
wcout << "choice" << endl
@@ -213,7 +205,7 @@ namespace
wcout << ind << "}" << endl;
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Sequence& s)
{
wcout << "sequence" << endl
@@ -231,7 +223,7 @@ namespace
struct Attribute: Traversal::Attribute
{
- virtual Void
+ virtual void
traverse (Type& a)
{
if (a.annotated_p ())
@@ -266,7 +258,7 @@ namespace
struct AnyAttribute: Traversal::AnyAttribute
{
- virtual Void
+ virtual void
traverse (Type& a)
{
if (a.annotated_p ())
@@ -279,7 +271,7 @@ namespace
struct Element: Traversal::Element
{
- virtual Void
+ virtual void
traverse (Type& e)
{
wcout << "element " << e.name ();
@@ -309,7 +301,7 @@ namespace
struct ElementFlat: Traversal::Element
{
- virtual Void
+ virtual void
traverse (Type& e)
{
if (e.annotated_p ())
@@ -329,7 +321,7 @@ namespace
struct Any: Traversal::Any
{
- virtual Void
+ virtual void
traverse (Type& a)
{
wcout << "any '" << a.name () << "'" << endl;
@@ -338,7 +330,7 @@ namespace
struct AnyFlat: Traversal::Any
{
- virtual Void
+ virtual void
traverse (Type& a)
{
if (a.annotated_p ())
@@ -351,7 +343,7 @@ namespace
struct Complex: Traversal::Complex
{
- virtual Void
+ virtual void
traverse (Type& c)
{
// Anonymous type definition can recursively refer to itself.
@@ -389,7 +381,7 @@ namespace
struct GlobalAttribute: Traversal::Attribute
{
- virtual Void
+ virtual void
traverse (Type& a)
{
if (a.annotated_p ())
@@ -423,7 +415,7 @@ namespace
struct GlobalElement: Traversal::Element
{
- virtual Void
+ virtual void
traverse (Type& e)
{
if (e.annotated_p ())
@@ -457,7 +449,7 @@ namespace
struct Namespace: Traversal::Namespace
{
- virtual Void
+ virtual void
traverse (Type& n)
{
wcout << ind << "namespace " << n.name () << endl
@@ -477,21 +469,21 @@ namespace
Traversal::Sources
//Traversal::Implies @@ Need a --with-implies option
{
- virtual Void
+ virtual void
traverse (SemanticGraph::Imports& i)
{
if (traverse_uses (i, "imports"))
Traversal::Imports::traverse (i);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Includes& i)
{
if (traverse_uses (i, "includes"))
Traversal::Includes::traverse (i);
}
- virtual Void
+ virtual void
traverse (SemanticGraph::Sources& s)
{
if (traverse_uses (s, "sources"))
@@ -499,7 +491,7 @@ namespace
}
/*
- virtual Void
+ virtual void
traverse (SemanticGraph::Implies& i)
{
if (traverse_uses (i, "implies"))
@@ -507,7 +499,7 @@ namespace
}
*/
- Boolean
+ bool
traverse_uses (SemanticGraph::Uses& u, String const& type)
{
SemanticGraph::Schema& s (u.schema ());
@@ -531,7 +523,7 @@ namespace
struct Schema: Traversal::Schema
{
- virtual Void
+ virtual void
traverse (Type& s)
{
wcout << ind << "{" << endl;
@@ -545,20 +537,19 @@ namespace
struct AnonymousNameTranslator: Transformations::AnonymousNameTranslator
{
- virtual WideString
- translate (WideString const& /*file*/,
- WideString const& ns,
- WideString const& name,
- WideString const& xpath)
+ virtual String
+ translate (String const& /*file*/,
+ String const& ns,
+ String const& name,
+ String const& xpath)
{
wcout << "anonymous: " << ns << " " << name << " " << xpath << endl;
return name;
}
};
-
-Int
-main (Int argc, Char* argv[])
+int
+main (int argc, char* argv[])
{
try
{
@@ -570,9 +561,9 @@ main (Int argc, Char* argv[])
// Parse options.
//
- Int i (1);
- Boolean anon (false);
- Boolean enum_synth (false);
+ int i (1);
+ bool anon (false);
+ bool enum_synth (false);
for (; i < argc; ++i)
{
@@ -586,10 +577,10 @@ main (Int argc, Char* argv[])
// Parse schema.
//
- SemanticGraph::Path path (argv[i], boost::filesystem::native);
+ SemanticGraph::Path path (argv[i]);
Parser parser (true, false, true);
- Evptr<SemanticGraph::Schema> tu (parser.parse (path));
+ auto_ptr<SemanticGraph::Schema> tu (parser.parse (path));
//
//