Class: Doxyparser::Function

Inherits:
Member show all
Defined in:
lib/nodes/function.rb

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

Methods inherited from Member

#file

Methods inherited from Node

#initialize

Methods included from Util

#del_prefix, #del_spaces, #do_filter, #escape_class_name, #escape_file_name, 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



5
6
7
8
# File 'lib/nodes/function.rb', line 5

def == another
	super
	self.args == another.args
end

#constructor?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/nodes/function.rb', line 23

def constructor?
	@basename==parent.basename
end

#destructor?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/nodes/function.rb', line 27

def destructor?
	@basename.start_with? %Q{~}
end

#eql?(another) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/nodes/function.rb', line 10

def eql? another
	super
	self.args == another.args
end

#getter_forObject



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/nodes/function.rb', line 31

def getter_for
	if @params.empty? || (@params.size == 1 && @params[0].type.name =~ /\s*void\s*/)
		if @basename.start_with?('get') || @basename.start_with?('Get')
			return @basename.gsub(/get[_]?(\w)/i){|match| $1.downcase}
		end
		if @type.name == 'bool'
			if @basename.start_with?('is') || @basename.start_with?('Is')
				return @basename.gsub(/is[_]?(\w)/i){|match| $1.downcase}
			end
		end
	end
	return nil
end

#setter_forObject



45
46
47
48
49
50
51
52
# File 'lib/nodes/function.rb', line 45

def setter_for
	if @type.name == 'void'
		if @basename.start_with?('set') || @basename.start_with?('Set')
			return @basename.gsub(/set[_]?(\w)/i){|match| $1.downcase}
		end
	end
	return nil
end

#to_sObject



19
20
21
# File 'lib/nodes/function.rb', line 19

def to_s
	super + @args
end

#to_strObject



15
16
17
# File 'lib/nodes/function.rb', line 15

def to_str
	super + @args
end