Represents a <Class> node.

Methods
Public Instance methods
constants(name = nil, &block)

Find all constants under this class. See Node#namespaces

    # File lib/rbgccxml/nodes/class.rb, line 64
64:     def constants(name = nil, &block)
65:       NodeCache.find_children_of_type(self, "Variable", name)
66:     end
constructors()

Find all the constructors for this class.

    # File lib/rbgccxml/nodes/class.rb, line 16
16:     def constructors
17:       NodeCache.find_children_of_type(self, "Constructor")
18:     end
destructor()

Find the destructor for this class. To tell if a destructor is gcc-generated or not, check the ‘artificial’ attribute:

  class_node.destructor.artificial?
    # File lib/rbgccxml/nodes/class.rb, line 26
26:     def destructor
27:       NodeCache.find_children_of_type(self, "Destructor")[0]
28:     end
methods(name = nil)

Find all methods for this class. See Node#namespaces

    # File lib/rbgccxml/nodes/class.rb, line 54
54:     def methods(name = nil)
55:       NodeCache.find_children_of_type(self, "Method", name)
56:     end
namespaces(name = nil)

Disabled: Classes cannot have nested namespaces

   # File lib/rbgccxml/nodes/class.rb, line 6
6:     def namespaces(name = nil)
7:       raise NotQueryableException.new("Cannot query for Namespaces while in a Class")
8:     end
pure_virtual?()

Is this class pure virtual?

    # File lib/rbgccxml/nodes/class.rb, line 11
11:     def pure_virtual?
12:       attributes["abstract"] ? attributes["abstract"] == "1" : false
13:     end
superclass(access_type = nil)

Find the superclass for this class. By default, this will find the superclass of any access type, pass in the type of access you‘re looking for if you want specific types (e.g. public, private, protected).

If there is more than one superclass to this class, this method will only return the first superclass. # If you know or expect there to be multiple superclasses, use superclasses instead

    # File lib/rbgccxml/nodes/class.rb, line 38
38:     def superclass(access_type = nil)
39:       found = superclasses(access_type)
40:       found.empty? ? nil : found[0]
41:     end
superclasses(access_type = nil)

Like superclass above, this will find all superclasses for this class. Functions the same as superclass except this method always returns a QueryResult

    # File lib/rbgccxml/nodes/class.rb, line 45
45:     def superclasses(access_type = nil)
46:       [
47:         NodeCache.find_children_of_type(self, "Base").select do |base|
48:           access_type.nil? ? true : base.send("#{access_type}?")
49:         end
50:       ].flatten.map {|base| base.cpp_type }
51:     end
variables(name = nil, &block)

Find all instance variables for this class. See Node#namespaces

    # File lib/rbgccxml/nodes/class.rb, line 59
59:     def variables(name = nil, &block)
60:       NodeCache.find_children_of_type(self, "Field", name)
61:     end