void generate_type_info_source (Context& ctx, SemanticGraph::Schema& schema) { ctx.os << "#include \"XMLSchema/TypeInfo.hpp\"" << endl << endl; Traversal::Schema traverser; Traversal::Sources sources; Traversal::Names schema_names; TypeInfoNamespace ns (ctx); traverser.edge_traverser (sources); traverser.edge_traverser (schema_names); sources.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; AnonymousType anonymous (ctx); Complex complex (ctx, anonymous); Enumeration enumeration (ctx); ns.edge_traverser (names); names.node_traverser (complex); names.node_traverser (enumeration); names.node_traverser (anonymous); traverser.traverse (schema); }
void generate_forward (Context& ctx, SemanticGraph::Schema& schema) { ctx.os << "// Forward declarations." << endl; Traversal::Schema traverser; Traversal::Sources sources; Traversal::Names schema_names; Namespace ns (ctx); traverser.edge_traverser (sources); traverser.edge_traverser (schema_names); sources.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; Complex complex (ctx); Enumeration enumeration (ctx); ns.edge_traverser (names); names.node_traverser (complex); names.node_traverser (enumeration); traverser.traverse (schema); }
void generate_inline (Context& ctx, SemanticGraph::Schema& schema, bool i) { Traversal::Schema traverser; Traversal::Sources sources; Traversal::Names schema_names; Namespace ns (ctx); traverser.edge_traverser (sources); traverser.edge_traverser (schema_names); sources.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; AnonymousType anonymous_type (ctx, i); Complex complex (ctx, anonymous_type, i); Enumeration enumeration (ctx, i); ns.edge_traverser (names); names.node_traverser (complex); names.node_traverser (enumeration); names.node_traverser (anonymous_type); traverser.traverse (schema); }
void generate_writer_header (Context& ctx, SemanticGraph::Schema& schema) { ctx.os << "#include \"XMLSchema/Writer.hpp\"" << endl << endl; { Traversal::Schema traverser; Traversal::Sources sources; Traversal::Names schema_names; WriterNamespace ns (ctx); traverser.edge_traverser (sources); traverser.edge_traverser (schema_names); sources.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; AnonymousType anonymous_type (ctx); Complex complex (ctx, anonymous_type); Enumeration enumeration (ctx); ns.edge_traverser (names); names.node_traverser (complex); names.node_traverser (enumeration); names.node_traverser (anonymous_type); traverser.traverse (schema); } { Traversal::Schema traverser; Traversal::Sources sources; Traversal::Names schema_names; Namespace ns (ctx); traverser.edge_traverser (sources); traverser.edge_traverser (schema_names); sources.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; Element element (ctx); ns.edge_traverser (names); names.node_traverser (element); traverser.traverse (schema); } }
bool has (Y& y) { bool r (false); struct Traverser : X { Traverser (bool& v) : v_ (v) { } virtual void traverse (typename X::Type&) { v_ = true; } private: bool& v_; } t (r); Traversal::Scope s; Traversal::Names n; s.edge_traverser (n); n.node_traverser (t); s.traverse (y); return r; }
void generate_writer_source (Context& ctx, SemanticGraph::Schema& schema) { { Traversal::Schema traverser; Traversal::Sources sources; Traversal::Names schema_names; WriterNamespace ns (ctx); traverser.edge_traverser (sources); traverser.edge_traverser (schema_names); sources.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; AnonymousType anonymous (ctx); Complex complex (ctx, anonymous); Enumeration enumeration (ctx); ns.edge_traverser (names); names.node_traverser (complex); names.node_traverser (enumeration); names.node_traverser (anonymous); traverser.traverse (schema); } { Traversal::Schema traverser; Traversal::Sources sources; Traversal::Names schema_names; Namespace ns (ctx); traverser.edge_traverser (sources); traverser.edge_traverser (schema_names); sources.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; Writer writer (ctx); ns.edge_traverser (names); names.node_traverser (writer); traverser.traverse (schema); } }
bool validate (SemanticGraph::Schema& schema) { bool valid (true); ValidationContext ctx (valid); Traversal::Schema traverser; Traversal::Implies implies; // go to XMLSchema namespace Traversal::Sources sources; Traversal::Includes includes; Traversal::Includes imports; Traversal::Names schema_names; Traversal::Namespace ns; traverser.edge_traverser (implies); traverser.edge_traverser (sources); traverser.edge_traverser (includes); traverser.edge_traverser (imports); traverser.edge_traverser (schema_names); implies.node_traverser (traverser); sources.node_traverser (traverser); includes.node_traverser (traverser); imports.node_traverser (traverser); schema_names.node_traverser (ns); Traversal::Names names; Complex complex (ctx); Element element (ctx); Attribute attribute (ctx); Anonymous anonymous (ctx, complex); ns.edge_traverser (names); names.node_traverser (complex); names.node_traverser (anonymous); names.node_traverser (element); names.node_traverser (attribute); traverser.traverse (schema); return valid; }