diff options
| author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:21:29 +0200 | 
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:21:29 +0200 | 
| commit | bada6666c70977a058755ccf232e7d67b24adeed (patch) | |
| tree | 1e92d50cebce96abaf9bce19e36026c47f77b9ba /libxsd-frontend/xsd-frontend/semantic-graph | |
| parent | eaf34adcbd8095bc6d1f3371b1227f654c7b19fc (diff) | |
New upstream release
Diffstat (limited to 'libxsd-frontend/xsd-frontend/semantic-graph')
37 files changed, 2493 insertions, 1373 deletions
| diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx index 22793f7..17a0f03 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.cxx @@ -1,19 +1,16 @@  // file      : xsd-frontend/semantic-graph/annotation.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 <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/annotation.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; - +    using compiler::type_info;      // Annotates      // @@ -23,11 +20,10 @@ namespace XSDFrontend        {          AnnotatesInit ()          { -          TypeInfo ti (typeid (Annotates)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Annotates)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } annotates_init_;      } @@ -39,11 +35,10 @@ namespace XSDFrontend        {          AnnotationInit ()          { -          TypeInfo ti (typeid (Annotation)); -          ti.add_base (Access::public_, true, typeid (Node)); -          RTTI::insert (ti); +          type_info ti (typeid (Annotation)); +          ti.add_base (typeid (Node)); +          insert (ti);          } -        } annotation_init_;      }    } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx index 661ac72..0464f4f 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/annotation.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/annotation.hxx -// 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  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANNOTATION_HXX @@ -25,29 +24,20 @@ namespace XSDFrontend          return *annotation_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Annotates () -          : annotation_ (0) -      { -      } +    public: +      Annotates (): annotation_ (0) {} -      Void +      void        set_left_node (Annotation& a)        {          annotation_ = &a;        } -      Void -      set_right_node (Node&) -      { -      } +      void +      set_right_node (Node&) {} -      Void -      set_right_node (Edge&) -      { -      } +      void +      set_right_node (Edge&) {}      private:        Annotation* annotation_; @@ -58,30 +48,26 @@ namespace XSDFrontend      class Annotation: public virtual Node      {      public: -      WideString const& +      String const&        documentation () const        {          return documentation_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        Annotation (Path const& file, -                  UnsignedLong line, -                  UnsignedLong column, -                  WideString const& documentation) +                  unsigned long line, +                  unsigned long column, +                  String const& documentation)            : Node (file, line, column), documentation_ (documentation)        {        } -      Void -      add_edge_left (Annotates&) -      { -      } +      void +      add_edge_left (Annotates&) {}      private: -      WideString documentation_; +      String documentation_;      };    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx index e25e742..19b9df2 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.cxx @@ -1,8 +1,9 @@  // file      : xsd-frontend/semantic-graph/any-attribute.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/any-attribute.hxx>  #include <xsd-frontend/semantic-graph/compositors.hxx> @@ -10,30 +11,11 @@ namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; - -    namespace -    { -      struct AnyAttributeInit -      { -        AnyAttributeInit () -        { -          TypeInfo ti (typeid (AnyAttribute)); -          ti.add_base (Access::public_, true, typeid (Nameable)); -          RTTI::insert (ti); -        } - -      } any_attribute_init_; -    } -      AnyAttribute::      AnyAttribute (Path const& file, -                  UnsignedLong line, -                  UnsignedLong column, -                  WideString const& namespaces) +                  unsigned long line, +                  unsigned long column, +                  String const& namespaces)          : Node (file, line, column),            prototype_ (0)      { @@ -41,11 +23,11 @@ namespace XSDFrontend        // chararcter.        // -      for (Size i (0), j (namespaces.find (L' '));;) +      for (size_t i (0), j (namespaces.find (L' '));;)        { -        if (j != WideString::npos) +        if (j != String::npos)          { -          namespaces_.push_back (WideString (namespaces, i, j - i)); +          namespaces_.push_back (String (namespaces, i, j - i));            i = j + 1;            j = namespaces.find (L' ', i); @@ -54,7 +36,7 @@ namespace XSDFrontend          {            // Last element.            // -          namespaces_.push_back (WideString (namespaces, i)); +          namespaces_.push_back (String (namespaces, i));            break;          }        } @@ -62,8 +44,8 @@ namespace XSDFrontend      AnyAttribute::      AnyAttribute (Path const& file, -                  UnsignedLong line, -                  UnsignedLong column, +                  unsigned long line, +                  unsigned long column,                    NamespaceIterator begin,                    NamespaceIterator end)          : Node (file, line, column), @@ -110,5 +92,20 @@ namespace XSDFrontend        return namespace_ (scope ());      } + +    namespace +    { +      using compiler::type_info; + +      struct AnyAttributeInit +      { +        AnyAttributeInit () +        { +          type_info ti (typeid (AnyAttribute)); +          ti.add_base (typeid (Nameable)); +          insert (ti); +        } +      } any_attribute_init_; +    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx index bc8c512..bb3d761 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any-attribute.hxx @@ -1,12 +1,11 @@  // file      : xsd-frontend/semantic-graph/any-attribute.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANY_ATTRIBUTE_HXX  #define XSD_FRONTEND_SEMANTIC_GRAPH_ANY_ATTRIBUTE_HXX -#include <cult/containers/vector.hxx> +#include <vector>  #include <xsd-frontend/semantic-graph/elements.hxx>  #include <xsd-frontend/semantic-graph/namespace.hxx> @@ -17,12 +16,10 @@ namespace XSDFrontend    {      class AnyAttribute: public virtual Nameable      { -      typedef -      Cult::Containers::Vector<WideString> -      Namespaces; +      typedef std::vector<String> Namespaces;      public: -      typedef Namespaces::ConstIterator NamespaceIterator; +      typedef Namespaces::const_iterator NamespaceIterator;        NamespaceIterator        namespace_begin () const @@ -37,7 +34,7 @@ namespace XSDFrontend        }      public: -      Boolean +      bool        prototype_p ()        {          return prototype_ != 0; @@ -50,7 +47,7 @@ namespace XSDFrontend          return *prototype_;        } -      Void +      void        prototype (AnyAttribute& a)        {          assert (prototype_ == 0); @@ -61,17 +58,15 @@ namespace XSDFrontend        Namespace&        definition_namespace (); -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        AnyAttribute (Path const& file, -                    UnsignedLong line, -                    UnsignedLong column, -                    WideString const& namespaces); +                    unsigned long line, +                    unsigned long column, +                    String const& namespaces);        AnyAttribute (Path const& file, -                    UnsignedLong line, -                    UnsignedLong column, +                    unsigned long line, +                    unsigned long column,                      NamespaceIterator begin,                      NamespaceIterator end); diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx index a6c9e72..c8ebc93 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any.cxx @@ -1,8 +1,9 @@  // file      : xsd-frontend/semantic-graph/any.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/any.hxx>  #include <xsd-frontend/semantic-graph/compositors.hxx> @@ -10,31 +11,11 @@ namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; - -    namespace -    { -      struct AnyInit -      { -        AnyInit () -        { -          TypeInfo ti (typeid (Any)); -          ti.add_base (Access::public_, true, typeid (Nameable)); -          ti.add_base (Access::public_, true, typeid (Particle)); -          RTTI::insert (ti); -        } - -      } any_init_; -    } -      Any::      Any (Path const& file, -         UnsignedLong line, -         UnsignedLong column, -         WideString const& namespaces) +         unsigned long line, +         unsigned long column, +         String const& namespaces)          : Node (file, line, column),            prototype_ (0)      { @@ -42,11 +23,11 @@ namespace XSDFrontend        // chararcter.        // -      for (Size i (0), j (namespaces.find (L' '));;) +      for (size_t i (0), j (namespaces.find (L' '));;)        { -        if (j != WideString::npos) +        if (j != String::npos)          { -          namespaces_.push_back (WideString (namespaces, i, j - i)); +          namespaces_.push_back (String (namespaces, i, j - i));            i = j + 1;            j = namespaces.find (L' ', i); @@ -55,7 +36,7 @@ namespace XSDFrontend          {            // Last element.            // -          namespaces_.push_back (WideString (namespaces, i)); +          namespaces_.push_back (String (namespaces, i));            break;          }        } @@ -63,8 +44,8 @@ namespace XSDFrontend      Any::      Any (Path const& file, -         UnsignedLong line, -         UnsignedLong column, +         unsigned long line, +         unsigned long column,           NamespaceIterator begin,           NamespaceIterator end)          : Node (file, line, column), @@ -121,5 +102,21 @@ namespace XSDFrontend        return namespace_ (scope);      } + +    namespace +    { +      using compiler::type_info; + +      struct AnyInit +      { +        AnyInit () +        { +          type_info ti (typeid (Any)); +          ti.add_base (typeid (Nameable)); +          ti.add_base (typeid (Particle)); +          insert (ti); +        } +      } any_init_; +    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx index ded9bd8..8e42762 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/any.hxx @@ -1,12 +1,11 @@  // file      : xsd-frontend/semantic-graph/any.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ANY_HXX  #define XSD_FRONTEND_SEMANTIC_GRAPH_ANY_HXX -#include <cult/containers/vector.hxx> +#include <vector>  #include <xsd-frontend/semantic-graph/elements.hxx>  #include <xsd-frontend/semantic-graph/particle.hxx> @@ -19,12 +18,10 @@ namespace XSDFrontend      class Any: public virtual Nameable,                 public virtual Particle      { -      typedef -      Cult::Containers::Vector<WideString> -      Namespaces; +      typedef std::vector<String> Namespaces;      public: -      typedef Namespaces::ConstIterator NamespaceIterator; +      typedef Namespaces::const_iterator NamespaceIterator;        NamespaceIterator        namespace_begin () const @@ -39,7 +36,7 @@ namespace XSDFrontend        }      public: -      Boolean +      bool        prototype_p ()        {          return prototype_ != 0; @@ -52,7 +49,7 @@ namespace XSDFrontend          return *prototype_;        } -      Void +      void        prototype (Any& a)        {          assert (prototype_ == 0); @@ -63,17 +60,15 @@ namespace XSDFrontend        Namespace&        definition_namespace (); -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        Any (Path const& file, -           UnsignedLong line, -           UnsignedLong column, -           WideString const& namespaces); +           unsigned long line, +           unsigned long column, +           String const& namespaces);        Any (Path const& file, -           UnsignedLong line, -           UnsignedLong column, +           unsigned long line, +           unsigned long column,             NamespaceIterator begin,             NamespaceIterator end); diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx index 54bb5df..f61fa39 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.cxx @@ -1,39 +1,34 @@  // file      : xsd-frontend/semantic-graph/attribute-group.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 <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/attribute-group.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; - +    AttributeGroup:: +    AttributeGroup (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    }      namespace      { +      using compiler::type_info; +        struct AttributeGroupInit        {          AttributeGroupInit ()          { -          TypeInfo ti (typeid (AttributeGroup)); -          ti.add_base (Access::public_, true, typeid (Scope)); -          RTTI::insert (ti); +          type_info ti (typeid (AttributeGroup)); +          ti.add_base (typeid (Scope)); +          insert (ti);          } -        } attribute_group_init_;      } - -    AttributeGroup:: -    AttributeGroup (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    } -    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx index 44739f2..62a1f81 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute-group.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/attribute-group.hxx -// 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  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ATTRIBUTE_GROUP_HXX @@ -14,12 +13,10 @@ namespace XSDFrontend    {      class AttributeGroup: public virtual Scope      { -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        AttributeGroup (Path const& file, -                      UnsignedLong line, -                      UnsignedLong column); +                      unsigned long line, +                      unsigned long column);      };    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx index 2e30d4e..624b16a 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.cxx @@ -1,44 +1,41 @@  // file      : xsd-frontend/semantic-graph/attribute.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/attribute.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; +    Attribute:: +    Attribute (Path const& file, +               unsigned long line, +               unsigned long column, +               bool optional, +               bool global, +               bool qualified) +        : Node (file, line, column), +          Member (global, qualified), +          optional_ (optional) +    { +    }      namespace      { +      using compiler::type_info; +        struct AttributeInit        {          AttributeInit ()          { -          TypeInfo ti (typeid (Attribute)); -          ti.add_base (Access::public_, true, typeid (Member)); -          RTTI::insert (ti); +          type_info ti (typeid (Attribute)); +          ti.add_base (typeid (Member)); +          insert (ti);          } -        } attribute_init_;      } - -    Attribute:: -    Attribute (Path const& file, -               UnsignedLong line, -               UnsignedLong column, -               Boolean optional, -               Boolean global, -               Boolean qualified) -        : Node (file, line, column), -          Member (global, qualified), -          optional_ (optional) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx index f7a516d..9d9b0fb 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/attribute.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/attribute.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ATTRIBUTE_HXX @@ -15,23 +14,21 @@ namespace XSDFrontend      class Attribute: public virtual Member      {      public: -      Boolean +      bool        optional_p () const        {          return optional_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        Attribute (Path const& file, -                 UnsignedLong line, -                 UnsignedLong column, -                 Boolean optional, -                 Boolean global, -                 Boolean qualified); +                 unsigned long line, +                 unsigned long column, +                 bool optional, +                 bool global, +                 bool qualified);      private: -      Boolean optional_; +      bool optional_;      };    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx index 0cc265f..8433a0e 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/complex.cxx @@ -1,34 +1,15 @@  // file      : xsd-frontend/semantic-graph/complex.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/complex.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; - -    namespace -    { -      struct ComplexInit -      { -        ComplexInit () -        { -          TypeInfo ti (typeid (Complex)); -          ti.add_base (Access::public_, true, typeid (Type)); -          ti.add_base (Access::public_, true, typeid (Scope)); -          RTTI::insert (ti); -        } - -      } complex_init_; -    } -      Complex::      Complex ()          : mixed_ (false), contains_compositor_ (0) @@ -36,10 +17,26 @@ namespace XSDFrontend      }      Complex:: -    Complex (Path const& file, UnsignedLong line, UnsignedLong column) +    Complex (Path const& file, unsigned long line, unsigned long column)          : Node (file, line, column),            mixed_ (false), contains_compositor_ (0)      {      } + +    namespace +    { +      using compiler::type_info; + +      struct ComplexInit +      { +        ComplexInit () +        { +          type_info ti (typeid (Complex)); +          ti.add_base (typeid (Type)); +          ti.add_base (typeid (Scope)); +          insert (ti); +        } +      } complex_init_; +    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx index 40327bc..ac47810 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/complex.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/complex.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPLEX_HXX @@ -9,8 +8,6 @@  #include <xsd-frontend/semantic-graph/elements.hxx>  #include <xsd-frontend/semantic-graph/compositors.hxx> -#include <cult/containers/vector.hxx> -  namespace XSDFrontend  {    namespace SemanticGraph @@ -18,15 +15,27 @@ namespace XSDFrontend      class Complex: public virtual Type, public virtual Scope      {      public: -      Boolean +      bool        mixed_p () const        { -        return mixed_; +        if (mixed_) +          return true; + +        // If we have empty content, then we have the same content +        // type as our base. +        // +        if (!contains_compositor_p () && inherits_p ()) +        { +          if (Complex* b = dynamic_cast<Complex*> (&inherits ().base ())) +            return b->mixed_p (); +        } + +        return false;        }      public: -      Boolean -      contains_compositor_p () +      bool +      contains_compositor_p () const        {          return contains_compositor_ != 0;        } @@ -39,37 +48,37 @@ namespace XSDFrontend        }      public: -      Void -      mixed_p (Boolean m) +      void +      mixed_p (bool m)        {          mixed_ = m;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Complex (); // Virtual inheritance (Enumeration). -      Complex (Path const& file, UnsignedLong line, UnsignedLong column); - -      using Type::add_edge_right; -      using Type::add_edge_left; -      using Scope::add_edge_left; +    public: +      Complex (Path const& file, unsigned long line, unsigned long column); -      Void +      void        add_edge_left (ContainsCompositor& e)        {          contains_compositor_ = &e;        } -      Void +      void        remove_edge_left (ContainsCompositor& e)        {          assert (contains_compositor_ == &e);          contains_compositor_ = 0;        } +      using Type::add_edge_right; +      using Type::add_edge_left; +      using Scope::add_edge_left; + +    protected: +      Complex (); // For virtual inheritance (Enumeration). +      private: -      Boolean mixed_; +      bool mixed_;        ContainsCompositor* contains_compositor_;      };    } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx index 08953bc..dd65e56 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.cxx @@ -1,124 +1,100 @@  // file      : xsd-frontend/semantic-graph/compositor.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 <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/compositors.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; +    // ContainsCompositor +    // +    ContainsCompositor:: +    ContainsCompositor (unsigned long min, unsigned long max) +        : compositor_ (0), container_ (0), min_ (min), max_ (max) +    { +    } -    using RTTI::Access; -    using RTTI::TypeInfo; +    // All +    // +    All:: +    All (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    } +    // Choice +    // +    Choice:: +    Choice (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    } -    // ContainsCompositor +    // Sequence      // +    Sequence:: +    Sequence (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    } +      namespace      { +      using compiler::type_info; +        struct ContainsCompositorInit        {          ContainsCompositorInit ()          { -          TypeInfo ti (typeid (ContainsCompositor)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (ContainsCompositor)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } contains_compositor_init_; -    } -    ContainsCompositor:: -    ContainsCompositor (UnsignedLong min, UnsignedLong max) -        : compositor_ (0), container_ (0), min_ (min), max_ (max) -    { -    } - -    // Compositor -    // -    namespace -    {        struct CompositorInit        {          CompositorInit ()          { -          TypeInfo ti (typeid (Compositor)); -          ti.add_base (Access::public_, true, typeid (Particle)); -          RTTI::insert (ti); +          type_info ti (typeid (Compositor)); +          ti.add_base (typeid (Particle)); +          insert (ti);          } -        } compositor_init_; -    } - -    // All -    // -    namespace -    {        struct AllInit        {          AllInit ()          { -          TypeInfo ti (typeid (All)); -          ti.add_base (Access::public_, true, typeid (Compositor)); -          RTTI::insert (ti); +          type_info ti (typeid (All)); +          ti.add_base (typeid (Compositor)); +          insert (ti);          } -        } all_init_; -    } -    All:: -    All (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    } - - -    // Choice -    // -    namespace -    {        struct ChoiceInit        {          ChoiceInit ()          { -          TypeInfo ti (typeid (Choice)); -          ti.add_base (Access::public_, true, typeid (Compositor)); -          RTTI::insert (ti); +          type_info ti (typeid (Choice)); +          ti.add_base (typeid (Compositor)); +          insert (ti);          } -        } choice_init_; -    } -    Choice:: -    Choice (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    } - -    // Sequence -    // -    namespace -    {        struct SequenceInit        {          SequenceInit ()          { -          TypeInfo ti (typeid (Sequence)); -          ti.add_base (Access::public_, true, typeid (Compositor)); -          RTTI::insert (ti); +          type_info ti (typeid (Sequence)); +          ti.add_base (typeid (Compositor)); +          insert (ti);          } -        } sequence_init_;      } - -    Sequence:: -    Sequence (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx index c82d8a4..3573c24 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/compositors.hxx @@ -1,12 +1,11 @@  // file      : xsd-frontend/semantic-graph/compositors.hxx -// 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  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX  #define XSD_FRONTEND_SEMANTIC_GRAPH_COMPOSITORS_HXX -#include <cult/containers/list.hxx> +#include <list>  #include <xsd-frontend/semantic-graph/elements.hxx>  #include <xsd-frontend/semantic-graph/particle.hxx> @@ -33,43 +32,41 @@ namespace XSDFrontend        }      public: -      UnsignedLong +      unsigned long        min () const        {          return min_;        } -      UnsignedLong +      unsigned long        max () const        {          return max_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      ContainsCompositor (UnsignedLong min, UnsignedLong max); +    public: +      ContainsCompositor (unsigned long min, unsigned long max); -      Void +      void        set_left_node (Node& n)        {          container_ = &n;        } -      Void +      void        set_right_node (Compositor& n)        {          compositor_ = &n;        } -      Void +      void        clear_left_node (Node& n)        {          assert (container_ == &n);          container_ = 0;        } -      Void +      void        clear_right_node (Compositor& n)        {          assert (compositor_ == &n); @@ -79,25 +76,19 @@ namespace XSDFrontend      private:        Compositor* compositor_;        Node* container_; -      UnsignedLong min_, max_; +      unsigned long min_, max_;      }; -      //      //      class Compositor: public virtual Particle      { -      typedef -      Cult::Containers::List<ContainsParticle*> -      ContainsList; +      typedef std::list<ContainsParticle*> ContainsList;      public: +      typedef pointer_iterator<ContainsList::iterator> ContainsIterator;        typedef -      Bits::PointerIterator<ContainsList::Iterator> -      ContainsIterator; - -      typedef -      Bits::PointerIterator<ContainsList::ConstIterator> +      pointer_iterator<ContainsList::const_iterator>        ContainsConstIterator;        ContainsIterator @@ -125,7 +116,7 @@ namespace XSDFrontend        }      public: -      Boolean +      bool        contained_compositor_p ()        {          return contained_compositor_ != 0; @@ -139,7 +130,7 @@ namespace XSDFrontend        }      public: -      UnsignedLong +      unsigned long        min () const        {          if (contained_compositor_ != 0) @@ -148,7 +139,7 @@ namespace XSDFrontend            return Particle::min ();        } -      UnsignedLong +      unsigned long        max () const        {          if (contained_compositor_ != 0) @@ -157,24 +148,31 @@ namespace XSDFrontend            return Particle::max ();        } -    protected: -      friend class Bits::Graph<Node, Edge>; +    public: +      Compositor (): contained_compositor_ (0) {} -      Compositor () -          : contained_compositor_ (0) +      void +      add_edge_left (ContainsParticle& e)        { +        contains_.push_back (&e);        } -      Void -      add_edge_left (ContainsParticle& e) +      void +      add_edge_left (ContainsParticle& e, ContainsIterator const& after)        { -        contains_.push_back (&e); +        if (after.base () == contains_.end ()) +          contains_.push_front (&e); +        else +        { +          ContainsList::iterator i (after.base ()); +          contains_.insert (++i, &e); +        }        } -      Void +      void        remove_edge_left (ContainsParticle& e)        { -        for (ContainsList::Iterator i (contains_.begin ()); +        for (ContainsList::iterator i (contains_.begin ());               i != contains_.end (); ++i)          {            if (*i == &e) @@ -185,77 +183,50 @@ namespace XSDFrontend          }        } -      //@@ Ideally should be protected but then NodeArg has no way to -      //   access it. Maybe when (if) I move NodeArg into Grpah I can -      //   resolve this. -      // -    public: -      Void -      add_edge_left (ContainsParticle& e, ContainsIterator const& after) -      { -        if (after.base () == contains_.end ()) -          contains_.push_front (&e); -        else -        { -          ContainsList::Iterator i (after.base ()); -          contains_.insert (++i, &e); -        } -      } - -    protected: -      using Node::add_edge_right; -      using Particle::add_edge_right; -      using Particle::remove_edge_right; - -      Void +      void        add_edge_right (ContainsCompositor& e)        {          contained_compositor_ = &e;        } -      Void +      void        remove_edge_right (ContainsCompositor& e)        {          assert (contained_compositor_ == &e);          contained_compositor_ = 0;        } +      using Node::add_edge_right; +      using Particle::add_edge_right; +      using Particle::remove_edge_right; +      private:        ContainsList contains_;        ContainsCompositor* contained_compositor_;      }; -      //      //      class All: public virtual Compositor      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      All (Path const& file, UnsignedLong line, UnsignedLong column); +    public: +      All (Path const& file, unsigned long line, unsigned long column);      }; -      //      //      class Choice: public virtual Compositor      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Choice (Path const& file, UnsignedLong line, UnsignedLong column); +    public: +      Choice (Path const& file, unsigned long line, unsigned long column);      }; -      //      //      class Sequence: public virtual Compositor      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Sequence (Path const& file, UnsignedLong line, UnsignedLong column); +    public: +      Sequence (Path const& file, unsigned long line, unsigned long column);      };    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx index 0e71aa6..a02d751 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.cxx @@ -1,38 +1,34 @@  // file      : xsd-frontend/semantic-graph/element-group.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 <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/element-group.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; - +    ElementGroup:: +    ElementGroup (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column), contains_compositor_ (0) +    { +    }      namespace      { +      using compiler::type_info; +        struct ElementGroupInit        {          ElementGroupInit ()          { -          TypeInfo ti (typeid (ElementGroup)); -          ti.add_base (Access::public_, true, typeid (Scope)); -          RTTI::insert (ti); +          type_info ti (typeid (ElementGroup)); +          ti.add_base (typeid (Scope)); +          insert (ti);          } -        } element_group_init_;      } - -    ElementGroup:: -    ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column), contains_compositor_ (0) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx index 23514b5..ee7772c 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element-group.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/element-group.hxx -// 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  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_GROUP_HXX @@ -23,19 +22,17 @@ namespace XSDFrontend          return *contains_compositor_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column); - -      using Scope::add_edge_left; +    public: +      ElementGroup (Path const& file, unsigned long line, unsigned long column); -      Void +      void        add_edge_left (ContainsCompositor& e)        {          contains_compositor_ = &e;        } +      using Scope::add_edge_left; +      private:        ContainsCompositor* contains_compositor_;      }; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx index 1d8cda5..fb7d3a7 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element.cxx @@ -1,63 +1,53 @@  // file      : xsd-frontend/semantic-graph/element.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/element.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; - - -    // Substitutes +    // Element      // +    Element:: +    Element (Path const& file, +             unsigned long line, +             unsigned long column, +             bool global, +             bool qualified) +        : Node (file, line, column), +          Member (global, qualified), +          substitutes_ (0) +    { +    } +      namespace      { +      using compiler::type_info; +        struct SubstitutesInit        {          SubstitutesInit ()          { -          TypeInfo ti (typeid (Substitutes)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Substitutes)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } substitutes_init_; -    } -    // Element -    // -    namespace -    {        struct ElementInit        {          ElementInit ()          { -          TypeInfo ti (typeid (Element)); -          ti.add_base (Access::public_, true, typeid (Member)); -          ti.add_base (Access::public_, true, typeid (Particle)); -          RTTI::insert (ti); +          type_info ti (typeid (Element)); +          ti.add_base (typeid (Member)); +          ti.add_base (typeid (Particle)); +          insert (ti);          } -        } element_init_;      } - -    Element:: -    Element (Path const& file, -             UnsignedLong line, -             UnsignedLong column, -             Boolean global, -             Boolean qualified) -        : Node (file, line, column), -          Member (global, qualified), -          substitutes_ (0) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx index e7046e4..0af164e 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/element.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/element.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENT_HXX @@ -30,20 +29,14 @@ namespace XSDFrontend          return *root_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Substitutes () -      { -      } - -      Void +    public: +      void        set_left_node (Element& n)        {          substitution_ = &n;        } -      Void +      void        set_right_node (Element& n)        {          root_ = &n; @@ -59,7 +52,7 @@ namespace XSDFrontend                     public virtual Particle      {      public: -      Boolean +      bool        substitutes_p () const        {          return substitutes_ != 0; @@ -72,25 +65,21 @@ namespace XSDFrontend          return *substitutes_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        Element (Path const& file, -               UnsignedLong line, -               UnsignedLong column, -               Boolean global, -               Boolean qualified); +               unsigned long line, +               unsigned long column, +               bool global, +               bool qualified); -      Void +      void        add_edge_left (Substitutes& e)        {          substitutes_ = &e;        } -      Void -      add_edge_right (Substitutes&) -      { -      } +      void +      add_edge_right (Substitutes&) {}        using Member::add_edge_left;        using Member::add_edge_right; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx index 6a2addf..fa48a9a 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/elements.cxx @@ -1,10 +1,11 @@  // file      : xsd-frontend/semantic-graph/elements.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #include <algorithm> +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/elements.hxx>  #include <xsd-frontend/semantic-graph/annotation.hxx> @@ -24,32 +25,29 @@ namespace XSDFrontend      // Type      // -    Void Type:: +    void Type::      remove_edge_left (Arguments& a)      { -      ArgumentsSet::Iterator i (arguments_.find (&a)); +      ArgumentsSet::iterator i (arguments_.find (&a));        assert (i != arguments_.end ());        arguments_.erase (i);      }      // Specialization      // -    Void Specialization:: +    void Specialization::      remove_edge_right (Arguments& a)      {        // The number of entries should be small so linear search will do.        // -      Argumented::Iterator i ( +      Argumented::iterator i (          std::find (argumented_.begin (), argumented_.end (), &a));        assert (i != argumented_.end ());        argumented_.erase (i);      } -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; +    using compiler::type_info;      namespace      { @@ -59,209 +57,178 @@ namespace XSDFrontend        {          EdgeInit ()          { -          TypeInfo ti (typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Edge)); +          insert (ti);          } -        } edge_init_; -        // Node        //        struct NodeInit        {          NodeInit ()          { -          TypeInfo ti (typeid (Node)); -          RTTI::insert (ti); +          type_info ti (typeid (Node)); +          insert (ti);          } -        } node_init_; -        // Names        //        struct NamesInit        {          NamesInit ()          { -          TypeInfo ti (typeid (Names)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Names)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } names_init_; -        // Nameable        //        struct NameableInit        {          NameableInit ()          { -          TypeInfo ti (typeid (Nameable)); -          ti.add_base (Access::public_, true, typeid (Node)); -          RTTI::insert (ti); +          type_info ti (typeid (Nameable)); +          ti.add_base (typeid (Node)); +          insert (ti);          } -        } nameable_init_; -        // Scope        //        struct ScopeInit        {          ScopeInit ()          { -          TypeInfo ti (typeid (Scope)); -          ti.add_base (Access::public_, true, typeid (Nameable)); -          RTTI::insert (ti); +          type_info ti (typeid (Scope)); +          ti.add_base (typeid (Nameable)); +          insert (ti);          } -        } scope_init_; -        // Type        //        struct TypeInit        {          TypeInit ()          { -          TypeInfo ti (typeid (Type)); -          ti.add_base (Access::public_, true, typeid (Nameable)); -          RTTI::insert (ti); +          type_info ti (typeid (Type)); +          ti.add_base (typeid (Nameable)); +          insert (ti);          } -        } type_init_; -        // Instance        //        struct InstanceInit        {          InstanceInit ()          { -          TypeInfo ti (typeid (Instance)); -          ti.add_base (Access::public_, true, typeid (Nameable)); -          RTTI::insert (ti); +          type_info ti (typeid (Instance)); +          ti.add_base (typeid (Nameable)); +          insert (ti);          } -        } instance_init_; -        // Belongs        //        struct BelongsInit        {          BelongsInit ()          { -          TypeInfo ti (typeid (Belongs)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Belongs)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } belongs_init_; - -        // Inherits        //        struct InheritsInit        {          InheritsInit ()          { -          TypeInfo ti (typeid (Inherits)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Inherits)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } inherits_init_; -        // Extends        //        struct ExtendsInit        {          ExtendsInit ()          { -          TypeInfo ti (typeid (Extends)); -          ti.add_base (Access::public_, true, typeid (Inherits)); -          RTTI::insert (ti); +          type_info ti (typeid (Extends)); +          ti.add_base (typeid (Inherits)); +          insert (ti);          } -        } extends_init_; -        // Restricts        //        struct RestrictsInit        {          RestrictsInit ()          { -          TypeInfo ti (typeid (Restricts)); -          ti.add_base (Access::public_, true, typeid (Inherits)); -          RTTI::insert (ti); +          type_info ti (typeid (Restricts)); +          ti.add_base (typeid (Inherits)); +          insert (ti);          } -        } restricts_init_; -        // BelongsToNamespace        //        struct BelongsToNamespaceInit        {          BelongsToNamespaceInit ()          { -          TypeInfo ti (typeid (BelongsToNamespace)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (BelongsToNamespace)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } belongs_to_namespace_init_; -        // Member        //        struct MemberInit        {          MemberInit ()          { -          TypeInfo ti (typeid (Member)); -          ti.add_base (Access::public_, true, typeid (Instance)); -          RTTI::insert (ti); +          type_info ti (typeid (Member)); +          ti.add_base (typeid (Instance)); +          insert (ti);          } -        } member_init_; -        // Specialization        //        struct SpecializationInit        {          SpecializationInit ()          { -          TypeInfo ti (typeid (Specialization)); -          ti.add_base (Access::public_, true, typeid (Type)); -          RTTI::insert (ti); +          type_info ti (typeid (Specialization)); +          ti.add_base (typeid (Type)); +          insert (ti);          } -        } specialization_init_; -        // Arguments        //        struct ArgumentsInit        {          ArgumentsInit ()          { -          TypeInfo ti (typeid (Arguments)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Arguments)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } arguments_init_; -        /*        // Contains        // @@ -269,64 +236,50 @@ namespace XSDFrontend        {          ContainsInit ()          { -          TypeInfo ti (typeid (Contains)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Contains)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } contains_init_; -        // Container        //        struct ContainerInit        {          ContainerInit ()          { -          TypeInfo ti (typeid (Container)); -          ti.add_base (Access::public_, true, typeid (Node)); -          RTTI::insert (ti); +          type_info ti (typeid (Container)); +          ti.add_base (typeid (Node)); +          insert (ti);          } -        } container_init_;        */ -        // AnyType        // -      namespace +      struct AnyTypeInit        { -        struct AnyTypeInit +        AnyTypeInit ()          { -          AnyTypeInit () -          { -            TypeInfo ti (typeid (AnyType)); -            ti.add_base (Access::public_, true, typeid (SemanticGraph::Type)); -            RTTI::insert (ti); -          } - -        } any_type_init_; -      } - +          type_info ti (typeid (AnyType)); +          ti.add_base (typeid (SemanticGraph::Type)); +            insert (ti); +        } +      } any_type_init_;        // AnySimpleType        // -      namespace +      struct AnySimpleTypeInit        { -        struct AnySimpleTypeInit +        AnySimpleTypeInit ()          { -          AnySimpleTypeInit () -          { -            TypeInfo ti (typeid (AnySimpleType)); -            ti.add_base (Access::public_, true, typeid (Type)); -            RTTI::insert (ti); -          } - -        } any_simple_type_init_; -      } +          type_info ti (typeid (AnySimpleType)); +          ti.add_base (typeid (Type)); +            insert (ti); +        } +      } any_simple_type_init_;      } -      // Instance      //      Type& Instance:: @@ -342,9 +295,5 @@ namespace XSDFrontend  std::wostream&  operator<< (std::wostream& os, XSDFrontend::SemanticGraph::Path const& path)  { -#if !defined(BOOST_FILESYSTEM_VERSION) || BOOST_FILESYSTEM_VERSION == 2 -  return os << path.native_file_string ().c_str (); -#else    return os << path.string ().c_str (); -#endif  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx index 78b6615..98fb180 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx @@ -1,171 +1,41 @@  // file      : xsd-frontend/semantic-graph/elements.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENTS_HXX  #define XSD_FRONTEND_SEMANTIC_GRAPH_ELEMENTS_HXX +#include <set> +#include <map> +#include <list> +#include <vector>  #include <iosfwd> +#include <utility> // std::pair +#include <cstdlib> // abort +#include <cassert> -#include <boost/filesystem/path.hpp> -#include <boost/filesystem/operations.hpp> -#include <boost/filesystem/exception.hpp> +#include <cutl/container/graph.hxx> +#include <cutl/container/pointer-iterator.hxx> +#include <cutl/compiler/context.hxx> +#include <cutl/fs/path.hxx> -#include <cult/types.hxx> - -#include <cult/rtti/type-info.hxx> - -#include <cult/containers/set.hxx> -#include <cult/containers/map.hxx> -#include <cult/containers/list.hxx> -#include <cult/containers/pair.hxx> -#include <cult/containers/graph.hxx> -#include <cult/containers/vector.hxx> - -#include <frontend-elements/context.hxx> +#include <xsd-frontend/types.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    using namespace Cult::Types; - -    namespace Bits -    { -      using Cult::Containers::Graph; - -      //@@ Should end up in Cult::Meta -      // -      template <typename X> -      struct strip_pointer -      { -        typedef X Type; -      }; - -      template <typename X> -      struct strip_pointer<X*> -      { -        typedef X Type; -      }; - -      template <typename I> -      struct PointerIterator -      { -        typedef -        typename strip_pointer<typename I::Value>::Type -        Value; - -        typedef I BaseIterator; -        typedef Value& Reference; -        typedef Value* Pointer; - -        PointerIterator () -            : i_ () // i_ can be of a pointer type. -        { -        } - -        PointerIterator (I const& i) -            : i_ (i) -        { -        } - -      public: -        Reference -        operator* () const -        { -          return **i_; -        } - -        Pointer -        operator-> () const -        { -          return *i_; -        } - -        I const& -        base () const -        { -          return i_; -        } - -      public: -        PointerIterator& -        operator++ () -        { -          ++i_; -          return *this; -        } - -        PointerIterator -        operator++ (Int) -        { -          PointerIterator r (*this); -          ++i_; -          return r; -        } - -        PointerIterator& -        operator-- () -        { -          --i_; -          return *this; -        } +    using namespace cutl; -        PointerIterator -        operator-- (Int) -        { -          PointerIterator r (*this); -          --i_; -          return r; -        } - -      private: -        I i_; -      }; - -      template <typename I> -      inline -      Boolean -      operator== (PointerIterator<I> const& a, PointerIterator<I> const& b) -      { -        return a.base () == b.base (); -      } - -      template <typename I> -      inline -      Boolean -      operator!= (PointerIterator<I> const& a, PointerIterator<I> const& b) -      { -        return a.base () != b.base (); -      } - -      template <typename I> -      inline -      typename PointerIterator<I>::BaseIterator::difference_type -      operator- (PointerIterator<I> const& a, PointerIterator<I> const& b) -      { -        return a.base () - b.base (); -      } -    } +    using container::pointer_iterator;      //      // -    typedef -    boost::filesystem::filesystem_error -    InvalidPath; - -    typedef -    boost::filesystem::path -    Path; +    typedef fs::path Path; +    typedef fs::invalid_path InvalidPath; +    typedef std::vector<Path> Paths; -    typedef -    Cult::Containers::Vector<Path> -    Paths; - -    typedef -    FrontendElements::Context -    Context; +    typedef compiler::context Context;      //      // @@ -195,24 +65,17 @@ namespace XSDFrontend      public:        template <typename X> -      Boolean +      bool        is_a () const        {          return dynamic_cast<X const*> (this) != 0;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Edge () -      { -      } -      private:        mutable Context context_;      }; -    inline Boolean +    inline bool      operator== (Edge const& x, Edge const& y)      {        return &x == &y; @@ -237,20 +100,20 @@ namespace XSDFrontend          return file_;        } -      UnsignedLong +      unsigned long        line () const        {          return line_;        } -      UnsignedLong +      unsigned long        column () const        {          return column_;        }      public: -      Boolean +      bool        annotated_p () const        {          return annotates_ != 0; @@ -267,56 +130,54 @@ namespace XSDFrontend      public:        template <typename X> -      Boolean +      bool        is_a () const        {          return dynamic_cast<X const*> (this) != 0;        }      public: -        virtual -      ~Node () -      { -      } +      ~Node () {} -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Node (Path const& file, UnsignedLong line, UnsignedLong column) +      Node (Path const& file, unsigned long line, unsigned long column)            : annotates_ (0), file_ (file), line_ (line), column_ (column)        {        } -      Node () // For virtual inheritance. +      void +      add_edge_right (Annotates& a)        { -        abort (); // Told you so! +        annotates_ = &a;        } -      Void -      add_edge_right (Annotates& a) +    protected: +      Node () // For virtual inheritance.        { -        annotates_ = &a; +        abort (); // Told you so!        }      private:        mutable Context context_;        Annotates* annotates_;        Path file_; -      UnsignedLong line_; -      UnsignedLong column_; +      unsigned long line_; +      unsigned long column_;      }; -    inline Boolean +    inline bool      operator== (Node const& x, Node const& y)      {        return &x == &y;      } +    // +    // +    typedef container::graph<Node, Edge> graph;      //      // -    typedef WideString Name; +    typedef String Name;      // @@ -348,34 +209,29 @@ namespace XSDFrontend          return *named_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Names (Name const& name) -          : name_ (name) -      { -      } +    public: +      Names (Name const& name): name_ (name) {} -      Void +      void        set_left_node (Scope& n)        {          scope_ = &n;        } -      Void +      void        set_right_node (Nameable& n)        {          named_ = &n;        } -      Void +      void        clear_left_node (Scope& n)        {          assert (scope_ == &n);          scope_ = 0;        } -      Void +      void        clear_right_node (Nameable& n)        {          assert (named_ == &n); @@ -392,7 +248,7 @@ namespace XSDFrontend      class Nameable: public virtual Node      {      public: -      Boolean +      bool        named_p () const        {          return named_ != 0; @@ -419,21 +275,16 @@ namespace XSDFrontend          return *named_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Nameable () -          : named_ (0) -      { -      } +    public: +      Nameable (): named_ (0) {} -      Void +      void        add_edge_right (Names& e)        {          named_ = &e;        } -      Void +      void        remove_edge_right (Names& e)        {          assert (named_ == &e); @@ -446,42 +297,25 @@ namespace XSDFrontend        Names* named_;      }; -      //      // -    typedef -    Cult::Containers::Set<Nameable*> -    Nameables; - +    typedef std::set<Nameable*> Nameables;      //      //      class Scope: public virtual Nameable      {      protected: -      typedef -      Cult::Containers::List<Names*> -      NamesList; - -      typedef -      Cult::Containers::Map<Names*, NamesList::Iterator> -      ListIteratorMap; - -      typedef -      Cult::Containers::Map<Name, NamesList> -      NamesMap; +      typedef std::list<Names*> NamesList; +      typedef std::map<Names*, NamesList::iterator> ListIteratorMap; +      typedef std::map<Name, NamesList> NamesMap;      public: -      typedef -      Bits::PointerIterator<NamesList::Iterator> -      NamesIterator; - -      typedef -      Bits::PointerIterator<NamesList::ConstIterator> -      NamesConstIterator; +      typedef pointer_iterator<NamesList::iterator> NamesIterator; +      typedef pointer_iterator<NamesList::const_iterator> NamesConstIterator;        typedef -      Cult::Containers::Pair <NamesConstIterator, NamesConstIterator> +      std::pair<NamesConstIterator, NamesConstIterator>        NamesIteratorPair;        NamesIterator @@ -511,7 +345,7 @@ namespace XSDFrontend        virtual NamesIteratorPair        find (Name const& name) const        { -        NamesMap::ConstIterator i (names_map_.find (name)); +        NamesMap::const_iterator i (names_map_.find (name));          if (i == names_map_.end ())            return NamesIteratorPair (names_.end (), names_.end ()); @@ -522,42 +356,36 @@ namespace XSDFrontend        NamesIterator        find (Names& e)        { -        ListIteratorMap::Iterator i (iterator_map_.find (&e)); +        ListIteratorMap::iterator i (iterator_map_.find (&e));          return i != iterator_map_.end () ? i->second : names_.end ();        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Scope (Path const& file, UnsignedLong line, UnsignedLong column) +    public: +      Scope (Path const& file, unsigned long line, unsigned long column)            : Node (file, line, column)        {        } -      Scope () -      { -      } - -      Void +      void        add_edge_left (Names& e)        { -        NamesList::Iterator i (names_.insert (names_.end (), &e)); +        NamesList::iterator i (names_.insert (names_.end (), &e));          iterator_map_[&e] = i;          names_map_[e.name ()].push_back (&e);        } -      Void +      void        remove_edge_left (Names& e)        { -        ListIteratorMap::Iterator i (iterator_map_.find (&e)); +        ListIteratorMap::iterator i (iterator_map_.find (&e));          assert (i != iterator_map_.end ());          names_.erase (i->second);          iterator_map_.erase (i); -        NamesMap::Iterator j (names_map_.find (e.name ())); +        NamesMap::iterator j (names_map_.find (e.name ())); -        for (NamesList::Iterator i (j->second.begin ()); +        for (NamesList::iterator i (j->second.begin ());               i != j->second.end (); ++i)          {            if (*i == &e) @@ -565,21 +393,16 @@ namespace XSDFrontend          }        } -      //@@ Ideally should be protected but then NodeArg has no way to -      //   access it. Maybe when (if) I move NodeArg into Grpah I can -      //   resolve this. -      // -    public: -      Void +      void        add_edge_left (Names& e, NamesIterator const& after)        { -        NamesList::Iterator i; +        NamesList::iterator i;          if (after.base () == names_.end ())            i = names_.insert (names_.begin (), &e);          else          { -          NamesList::Iterator j (after.base ()); +          NamesList::iterator j (after.base ());            i = names_.insert (++j, &e);          } @@ -587,9 +410,11 @@ namespace XSDFrontend          names_map_[e.name ()].push_back (&e);        } -    protected:        using Nameable::add_edge_right; +    protected: +      Scope () {} +      private:        NamesList names_;        ListIteratorMap iterator_map_; @@ -606,22 +431,12 @@ namespace XSDFrontend      class Type: public virtual Nameable      {      protected: -      typedef -      Cult::Containers::Vector<Belongs*> -      Classifies; - -      typedef -      Cult::Containers::Vector<Inherits*> -      Begets; - -      typedef -      Cult::Containers::Set<Arguments*> -      ArgumentsSet; +      typedef std::vector<Belongs*> Classifies; +      typedef std::vector<Inherits*> Begets; +      typedef std::set<Arguments*> ArgumentsSet;      public: -      typedef -      Bits::PointerIterator<Classifies::ConstIterator> -      ClassifiesIterator; +      typedef pointer_iterator<Classifies::const_iterator> ClassifiesIterator;        ClassifiesIterator        classifies_begin () const @@ -637,7 +452,7 @@ namespace XSDFrontend        //        // -      Boolean +      bool        inherits_p () const        {          return inherits_ != 0; @@ -652,9 +467,7 @@ namespace XSDFrontend        //        // -      typedef -      Bits::PointerIterator<Begets::ConstIterator> -      BegetsIterator; +      typedef pointer_iterator<Begets::const_iterator> BegetsIterator;        BegetsIterator        begets_begin () const @@ -670,9 +483,7 @@ namespace XSDFrontend        //        // -      typedef -      Bits::PointerIterator<ArgumentsSet::ConstIterator> -      ArgumentsIterator; +      typedef pointer_iterator<ArgumentsSet::const_iterator> ArgumentsIterator;        ArgumentsIterator        arguments_begin () const @@ -686,21 +497,16 @@ namespace XSDFrontend          return arguments_.end ();        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Type () -          : inherits_ (0) -      { -      } +    public: +      Type (): inherits_ (0) {} -      Void +      void        add_edge_right (Belongs& e)        {          classifies_.push_back (&e);        } -      Void +      void        add_edge_right (Inherits& e)        {          begets_.push_back (&e); @@ -708,16 +514,16 @@ namespace XSDFrontend        using Nameable::add_edge_right; -      Void +      void        add_edge_left (Arguments& a)        {          arguments_.insert (&a);        } -      Void +      void        remove_edge_left (Arguments&); -      Void +      void        add_edge_left (Inherits& e)        {          inherits_ = &e; @@ -730,7 +536,6 @@ namespace XSDFrontend        ArgumentsSet arguments_;      }; -      class Instance: public virtual Nameable      {      public: @@ -743,21 +548,16 @@ namespace XSDFrontend        Type&        type () const; -      Boolean +      bool        typed_p () const        {          return belongs_ != 0;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Instance () -          : belongs_ (0) -      { -      } +    public: +      Instance (): belongs_ (0) {} -      Void +      void        add_edge_left (Belongs& e)        {          belongs_ = &e; @@ -783,20 +583,14 @@ namespace XSDFrontend          return *type_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Belongs () -      { -      } - -      Void +    public: +      void        set_left_node (Instance& n)        {          instance_ = &n;        } -      Void +      void        set_right_node (Type& n)        {          type_ = &n; @@ -825,20 +619,14 @@ namespace XSDFrontend          return *derived_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Inherits () -      { -      } - -      Void +    public: +      void        set_left_node (Type& n)        {          derived_ = &n;        } -      Void +      void        set_right_node (Type& n)        {          base_ = &n; @@ -849,30 +637,17 @@ namespace XSDFrontend        Type* derived_;      }; -      class Extends: public virtual Inherits      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Extends () -      { -      }      };      class Restricts: public virtual Inherits      { -    protected: -      typedef -      Cult::Containers::Map<WideString, WideString> -      Facets; -      public: -      typedef -      Facets::Iterator -      FacetIterator; +      typedef std::map<String, String> Facets; +      typedef Facets::iterator FacetIterator; -      Boolean +      bool        facet_empty ()        {          return facets_.empty (); @@ -891,22 +666,21 @@ namespace XSDFrontend        }        FacetIterator -      facet_find (WideString const& name) +      facet_find (String const& name)        {          return facets_.find (name);        } -      Void +      void        facet_insert (String const& name, String const& value)        {          facets_[name] = value;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Restricts () +      Facets const& +      facets () const        { +        return facets_;        }      protected: @@ -936,21 +710,16 @@ namespace XSDFrontend          return *namespace__;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      BelongsToNamespace () -          : member_ (0), namespace__ (0) -      { -      } +    public: +      BelongsToNamespace (): member_ (0), namespace__ (0) {} -      Void +      void        set_left_node (Member& n)        {          member_ = &n;        } -      Void +      void        set_right_node (Namespace& n)        {          namespace__ = &n; @@ -969,13 +738,13 @@ namespace XSDFrontend        // Member is global either if it is defined outside any type        // or it is a ref="" of a global member.        // -      Boolean +      bool        global_p () const        {          return global_;        } -      Boolean +      bool        qualified_p () const        {          return qualified_; @@ -995,13 +764,13 @@ namespace XSDFrontend        // is a superset of the default value semantics. As such setting the        // fixed value appears as if the default value was also set.        // -      Boolean +      bool        default_p () const        {          return value_type_ != ValueType::none;        } -      Boolean +      bool        fixed_p () const        {          return value_type_ == ValueType::fixed; @@ -1009,7 +778,7 @@ namespace XSDFrontend        struct NoValue {}; -      WideString +      String        value () const        {          if (value_type_ != ValueType::none) @@ -1020,24 +789,22 @@ namespace XSDFrontend        //        // -      Void -      default_ (WideString const& v) +      void +      default_ (String const& v)        {          value_ = v;          value_type_ = ValueType::default_;        } -      Void -      fixed (WideString const& v) +      void +      fixed (String const& v)        {          value_ = v;          value_type_ = ValueType::fixed;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Member (Boolean global, Boolean qualified) +    public: +      Member (bool global, bool qualified)            : global_ (global),              qualified_ (qualified),              belongs_to_namespace_ (0), @@ -1045,7 +812,7 @@ namespace XSDFrontend        {        } -      Void +      void        add_edge_left (BelongsToNamespace& e)        {          // In the parser we sometimes re-add the same adge. @@ -1056,8 +823,8 @@ namespace XSDFrontend        using Instance::add_edge_left;      private: -      Boolean global_; -      Boolean qualified_; +      bool global_; +      bool qualified_;        BelongsToNamespace* belongs_to_namespace_;        struct ValueType @@ -1070,7 +837,7 @@ namespace XSDFrontend          };        }; -      WideString value_; +      String value_;        ValueType::Value value_type_;      }; @@ -1080,17 +847,12 @@ namespace XSDFrontend      class Specialization: public virtual Type      { -      typedef -      Cult::Containers::Vector<Arguments*> -      Argumented; +      typedef std::vector<Arguments*> Argumented;      public: +      typedef pointer_iterator<Argumented::iterator> ArgumentedIterator;        typedef -      Bits::PointerIterator<Argumented::Iterator> -      ArgumentedIterator; - -      typedef -      Bits::PointerIterator<Argumented::ConstIterator> +      pointer_iterator<Argumented::const_iterator>        ArgumentedConstIterator;        ArgumentedIterator @@ -1125,32 +887,28 @@ namespace XSDFrontend          return *argumented_[0];        } -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        using Type::add_edge_right; -      Void +      void        add_edge_right (Arguments& a)        {          argumented_.push_back (&a);        } -      Void -      remove_edge_right (Arguments&); - -    public: -      Void +      void        add_edge_right (Arguments& a, ArgumentedIterator const& pos)        {          argumented_.insert (pos.base (), &a);        } +      void +      remove_edge_right (Arguments&); +      private:        Argumented argumented_;      }; -      class Arguments: public virtual Edge      {      public: @@ -1166,9 +924,7 @@ namespace XSDFrontend          return *specialization_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        void        set_left_node (Type& n)        { @@ -1205,17 +961,14 @@ namespace XSDFrontend      //      class AnyType: public virtual Type      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      AnyType (Path const& file, UnsignedLong line, UnsignedLong column) +    public: +      AnyType (Path const& file, unsigned long line, unsigned long column)            : Node (file, line, column)        {        } -      AnyType () // For virtual inheritance. -      { -      } +    protected: +      AnyType () {} // For virtual inheritance.      }; @@ -1223,17 +976,14 @@ namespace XSDFrontend      //      class AnySimpleType: public virtual Type      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      AnySimpleType (Path const& file, UnsignedLong line, UnsignedLong column) +    public: +      AnySimpleType (Path const& file, unsigned long line, unsigned long column)            : Node (file, line, column)        {        } -      AnySimpleType () // For virtual inheritance. -      { -      } +    protected: +      AnySimpleType () {} // For virtual inheritance.      };    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx index adcf71e..93bcf79 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.cxx @@ -1,32 +1,45 @@  // file      : xsd-frontend/semantic-graph/enumeration.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/enumeration.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; +    // Enumeration +    // +    Enumeration:: +    Enumeration (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    } -    using RTTI::Access; -    using RTTI::TypeInfo; +    // Enumerator +    // +    Enumerator:: +    Enumerator (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    }      namespace      { +      using compiler::type_info; +        // Enumeration        //        struct EnumerationInit        {          EnumerationInit ()          { -          TypeInfo ti (typeid (Enumeration)); -          ti.add_base (Access::public_, true, typeid (Complex)); -          RTTI::insert (ti); +          type_info ti (typeid (Enumeration)); +          ti.add_base (typeid (Complex)); +          insert (ti);          } -        } enumeration_init_; @@ -36,32 +49,11 @@ namespace XSDFrontend        {          EnumeratorInit ()          { -          TypeInfo ti (typeid (Enumerator)); -          ti.add_base (Access::public_, true, typeid (Instance)); -          RTTI::insert (ti); +          type_info ti (typeid (Enumerator)); +          ti.add_base (typeid (Instance)); +          insert (ti);          } -        } enumerator_init_;      } - - -    // Enumeration -    // - -    Enumeration:: -    Enumeration (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    } - - -    // Enumerator -    // - -    Enumerator:: -    Enumerator (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx index a21e8f3..90a33d1 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/enumeration.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/enumeration.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_ENUMERATION_HXX @@ -15,19 +14,15 @@ namespace XSDFrontend    {      class Enumeration: public virtual Complex      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Enumeration (Path const& file, UnsignedLong line, UnsignedLong column); +    public: +      Enumeration (Path const& file, unsigned long line, unsigned long column);      };      class Enumerator: public virtual Instance      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Enumerator (Path const& file, UnsignedLong line, UnsignedLong column); +    public: +      Enumerator (Path const& file, unsigned long line, unsigned long column);      };    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx new file mode 100644 index 0000000..cc98449 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx @@ -0,0 +1,1143 @@ +// file      : xsd-frontend/semantic-graph/fundamental.cxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Note, that this file is automatically generated! +// + +#include <cutl/compiler/type-info.hxx> + +#include <xsd-frontend/semantic-graph/fundamental.hxx> + +namespace XSDFrontend +{ +  namespace SemanticGraph +  { +    namespace Fundamental +    { +      using compiler::type_info; + +      // Type +      // +      namespace +      { +        struct TypeInit +        { +          TypeInit () +          { +            type_info ti (typeid (Type)); +            ti.add_base (typeid (SemanticGraph::Type)); +            insert (ti); +          } +        } any_type_init_; +      } + +      Type:: +      Type () +      { +      } + + +      // Byte +      // +      namespace +      { +        struct ByteInit +        { +          ByteInit () +          { +            type_info ti (typeid (Byte)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } byte_init_; +      } + +      Byte:: +      Byte (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // UnsignedByte +      // +      namespace +      { +        struct UnsignedByteInit +        { +          UnsignedByteInit () +          { +            type_info ti (typeid (UnsignedByte)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } unsigned_byte_init_; +      } + +      UnsignedByte:: +      UnsignedByte (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Short +      // +      namespace +      { +        struct ShortInit +        { +          ShortInit () +          { +            type_info ti (typeid (Short)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } short_init_; +      } + +      Short:: +      Short (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // UnsignedShort +      // +      namespace +      { +        struct UnsignedShortInit +        { +          UnsignedShortInit () +          { +            type_info ti (typeid (UnsignedShort)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } unsigned_short_init_; +      } + +      UnsignedShort:: +      UnsignedShort (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Int +      // +      namespace +      { +        struct IntInit +        { +          IntInit () +          { +            type_info ti (typeid (Int)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } int_init_; +      } + +      Int:: +      Int (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // UnsignedInt +      // +      namespace +      { +        struct UnsignedIntInit +        { +          UnsignedIntInit () +          { +            type_info ti (typeid (UnsignedInt)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } unsigned_int_init_; +      } + +      UnsignedInt:: +      UnsignedInt (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Long +      // +      namespace +      { +        struct LongInit +        { +          LongInit () +          { +            type_info ti (typeid (Long)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } long_init_; +      } + +      Long:: +      Long (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // UnsignedLong +      // +      namespace +      { +        struct UnsignedLongInit +        { +          UnsignedLongInit () +          { +            type_info ti (typeid (UnsignedLong)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } unsigned_long_init_; +      } + +      UnsignedLong:: +      UnsignedLong (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Integer +      // +      namespace +      { +        struct IntegerInit +        { +          IntegerInit () +          { +            type_info ti (typeid (Integer)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } integer_init_; +      } + +      Integer:: +      Integer (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // NonPositiveInteger +      // +      namespace +      { +        struct NonPositiveIntegerInit +        { +          NonPositiveIntegerInit () +          { +            type_info ti (typeid (NonPositiveInteger)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } non_positive_integer_init_; +      } + +      NonPositiveInteger:: +      NonPositiveInteger (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // NonNegativeInteger +      // +      namespace +      { +        struct NonNegativeIntegerInit +        { +          NonNegativeIntegerInit () +          { +            type_info ti (typeid (NonNegativeInteger)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } non_negative_integer_init_; +      } + +      NonNegativeInteger:: +      NonNegativeInteger (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // PositiveInteger +      // +      namespace +      { +        struct PositiveIntegerInit +        { +          PositiveIntegerInit () +          { +            type_info ti (typeid (PositiveInteger)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } positive_integer_init_; +      } + +      PositiveInteger:: +      PositiveInteger (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // NegativeInteger +      // +      namespace +      { +        struct NegativeIntegerInit +        { +          NegativeIntegerInit () +          { +            type_info ti (typeid (NegativeInteger)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } negative_integer_init_; +      } + +      NegativeInteger:: +      NegativeInteger (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Boolean +      // +      namespace +      { +        struct BooleanInit +        { +          BooleanInit () +          { +            type_info ti (typeid (Boolean)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } boolean_init_; +      } + +      Boolean:: +      Boolean (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Float +      // +      namespace +      { +        struct FloatInit +        { +          FloatInit () +          { +            type_info ti (typeid (Float)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } float_init_; +      } + +      Float:: +      Float (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Double +      // +      namespace +      { +        struct DoubleInit +        { +          DoubleInit () +          { +            type_info ti (typeid (Double)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } double_init_; +      } + +      Double:: +      Double (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Decimal +      // +      namespace +      { +        struct DecimalInit +        { +          DecimalInit () +          { +            type_info ti (typeid (Decimal)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } decimal_init_; +      } + +      Decimal:: +      Decimal (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // String +      // +      namespace +      { +        struct StringInit +        { +          StringInit () +          { +            type_info ti (typeid (String)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } string_init_; +      } + +      String:: +      String (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // NormalizedString +      // +      namespace +      { +        struct NormalizedStringInit +        { +          NormalizedStringInit () +          { +            type_info ti (typeid (NormalizedString)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } normalized_string_init_; +      } + +      NormalizedString:: +      NormalizedString (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Token +      // +      namespace +      { +        struct TokenInit +        { +          TokenInit () +          { +            type_info ti (typeid (Token)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } token_init_; +      } + +      Token:: +      Token (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Name +      // +      namespace +      { +        struct NameInit +        { +          NameInit () +          { +            type_info ti (typeid (Name)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } name_init_; +      } + +      Name:: +      Name (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // NameToken +      // +      namespace +      { +        struct NameTokenInit +        { +          NameTokenInit () +          { +            type_info ti (typeid (NameToken)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } name_token_init_; +      } + +      NameToken:: +      NameToken (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // NameTokens +      // +      namespace +      { +        struct NameTokensInit +        { +          NameTokensInit () +          { +            type_info ti (typeid (NameTokens)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } name_tokens_init_; +      } + +      NameTokens:: +      NameTokens (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // NCName +      // +      namespace +      { +        struct NCNameInit +        { +          NCNameInit () +          { +            type_info ti (typeid (NCName)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } NC_name_init_; +      } + +      NCName:: +      NCName (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Language +      // +      namespace +      { +        struct LanguageInit +        { +          LanguageInit () +          { +            type_info ti (typeid (Language)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } language_init_; +      } + +      Language:: +      Language (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // QName +      // +      namespace +      { +        struct QNameInit +        { +          QNameInit () +          { +            type_info ti (typeid (QName)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } q_name_init_; +      } + +      QName:: +      QName (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Id +      // +      namespace +      { +        struct IdInit +        { +          IdInit () +          { +            type_info ti (typeid (Id)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } id_init_; +      } + +      Id:: +      Id (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // IdRef +      // +      namespace +      { +        struct IdRefInit +        { +          IdRefInit () +          { +            type_info ti (typeid (IdRef)); +	    ti.add_base (typeid (Type)); +            ti.add_base (typeid (Specialization)); +            insert (ti); +          } + +        } id_ref_init_; +      } + +      IdRef:: +      IdRef (Path const& file, +             unsigned long line, +             unsigned long column) +          : Node (file, line, column) +      { +      } + + +      // IdRefs +      // +      namespace +      { +        struct IdRefsInit +        { +          IdRefsInit () +          { +            type_info ti (typeid (IdRefs)); +	    ti.add_base (typeid (Type)); +            ti.add_base (typeid (Specialization)); +            insert (ti); +          } + +        } id_refs_init_; +      } + +      IdRefs:: +      IdRefs (Path const& file, +              unsigned long line, +              unsigned long column) +          : Node (file, line, column) +      { +      } + + +      // AnyURI +      // +      namespace +      { +        struct AnyURIInit +        { +          AnyURIInit () +          { +            type_info ti (typeid (AnyURI)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } any_URI_init_; +      } + +      AnyURI:: +      AnyURI (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Base64Binary +      // +      namespace +      { +        struct Base64BinaryInit +        { +          Base64BinaryInit () +          { +            type_info ti (typeid (Base64Binary)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } base_64_binary_init_; +      } + +      Base64Binary:: +      Base64Binary (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // HexBinary +      // +      namespace +      { +        struct HexBinaryInit +        { +          HexBinaryInit () +          { +            type_info ti (typeid (HexBinary)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } hex_binary_init_; +      } + +      HexBinary:: +      HexBinary (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Date +      // +      namespace +      { +        struct DateInit +        { +          DateInit () +          { +            type_info ti (typeid (Date)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } date_init_; +      } + +      Date:: +      Date (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // DateTime +      // +      namespace +      { +        struct DateTimeInit +        { +          DateTimeInit () +          { +            type_info ti (typeid (DateTime)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } date_time_init_; +      } + +      DateTime:: +      DateTime (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Duration +      // +      namespace +      { +        struct DurationInit +        { +          DurationInit () +          { +            type_info ti (typeid (Duration)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } duration_init_; +      } + +      Duration:: +      Duration (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Day +      // +      namespace +      { +        struct DayInit +        { +          DayInit () +          { +            type_info ti (typeid (Day)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } day_init_; +      } + +      Day:: +      Day (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Month +      // +      namespace +      { +        struct MonthInit +        { +          MonthInit () +          { +            type_info ti (typeid (Month)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } month_init_; +      } + +      Month:: +      Month (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // MonthDay +      // +      namespace +      { +        struct MonthDayInit +        { +          MonthDayInit () +          { +            type_info ti (typeid (MonthDay)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } month_day_init_; +      } + +      MonthDay:: +      MonthDay (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Year +      // +      namespace +      { +        struct YearInit +        { +          YearInit () +          { +            type_info ti (typeid (Year)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } year_init_; +      } + +      Year:: +      Year (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // YearMonth +      // +      namespace +      { +        struct YearMonthInit +        { +          YearMonthInit () +          { +            type_info ti (typeid (YearMonth)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } year_month_init_; +      } + +      YearMonth:: +      YearMonth (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Time +      // +      namespace +      { +        struct TimeInit +        { +          TimeInit () +          { +            type_info ti (typeid (Time)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } time_init_; +      } + +      Time:: +      Time (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Entity +      // +      namespace +      { +        struct EntityInit +        { +          EntityInit () +          { +            type_info ti (typeid (Entity)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } entity_init_; +      } + +      Entity:: +      Entity (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Entities +      // +      namespace +      { +        struct EntitiesInit +        { +          EntitiesInit () +          { +            type_info ti (typeid (Entities)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } entities_init_; +      } + +      Entities:: +      Entities (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } + + +      // Notation +      // +      namespace +      { +        struct NotationInit +        { +          NotationInit () +          { +            type_info ti (typeid (Notation)); +            ti.add_base (typeid (Type)); +            insert (ti); +          } + +        } notation_init_; +      } + +      Notation:: +      Notation (Path const& file, +          unsigned long line, +          unsigned long column) +        : Node (file, line, column) +      { +      } +    } +  } +} diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 index cc1316c..c336ab8 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.cxx.m4 @@ -1,8 +1,7 @@  divert(-1)  # file      : xsd-frontend/semantic-graph/fundamental.cxx.m4 -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  include(`fundamental.m4') @@ -21,9 +20,9 @@ define(`fundamental_type_impl', `          {            $1Init ()            { -            TypeInfo ti (typeid ($1)); -            ti.add_base (Access::public_, true, typeid (Type)); -            RTTI::insert (ti); +            type_info ti (typeid ($1)); +            ti.add_base (typeid (Type)); +            insert (ti);            }          } $2_init_; @@ -31,8 +30,8 @@ define(`fundamental_type_impl', `        $1::        $1 (Path const& file, -          SemanticGraph::UnsignedLong line, -          SemanticGraph::UnsignedLong column) +          unsigned long line, +          unsigned long column)          : Node (file, line, column)        {        }') @@ -42,13 +41,14 @@ dnl  dnl  dnl  // file      : xsd-frontend/semantic-graph/fundamental.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  // Note, that this file is automatically generated!  // +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/fundamental.hxx>  namespace XSDFrontend @@ -57,11 +57,7 @@ namespace XSDFrontend    {      namespace Fundamental      { -      namespace RTTI = Cult::RTTI; - -      using RTTI::Access; -      using RTTI::TypeInfo; - +      using compiler::type_info;        // Type        // @@ -71,11 +67,10 @@ namespace XSDFrontend          {            TypeInit ()            { -            TypeInfo ti (typeid (Type)); -            ti.add_base (Access::public_, true, typeid (SemanticGraph::Type)); -            RTTI::insert (ti); +            type_info ti (typeid (Type)); +            ti.add_base (typeid (SemanticGraph::Type)); +            insert (ti);            } -          } any_type_init_;        } @@ -138,10 +133,10 @@ fundamental_type(`id')          {            IdRefInit ()            { -            TypeInfo ti (typeid (IdRef)); -	    ti.add_base (Access::public_, true, typeid (Type)); -            ti.add_base (Access::public_, true, typeid (Specialization)); -            RTTI::insert (ti); +            type_info ti (typeid (IdRef)); +	    ti.add_base (typeid (Type)); +            ti.add_base (typeid (Specialization)); +            insert (ti);            }          } id_ref_init_; @@ -149,8 +144,8 @@ fundamental_type(`id')        IdRef::        IdRef (Path const& file, -             SemanticGraph::UnsignedLong line, -             SemanticGraph::UnsignedLong column) +             unsigned long line, +             unsigned long column)            : Node (file, line, column)        {        } @@ -164,10 +159,10 @@ fundamental_type(`id')          {            IdRefsInit ()            { -            TypeInfo ti (typeid (IdRefs)); -	    ti.add_base (Access::public_, true, typeid (Type)); -            ti.add_base (Access::public_, true, typeid (Specialization)); -            RTTI::insert (ti); +            type_info ti (typeid (IdRefs)); +	    ti.add_base (typeid (Type)); +            ti.add_base (typeid (Specialization)); +            insert (ti);            }          } id_refs_init_; @@ -175,8 +170,8 @@ fundamental_type(`id')        IdRefs::        IdRefs (Path const& file, -              SemanticGraph::UnsignedLong line, -              SemanticGraph::UnsignedLong column) +              unsigned long line, +              unsigned long column)            : Node (file, line, column)        {        } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx new file mode 100644 index 0000000..d810824 --- /dev/null +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx @@ -0,0 +1,516 @@ +// file      : xsd-frontend/semantic-graph/fundamental.hxx +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC +// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Note, that this file is automatically generated! +// + +#ifndef XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX +#define XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX + +#include <xsd-frontend/semantic-graph/elements.hxx> + +namespace XSDFrontend +{ +  namespace SemanticGraph +  { +    namespace Fundamental +    { +      // +      // +      class Type: public virtual SemanticGraph::Type +      { +      protected: +        Type (); +      }; + + +      // +      // +      class Byte: public virtual Type +      { +      public: +        Byte (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class UnsignedByte: public virtual Type +      { +      public: +        UnsignedByte (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Short: public virtual Type +      { +      public: +        Short (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class UnsignedShort: public virtual Type +      { +      public: +        UnsignedShort (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Int: public virtual Type +      { +      public: +        Int (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class UnsignedInt: public virtual Type +      { +      public: +        UnsignedInt (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Long: public virtual Type +      { +      public: +        Long (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class UnsignedLong: public virtual Type +      { +      public: +        UnsignedLong (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Integer: public virtual Type +      { +      public: +        Integer (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class NonPositiveInteger: public virtual Type +      { +      public: +        NonPositiveInteger (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class NonNegativeInteger: public virtual Type +      { +      public: +        NonNegativeInteger (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class PositiveInteger: public virtual Type +      { +      public: +        PositiveInteger (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class NegativeInteger: public virtual Type +      { +      public: +        NegativeInteger (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Boolean: public virtual Type +      { +      public: +        Boolean (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Float: public virtual Type +      { +      public: +        Float (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Double: public virtual Type +      { +      public: +        Double (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Decimal: public virtual Type +      { +      public: +        Decimal (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class String: public virtual Type +      { +      public: +        String (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class NormalizedString: public virtual Type +      { +      public: +        NormalizedString (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Token: public virtual Type +      { +      public: +        Token (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Name: public virtual Type +      { +      public: +        Name (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class NameToken: public virtual Type +      { +      public: +        NameToken (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class NameTokens: public virtual Type +      { +      public: +        NameTokens (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class NCName: public virtual Type +      { +      public: +        NCName (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Language: public virtual Type +      { +      public: +        Language (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class QName: public virtual Type +      { +      public: +        QName (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Id: public virtual Type +      { +      public: +        Id (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class IdRef: public virtual Type, +                   public virtual Specialization +      { +      public: +        IdRef (Path const& file, +               unsigned long line, +               unsigned long column); +      }; + + +      // +      // +      class IdRefs: public virtual Type, +                    public virtual Specialization +      { +      public: +        IdRefs (Path const& file, +                unsigned long line, +                unsigned long column); +      }; + + +      // +      // +      class AnyURI: public virtual Type +      { +      public: +        AnyURI (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Base64Binary: public virtual Type +      { +      public: +        Base64Binary (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class HexBinary: public virtual Type +      { +      public: +        HexBinary (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Date: public virtual Type +      { +      public: +        Date (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class DateTime: public virtual Type +      { +      public: +        DateTime (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Duration: public virtual Type +      { +      public: +        Duration (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Day: public virtual Type +      { +      public: +        Day (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Month: public virtual Type +      { +      public: +        Month (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class MonthDay: public virtual Type +      { +      public: +        MonthDay (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Year: public virtual Type +      { +      public: +        Year (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class YearMonth: public virtual Type +      { +      public: +        YearMonth (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Time: public virtual Type +      { +      public: +        Time (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Entity: public virtual Type +      { +      public: +        Entity (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Entities: public virtual Type +      { +      public: +        Entities (Path const& file, +            unsigned long line, +            unsigned long column); +      }; + + +      // +      // +      class Notation: public virtual Type +      { +      public: +        Notation (Path const& file, +            unsigned long line, +            unsigned long column); +      }; +    } +  } +} + +#endif  // XSD_FRONTEND_SEMANTIC_GRAPH_FUNDAMENTAL_HXX diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 index f5a88a9..52c9c89 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.hxx.m4 @@ -1,8 +1,7 @@  divert(-1)  # file      : xsd-frontend/semantic-graph/fundamental.hxx.m4 -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  include(`fundamental.m4') @@ -15,20 +14,17 @@ define(`fundamental_type_impl', `        //        class $1: public virtual Type        { -      protected: -        friend class Bits::Graph<Node, Edge>; - +      public:          $1 (Path const& file, -            SemanticGraph::UnsignedLong line, -            SemanticGraph::UnsignedLong column); +            unsigned long line, +            unsigned long column);        };')  divert(0)dnl  dnl  dnl  dnl  // file      : xsd-frontend/semantic-graph/fundamental.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  // Note, that this file is automatically generated! @@ -50,8 +46,6 @@ namespace XSDFrontend        class Type: public virtual SemanticGraph::Type        {        protected: -        friend class Bits::Graph<Node, Edge>; -          Type ();        };  dnl @@ -106,12 +100,10 @@ fundamental_type(`id')        class IdRef: public virtual Type,                     public virtual Specialization        { -      protected: -        friend class Bits::Graph<Node, Edge>; - +      public:          IdRef (Path const& file, -               SemanticGraph::UnsignedLong line, -               SemanticGraph::UnsignedLong column); +               unsigned long line, +               unsigned long column);        }; @@ -120,12 +112,10 @@ fundamental_type(`id')        class IdRefs: public virtual Type,                      public virtual Specialization        { -      protected: -        friend class Bits::Graph<Node, Edge>; - +      public:          IdRefs (Path const& file, -                SemanticGraph::UnsignedLong line, -                SemanticGraph::UnsignedLong column); +                unsigned long line, +                unsigned long column);        };  dnl  dnl URI. diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 index 735b35d..b9243f7 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 +++ b/libxsd-frontend/xsd-frontend/semantic-graph/fundamental.m4 @@ -1,6 +1,5 @@  # file      : xsd-frontend/semantic-graph/fundamental.m4 -# author    : Boris Kolpackov <boris@codesynthesis.com> -# copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  # license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  define(`upcase', `translit(`$*', `a-z', `A-Z')') diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx index 3184041..f62f617 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/list.cxx @@ -1,37 +1,34 @@  // file      : xsd-frontend/semantic-graph/list.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/list.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; +    List:: +    List (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    }      namespace      { +      using compiler::type_info; +        struct ListInit        {          ListInit ()          { -          TypeInfo ti (typeid (List)); -          ti.add_base (Access::public_, true, typeid (Specialization)); -          RTTI::insert (ti); +          type_info ti (typeid (List)); +          ti.add_base (typeid (Specialization)); +          insert (ti);          } -        } list_init_;      } - -    List:: -    List (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx index 3ba0c02..d7f370f 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/list.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/list.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_LIST_HXX @@ -14,10 +13,8 @@ namespace XSDFrontend    {      class List: public virtual Specialization      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      List (Path const& file, UnsignedLong line, UnsignedLong column); +    public: +      List (Path const& file, unsigned long line, unsigned long column);      };    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx index 789b5d8..e33a892 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.cxx @@ -1,37 +1,34 @@  // file      : xsd-frontend/semantic-graph/namespace.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/namespace.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; +    Namespace:: +    Namespace (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    }      namespace      { +      using compiler::type_info; +        struct NamespaceInit        {          NamespaceInit ()          { -          TypeInfo ti (typeid (Namespace)); -          ti.add_base (Access::public_, true, typeid (Scope)); -          RTTI::insert (ti); +          type_info ti (typeid (Namespace)); +          ti.add_base (typeid (Scope)); +          insert (ti);          } -        } namespace_init_;      } - -    Namespace:: -    Namespace (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx index 25bd1c0..ccc9d61 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/namespace.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/namespace.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_NAMESPACE_HXX @@ -14,15 +13,11 @@ namespace XSDFrontend    {      class Namespace : public virtual Scope      { -    protected: -      friend class Bits::Graph<Node, Edge>; +    public: +      Namespace (Path const& file, unsigned long line, unsigned long column); -      Namespace (Path const& file, UnsignedLong line, UnsignedLong column); - -      Void -      add_edge_right (BelongsToNamespace&) -      { -      } +      void +      add_edge_right (BelongsToNamespace&) {}        using Scope::add_edge_right;      }; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx index f8c93de..c3269e6 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/particle.cxx @@ -1,61 +1,54 @@  // file      : xsd-frontend/semantic-graph/particle.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 <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/particle.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; -      // ContainsParticle      // -    namespace -    { -      struct ContainsParticleInit -      { -        ContainsParticleInit () -        { -          TypeInfo ti (typeid (ContainsParticle)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); -        } - -      } contains_particle_init_; -    } -      ContainsParticle:: -    ContainsParticle (UnsignedLong min, UnsignedLong max) +    ContainsParticle (unsigned long min, unsigned long max)          : particle_ (0), compositor_ (0), min_ (min), max_ (max)      {      }      // Particle      // +    Particle:: +    Particle () +        : contained_particle_ (0) +    { +    } +      namespace      { +      using compiler::type_info; + +      struct ContainsParticleInit +      { +        ContainsParticleInit () +        { +          type_info ti (typeid (ContainsParticle)); +          ti.add_base (typeid (Edge)); +          insert (ti); +        } +      } contains_particle_init_; +        struct ParticleInit        {          ParticleInit ()          { -          TypeInfo ti (typeid (Particle)); -          ti.add_base (Access::public_, true, typeid (Node)); -          RTTI::insert (ti); +          type_info ti (typeid (Particle)); +          ti.add_base (typeid (Node)); +          insert (ti);          } -        } particle_init_;      } - -    Particle:: -    Particle () -        : contained_particle_ (0) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx index df48de4..a7f0755 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/particle.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/particle.hxx -// 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  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_PARTICLE_HXX @@ -36,43 +35,41 @@ namespace XSDFrontend        }      public: -      UnsignedLong +      unsigned long        min () const        {          return min_;        } -      UnsignedLong +      unsigned long        max () const        {          return max_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      ContainsParticle (UnsignedLong min, UnsignedLong max); +    public: +      ContainsParticle (unsigned long min, unsigned long max); -      Void +      void        set_left_node (Compositor& n)        {          compositor_ = &n;        } -      Void +      void        set_right_node (Particle& n)        {          particle_ = &n;        } -      Void +      void        clear_left_node (Compositor& n)        {          assert (compositor_ == &n);          compositor_ = 0;        } -      Void +      void        clear_right_node (Particle& n)        {          assert (particle_ == &n); @@ -82,7 +79,7 @@ namespace XSDFrontend      private:        Particle* particle_;        Compositor* compositor_; -      UnsignedLong min_, max_; +      unsigned long min_, max_;      };      // @@ -90,7 +87,7 @@ namespace XSDFrontend      class Particle: public virtual Node      {      public: -      Boolean +      bool        contained_particle_p ()        {          return contained_particle_ != 0; @@ -104,32 +101,30 @@ namespace XSDFrontend        }      public: -      UnsignedLong +      unsigned long        min () const        {          assert (contained_particle_ != 0);          return contained_particle_->min ();        } -      UnsignedLong +      unsigned long        max () const        {          assert (contained_particle_ != 0);          return contained_particle_->max ();        } -    protected: -      friend class Bits::Graph<Node, Edge>; - +    public:        Particle (); -      Void +      void        add_edge_right (ContainsParticle& e)        {          contained_particle_ = &e;        } -      Void +      void        remove_edge_right (ContainsParticle& e)        {          assert (contained_particle_ == &e); diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx index f812797..d1cbf25 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/schema.cxx @@ -1,32 +1,64 @@  // file      : xsd-frontend/semantic-graph/schema.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/schema.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; +    // Schema +    // +    Schema::NamesIteratorPair Schema:: +    find (Name const& name) const +    { +      // Here we are going to create an illusion that the namespace +      // hierarchy is flat. +      names_.clear (); +      schemas_.clear (); + +      find_ (name, names_, schemas_); + +      return NamesIteratorPair (NamesConstIterator (names_.begin ()), +                                NamesConstIterator (names_.end ())); +    } + +    void Schema:: +    find_ (Name const& name, NamesList& names, SchemaSet& set) const +    { +      set.insert (this); + +      // Check our own namespace first so it will end up first in the list. +      // +      NamesIteratorPair pair (Scope::find (name)); +      names.insert (names.end (), pair.first.base (), pair.second.base ()); -    using RTTI::Access; -    using RTTI::TypeInfo; +      for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i) +      { +        Schema& s (i->schema ()); + +        if (set.find (&s) == set.end ()) +          s.find_ (name, names, set); +      } +    }      namespace      { +      using compiler::type_info; +        // Uses        //        struct UsesInit        {          UsesInit ()          { -          TypeInfo ti (typeid (Uses)); -          ti.add_base (Access::public_, true, typeid (Edge)); -          RTTI::insert (ti); +          type_info ti (typeid (Uses)); +          ti.add_base (typeid (Edge)); +          insert (ti);          } -        } uses_init_; @@ -36,11 +68,10 @@ namespace XSDFrontend        {          ImpliesInit ()          { -          TypeInfo ti (typeid (Implies)); -          ti.add_base (Access::public_, true, typeid (Uses)); -          RTTI::insert (ti); +          type_info ti (typeid (Implies)); +          ti.add_base (typeid (Uses)); +          insert (ti);          } -        } implies_init_; @@ -50,11 +81,10 @@ namespace XSDFrontend        {          SourcesInit ()          { -          TypeInfo ti (typeid (Sources)); -          ti.add_base (Access::public_, true, typeid (Uses)); -          RTTI::insert (ti); +          type_info ti (typeid (Sources)); +          ti.add_base (typeid (Uses)); +          insert (ti);          } -        } sources_init_; @@ -64,11 +94,10 @@ namespace XSDFrontend        {          IncludesInit ()          { -          TypeInfo ti (typeid (Includes)); -          ti.add_base (Access::public_, true, typeid (Uses)); -          RTTI::insert (ti); +          type_info ti (typeid (Includes)); +          ti.add_base (typeid (Uses)); +          insert (ti);          } -        } includes_init_; @@ -78,11 +107,10 @@ namespace XSDFrontend        {          ImportsInit ()          { -          TypeInfo ti (typeid (Imports)); -          ti.add_base (Access::public_, true, typeid (Uses)); -          RTTI::insert (ti); +          type_info ti (typeid (Imports)); +          ti.add_base (typeid (Uses)); +          insert (ti);          } -        } imports_init_; @@ -92,48 +120,11 @@ namespace XSDFrontend        {          SchemaInit ()          { -          TypeInfo ti (typeid (Schema)); -          ti.add_base (Access::public_, true, typeid (Scope)); -          RTTI::insert (ti); +          type_info ti (typeid (Schema)); +          ti.add_base (typeid (Scope)); +          insert (ti);          } -        } schema_init_;      } - - -    // Schema -    // -    Schema::NamesIteratorPair Schema:: -    find (Name const& name) const -    { -      // Here we are going to create an illusion that the namespace -      // hierarchy is flat. -      names_.clear (); -      schemas_.clear (); - -      find_ (name, names_, schemas_); - -      return NamesIteratorPair (NamesConstIterator (names_.begin ()), -                                NamesConstIterator (names_.end ())); -    } - -    Void Schema:: -    find_ (Name const& name, NamesList& names, SchemaSet& set) const -    { -      set.insert (this); - -      // Check our own namespace first so it will end up first in the list. -      // -      NamesIteratorPair pair (Scope::find (name)); -      names.insert (names.end (), pair.first.base (), pair.second.base ()); - -      for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i) -      { -        Schema& s (i->schema ()); - -        if (set.find (&s) == set.end ()) -          s.find_ (name, names, set); -      } -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx index 10d2f75..803c870 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/schema.hxx @@ -1,12 +1,12 @@  // file      : xsd-frontend/semantic-graph/schema.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX  #define XSD_FRONTEND_SEMANTIC_GRAPH_SCHEMA_HXX -#include <cult/containers/set.hxx> +#include <set> +#include <vector>  #include <xsd-frontend/semantic-graph/elements.hxx>  #include <xsd-frontend/semantic-graph/namespace.hxx> @@ -15,11 +15,8 @@ namespace XSDFrontend  {    namespace SemanticGraph    { -    // -    //      class Schema; -      class Uses: public virtual Edge      {      public: @@ -41,21 +38,16 @@ namespace XSDFrontend          return path_;        } -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Uses (Path const& path) -          : path_ (path) -      { -      } +    public: +      Uses (Path const& path): path_ (path) {} -      Void +      void        set_left_node (Schema& s)        {          user_ = &s;        } -      Void +      void        set_right_node (Schema& s)        {          schema_ = &s; @@ -72,13 +64,8 @@ namespace XSDFrontend      //      class Implies: public virtual Uses      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Implies (Path const& path) -          : Uses (path) -      { -      } +    public: +      Implies (Path const& path): Uses (path) {}      }; @@ -86,13 +73,8 @@ namespace XSDFrontend      //      class Sources: public virtual Uses      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Sources (Path const& path) -          : Uses (path) -      { -      } +    public: +      Sources (Path const& path): Uses (path) {}      }; @@ -100,13 +82,8 @@ namespace XSDFrontend      //      class Includes: public virtual Uses      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Includes (Path const& path) -          : Uses (path) -      { -      } +    public: +      Includes (Path const& path): Uses (path) {}      }; @@ -114,40 +91,29 @@ namespace XSDFrontend      //      class Imports: public virtual Uses      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Imports (Path const& path) -          : Uses (path) -      { -      } +    public: +      Imports (Path const& path): Uses (path) {}      }; -      //      // -    class Schema: public virtual Scope, -                  private Bits::Graph<Node, Edge>, -                  public NonCopyable +    class Schema: public graph, public virtual Scope      { -      typedef -      Cult::Containers::Vector<Uses*> -      UsesList; - -      typedef -      Cult::Containers::Vector<Uses*> -      UsedList; +      typedef std::vector<Uses*> UsesList; +      typedef std::vector<Uses*> UsedList;      public: -      Schema (Path const& file, UnsignedLong line, UnsignedLong column) -          : SemanticGraph::Node (file, line, column) +      Schema (Path const& file, unsigned long line, unsigned long column) +          : Node (file, line, column), graph_ (*this)        {        } +    private: +      Schema (Schema const&); +      Schema& operator= (Schema const&); +      public: -      typedef -      Bits::PointerIterator<UsesList::ConstIterator> -      UsesIterator; +      typedef pointer_iterator<UsesList::const_iterator> UsesIterator;        UsesIterator        uses_begin () const @@ -161,9 +127,8 @@ namespace XSDFrontend          return uses_.end ();        } -      typedef -      Bits::PointerIterator<UsedList::ConstIterator> -      UsedIterator; +    public: +      typedef pointer_iterator<UsedList::const_iterator> UsedIterator;        UsedIterator        used_begin () const @@ -177,7 +142,7 @@ namespace XSDFrontend          return used_.end ();        } -      Boolean +      bool        used_p () const        {          return used_begin () != used_end (); @@ -187,90 +152,81 @@ namespace XSDFrontend        find (Name const& name) const;      public: -      using Bits::Graph<SemanticGraph::Node, Edge>::new_edge; -      using Bits::Graph<SemanticGraph::Node, Edge>::reset_left_node; -      using Bits::Graph<SemanticGraph::Node, Edge>::reset_right_node; -      using Bits::Graph<SemanticGraph::Node, Edge>::add_edge_left; -      using Bits::Graph<SemanticGraph::Node, Edge>::add_edge_right; -      using Bits::Graph<SemanticGraph::Node, Edge>::delete_node; -      using Bits::Graph<SemanticGraph::Node, Edge>::delete_edge; +      using graph::new_edge; +      using graph::reset_left_node; +      using graph::reset_right_node; +      using graph::add_edge_left; +      using graph::add_edge_right; +      using graph::delete_node; +      using graph::delete_edge;        template <typename T>        T& -      new_node (Path const& file, UnsignedLong line, UnsignedLong column) +      new_node (Path const& file, unsigned long line, unsigned long column)        { -        return graph ().new_node<T> (file, line, column); +        return graph_.new_node<T> (file, line, column);        }        template <typename T, typename A0>        T& -      new_node (Path const& file, UnsignedLong line, UnsignedLong column, +      new_node (Path const& file, unsigned long line, unsigned long column,                  A0 const& a0)        { -        return graph ().new_node<T> (file, line, column, a0); +        return graph_.new_node<T> (file, line, column, a0);        }        template <typename T, typename A0, typename A1>        T& -      new_node (Path const& file, UnsignedLong line, UnsignedLong column, +      new_node (Path const& file, unsigned long line, unsigned long column,                  A0 const& a0, A1 const& a1)        { -        return graph ().new_node<T> (file, line, column, a0, a1); +        return graph_.new_node<T> (file, line, column, a0, a1);        }        template <typename T, typename A0, typename A1, typename A2>        T& -      new_node (Path const& file, UnsignedLong line, UnsignedLong column, +      new_node (Path const& file, unsigned long line, unsigned long column,                  A0 const& a0, A1 const& a1, A2 const& a2)        { -        return graph ().new_node<T> (file, line, column, a0, a1, a2); +        return graph_.new_node<T> (file, line, column, a0, a1, a2);        }        template <typename T, typename A0, typename A1, typename A2,                  typename A3>        T& -      new_node (Path const& file, UnsignedLong line, UnsignedLong column, +      new_node (Path const& file, unsigned long line, unsigned long column,                  A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3)        { -        return graph ().new_node<T> (file, line, column, a0, a1, a2, a3); +        return graph_.new_node<T> (file, line, column, a0, a1, a2, a3);        } -    protected: -      //@@ gcc bug #21146 -      // -      friend class Bits::Graph<SemanticGraph::Node, Edge>; - +    public:        using Scope::add_edge_left;        using Node::add_edge_right; -      Void +      void        add_edge_left (Uses& e)        {          uses_.push_back (&e);        } -      Void +      void        add_edge_right (Uses& e)        {          used_.push_back (&e);        }      private: -      Bits::Graph<SemanticGraph::Node, Edge>& -      graph () -      { -        return *this; -      } +      typedef std::set<Schema const*> SchemaSet; -    private: -      UsesList uses_; -      UsedList used_; +      void +      find_ (Name const& name, NamesList&, SchemaSet&) const;      private: -      typedef Cult::Containers::Set<Schema const*> SchemaSet; +      graph& graph_; -      Void -      find_ (Name const& name, NamesList&, SchemaSet&) const; +      UsesList uses_; +      UsedList used_;        mutable NamesList names_;        mutable SchemaSet schemas_; diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx b/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx index b4b4cf0..4e7436d 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/union.cxx @@ -1,37 +1,34 @@  // file      : xsd-frontend/semantic-graph/union.cxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include <cutl/compiler/type-info.hxx> +  #include <xsd-frontend/semantic-graph/union.hxx>  namespace XSDFrontend  {    namespace SemanticGraph    { -    namespace RTTI = Cult::RTTI; - -    using RTTI::Access; -    using RTTI::TypeInfo; +    Union:: +    Union (Path const& file, unsigned long line, unsigned long column) +        : Node (file, line, column) +    { +    }      namespace      { +      using compiler::type_info; +        struct UnionInit        {          UnionInit ()          { -          TypeInfo ti (typeid (Union)); -          ti.add_base (Access::public_, true, typeid (Specialization)); -          RTTI::insert (ti); +          type_info ti (typeid (Union)); +          ti.add_base (typeid (Specialization)); +          insert (ti);          } -        } union_init_;      } - -    Union:: -    Union (Path const& file, UnsignedLong line, UnsignedLong column) -        : Node (file, line, column) -    { -    }    }  } diff --git a/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx b/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx index 62df730..d7ba385 100644 --- a/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx +++ b/libxsd-frontend/xsd-frontend/semantic-graph/union.hxx @@ -1,6 +1,5 @@  // file      : xsd-frontend/semantic-graph/union.hxx -// author    : Boris Kolpackov <boris@codesynthesis.com> -// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC  // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file  #ifndef XSD_FRONTEND_SEMANTIC_GRAPH_UNION_HXX @@ -14,10 +13,8 @@ namespace XSDFrontend    {      class Union: public virtual Specialization      { -    protected: -      friend class Bits::Graph<Node, Edge>; - -      Union (Path const& file, UnsignedLong line, UnsignedLong column); +    public: +      Union (Path const& file, unsigned long line, unsigned long column);      };    }  } | 
