Class: Doxyparser::Struct
Overview
A plain old OOP Class
Direct Known Subclasses
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#friends ⇒ Object
readonly
Returns the value of attribute friends.
-
#template_params ⇒ Object
readonly
Returns the value of attribute template_params.
Attributes inherited from Compound
Attributes inherited from Node
#basename, #dir, #doc, #name, #node, #parent
Instance Method Summary collapse
-
#abstract? ⇒ bool
True if any of its methods is ‘pure virtual’.
-
#attributes(access = :public, static = nil, filter = nil) ⇒ Array<Variable>
Declared attributes.
-
#constructors(access = :public) ⇒ Array<Function>
Declared constructors.
-
#destructors(access = :public) ⇒ Array<Function>
Declared destructors.
-
#enums(access = :public, filter = nil) ⇒ Array<Enum>
Declared enums.
-
#innerclasses(access = :public, filter = nil) ⇒ Array<Struct>
Declared inner-classes and inner-structs.
-
#methods(access = :public, static = nil, filter = nil) ⇒ Array<Function>
Declared methods.
-
#only_innerclasses(access = :public, filter = nil) ⇒ Array<Struct>
Declared inner-classes (inner-structs are excluded).
-
#only_innerstructs(access = :public, filter = nil) ⇒ Array<Struct>
Declared inner-structs (inner-classes are excluded).
-
#parent_types(access = :public) ⇒ Array<Type>
Declared super-types for this struct/class.
-
#typedefs(access = :public, filter = nil) ⇒ Array<Typedef>
Declared typedefs.
Methods inherited from Node
#==, #eql?, #escaped_name, #initialize, #to_s, #to_str
Methods included from Util
#del_prefix_class, #del_prefix_file, #del_spaces, #do_filter, #escape_all, #escape_class_name, #escape_const_ref_ptr, escape_const_ref_ptr, #escape_file_name, #escape_template, home_dir, #match, read_file, write_file
Constructor Details
This class inherits a constructor from Doxyparser::Node
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Doxyparser::Node
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
172 173 174 |
# File 'lib/nodes/struct.rb', line 172 def file @file end |
#friends ⇒ Object (readonly)
Returns the value of attribute friends.
173 174 175 |
# File 'lib/nodes/struct.rb', line 173 def friends @friends end |
#template_params ⇒ Object (readonly)
Returns the value of attribute template_params.
174 175 176 |
# File 'lib/nodes/struct.rb', line 174 def template_params @template_params end |
Instance Method Details
#abstract? ⇒ bool
Returns true if any of its methods is ‘pure virtual’.
7 8 9 |
# File 'lib/nodes/struct.rb', line 7 def abstract? @is_abstract ||= methods(:all).any? { |m| m.virt == 'pure-virtual'} end |
#attributes(access = :public, static = nil, filter = nil) ⇒ Array<Variable>
Returns declared attributes.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/nodes/struct.rb', line 64 def attributes(access = :public, static = nil, filter = nil) if access == :all return attributes(:public, static, filter) + attributes(:protected, static, filter) + attributes(:private, static, filter) end if access == :public && filter.nil? # Caches public attributes if static.nil? @public_attributes ||= _attributes(:public, nil, nil) return @public_attributes end @public_static_attributes ||= _attributes(:public, true, nil) return @public_static_attributes end _attributes(access, static, filter) end |
#constructors(access = :public) ⇒ Array<Function>
Returns declared constructors.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/nodes/struct.rb', line 13 def constructors(access = :public) return case access when :public @public_constructors ||= methods(:public, nil, [@basename]) when :protected @protected_constructors ||= methods(:protected, nil, [@basename]) when :private @private_constructors ||= methods(:private, nil, [@basename]) when :all constructors(:public) + constructors(:protected) + constructors(:private) end end |
#destructors(access = :public) ⇒ Array<Function>
Returns declared destructors.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/nodes/struct.rb', line 28 def destructors(access = :public) return case access when :public @public_destructors ||= methods(:public, nil, [/^~/]) when :protected @protected_destructors ||= methods(:protected, nil, [/^~/]) when :private @private_destructors ||= methods(:private, nil, [/^~/]) when :all destructors(:public) + destructors(:protected) + destructors(:private) end end |
#enums(access = :public, filter = nil) ⇒ Array<Enum>
Returns declared enums.
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/nodes/struct.rb', line 144 def enums(access = :public, filter = nil) if access == :public && filter.nil? @public_enums ||= _enums(:public) return @public_enums end if access == :all && filter.nil? @all_enums ||= enums(:public) + enums(:protected) + enums(:private) return @all_enums end _enums(access, filter) end |
#innerclasses(access = :public, filter = nil) ⇒ Array<Struct>
Returns declared inner-classes and inner-structs.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/nodes/struct.rb', line 82 def innerclasses(access = :public, filter = nil) if filter.nil? if access == :all @all_innerclasses ||= innerclasses(:public) + innerclasses(:protected) + innerclasses(:private) return @all_innerclasses end if access == :public @public_innerclasses ||= only_innerclasses(:public) + only_innerstructs(:public) return @public_innerclasses end end if access == :all return innerclasses(:public, filter) + innerclasses(:protected, filter) + innerclasses(:private, filter) end only_innerclasses(access, filter) + only_innerstructs(access, filter) end |
#methods(access = :public, static = nil, filter = nil) ⇒ Array<Function>
Returns declared methods.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/nodes/struct.rb', line 45 def methods(access = :public, static = nil, filter = nil) if access == :all return methods(:public, static, filter) + methods(:protected, static, filter) + methods(:private, static, filter) end if access == :public && filter.nil? # Caches public methods if static.nil? @public_methods ||= _methods(:public, nil, nil) return @public_methods end @public_static_methods ||= _methods(:public, true, nil) return @public_static_methods end _methods(access, static, filter) end |
#only_innerclasses(access = :public, filter = nil) ⇒ Array<Struct>
Returns declared inner-classes (inner-structs are excluded).
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/nodes/struct.rb', line 102 def only_innerclasses(access = :public, filter = nil) if access == :all return innerclasses(:public, filter) + innerclasses(:protected, filter) + innerclasses(:private, filter) end lst = doc.xpath(%Q{/doxygen/compounddef/innerclass[@prot="#{access}"]}) lst = lst.select { |c| c["refid"].start_with?("class") } do_filter(filter, lst, Doxyparser::Class) { |node| del_prefix(node.child.content) } end |
#only_innerstructs(access = :public, filter = nil) ⇒ Array<Struct>
Returns declared inner-structs (inner-classes are excluded).
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/nodes/struct.rb', line 116 def only_innerstructs(access = :public, filter = nil) if access == :all return innerstructs(:public, filter) + innerstructs(:protected, filter) + innerstructs(:private, filter) end lst = doc.xpath(%Q{/doxygen/compounddef/innerclass[@prot="#{access}"]}) lst = lst.select { |c| c["refid"].start_with?("struct") } do_filter(filter, lst, Doxyparser::Struct) { |node| del_prefix(node.child.content) } end |
#parent_types(access = :public) ⇒ Array<Type>
Returns declared super-types for this struct/class.
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/nodes/struct.rb', line 129 def parent_types(access = :public) if access == :public @public_parent_types ||= _parent_types(:public) return @public_parent_types end if access == :all @all_parent_types ||= parent_types(:public) + parent_types(:protected) + parent_types(:private) return @all_parent_types end _parent_types(access) end |
#typedefs(access = :public, filter = nil) ⇒ Array<Typedef>
Returns declared typedefs.
159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/nodes/struct.rb', line 159 def typedefs(access = :public, filter = nil) if access == :public && filter.nil? @public_typedefs ||= _typedefs(:public) return @public_typedefs end if access == :all && filter.nil? @all_typedefs ||= typedefs(:public) + typedefs(:protected) + typedefs(:private) return @all_typedefs end _typedefs(access, filter) end |