Class: Doxyparser::Function
Overview
A C/C++ function with its parameters und return type
Instance Attribute Summary
Attributes inherited from Member
#args, #definition, #location, #params, #static, #type
Attributes inherited from Node
#basename, #dir, #doc, #name, #node, #parent
Instance Method Summary collapse
- #==(another) ⇒ Object
- #constructor? ⇒ Boolean
- #destructor? ⇒ Boolean
- #eql?(another) ⇒ Boolean
-
#getter_for ⇒ String
Finds the name of the -hypothetical- property this method refers to in case this Function complies with the ‘getter’ naming convention and has no parameters.
-
#setter_for ⇒ String
with the ‘setter’ naming convention and has no return value (void).
- #to_s ⇒ Object
- #to_str ⇒ Object
Methods inherited from Member
Methods inherited from Node
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 Method Details
#==(another) ⇒ Object
56 57 58 59 |
# File 'lib/nodes/function.rb', line 56 def == another super self.args == another.args end |
#constructor? ⇒ Boolean
7 8 9 |
# File 'lib/nodes/function.rb', line 7 def constructor? @basename == parent.basename end |
#destructor? ⇒ Boolean
12 13 14 |
# File 'lib/nodes/function.rb', line 12 def destructor? @basename.start_with? %Q{~} end |
#eql?(another) ⇒ Boolean
61 62 63 64 |
# File 'lib/nodes/function.rb', line 61 def eql?(another) super self.args == another.args end |
#getter_for ⇒ String
Finds the name of the -hypothetical- property this method refers to in case this Doxyparser::Function complies with the ‘getter’ naming convention and has no parameters.
Getter examples for ‘myProperty’ are: getMyProperty, get_myProperty, GetMyProperty, Get_MyProperty, etc Getter examples for ‘booleanProp’ are: isBooleanProp, is_booleanProp, get_booleanProp, etc
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/nodes/function.rb', line 21 def getter_for return nil if @type.name == 'void' if @params.empty? || (@params.size == 1 && @params[0].type.name.strip == 'void') if @basename.start_with?('get') || @basename.start_with?('Get') ret = @basename.gsub(/^get[_]?(\w)/i) { |match| $1.downcase } ret.prepend('_') if ret =~ %r{^\d} return ret end if @type.name == 'bool' if @basename.start_with?('is') || @basename.start_with?('Is') ret = @basename.gsub(/^is[_]?(\w)/i) { |match| $1.downcase } ret.prepend('_') if ret =~ %r{^\d} return ret end end end return nil end |
#setter_for ⇒ String
with the ‘setter’ naming convention and has no return value (void).
Setter examples for ‘myProperty’ are: setMyProperty, set_myProperty, SetMyProperty, Set_MyProperty, etc
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/nodes/function.rb', line 45 def setter_for if (@type.name == 'void') && (@params.size == 1 && @params[0].type.name.strip != 'void') if @basename.start_with?('set') || @basename.start_with?('Set') ret = @basename.gsub(/^set[_]?(\w)/i) { |match| $1.downcase } ret.prepend('_') if ret =~ %r{^\d} return ret end end return nil end |
#to_s ⇒ Object
70 71 72 |
# File 'lib/nodes/function.rb', line 70 def to_s super + @args end |
#to_str ⇒ Object
66 67 68 |
# File 'lib/nodes/function.rb', line 66 def to_str super + @args end |