Class: Doxyparser::Namespace

Inherits:
Compound show all
Defined in:
lib/nodes/namespace.rb

Overview

A C/C++ Namespace

Instance Attribute Summary

Attributes inherited from Compound

#xml_path

Attributes inherited from Node

#basename, #dir, #doc, #name, #node, #parent

Instance Method Summary collapse

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 Method Details

#classes(filter = nil) ⇒ Array<Class>

Returns list of classes defined in this namespace.

Returns:

  • (Array<Class>)

    list of classes defined in this namespace



63
64
65
66
67
68
69
70
# File 'lib/nodes/namespace.rb', line 63

def classes(filter=nil)
	return @classes if @classes
  lst = doc.xpath(%Q{/doxygen/compounddef/innerclass})
  lst = lst.select { |c| c["refid"].start_with?("class") }
  @classes = do_filter(filter, lst, Doxyparser::Class) { |node|
    del_spaces del_prefix_class(node.child.content)
  }
end

#enums(filter = nil) ⇒ Array<Enum>

Returns list of enums defined inside this namespace but outside any Class or Struct.

Returns:

  • (Array<Enum>)

    list of enums defined inside this namespace but outside any Class or Struct



16
17
18
19
20
21
22
23
# File 'lib/nodes/namespace.rb', line 16

def enums(filter=nil)
	return @enums if @enums 
  lst = doc.xpath(%Q{/doxygen/compounddef/sectiondef[@kind="enum"]/memberdef[@kind="enum"]})
  filter.map! { |exp| exp =~ /^#{@basename}_Enum/ ? /@\d*/ : exp } unless filter.nil?
  @enums = do_filter(filter, lst, Doxyparser::Enum) { |node|
    node.xpath("name")[0].child.content.strip
  }
end

#fileObject

Returns nil always.

Returns:

  • nil always



73
74
75
# File 'lib/nodes/namespace.rb', line 73

def file
  nil
end

#functions(filter = nil) ⇒ Array<Function>

Returns list of functions defined inside this namespace but outside any Class or Struct.

Returns:

  • (Array<Function>)

    list of functions defined inside this namespace but outside any Class or Struct



7
8
9
10
11
12
13
# File 'lib/nodes/namespace.rb', line 7

def functions(filter=nil)
	return @functions if @functions
  lst = doc.xpath(%Q{/doxygen/compounddef/sectiondef[@kind="func"]/memberdef[@kind="function"]})
  @functions = do_filter(filter, lst, Doxyparser::Function) { |node|
    node.xpath("name")[0].child.content.strip
  }
end

#innernamespaces(filter = nil) ⇒ Array<Namespace>

Returns list of namespaces defined inside this one.

Returns:

  • (Array<Namespace>)

    list of namespaces defined inside this one



44
45
46
47
48
49
50
# File 'lib/nodes/namespace.rb', line 44

def innernamespaces(filter=nil)
	return @innernamespaces if @innernamespaces
  lst = doc.xpath(%Q{/doxygen/compounddef/innernamespace})
  @innernamespaces = do_filter(filter, lst, Doxyparser::Namespace) { |node|
    del_spaces del_prefix_class(node.child.content)
  }
end

#structs(filter = nil) ⇒ Array<Struct>

Returns list of structs defined in this namespace.

Returns:

  • (Array<Struct>)

    list of structs defined in this namespace



53
54
55
56
57
58
59
60
# File 'lib/nodes/namespace.rb', line 53

def structs(filter=nil)
			return @structs if @structs
  lst = doc.xpath(%Q{/doxygen/compounddef/innerclass})
  lst = lst.select { |c| c["refid"].start_with?("struct") }
  @structs = do_filter(filter, lst, Doxyparser::Struct) { |node|
    del_spaces del_prefix_class(node.child.content)
  }
end

#typedefs(filter = nil) ⇒ Array<Typedef>

Returns list of typedefs defined inside this namespace but outside any Class or Struct.

Returns:

  • (Array<Typedef>)

    list of typedefs defined inside this namespace but outside any Class or Struct



35
36
37
38
39
40
41
# File 'lib/nodes/namespace.rb', line 35

def typedefs(filter=nil)
	return @typedefs if @typedefs
  lst = doc.xpath(%Q{/doxygen/compounddef/sectiondef[@kind="typedef"]/memberdef[@kind="typedef"]})
  @typedefs = do_filter(filter, lst, Doxyparser::Typedef) { |node| 
  	del_spaces(node.xpath("name")[0].child.content)
  }
end

#variables(filter = nil) ⇒ Array<Variable>

Returns list of variables defined inside this namespace but are not attributes of any Class or Struct.

Returns:

  • (Array<Variable>)

    list of variables defined inside this namespace but are not attributes of any Class or Struct



26
27
28
29
30
31
32
# File 'lib/nodes/namespace.rb', line 26

def variables(filter=nil)
	return @variables if @variables
  lst = doc.xpath(%Q{/doxygen/compounddef/sectiondef[@kind="var"]/memberdef[@kind="variable"]})
  @variables = do_filter(filter, lst, Doxyparser::Variable) { |node|
    node.xpath("name")[0].child.content.strip
  }
end