示例#1
0
文件: Forward.cpp 项目: DOCGroup/XSC
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);
}
示例#2
0
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);
}
示例#3
0
文件: Inline.cpp 项目: jwillemsen/XSC
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);
}
示例#4
0
文件: WriterHeader.cpp 项目: SEDS/XSC
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);
  }
}
示例#5
0
文件: WriterSource.cpp 项目: SEDS/XSC
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);
  }
}
示例#6
0
  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;
  }