Helper Class ExhaleNode Reference¶
-
class
exhale.
ExhaleNode
(breatheCompound)¶ A wrapper class to track parental relationships, filenames, etc.
Parameters: breatheCompound
(breathe.compound)The Breathe compound object we will use to gather the name, chilren, etc.
Attributes: compound
(breathe.compound)The compound discovered from breathe that we are going to track.
kind
(str)The string returned by the
breatheCompound.get_kind()
method. Used to qualify this node throughout the framework, as well as for hierarchical sorting.name
(str)The string returned by the
breatheCompound.get_name()
method. This name will be fully qualified —class A
inside ofnamespace n
will have aname
ofn::A
. Files and directories may have/
characters as well.refid
(str)The reference ID as created by Doxygen. This will be used to scrape files and see if a given reference identification number should be associated with that file or not.
children
(list)A potentially empty list of
ExhaleNode
object references that are considered a child of this Node. Please note that a child reference in anychildren
list may be stored in many other lists. Mutating a given child will mutate the object, and therefore affect other parents of this child. Lastly, a node of kindenum
will never have itsenumvalue
children as it is impossible to rebuild that relationship without more Doxygen xml parsing.parent
(ExhaleNode)If an ExhaleNode is determined to be a child of another ExhaleNode, this node will be added to its parent’s
children
list, and a reference to the parent will be in this field. Initialized toNone
, make sure you check that it is an object first.Warning
Do not ever set the
parent
of a given node if the would-be parent’s kind is"file"
. Doing so will break many important relationships, such as nested class definitions. Effectively, every node will be added as a child to a file node at some point. The file node will track this, but the child should not.
The following three member variables are stored internally, but managed externally by the
exhale.ExhaleRoot
class:file_name
(str)The name of the file to create. Set to
None
on creation, refer toexhale.ExhaleRoot.initializeNodeFilenameAndLink()
.link_name
(str)The name of the reStructuredText link that will be at the top of the file. Set to
None
on creation, refer toexhale.ExhaleRoot.initializeNodeFilenameAndLink()
.title
(str)The title that will appear at the top of the reStructuredText file
file_name
. When the reStructuredText document for this node is being written, the root object will set this field.
The following two fields are used for tracking what has or has not already been included in the hierarchy views. Things like classes or structs in the global namespace will not be found by
exhale.ExhaleNode.inClassView()
, and the ExhaleRoot object will need to track which ones were missed.in_class_view
(bool)Whether or not this node has already been incorporated in the class view.
in_file_view
(bool)Whether or not this node has already been incorporated in the file view.
This class wields duck typing. If
self.kind == "file"
, then the additional member variables below exist:namespaces_used
(list)A list of namespace nodes that are either defined or used in this file.
includes
(list)A list of strings that are parsed from the Doxygen xml for this file as include directives.
included_by
(list)A list of (refid, name) string tuples that are parsed from the Doxygen xml for this file presenting all of the other files that include this file. They are stored this way so that the root class can later link to that file by its refid.
location
(str)A string parsed from the Doxygen xml for this file stating where this file is physically in relation to the Doxygen root.
program_listing
(list)A list of strings that is the Doxygen xml <programlisting>, without the opening or closing <programlisting> tags.
program_file
(list)Managed externally by the root similar to
file_name
etc, this is the name of the file that will be created to display the program listing if it exists. Set toNone
on creation, refer toexhale.ExhaleRoot.initializeNodeFilenameAndLink()
.program_link_name
(str)Managed externally by the root similar to
file_name
etc, this is the reStructuredText link that will be declared at the top of theprogram_file
. Set toNone
on creation, refer toexhale.ExhaleRoot.initializeNodeFilenameAndLink()
.
-
__lt__
(other)¶ The
ExhaleRoot
class stores a bunch of lists ofExhaleNode
objects. When these lists are sorted, this method will be called to perform the sorting.Parameters: other
(ExhaleNode)The node we are comparing whether
self
is less than or not.
Return (bool): True if
self
is less thanother
, False otherwise.
-
findNestedNamespaces
(lst)¶ Recursive helper function for finding nested namespaces. If this node is a namespace node, it is appended to
lst
. Each node also calls each of its childfindNestedNamespaces
with the same list.Parameters: lst
(list)The list each namespace node is to be appended to.
-
findNestedDirectories
(lst)¶ Recursive helper function for finding nested directories. If this node is a directory node, it is appended to
lst
. Each node also calls each of its childfindNestedDirectories
with the same list.Parameters: lst
(list)The list each directory node is to be appended to.
-
findNestedClassLike
(lst)¶ Recursive helper function for finding nested classes and structs. If this node is a class or struct, it is appended to
lst
. Each node also calls each of its childfindNestedClassLike
with the same list.Parameters: lst
(list)The list each class or struct node is to be appended to.
-
findNestedEnums
(lst)¶ Recursive helper function for finding nested enums. If this node is a class or struct it may have had an enum added to its child list. When this occurred, the enum was removed from
self.enums
in theexhale.ExhaleRoot
class and needs to be rediscovered by calling this method on all of its children. If this node is an enum, it is because a parent class or struct called this method, in which case it is added tolst
.Note: this is used slightly differently than nested directories, namespaces, and classes will be. Refer to
exhale.ExhaleRoot.generateNodeDocuments()
function for details.Parameters: lst
(list)The list each enum is to be appended to.
-
findNestedUnions
(lst)¶ Recursive helper function for finding nested unions. If this node is a class or struct it may have had a union added to its child list. When this occurred, the union was removed from
self.unions
in theexhale.ExhaleRoot
class and needs to be rediscovered by calling this method on all of its children. If this node is a union, it is because a parent class or struct called this method, in which case it is added tolst
.Note: this is used slightly differently than nested directories, namespaces, and classes will be. Refer to
exhale.ExhaleRoot.generateNodeDocuments()
function for details.Parameters: lst
(list)The list each union is to be appended to.
-
toConsole
(level, printChildren=True)¶ Debugging tool for printing hierarchies / ownership to the console. Recursively calls children
toConsole
if this node is not a directory or a file, andprintChildren == True
.Parameters: level
(int)The indentation level to be used, should be greater than or equal to 0.
printChildren
(bool)Whether or not the
toConsole
method for the children found inself.children
should be called withlevel+1
. Default is True, set to False for directories and files.
-
typeSort
()¶ Sorts
self.children
in place, and has each child sort its own children. Refer toexhale.ExhaleRoot.deepSortList()
for more information on when this is necessary.
-
inClassView
()¶ Whether or not this node should be included in the class view hierarchy. Helper method for
exhale.ExhaleNode.toClassView()
. Sets the member variableself.in_class_view
to True if appropriate.Return (bool): True if this node should be included in the class view — either it is a node of kind struct
,class
,enum
,union
, or it is anamespace
that one or more if its descendants was one of the previous four kinds. Returns False otherwise.
-
toClassView
(level, stream, treeView, lastChild=False)¶ Recursively generates the class view hierarchy using this node and its children, if it is determined by
exhale.ExhaleNode.inClassView()
that this node should be included.Parameters: level
(int)An integer greater than or equal to 0 representing the indentation level for this node.
stream
(StringIO)The stream that is being written to by all of the nodes (created and destroyed by the ExhaleRoot object).
treeView
(bool)If False, standard reStructuredText bulleted lists will be written to the
stream
. If True, then raw html unordered lists will be written to thestream
.lastChild
(bool)When
treeView == True
, the unordered lists generated need to have an <li class=”lastChild”> tag on the last child for thecollapsibleList
to work correctly. The default value of this parameter is False, and should only ever be set to True internally by recursive calls to this method.
-
inDirectoryView
()¶ Whether or not this node should be included in the file view hierarchy. Helper method for
exhale.ExhaleNode.toDirectoryView()
. Sets the member variableself.in_directory_view
to True if appropriate.Return (bool): True if this node should be included in the file view — either it is a node of kind file
, or it is adir
that one or more if its descendants was afile
. Returns False otherwise.
-
toDirectoryView
(level, stream, treeView, lastChild=False)¶ Recursively generates the file view hierarchy using this node and its children, if it is determined by
exhale.ExhaleNode.inDirectoryView()
that this node should be included.Parameters: level
(int)An integer greater than or equal to 0 representing the indentation level for this node.
stream
(StringIO)The stream that is being written to by all of the nodes (created and destroyed by the ExhaleRoot object).
treeView
(bool)If False, standard reStructuredText bulleted lists will be written to the
stream
. If True, then raw html unordered lists will be written to thestream
.lastChild
(bool)When
treeView == True
, the unordered lists generated need to have an <li class=”lastChild”> tag on the last child for thecollapsibleList
to work correctly. The default value of this parameter is False, and should only ever be set to True internally by recursive calls to this method.
-
__weakref__
¶ list of weak references to the object (if defined)