Sha256: c1cc04faf1cc60432a4cb423ed3f5663a2b81ee782fadb4d9ed43607b3c002fb

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

module RbGCCXML

  # The base class for all type management classes.
  # RbGCCXML has a pretty extensive type querying sub-system that
  # allows type matching by names, types, base types, etc
  class Type < Node

    # For types like pointers or references, we recursively track down
    # the base type when doing comparisons.
    #
    # delim needs to be a regex
    def check_sub_type_without(val, delim)
      return false unless val =~ delim
      new_val = val.gsub(delim, "").strip
      NodeCache.find(attributes["type"]) == new_valu
    end

    # Get the base type without any qualifiers. E.g, if you've
    # got the CvQualifiedType "const my_space::MyClass&, this 
    # will return the Node for "my_space::MyClass"
    #
    # returns: Node related to the base C++ construct of this type
    def base_type
      n = NodeCache.find(attributes["type"])
      n.is_a?(Type) ? n.base_type : n
    end
    once :base_type

    # Is this type const qualified?
    def const?
      found = NodeCache.find(attributes["type"])
      found ? found.const? : false
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rbgccxml-1.1.0 lib/rbgccxml/nodes/type.rb
rbgccxml-1.0.4 lib/rbgccxml/nodes/type.rb
rbgccxml-1.0.3 lib/rbgccxml/nodes/type.rb
rbgccxml-1.0.2 lib/rbgccxml/nodes/type.rb
rbgccxml-1.0.1 lib/rbgccxml/nodes/type.rb
rbgccxml-1.0 lib/rbgccxml/nodes/type.rb