Class: Doxyparser::Node

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/nodes/node.rb

Overview

A Node can be any member of the tree-like structure of a C/C++ header file. examples are namespaces, classes, methods, params, etc

Direct Known Subclasses

Compound, EnumValue, Member, Param, Type

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#initialize(hash) ⇒ Node

Takes a hash as input with following keys: :node, :parent, :dir, :name



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/nodes/node.rb', line 32

def initialize(hash)
  @dir = hash[:dir]
  @name = hash[:name]
  if hash[:node] # If a reference to an xml declaration (node) is given
    @node = hash[:node]
    @parent = hash[:parent]
    @name = find_name
    if @name =~ /PxVec3.h/
    	@name = find_name
    end
    @dir ||= @parent.dir unless @parent.nil?
  end
  raise "No name given for node: #{self.class.name}" unless @name
  raise "No xml directory given for node: #{self.class.name}" unless @dir
  init_attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object (private)



55
56
57
58
59
60
61
# File 'lib/nodes/node.rb', line 55

def method_missing(sym, *args)
  if @node.respond_to?(sym)
  	@node.send(sym, *args)
  else
  	@node[sym.to_s] || super
  end
end

Instance Attribute Details

#basenameObject (readonly)

Returns the value of attribute basename.



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

def basename
  @basename
end

#dirObject (readonly)

Returns the value of attribute dir.



8
9
10
# File 'lib/nodes/node.rb', line 8

def dir
  @dir
end

#docObject (readonly)

Returns the value of attribute doc.



12
13
14
# File 'lib/nodes/node.rb', line 12

def doc
  @doc
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/nodes/node.rb', line 9

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node.



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

def node
  @node
end

#parentObject

Returns the value of attribute parent.



13
14
15
# File 'lib/nodes/node.rb', line 13

def parent
  @parent
end

Instance Method Details

#==(another) ⇒ Object



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

def == another
  self.name == another.name
end

#eql?(another) ⇒ Boolean

Returns:

  • (Boolean)


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

def eql?(another)
  self.name == another.name
end

#escaped_nameObject



49
50
51
# File 'lib/nodes/node.rb', line 49

def escaped_name
	name
end

#to_sObject



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

def to_s
  @name
end

#to_strObject



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

def to_str
  @name
end