class RbGCCXML::Type

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

Public Instance Methods

base_type() click to toggle source

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

# File lib/rbgccxml/nodes/type.rb, line 23
def base_type
  n = NodeCache.find(attributes["type"])
  n.is_a?(Type) ? n.base_type : n
end
check_sub_type_without(val, delim) click to toggle source

For types like pointers or references, we recursively track down the base type when doing comparisons.

delim needs to be a regex

# File lib/rbgccxml/nodes/type.rb, line 12
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
const?() click to toggle source

Is this type const qualified?

# File lib/rbgccxml/nodes/type.rb, line 30
def const?
  found = NodeCache.find(attributes["type"])
  found ? found.const? : false
end