adding the breathe files
This commit is contained in:
0
doc/breathe/finder/__init__.py
Normal file
0
doc/breathe/finder/__init__.py
Normal file
BIN
doc/breathe/finder/__init__.pyc
Normal file
BIN
doc/breathe/finder/__init__.pyc
Normal file
Binary file not shown.
45
doc/breathe/finder/core.py
Normal file
45
doc/breathe/finder/core.py
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
class FakeParentNode(object):
|
||||
|
||||
node_type = "fakeparent"
|
||||
|
||||
|
||||
class Finder(object):
|
||||
|
||||
def __init__(self, root, item_finder_factory):
|
||||
|
||||
self._root = root
|
||||
self.item_finder_factory = item_finder_factory
|
||||
|
||||
def filter_(self, filter_, matches):
|
||||
"""Adds all nodes which match the filter into the matches list"""
|
||||
|
||||
item_finder = self.item_finder_factory.create_finder(self._root)
|
||||
item_finder.filter_([FakeParentNode()], filter_, matches)
|
||||
|
||||
def root(self):
|
||||
|
||||
return self._root
|
||||
|
||||
|
||||
class FinderFactory(object):
|
||||
|
||||
def __init__(self, parser, item_finder_factory_creator):
|
||||
|
||||
self.parser = parser
|
||||
self.item_finder_factory_creator = item_finder_factory_creator
|
||||
|
||||
def create_finder(self, project_info):
|
||||
|
||||
root = self.parser.parse(project_info)
|
||||
item_finder_factory = self.item_finder_factory_creator.create_factory(project_info)
|
||||
|
||||
return Finder(root, item_finder_factory)
|
||||
|
||||
def create_finder_from_root(self, root, project_info):
|
||||
|
||||
item_finder_factory = self.item_finder_factory_creator.create_factory(project_info)
|
||||
|
||||
return Finder(root, item_finder_factory)
|
||||
|
||||
|
BIN
doc/breathe/finder/core.pyc
Normal file
BIN
doc/breathe/finder/core.pyc
Normal file
Binary file not shown.
1
doc/breathe/finder/doxygen/__init__.py
Normal file
1
doc/breathe/finder/doxygen/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
|
BIN
doc/breathe/finder/doxygen/__init__.pyc
Normal file
BIN
doc/breathe/finder/doxygen/__init__.pyc
Normal file
Binary file not shown.
18
doc/breathe/finder/doxygen/base.py
Normal file
18
doc/breathe/finder/doxygen/base.py
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
class ItemFinder(object):
|
||||
|
||||
def __init__(self, project_info, data_object, item_finder_factory):
|
||||
|
||||
self.data_object = data_object
|
||||
self.item_finder_factory = item_finder_factory
|
||||
self.project_info = project_info
|
||||
|
||||
|
||||
def stack(element, list_):
|
||||
"""Stack an element on to the start of a list and return as a new list"""
|
||||
|
||||
# Copy list first so we have a new list to insert into
|
||||
output = list_[:]
|
||||
output.insert(0, element)
|
||||
return output
|
||||
|
BIN
doc/breathe/finder/doxygen/base.pyc
Normal file
BIN
doc/breathe/finder/doxygen/base.pyc
Normal file
Binary file not shown.
75
doc/breathe/finder/doxygen/compound.py
Normal file
75
doc/breathe/finder/doxygen/compound.py
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
from .base import ItemFinder, stack
|
||||
|
||||
|
||||
class DoxygenTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
"""Find nodes which match the filter. Doesn't test this node, only its children"""
|
||||
|
||||
node_stack = stack(self.data_object, ancestors)
|
||||
|
||||
compound_finder = self.item_finder_factory.create_finder(self.data_object.compounddef)
|
||||
compound_finder.filter_(node_stack, filter_, matches)
|
||||
|
||||
|
||||
class CompoundDefTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
"""Finds nodes which match the filter and continues checks to children"""
|
||||
|
||||
node_stack = stack(self.data_object, ancestors)
|
||||
|
||||
if filter_.allow(node_stack):
|
||||
matches.append(node_stack)
|
||||
|
||||
for sectiondef in self.data_object.sectiondef:
|
||||
finder = self.item_finder_factory.create_finder(sectiondef)
|
||||
finder.filter_(node_stack, filter_, matches)
|
||||
|
||||
for innerclass in self.data_object.innerclass:
|
||||
finder = self.item_finder_factory.create_finder(innerclass)
|
||||
finder.filter_(node_stack, filter_, matches)
|
||||
|
||||
|
||||
class SectionDefTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
"""Find nodes which match the filter. Doesn't test this node, only its children"""
|
||||
|
||||
node_stack = stack(self.data_object, ancestors)
|
||||
|
||||
if filter_.allow(node_stack):
|
||||
matches.append(node_stack)
|
||||
|
||||
for memberdef in self.data_object.memberdef:
|
||||
finder = self.item_finder_factory.create_finder(memberdef)
|
||||
finder.filter_(node_stack, filter_, matches)
|
||||
|
||||
|
||||
class MemberDefTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
|
||||
data_object = self.data_object
|
||||
node_stack = stack(data_object, ancestors)
|
||||
|
||||
if filter_.allow(node_stack):
|
||||
matches.append(node_stack)
|
||||
|
||||
if data_object.kind == 'enum':
|
||||
for value in data_object.enumvalue:
|
||||
value_stack = stack(value, node_stack)
|
||||
if filter_.allow(value_stack):
|
||||
matches.append(value_stack)
|
||||
|
||||
|
||||
class RefTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
|
||||
node_stack = stack(self.data_object, ancestors)
|
||||
|
||||
if filter_.allow(node_stack):
|
||||
matches.append(node_stack)
|
||||
|
BIN
doc/breathe/finder/doxygen/compound.pyc
Normal file
BIN
doc/breathe/finder/doxygen/compound.pyc
Normal file
Binary file not shown.
55
doc/breathe/finder/doxygen/core.py
Normal file
55
doc/breathe/finder/doxygen/core.py
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
from . import index as indexfinder
|
||||
from . import compound as compoundfinder
|
||||
|
||||
|
||||
class CreateCompoundTypeSubFinder(object):
|
||||
|
||||
def __init__(self, parser_factory, matcher_factory):
|
||||
|
||||
self.parser_factory = parser_factory
|
||||
self.matcher_factory = matcher_factory
|
||||
|
||||
def __call__(self, project_info, *args):
|
||||
|
||||
compound_parser = self.parser_factory.create_compound_parser(project_info)
|
||||
return indexfinder.CompoundTypeSubItemFinder(self.matcher_factory, compound_parser,
|
||||
project_info, *args)
|
||||
|
||||
|
||||
class DoxygenItemFinderFactory(object):
|
||||
|
||||
def __init__(self, finders, project_info):
|
||||
|
||||
self.finders = finders
|
||||
self.project_info = project_info
|
||||
|
||||
def create_finder(self, data_object):
|
||||
|
||||
return self.finders[data_object.node_type](self.project_info, data_object, self)
|
||||
|
||||
|
||||
class DoxygenItemFinderFactoryCreator(object):
|
||||
|
||||
def __init__(self, parser_factory, filter_factory):
|
||||
|
||||
self.parser_factory = parser_factory
|
||||
self.filter_factory = filter_factory
|
||||
|
||||
def create_factory(self, project_info):
|
||||
|
||||
finders = {
|
||||
"doxygen": indexfinder.DoxygenTypeSubItemFinder,
|
||||
"compound": CreateCompoundTypeSubFinder(self.parser_factory, self.filter_factory),
|
||||
"member": indexfinder.MemberTypeSubItemFinder,
|
||||
"doxygendef": compoundfinder.DoxygenTypeSubItemFinder,
|
||||
"compounddef": compoundfinder.CompoundDefTypeSubItemFinder,
|
||||
"sectiondef": compoundfinder.SectionDefTypeSubItemFinder,
|
||||
"memberdef": compoundfinder.MemberDefTypeSubItemFinder,
|
||||
"ref": compoundfinder.RefTypeSubItemFinder,
|
||||
}
|
||||
|
||||
return DoxygenItemFinderFactory(finders, project_info)
|
||||
|
||||
|
||||
|
BIN
doc/breathe/finder/doxygen/core.pyc
Normal file
BIN
doc/breathe/finder/doxygen/core.pyc
Normal file
Binary file not shown.
79
doc/breathe/finder/doxygen/index.py
Normal file
79
doc/breathe/finder/doxygen/index.py
Normal file
@@ -0,0 +1,79 @@
|
||||
|
||||
from .base import ItemFinder, stack
|
||||
|
||||
|
||||
class DoxygenTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
"""Find nodes which match the filter. Doesn't test this node, only its children"""
|
||||
|
||||
compounds = self.data_object.get_compound()
|
||||
|
||||
node_stack = stack(self.data_object, ancestors)
|
||||
|
||||
for compound in compounds:
|
||||
|
||||
compound_finder = self.item_finder_factory.create_finder(compound)
|
||||
compound_finder.filter_(node_stack, filter_, matches)
|
||||
|
||||
|
||||
class CompoundTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def __init__(self, filter_factory, compound_parser, *args):
|
||||
ItemFinder.__init__(self, *args)
|
||||
|
||||
self.filter_factory = filter_factory
|
||||
self.compound_parser = compound_parser
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
"""Finds nodes which match the filter and continues checks to children
|
||||
|
||||
Requires parsing the xml files referenced by the children for which we use the compound
|
||||
parser and continue at the top level of that pretending that this node is the parent of the
|
||||
top level node of the compound file.
|
||||
"""
|
||||
|
||||
node_stack = stack(self.data_object, ancestors)
|
||||
|
||||
# Match against compound object
|
||||
if filter_.allow(node_stack):
|
||||
matches.append(node_stack)
|
||||
|
||||
# Descend to member children
|
||||
members = self.data_object.get_member()
|
||||
member_matches = []
|
||||
for member in members:
|
||||
member_finder = self.item_finder_factory.create_finder(member)
|
||||
member_finder.filter_(node_stack, filter_, member_matches)
|
||||
|
||||
results = []
|
||||
|
||||
# If there are members in this compound that match the criteria
|
||||
# then load up the file for this compound and get the member data objects
|
||||
if member_matches:
|
||||
|
||||
file_data = self.compound_parser.parse(self.data_object.refid)
|
||||
finder = self.item_finder_factory.create_finder(file_data)
|
||||
|
||||
for member_stack in member_matches:
|
||||
ref_filter = self.filter_factory.create_id_filter('memberdef', member_stack[0].refid)
|
||||
finder.filter_(node_stack, ref_filter, matches)
|
||||
|
||||
else:
|
||||
|
||||
# Read in the xml file referenced by the compound and descend into that as well
|
||||
file_data = self.compound_parser.parse(self.data_object.refid)
|
||||
finder = self.item_finder_factory.create_finder(file_data)
|
||||
|
||||
finder.filter_(node_stack, filter_, matches)
|
||||
|
||||
|
||||
class MemberTypeSubItemFinder(ItemFinder):
|
||||
|
||||
def filter_(self, ancestors, filter_, matches):
|
||||
|
||||
node_stack = stack(self.data_object, ancestors)
|
||||
|
||||
# Match against member object
|
||||
if filter_.allow(node_stack):
|
||||
matches.append(node_stack)
|
BIN
doc/breathe/finder/doxygen/index.pyc
Normal file
BIN
doc/breathe/finder/doxygen/index.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user