diff --git a/doc/breathe/__init__.py b/doc/breathe/__init__.py new file mode 100644 index 0000000..0aaa564 --- /dev/null +++ b/doc/breathe/__init__.py @@ -0,0 +1,16 @@ + +__version__ = '4.0.0' + + +def setup(app): + + # We can't do the import at the module scope as setup.py has to be able to + # import this file to read __version__ without hitting any syntax errors + # from both Python 2 & Python 3. + + # By the time this function is called, the directives code will have been + # converted with 2to3 if appropriate + + from . import directives + + directives.setup(app) diff --git a/doc/breathe/__init__.pyc b/doc/breathe/__init__.pyc new file mode 100644 index 0000000..63dcadd Binary files /dev/null and b/doc/breathe/__init__.pyc differ diff --git a/doc/breathe/directive/__init__.py b/doc/breathe/directive/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/doc/breathe/directive/__init__.pyc b/doc/breathe/directive/__init__.pyc new file mode 100644 index 0000000..7696747 Binary files /dev/null and b/doc/breathe/directive/__init__.pyc differ diff --git a/doc/breathe/directive/base.py b/doc/breathe/directive/base.py new file mode 100644 index 0000000..77f86f1 --- /dev/null +++ b/doc/breathe/directive/base.py @@ -0,0 +1,88 @@ + +from ..renderer.rst.doxygen.base import RenderContext +from ..renderer.rst.doxygen import format_parser_error +from ..parser import ParserError, FileIOError + +from docutils import nodes +from docutils.parsers import rst + + +class WarningHandler(object): + + def __init__(self, state, context): + self.state = state + self.context = context + + def warn(self, raw_text, rendered_nodes=None): + raw_text = self.format(raw_text) + if rendered_nodes is None: + rendered_nodes = [nodes.paragraph("", "", nodes.Text(raw_text))] + return [ + nodes.warning("", *rendered_nodes), + self.state.document.reporter.warning(raw_text, line=self.context['lineno']) + ] + + def format(self, text): + return text.format(**self.context) + + +def create_warning(project_info, state, lineno, **kwargs): + + tail = '' + if project_info: + tail = 'in doxygen xml output for project "{project}" from directory: {path}'.format( + project=project_info.name(), + path=project_info.project_path() + ) + + context = dict( + lineno=lineno, + tail=tail, + **kwargs + ) + + return WarningHandler(state, context) + + +class BaseDirective(rst.Directive): + + def __init__(self, root_data_object, renderer_factory_creator_constructor, finder_factory, + project_info_factory, filter_factory, target_handler_factory, parser_factory, *args): + rst.Directive.__init__(self, *args) + self.directive_args = list(args) # Convert tuple to list to allow modification. + + self.root_data_object = root_data_object + self.renderer_factory_creator_constructor = renderer_factory_creator_constructor + self.finder_factory = finder_factory + self.project_info_factory = project_info_factory + self.filter_factory = filter_factory + self.target_handler_factory = target_handler_factory + self.parser_factory = parser_factory + + def render(self, node_stack, project_info, options, filter_, target_handler, mask_factory): + "Standard render process used by subclasses" + + renderer_factory_creator = self.renderer_factory_creator_constructor.create_factory_creator( + project_info, + self.state.document, + options, + target_handler + ) + + try: + renderer_factory = renderer_factory_creator.create_factory( + node_stack, + self.state, + self.state.document, + filter_, + target_handler, + ) + except ParserError as e: + return format_parser_error("doxygenclass", e.error, e.filename, self.state, + self.lineno, True) + except FileIOError as e: + return format_parser_error("doxygenclass", e.error, e.filename, self.state, self.lineno) + + context = RenderContext(node_stack, mask_factory, self.directive_args) + object_renderer = renderer_factory.create_renderer(context) + return object_renderer.render() diff --git a/doc/breathe/directive/base.pyc b/doc/breathe/directive/base.pyc new file mode 100644 index 0000000..e80d74f Binary files /dev/null and b/doc/breathe/directive/base.pyc differ diff --git a/doc/breathe/directive/file.py b/doc/breathe/directive/file.py new file mode 100644 index 0000000..842ffeb --- /dev/null +++ b/doc/breathe/directive/file.py @@ -0,0 +1,123 @@ + +from ..renderer.rst.doxygen.base import RenderContext +from ..renderer.rst.doxygen.mask import NullMaskFactory +from ..directive.base import BaseDirective +from ..project import ProjectError +from .base import create_warning + +from docutils.parsers.rst.directives import unchanged_required, flag +from docutils.parsers import rst + + +class BaseFileDirective(BaseDirective): + """Base class handle the main work when given the appropriate file and project info to work + from. + """ + + # We use inheritance here rather than a separate object and composition, because so much + # information is present in the Directive class from the docutils framework that we'd have to + # pass way too much stuff to a helper object to be reasonable. + + def handle_contents(self, file_, project_info): + + finder = self.finder_factory.create_finder(project_info) + + finder_filter = self.filter_factory.create_file_finder_filter(file_) + + matches = [] + finder.filter_(finder_filter, matches) + + if len(matches) > 1: + warning = create_warning(None, self.state, self.lineno, file=file_, + directivename=self.directive_name) + return warning.warn('{directivename}: Found multiple matches for file "{file} {tail}') + + elif not matches: + warning = create_warning(None, self.state, self.lineno, file=file_, + directivename=self.directive_name) + return warning.warn('{directivename}: Cannot find file "{file} {tail}') + + target_handler = self.target_handler_factory.create_target_handler( + self.options, project_info, self.state.document) + filter_ = self.filter_factory.create_file_filter(file_, self.options) + + renderer_factory_creator = self.renderer_factory_creator_constructor.create_factory_creator( + project_info, + self.state.document, + self.options, + target_handler + ) + node_list = [] + for node_stack in matches: + + renderer_factory = renderer_factory_creator.create_factory( + node_stack, + self.state, + self.state.document, + filter_, + target_handler, + ) + + mask_factory = NullMaskFactory() + context = RenderContext(node_stack, mask_factory, self.directive_args) + object_renderer = renderer_factory.create_renderer(context) + node_list.extend(object_renderer.render()) + + return node_list + + +class DoxygenFileDirective(BaseFileDirective): + + directive_name = 'doxygenfile' + + required_arguments = 0 + optional_arguments = 2 + option_spec = { + "path": unchanged_required, + "project": unchanged_required, + "outline": flag, + "no-link": flag, + } + has_content = False + + def run(self): + """Get the file from the argument and the project info from the factory.""" + + file_ = self.arguments[0] + + try: + project_info = self.project_info_factory.create_project_info(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno) + return warning.warn('doxygenfile: %s' % e) + + return self.handle_contents(file_, project_info) + + +class AutoDoxygenFileDirective(BaseFileDirective): + + directive_name = 'autodoxygenfile' + + required_arguments = 1 + option_spec = { + "project": unchanged_required, + "outline": flag, + "no-link": flag, + } + has_content = False + + def run(self): + """Get the file from the argument and extract the associated project info for the named + project given that it is an auto-project. + """ + + file_ = self.arguments[0] + + try: + project_info = self.project_info_factory.retrieve_project_info_for_auto(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno) + return warning.warn('autodoxygenfile: %s' % e) + + return self.handle_contents(file_, project_info) + diff --git a/doc/breathe/directive/file.pyc b/doc/breathe/directive/file.pyc new file mode 100644 index 0000000..30c7a49 Binary files /dev/null and b/doc/breathe/directive/file.pyc differ diff --git a/doc/breathe/directive/index.py b/doc/breathe/directive/index.py new file mode 100644 index 0000000..a8faa7b --- /dev/null +++ b/doc/breathe/directive/index.py @@ -0,0 +1,115 @@ + +from ..renderer.rst.doxygen.base import RenderContext +from ..renderer.rst.doxygen.mask import NullMaskFactory +from ..renderer.rst.doxygen import format_parser_error +from ..directive.base import BaseDirective +from ..project import ProjectError +from ..parser import ParserError, FileIOError +from .base import create_warning + +from docutils.parsers import rst +from docutils.parsers.rst.directives import unchanged_required, flag + + +class BaseIndexDirective(BaseDirective): + """Base class handle the main work when given the appropriate project info to work from. + """ + + # We use inheritance here rather than a separate object and composition, because so much + # information is present in the Directive class from the docutils framework that we'd have to + # pass way too much stuff to a helper object to be reasonable. + + def handle_contents(self, project_info): + + try: + finder = self.finder_factory.create_finder(project_info) + except ParserError as e: + return format_parser_error(self.name, e.error, e.filename, self.state, + self.lineno, True) + except FileIOError as e: + return format_parser_error(self.name, e.error, e.filename, self.state, self.lineno) + + data_object = finder.root() + + target_handler = self.target_handler_factory.create_target_handler( + self.options, project_info, self.state.document) + filter_ = self.filter_factory.create_index_filter(self.options) + + renderer_factory_creator = self.renderer_factory_creator_constructor.create_factory_creator( + project_info, + self.state.document, + self.options, + target_handler + ) + renderer_factory = renderer_factory_creator.create_factory( + [data_object], + self.state, + self.state.document, + filter_, + target_handler, + ) + + mask_factory = NullMaskFactory() + context = RenderContext([data_object, self.root_data_object], mask_factory, self.directive_args) + object_renderer = renderer_factory.create_renderer(context) + + try: + node_list = object_renderer.render() + except ParserError as e: + return format_parser_error(self.name, e.error, e.filename, self.state, + self.lineno, True) + except FileIOError as e: + return format_parser_error(self.name, e.error, e.filename, self.state, self.lineno) + + return node_list + + +class DoxygenIndexDirective(BaseIndexDirective): + + required_arguments = 0 + optional_arguments = 2 + option_spec = { + "path": unchanged_required, + "project": unchanged_required, + "outline": flag, + "no-link": flag, + } + has_content = False + + def run(self): + """Extract the project info and pass it to the helper method""" + + try: + project_info = self.project_info_factory.create_project_info(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno) + return warning.warn('doxygenindex: %s' % e) + + return self.handle_contents(project_info) + + +class AutoDoxygenIndexDirective(BaseIndexDirective): + + required_arguments = 0 + final_argument_whitespace = True + option_spec = { + "project": unchanged_required, + "outline": flag, + "no-link": flag, + } + has_content = False + + def run(self): + """Extract the project info from the auto project info store and pass it to the helper + method + """ + + try: + project_info = self.project_info_factory.retrieve_project_info_for_auto(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno) + return warning.warn('autodoxygenindex: %s' % e) + + return self.handle_contents(project_info) + + diff --git a/doc/breathe/directive/index.pyc b/doc/breathe/directive/index.pyc new file mode 100644 index 0000000..71aacef Binary files /dev/null and b/doc/breathe/directive/index.pyc differ diff --git a/doc/breathe/directives.py b/doc/breathe/directives.py new file mode 100644 index 0000000..99a8a77 --- /dev/null +++ b/doc/breathe/directives.py @@ -0,0 +1,1050 @@ + +from .finder.core import FinderFactory +from .parser import DoxygenParserFactory, CacheFactory +from .renderer.rst.doxygen import DoxygenToRstRendererFactoryCreatorConstructor, \ + RstContentCreator, RenderContext +from .renderer.rst.doxygen.filter import FilterFactory, GlobFactory +from .renderer.rst.doxygen.target import TargetHandlerFactory +from .renderer.rst.doxygen.mask import MaskFactory, NullMaskFactory, NoParameterNamesMask + +from .finder.doxygen.core import DoxygenItemFinderFactoryCreator +from .directive.base import BaseDirective, create_warning +from .directive.index import DoxygenIndexDirective, AutoDoxygenIndexDirective +from .directive.file import DoxygenFileDirective, AutoDoxygenFileDirective +from .process import AutoDoxygenProcessHandle +from .exception import BreatheError +from .project import ProjectInfoFactory, ProjectError + +from docutils.parsers.rst.directives import unchanged_required, unchanged, flag +from docutils.statemachine import ViewList +from sphinx.domains import cpp, c, python +from sphinx.writers.text import TextWriter +from sphinx.builders.text import TextBuilder + +import docutils.nodes +import sphinx.addnodes +import sphinx.ext.mathbase + +import os +import fnmatch +import re +import textwrap +import collections +import subprocess + +# Somewhat outrageously, reach in and fix a Sphinx regex +cpp._identifier_re = re.compile(r'(~?\b[a-zA-Z_][a-zA-Z0-9_]*)\b') + + +class NoMatchingFunctionError(BreatheError): + pass + + +class UnableToResolveFunctionError(BreatheError): + + def __init__(self, signatures): + self.signatures = signatures + + +class NodeNotFoundError(BreatheError): + pass + + +class FakeDestination(object): + + def write(self, output): + return output + + +class TextRenderer(object): + + def __init__(self, app): + self.app = app + + def render(self, nodes, document): + + new_document = document.copy() + + new_document.children = nodes + + writer = TextWriter(TextBuilder(self.app)) + output = writer.write(new_document, FakeDestination()) + + return output.strip() + + +# Directives +# ---------- + +class DoxygenFunctionDirective(BaseDirective): + + required_arguments = 1 + option_spec = { + "path": unchanged_required, + "project": unchanged_required, + "outline": flag, + "no-link": flag, + } + has_content = False + final_argument_whitespace = True + + def __init__(self, node_factory, text_renderer, *args, **kwargs): + BaseDirective.__init__(self, *args, **kwargs) + + self.node_factory = node_factory + self.text_renderer = text_renderer + + def run(self): + + # Separate possible arguments (delimited by a "(") from the namespace::name + match = re.match(r"([^(]*)(.*)", self.arguments[0]) + namespaced_function, args = match.group(1), match.group(2) + + # Split the namespace and the function name + try: + (namespace, function_name) = namespaced_function.rsplit("::", 1) + except ValueError: + (namespace, function_name) = "", namespaced_function + + try: + project_info = self.project_info_factory.create_project_info(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno) + return warning.warn('doxygenfunction: %s' % e) + + try: + finder = self.finder_factory.create_finder(project_info) + except MTimerError as e: + warning = create_warning(None, self.state, self.lineno) + return warning.warn('doxygenfunction: %s' % e) + + # Extract arguments from the function name. + args = self.parse_args(args) + + finder_filter = self.filter_factory.create_member_finder_filter( + namespace, function_name, 'function') + + matches = [] + finder.filter_(finder_filter, matches) + + # Create it ahead of time as it is cheap and it is ugly to declare it for both exception + # clauses below + warning = create_warning( + project_info, + self.state, + self.lineno, + namespace='%s::' % namespace if namespace else '', + function=function_name, + args=', '.join(args) + ) + + try: + node_stack = self.resolve_function(matches, args, project_info) + except NoMatchingFunctionError: + return warning.warn('doxygenfunction: Cannot find function "{namespace}{function}" ' + '{tail}') + except UnableToResolveFunctionError as error: + message = 'doxygenfunction: Unable to resolve multiple matches for function ' \ + '"{namespace}{function}" with arguments ({args}) {tail}.\n' \ + 'Potential matches:\n' + + # We want to create a raw_text string for the console output and a set of docutils nodes + # for rendering into the final output. We handle the final output as a literal string + # with a txt based list of the options. + raw_text = message + literal_text = '' + + # TODO: We're cheating here with the set() as signatures has repeating entries for some + # reason (failures in the matcher_stack code) so we consolidate them by shoving them in + # a set to remove duplicates. Should be fixed! + for i, entry in enumerate(set(error.signatures)): + if i: + literal_text += '\n' + # Replace new lines with a new line & enough spacing to reach the appropriate + # alignment for our simple plain text list + literal_text += '- %s' % entry.replace('\n', '\n ') + raw_text += ' - %s\n' % entry.replace('\n', '\n ') + block = self.node_factory.literal_block('', '', self.node_factory.Text(literal_text)) + formatted_message = warning.format(message) + warning_nodes = [ + self.node_factory.paragraph( + "", "", + self.node_factory.Text(formatted_message) + ), + block + ] + result = warning.warn(raw_text, warning_nodes) + return result + + target_handler = self.target_handler_factory.create_target_handler( + self.options, project_info, self.state.document + ) + filter_ = self.filter_factory.create_outline_filter(self.options) + + return self.render(node_stack, project_info, self.options, filter_, target_handler, + NullMaskFactory()) + + def parse_args(self, function_description): + # Strip off trailing qualifiers + pattern = re.compile(r'''(?<= \)) \s* + (?: const)? \s* + (?: volatile)? \s* + (?: = \s* 0)? \s* $ ''', + re.VERBOSE) + + function_description = re.sub(pattern, + '', + function_description) + + paren_index = function_description.find('(') + if paren_index == -1: + return [] + # If it is empty parenthesis, then return empty list as we want empty parenthesis coming + # from the xml file to match the user's function when the user doesn't provide parenthesis + # ie. when there are no args anyway + elif function_description == '()': + return [] + else: + # Parse the function name string, eg. f(int, float) to + # extract the types so we can use them for matching + args = [] + num_open_brackets = -1 + start = paren_index + 1 + for i in range(paren_index, len(function_description)): + c = function_description[i] + if c == '(' or c == '<': + num_open_brackets += 1 + elif c == ')' or c == '>': + num_open_brackets -= 1 + elif c == ',' and num_open_brackets == 0: + args.append(function_description[start:i].strip()) + start = i + 1 + args.append(function_description[start:-1].strip()) + + return args + + def resolve_function(self, matches, args, project_info): + + if not matches: + raise NoMatchingFunctionError() + + if len(matches) == 1: + return matches[0] + + node_stack = None + + signatures = [] + + # Iterate over the potential matches + for entry in matches: + + text_options = {'no-link': u'', 'outline': u''} + + # Render the matches to docutils nodes + target_handler = self.target_handler_factory.create_target_handler( + {'no-link': u''}, project_info, self.state.document + ) + filter_ = self.filter_factory.create_outline_filter(text_options) + mask_factory = MaskFactory({'param': NoParameterNamesMask}) + nodes = self.render(entry, project_info, text_options, filter_, target_handler, + mask_factory) + + # Render the nodes to text + signature = self.text_renderer.render(nodes, self.state.document) + signatures.append(signature) + + match = re.match(r"([^(]*)(.*)", signature) + match_args = match.group(2) + + # Parse the text to find the arguments + match_args = self.parse_args(match_args) + + # Match them against the arg spec + if args == match_args: + node_stack = entry + break + + if not node_stack: + raise UnableToResolveFunctionError(signatures) + + return node_stack + + +class DoxygenClassLikeDirective(BaseDirective): + + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + option_spec = { + "path": unchanged_required, + "project": unchanged_required, + "members": unchanged, + "protected-members": flag, + "private-members": flag, + "undoc-members": flag, + "show": unchanged_required, + "outline": flag, + "no-link": flag, + } + has_content = False + + def run(self): + + name = self.arguments[0] + + try: + project_info = self.project_info_factory.create_project_info(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno, kind=self.kind) + return warning.warn('doxygen{kind}: %s' % e) + + try: + finder = self.finder_factory.create_finder(project_info) + except MTimerError as e: + warning = create_warning(None, self.state, self.lineno, kind=self.kind) + return warning.warn('doxygen{kind}: %s' % e) + + finder_filter = self.filter_factory.create_compound_finder_filter(name, self.kind) + + matches = [] + finder.filter_(finder_filter, matches) + + if len(matches) == 0: + warning = create_warning(project_info, self.state, self.lineno, name=name, + kind=self.kind) + return warning.warn('doxygen{kind}: Cannot find class "{name}" {tail}') + + target_handler = self.target_handler_factory.create_target_handler( + self.options, project_info, self.state.document + ) + filter_ = self.filter_factory.create_class_filter(name, self.options) + + mask_factory = NullMaskFactory() + return self.render(matches[0], project_info, self.options, filter_, target_handler, + mask_factory) + + +class DoxygenClassDirective(DoxygenClassLikeDirective): + + kind = "class" + + +class DoxygenStructDirective(DoxygenClassLikeDirective): + + kind = "struct" + + +class DoxygenContentBlockDirective(BaseDirective): + """Base class for namespace and group directives which have very similar behaviours""" + + required_arguments = 1 + optional_arguments = 1 + option_spec = { + "path": unchanged_required, + "project": unchanged_required, + "content-only": flag, + "outline": flag, + "members": flag, + "protected-members": flag, + "private-members": flag, + "undoc-members": flag, + "no-link": flag + } + has_content = False + + def run(self): + + name = self.arguments[0] + + try: + project_info = self.project_info_factory.create_project_info(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno, kind=self.kind) + return warning.warn('doxygen{kind}: %s' % e) + + try: + finder = self.finder_factory.create_finder(project_info) + except MTimerError as e: + warning = create_warning(None, self.state, self.lineno, kind=self.kind) + return warning.warn('doxygen{kind}: %s' % e) + + finder_filter = self.filter_factory.create_finder_filter(self.kind, name) + + matches = [] + finder.filter_(finder_filter, matches) + + # It shouldn't be possible to have too many matches as namespaces & groups in their nature + # are merged together if there are multiple declarations, so we only check for no matches + if not matches: + warning = create_warning(project_info, self.state, self.lineno, name=name, + kind=self.kind) + return warning.warn('doxygen{kind}: Cannot find namespace "{name}" {tail}') + + if 'content-only' in self.options: + + # Unpack the single entry in the matches list + (node_stack,) = matches + + filter_ = self.filter_factory.create_content_filter(self.kind, self.options) + + # Having found the compound node for the namespace or group in the index we want to grab + # the contents of it which match the filter + contents_finder = self.finder_factory.create_finder_from_root(node_stack[0], + project_info) + contents = [] + contents_finder.filter_(filter_, contents) + + # Replaces matches with our new starting points + matches = contents + + target_handler = self.target_handler_factory.create_target_handler( + self.options, project_info, self.state.document + ) + filter_ = self.filter_factory.create_render_filter(self.kind, self.options) + + renderer_factory_creator = self.renderer_factory_creator_constructor.create_factory_creator( + project_info, + self.state.document, + self.options, + target_handler + ) + node_list = [] + + for node_stack in matches: + renderer_factory = renderer_factory_creator.create_factory( + node_stack, + self.state, + self.state.document, + filter_, + target_handler, + ) + + mask_factory = NullMaskFactory() + context = RenderContext(node_stack, mask_factory, self.directive_args) + object_renderer = renderer_factory.create_renderer(context) + node_list.extend(object_renderer.render()) + + return node_list + + +class DoxygenNamespaceDirective(DoxygenContentBlockDirective): + + kind = "namespace" + + +class DoxygenGroupDirective(DoxygenContentBlockDirective): + + kind = "group" + + +# This class was the same as the DoxygenBaseDirective above, except that it +# wraps the output in a definition_list before passing it back. This should be +# abstracted in a far nicer way to avoid repeating so much code +# +# Now we've removed the definition_list wrap so we really need to refactor this! +class DoxygenBaseItemDirective(BaseDirective): + + required_arguments = 1 + optional_arguments = 1 + option_spec = { + "path": unchanged_required, + "project": unchanged_required, + "outline": flag, + "no-link": flag, + } + has_content = False + + def create_finder_filter(self, namespace, name): + """Creates a filter to find the node corresponding to this item.""" + + return self.filter_factory.create_member_finder_filter( + namespace, name, self.kind) + + def run(self): + + try: + namespace, name = self.arguments[0].rsplit("::", 1) + except ValueError: + namespace, name = "", self.arguments[0] + + try: + project_info = self.project_info_factory.create_project_info(self.options) + except ProjectError as e: + warning = create_warning(None, self.state, self.lineno, kind=self.kind) + return warning.warn('doxygen{kind}: %s' % e) + + try: + finder = self.finder_factory.create_finder(project_info) + except MTimerError as e: + warning = create_warning(None, self.state, self.lineno, kind=self.kind) + return warning.warn('doxygen{kind}: %s' % e) + + finder_filter = self.create_finder_filter(namespace, name) + + matches = [] + finder.filter_(finder_filter, matches) + + if len(matches) == 0: + display_name = "%s::%s" % (namespace, name) if namespace else name + warning = create_warning(project_info, self.state, self.lineno, kind=self.kind, + display_name=display_name) + return warning.warn('doxygen{kind}: Cannot find {kind} "{display_name}" {tail}') + + target_handler = self.target_handler_factory.create_target_handler( + self.options, project_info, self.state.document + ) + filter_ = self.filter_factory.create_outline_filter(self.options) + + node_stack = matches[0] + mask_factory = NullMaskFactory() + return self.render(node_stack, project_info, self.options, filter_, target_handler, + mask_factory) + + +class DoxygenVariableDirective(DoxygenBaseItemDirective): + + kind = "variable" + + def render(self, node_stack, project_info, options, filter_, target_handler, mask_factory): + # Remove 'extern' keyword as Sphinx doesn't support it. + definition = node_stack[0].definition + extern = 'extern ' + if definition.startswith(extern): + definition = definition[len(extern):] + self.directive_args[1] = [definition] + return DoxygenBaseItemDirective.render(self, node_stack, project_info, options, filter_, + target_handler, mask_factory) + + +class DoxygenDefineDirective(DoxygenBaseItemDirective): + + kind = "define" + + +class DoxygenEnumDirective(DoxygenBaseItemDirective): + + kind = "enum" + + +class DoxygenEnumValueDirective(DoxygenBaseItemDirective): + + kind = "enumvalue" + + def create_finder_filter(self, namespace, name): + + return self.filter_factory.create_enumvalue_finder_filter(name) + + +class DoxygenTypedefDirective(DoxygenBaseItemDirective): + + kind = "typedef" + + +class DoxygenUnionDirective(DoxygenBaseItemDirective): + + kind = "union" + + def create_finder_filter(self, namespace, name): + + # Unions are stored in the xml file with their fully namespaced name + # We're using C++ namespaces here, it might be best to make this file + # type dependent + # + xml_name = "%s::%s" % (namespace, name) if namespace else name + return self.filter_factory.create_compound_finder_filter(xml_name, 'union') + + +# Setup Administration +# -------------------- + +class DirectiveContainer(object): + + def __init__(self, directive, *args): + + self.directive = directive + self.args = args + + # Required for sphinx to inspect + self.required_arguments = directive.required_arguments + self.optional_arguments = directive.optional_arguments + self.option_spec = directive.option_spec + self.has_content = directive.has_content + self.final_argument_whitespace = directive.final_argument_whitespace + + def __call__(self, *args): + + call_args = [] + call_args.extend(self.args) + call_args.extend(args) + + return self.directive(*call_args) + + +class DoxygenDirectiveFactory(object): + + directives = { + "doxygenindex": DoxygenIndexDirective, + "autodoxygenindex": AutoDoxygenIndexDirective, + "doxygenfunction": DoxygenFunctionDirective, + "doxygenstruct": DoxygenStructDirective, + "doxygenclass": DoxygenClassDirective, + "doxygenvariable": DoxygenVariableDirective, + "doxygendefine": DoxygenDefineDirective, + "doxygenenum": DoxygenEnumDirective, + "doxygenenumvalue": DoxygenEnumValueDirective, + "doxygentypedef": DoxygenTypedefDirective, + "doxygenunion": DoxygenUnionDirective, + "doxygennamespace": DoxygenNamespaceDirective, + "doxygengroup": DoxygenGroupDirective, + "doxygenfile": DoxygenFileDirective, + "autodoxygenfile": AutoDoxygenFileDirective, + } + + def __init__(self, node_factory, text_renderer, root_data_object, + renderer_factory_creator_constructor, finder_factory, + project_info_factory, filter_factory, target_handler_factory, parser_factory): + + self.node_factory = node_factory + self.text_renderer = text_renderer + self.root_data_object = root_data_object + self.renderer_factory_creator_constructor = renderer_factory_creator_constructor + self.finder_factory = finder_factory + self.project_info_factory = project_info_factory + self.filter_factory = filter_factory + self.target_handler_factory = target_handler_factory + self.parser_factory = parser_factory + + # TODO: This methods should be scrapped as they are only called in one place. We should just + # inline the code at the call site + def create_index_directive_container(self): + return self.create_directive_container("doxygenindex") + + def create_function_directive_container(self): + + # Pass text_renderer to the function directive + return DirectiveContainer( + self.directives["doxygenfunction"], + self.node_factory, + self.text_renderer, + self.root_data_object, + self.renderer_factory_creator_constructor, + self.finder_factory, + self.project_info_factory, + self.filter_factory, + self.target_handler_factory, + self.parser_factory + ) + + def create_struct_directive_container(self): + return self.create_directive_container("doxygenstruct") + + def create_enum_directive_container(self): + return self.create_directive_container("doxygenenum") + + def create_enumvalue_directive_container(self): + return self.create_directive_container("doxygenenumvalue") + + def create_typedef_directive_container(self): + return self.create_directive_container("doxygentypedef") + + def create_union_directive_container(self): + return self.create_directive_container("doxygenunion") + + def create_class_directive_container(self): + return self.create_directive_container("doxygenclass") + + def create_file_directive_container(self): + return self.create_directive_container("doxygenfile") + + def create_namespace_directive_container(self): + return self.create_directive_container("doxygennamespace") + + def create_group_directive_container(self): + return self.create_directive_container("doxygengroup") + + def create_variable_directive_container(self): + return self.create_directive_container("doxygenvariable") + + def create_define_directive_container(self): + return self.create_directive_container("doxygendefine") + + def create_auto_index_directive_container(self): + return self.create_directive_container("autodoxygenindex") + + def create_auto_file_directive_container(self): + return self.create_directive_container("autodoxygenfile") + + def create_directive_container(self, type_): + + return DirectiveContainer( + self.directives[type_], + self.root_data_object, + self.renderer_factory_creator_constructor, + self.finder_factory, + self.project_info_factory, + self.filter_factory, + self.target_handler_factory, + self.parser_factory + ) + + def get_config_values(self, app): + + # All DirectiveContainers maintain references to this project info factory + # so we can update this to update them + self.project_info_factory.update( + app.config.breathe_projects, + app.config.breathe_default_project, + app.config.breathe_domain_by_extension, + app.config.breathe_domain_by_file_pattern, + app.config.breathe_projects_source, + app.config.breathe_build_directory + ) + + +class NodeFactory(object): + + def __init__(self, *args): + + self.sources = args + + def __getattr__(self, node_name): + + for source in self.sources: + try: + return getattr(source, node_name) + except AttributeError: + pass + + raise NodeNotFoundError(node_name) + + +class RootDataObject(object): + + node_type = "root" + + +class PathHandler(object): + + def __init__(self, config_directory, sep, basename, join): + + self.config_directory = config_directory + + self.sep = sep + self.basename = basename + self.join = join + + def includes_directory(self, file_path): + + # Check for backslash or forward slash as we don't know what platform we're on and sometimes + # the doxygen paths will have forward slash even on Windows. + return bool(file_path.count('\\')) or bool(file_path.count('/')) + + def resolve_path(self, directory, filename): + """Returns a full path to the filename in the given directory assuming that if the directory + path is relative, then it is relative to the conf.py directory. + """ + + # os.path.join does the appropriate handling if _project_path is an absolute path + return self.join(self.config_directory, directory, filename) + + +def write_file(directory, filename, content): + + # Check the directory exists + if not os.path.exists(directory): + os.makedirs(directory) + + # Write the file with the provided contents + with open(os.path.join(directory, filename), "w") as f: + f.write(content) + + +class MTimerError(Exception): + pass + + +class MTimer(object): + + def __init__(self, getmtime): + self.getmtime = getmtime + + def get_mtime(self, filename): + + try: + return self.getmtime(filename) + except OSError: + raise MTimerError('Cannot find file: %s' % os.path.realpath(filename)) + + +class FileStateCache(object): + """ + Stores the modified time of the various doxygen xml files against the + reStructuredText file that they are referenced from so that we know which + reStructuredText files to rebuild if the doxygen xml is modified. + + We store the information in the environment object so that it is pickled + down and stored between builds as Sphinx is designed to do. + """ + + def __init__(self, mtimer, app): + + self.app = app + self.mtimer = mtimer + + def update(self, source_file): + + if not hasattr(self.app.env, "breathe_file_state"): + self.app.env.breathe_file_state = {} + + new_mtime = self.mtimer.get_mtime(source_file) + + mtime, docnames = self.app.env.breathe_file_state.setdefault( + source_file, (new_mtime, set()) + ) + + docnames.add(self.app.env.docname) + + self.app.env.breathe_file_state[source_file] = (new_mtime, docnames) + + def get_outdated(self, app, env, added, changed, removed): + + if not hasattr(self.app.env, "breathe_file_state"): + return [] + + stale = [] + + for filename, info in self.app.env.breathe_file_state.iteritems(): + old_mtime, docnames = info + if self.mtimer.get_mtime(filename) > old_mtime: + stale.extend(docnames) + + return list(set(stale).difference(removed)) + + def purge_doc(self, app, env, docname): + + if not hasattr(self.app.env, "breathe_file_state"): + return + + toremove = [] + + for filename, info in self.app.env.breathe_file_state.iteritems(): + + _, docnames = info + docnames.discard(docname) + if not docnames: + toremove.append(filename) + + for filename in toremove: + del self.app.env.breathe_file_state[filename] + + +class DomainDirectiveFactory(object): + # A mapping from node kinds to cpp domain classes and directive names. + cpp_classes = { + 'class': (cpp.CPPClassObject, 'class'), + 'struct': (cpp.CPPClassObject, 'class'), + 'function': (cpp.CPPFunctionObject, 'function'), + 'friend': (cpp.CPPFunctionObject, 'function'), + 'slot': (cpp.CPPFunctionObject, 'function'), + 'enum': (cpp.CPPTypeObject, 'type'), + 'typedef': (cpp.CPPTypeObject, 'type'), + 'union': (cpp.CPPTypeObject, 'type'), + 'namespace': (cpp.CPPTypeObject, 'type'), + # Use CPPClassObject for enum values as the cpp domain doesn't have a directive for + # enum values and CPPMemberObject requires a type. + 'enumvalue': (cpp.CPPClassObject, 'member'), + 'define': (c.CObject, 'macro') + } + + python_classes = { + 'function': (python.PyModulelevel, 'function'), + 'variable': (python.PyClassmember, 'attribute') + } + + @staticmethod + def fix_python_signature(sig): + def_ = 'def ' + if sig.startswith(def_): + sig = sig[len(def_):] + # Doxygen uses an invalid separator ('::') in Python signatures. Replace them with '.'. + return sig.replace('::', '.') + + @staticmethod + def create(domain, args): + if domain == 'c': + return c.CObject(*args) + if domain == 'py': + cls, name = DomainDirectiveFactory.python_classes.get( + args[0], (python.PyClasslike, 'class')) + args[1] = [DomainDirectiveFactory.fix_python_signature(n) for n in args[1]] + else: + cls, name = DomainDirectiveFactory.cpp_classes.get( + args[0], (cpp.CPPMemberObject, 'member')) + # Replace the directive name because domain directives don't know how to handle + # Breathe's "doxygen" directives. + args = [name] + args[1:] + return cls(*args) + + +# Setup +# ----- + +def setup(app): + + cache_factory = CacheFactory() + cache = cache_factory.create_cache() + path_handler = PathHandler(app.confdir, os.sep, os.path.basename, os.path.join) + mtimer = MTimer(os.path.getmtime) + file_state_cache = FileStateCache(mtimer, app) + parser_factory = DoxygenParserFactory(cache, path_handler, file_state_cache) + glob_factory = GlobFactory(fnmatch.fnmatch) + filter_factory = FilterFactory(glob_factory, path_handler) + item_finder_factory_creator = DoxygenItemFinderFactoryCreator(parser_factory, filter_factory) + index_parser = parser_factory.create_index_parser() + finder_factory = FinderFactory(index_parser, item_finder_factory_creator) + + # Create a math_nodes object with a displaymath member for the displaymath + # node so that we can treat it in the same way as the nodes & addnodes + # modules in the NodeFactory + math_nodes = collections.namedtuple("MathNodes", ["displaymath"]) + math_nodes.displaymath = sphinx.ext.mathbase.displaymath + node_factory = NodeFactory(docutils.nodes, sphinx.addnodes, math_nodes) + + rst_content_creator = RstContentCreator(ViewList, textwrap.dedent) + renderer_factory_creator_constructor = DoxygenToRstRendererFactoryCreatorConstructor( + node_factory, + parser_factory, + DomainDirectiveFactory, + rst_content_creator + ) + + # Assume general build directory is the doctree directory without the last component. We strip + # off any trailing slashes so that dirname correctly drops the last part. This can be overriden + # with the breathe_build_directory config variable + build_dir = os.path.dirname(app.doctreedir.rstrip(os.sep)) + project_info_factory = ProjectInfoFactory(app.srcdir, build_dir, app.confdir, fnmatch.fnmatch) + target_handler_factory = TargetHandlerFactory(node_factory) + + root_data_object = RootDataObject() + + text_renderer = TextRenderer(app) + + directive_factory = DoxygenDirectiveFactory( + node_factory, + text_renderer, + root_data_object, + renderer_factory_creator_constructor, + finder_factory, + project_info_factory, + filter_factory, + target_handler_factory, + parser_factory + ) + + DoxygenFunctionDirective.app = app + + app.add_directive( + "doxygenindex", + directive_factory.create_index_directive_container(), + ) + + app.add_directive( + "doxygenfunction", + directive_factory.create_function_directive_container(), + ) + + app.add_directive( + "doxygenstruct", + directive_factory.create_struct_directive_container(), + ) + + app.add_directive( + "doxygenenum", + directive_factory.create_enum_directive_container(), + ) + + app.add_directive( + "doxygenenumvalue", + directive_factory.create_enumvalue_directive_container(), + ) + + app.add_directive( + "doxygentypedef", + directive_factory.create_typedef_directive_container(), + ) + + app.add_directive( + "doxygenunion", + directive_factory.create_union_directive_container(), + ) + + app.add_directive( + "doxygenclass", + directive_factory.create_class_directive_container(), + ) + + app.add_directive( + "doxygenfile", + directive_factory.create_file_directive_container(), + ) + + app.add_directive( + "doxygennamespace", + directive_factory.create_namespace_directive_container(), + ) + + app.add_directive( + "doxygengroup", + directive_factory.create_group_directive_container(), + ) + + app.add_directive( + "doxygenvariable", + directive_factory.create_variable_directive_container(), + ) + + app.add_directive( + "doxygendefine", + directive_factory.create_define_directive_container(), + ) + + app.add_directive( + "autodoxygenindex", + directive_factory.create_auto_index_directive_container(), + ) + + app.add_directive( + "autodoxygenfile", + directive_factory.create_auto_file_directive_container(), + ) + + app.add_config_value("breathe_projects", {}, True) + app.add_config_value("breathe_default_project", "", True) + # Provide reasonable defaults for domain_by_extension mapping. Can be overridden by users. + app.add_config_value("breathe_domain_by_extension", {'py': 'py'}, True) + app.add_config_value("breathe_domain_by_file_pattern", {}, True) + app.add_config_value("breathe_projects_source", {}, True) + app.add_config_value("breathe_build_directory", '', True) + app.add_config_value("breathe_default_members", (), True) + app.add_config_value("breathe_implementation_filename_extensions", ['.c', '.cc', '.cpp'], True) + + breathe_css = "breathe.css" + if (os.path.exists(os.path.join(app.confdir, "_static", breathe_css))): + app.add_stylesheet(breathe_css) + + doxygen_handle = AutoDoxygenProcessHandle( + path_handler, + subprocess.check_call, + write_file, + project_info_factory + ) + + app.connect("builder-inited", doxygen_handle.generate_xml) + + app.connect("builder-inited", directive_factory.get_config_values) + + app.connect("builder-inited", filter_factory.get_config_values) + + app.connect("env-get-outdated", file_state_cache.get_outdated) + + app.connect("env-purge-doc", file_state_cache.purge_doc) diff --git a/doc/breathe/directives.pyc b/doc/breathe/directives.pyc new file mode 100644 index 0000000..562ebf4 Binary files /dev/null and b/doc/breathe/directives.pyc differ diff --git a/doc/breathe/exception.py b/doc/breathe/exception.py new file mode 100644 index 0000000..ebb7b0d --- /dev/null +++ b/doc/breathe/exception.py @@ -0,0 +1,3 @@ + +class BreatheError(Exception): + pass diff --git a/doc/breathe/exception.pyc b/doc/breathe/exception.pyc new file mode 100644 index 0000000..5285d1e Binary files /dev/null and b/doc/breathe/exception.pyc differ diff --git a/doc/breathe/finder/__init__.py b/doc/breathe/finder/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/doc/breathe/finder/__init__.pyc b/doc/breathe/finder/__init__.pyc new file mode 100644 index 0000000..af53154 Binary files /dev/null and b/doc/breathe/finder/__init__.pyc differ diff --git a/doc/breathe/finder/core.py b/doc/breathe/finder/core.py new file mode 100644 index 0000000..a519a11 --- /dev/null +++ b/doc/breathe/finder/core.py @@ -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) + + diff --git a/doc/breathe/finder/core.pyc b/doc/breathe/finder/core.pyc new file mode 100644 index 0000000..d9ce31b Binary files /dev/null and b/doc/breathe/finder/core.pyc differ diff --git a/doc/breathe/finder/doxygen/__init__.py b/doc/breathe/finder/doxygen/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/doc/breathe/finder/doxygen/__init__.py @@ -0,0 +1 @@ + diff --git a/doc/breathe/finder/doxygen/__init__.pyc b/doc/breathe/finder/doxygen/__init__.pyc new file mode 100644 index 0000000..85d7ec6 Binary files /dev/null and b/doc/breathe/finder/doxygen/__init__.pyc differ diff --git a/doc/breathe/finder/doxygen/base.py b/doc/breathe/finder/doxygen/base.py new file mode 100644 index 0000000..0bccb75 --- /dev/null +++ b/doc/breathe/finder/doxygen/base.py @@ -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 + diff --git a/doc/breathe/finder/doxygen/base.pyc b/doc/breathe/finder/doxygen/base.pyc new file mode 100644 index 0000000..39f32a8 Binary files /dev/null and b/doc/breathe/finder/doxygen/base.pyc differ diff --git a/doc/breathe/finder/doxygen/compound.py b/doc/breathe/finder/doxygen/compound.py new file mode 100644 index 0000000..459190c --- /dev/null +++ b/doc/breathe/finder/doxygen/compound.py @@ -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) + diff --git a/doc/breathe/finder/doxygen/compound.pyc b/doc/breathe/finder/doxygen/compound.pyc new file mode 100644 index 0000000..3adaad4 Binary files /dev/null and b/doc/breathe/finder/doxygen/compound.pyc differ diff --git a/doc/breathe/finder/doxygen/core.py b/doc/breathe/finder/doxygen/core.py new file mode 100644 index 0000000..9b6c6f0 --- /dev/null +++ b/doc/breathe/finder/doxygen/core.py @@ -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) + + + diff --git a/doc/breathe/finder/doxygen/core.pyc b/doc/breathe/finder/doxygen/core.pyc new file mode 100644 index 0000000..5ed6829 Binary files /dev/null and b/doc/breathe/finder/doxygen/core.pyc differ diff --git a/doc/breathe/finder/doxygen/index.py b/doc/breathe/finder/doxygen/index.py new file mode 100644 index 0000000..f839953 --- /dev/null +++ b/doc/breathe/finder/doxygen/index.py @@ -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) diff --git a/doc/breathe/finder/doxygen/index.pyc b/doc/breathe/finder/doxygen/index.pyc new file mode 100644 index 0000000..b1b87a2 Binary files /dev/null and b/doc/breathe/finder/doxygen/index.pyc differ diff --git a/doc/breathe/parser/__init__.py b/doc/breathe/parser/__init__.py new file mode 100644 index 0000000..a88edf1 --- /dev/null +++ b/doc/breathe/parser/__init__.py @@ -0,0 +1,118 @@ + +import breathe.parser.doxygen.index +import breathe.parser.doxygen.compound + +class ParserError(Exception): + + def __init__(self, error, filename): + Exception.__init__(self, error) + + self.error = error + self.filename = filename + +class FileIOError(Exception): + + def __init__(self, error, filename): + Exception.__init__(self, error) + + self.error = error + self.filename = filename + +class Parser(object): + + def __init__(self, cache, path_handler, file_state_cache): + + self.cache = cache + self.path_handler = path_handler + self.file_state_cache = file_state_cache + +class DoxygenIndexParser(Parser): + + def __init__(self, cache, path_handler, file_state_cache): + Parser.__init__(self, cache, path_handler, file_state_cache) + + def parse(self, project_info): + + filename = self.path_handler.resolve_path( + project_info.project_path(), + "index.xml" + ) + + self.file_state_cache.update(filename) + + try: + # Try to get from our cache + return self.cache[filename] + except KeyError: + + # If that fails, parse it afresh + try: + result = breathe.parser.doxygen.index.parse(filename) + self.cache[filename] = result + return result + except breathe.parser.doxygen.index.ParseError as e: + raise ParserError(e, filename) + except breathe.parser.doxygen.index.FileIOError as e: + raise FileIOError(e, filename) + +class DoxygenCompoundParser(Parser): + + def __init__(self, cache, path_handler, file_state_cache, project_info): + Parser.__init__(self, cache, path_handler, file_state_cache) + + self.project_info = project_info + + def parse(self, refid): + + filename = self.path_handler.resolve_path( + self.project_info.project_path(), + "%s.xml" % refid + ) + + self.file_state_cache.update(filename) + + try: + # Try to get from our cache + return self.cache[filename] + except KeyError: + + # If that fails, parse it afresh + try: + result = breathe.parser.doxygen.compound.parse(filename) + self.cache[filename] = result + return result + except breathe.parser.doxygen.compound.ParseError as e: + raise ParserError(e, filename) + except breathe.parser.doxygen.compound.FileIOError as e: + raise FileIOError(e, filename) + +class CacheFactory(object): + + def create_cache(self): + + # Return basic dictionary as cache + return {} + +class DoxygenParserFactory(object): + + def __init__(self, cache, path_handler, file_state_cache): + + self.cache = cache + self.path_handler = path_handler + self.file_state_cache = file_state_cache + + def create_index_parser(self): + + return DoxygenIndexParser(self.cache, self.path_handler, self.file_state_cache) + + def create_compound_parser(self, project_info): + + return DoxygenCompoundParser( + self.cache, + self.path_handler, + self.file_state_cache, + project_info + ) + + + diff --git a/doc/breathe/parser/__init__.pyc b/doc/breathe/parser/__init__.pyc new file mode 100644 index 0000000..e0c22ea Binary files /dev/null and b/doc/breathe/parser/__init__.pyc differ diff --git a/doc/breathe/parser/doxygen/__init__.py b/doc/breathe/parser/doxygen/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/doc/breathe/parser/doxygen/__init__.pyc b/doc/breathe/parser/doxygen/__init__.pyc new file mode 100644 index 0000000..555c9d5 Binary files /dev/null and b/doc/breathe/parser/doxygen/__init__.pyc differ diff --git a/doc/breathe/parser/doxygen/compound.py b/doc/breathe/parser/doxygen/compound.py new file mode 100644 index 0000000..c177ec1 --- /dev/null +++ b/doc/breathe/parser/doxygen/compound.py @@ -0,0 +1,964 @@ +#!/usr/bin/env python + +""" +Generated Mon Feb 9 19:08:05 2009 by generateDS.py. +""" + +from xml.dom import minidom +from xml.dom import Node +from xml.parsers.expat import ExpatError + +from . import compoundsuper as supermod +from .compoundsuper import MixedContainer + + +class DoxygenTypeSub(supermod.DoxygenType): + + node_type = "doxygendef" + + def __init__(self, version=None, compounddef=None): + supermod.DoxygenType.__init__(self, version, compounddef) +supermod.DoxygenType.subclass = DoxygenTypeSub +# end class DoxygenTypeSub + + +class compounddefTypeSub(supermod.compounddefType): + + node_type = "compounddef" + + def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', + basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, + incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, + innerclass=None, innernamespace=None, innerpage=None, innergroup=None, + templateparamlist=None, sectiondef=None, briefdescription=None, + detaileddescription=None, inheritancegraph=None, collaborationgraph=None, + programlisting=None, location=None, listofallmembers=None): + + supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, + basecompoundref, derivedcompoundref, includes, includedby, + incdepgraph, invincdepgraph, innerdir, innerfile, + innerclass, innernamespace, innerpage, innergroup, + templateparamlist, sectiondef, briefdescription, + detaileddescription, inheritancegraph, collaborationgraph, + programlisting, location, listofallmembers) + +supermod.compounddefType.subclass = compounddefTypeSub +# end class compounddefTypeSub + + +class listofallmembersTypeSub(supermod.listofallmembersType): + + node_type = "listofallmembers" + + def __init__(self, member=None): + supermod.listofallmembersType.__init__(self, member) +supermod.listofallmembersType.subclass = listofallmembersTypeSub +# end class listofallmembersTypeSub + + +class memberRefTypeSub(supermod.memberRefType): + + node_type = "memberref" + + def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''): + supermod.memberRefType.__init__(self, virt, prot, refid, ambiguityscope, scope, name) +supermod.memberRefType.subclass = memberRefTypeSub +# end class memberRefTypeSub + + +class compoundRefTypeSub(supermod.compoundRefType): + + node_type = "compoundref" + + def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, + content_=None): + supermod.compoundRefType.__init__(self, mixedclass_, content_) +supermod.compoundRefType.subclass = compoundRefTypeSub +# end class compoundRefTypeSub + + +class reimplementTypeSub(supermod.reimplementType): + + node_type = "reimplement" + + def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None): + supermod.reimplementType.__init__(self, mixedclass_, content_) +supermod.reimplementType.subclass = reimplementTypeSub +# end class reimplementTypeSub + + +class incTypeSub(supermod.incType): + + node_type = "inc" + + def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None): + supermod.incType.__init__(self, mixedclass_, content_) +supermod.incType.subclass = incTypeSub +# end class incTypeSub + + +class refTypeSub(supermod.refType): + + node_type = "ref" + + def __init__(self, node_name, prot=None, refid=None, valueOf_='', mixedclass_=None, + content_=None): + supermod.refType.__init__(self, mixedclass_, content_) + + self.node_name = node_name + +supermod.refType.subclass = refTypeSub + + +class refTextTypeSub(supermod.refTextType): + + node_type = "reftex" + + def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, + content_=None): + supermod.refTextType.__init__(self, mixedclass_, content_) + +supermod.refTextType.subclass = refTextTypeSub +# end class refTextTypeSub + + +class sectiondefTypeSub(supermod.sectiondefType): + + node_type = "sectiondef" + + def __init__(self, kind=None, header='', description=None, memberdef=None): + supermod.sectiondefType.__init__(self, kind, header, description, memberdef) + +supermod.sectiondefType.subclass = sectiondefTypeSub +# end class sectiondefTypeSub + + +class memberdefTypeSub(supermod.memberdefType): + + node_type = "memberdef" + + def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, + readable=None, prot=None, explicit=None, new=None, final=None, writable=None, + add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, + inline=None, settable=None, id=None, templateparamlist=None, type_=None, + definition='', argsstring='', name='', read='', write='', bitfield='', + reimplements=None, reimplementedby=None, param=None, enumvalue=None, + initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, + inbodydescription=None, location=None, references=None, referencedby=None): + + supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, + readable, prot, explicit, new, final, writable, add, static, + remove, sealed, mutable, gettable, inline, settable, id, + templateparamlist, type_, definition, argsstring, name, + read, write, bitfield, reimplements, reimplementedby, param, + enumvalue, initializer, exceptions, briefdescription, + detaileddescription, inbodydescription, location, + references, referencedby) + + self.parameterlist = supermod.docParamListType.factory() + self.parameterlist.kind = "param" + + def buildChildren(self, child_, nodeName_): + supermod.memberdefType.buildChildren(self, child_, nodeName_) + + if child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'param': + + # Get latest param + param = self.param[-1] + + # If it doesn't have a description we're done + if not param.briefdescription: + return + + # Construct our own param list from the descriptions stored inline + # with the parameters + paramdescription = param.briefdescription + paramname = supermod.docParamName.factory() + + # Add parameter name + obj_ = paramname.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', + param.declname) + paramname.content_.append(obj_) + + paramnamelist = supermod.docParamNameList.factory() + paramnamelist.parametername.append(paramname) + + paramlistitem = supermod.docParamListItem.factory() + paramlistitem.parameternamelist.append(paramnamelist) + + # Add parameter description + paramlistitem.parameterdescription = paramdescription + + self.parameterlist.parameteritem.append(paramlistitem) + + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'detaileddescription': + + if not self.parameterlist.parameteritem: + # No items in our list + return + + # Assume supermod.memberdefType.buildChildren has already built the + # description object, we just want to slot our parameterlist in at + # a reasonable point + + if not self.detaileddescription: + # Create one if it doesn't exist + self.detaileddescription = supermod.descriptionType.factory() + + detaileddescription = self.detaileddescription + + para = supermod.docParaType.factory() + para.parameterlist.append(self.parameterlist) + + obj_ = detaileddescription.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', para) + + index = 0 + detaileddescription.content_.insert(index, obj_) + + +supermod.memberdefType.subclass = memberdefTypeSub +# end class memberdefTypeSub + + +class descriptionTypeSub(supermod.descriptionType): + + node_type = "description" + + def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, + content_=None): + supermod.descriptionType.__init__(self, mixedclass_, content_) + +supermod.descriptionType.subclass = descriptionTypeSub +# end class descriptionTypeSub + + +class enumvalueTypeSub(supermod.enumvalueType): + + node_type = "enumvalue" + + def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, + detaileddescription=None, mixedclass_=None, content_=None): + supermod.enumvalueType.__init__(self, mixedclass_, content_) + + self.initializer = None + + def buildChildren(self, child_, nodeName_): + # Get text from child and put it in self.name + if child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'name': + value_ = [] + for text_ in child_.childNodes: + value_.append(text_.nodeValue) + valuestr_ = ''.join(value_) + self.name = valuestr_ + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'briefdescription': + obj_ = supermod.descriptionType.factory() + obj_.build(child_) + self.set_briefdescription(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'detaileddescription': + obj_ = supermod.descriptionType.factory() + obj_.build(child_) + self.set_detaileddescription(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'initializer': + childobj_ = supermod.linkedTextType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, + 'initializer', childobj_) + self.set_initializer(obj_) + self.content_.append(obj_) + +supermod.enumvalueType.subclass = enumvalueTypeSub +# end class enumvalueTypeSub + + +class templateparamlistTypeSub(supermod.templateparamlistType): + + node_type = "templateparamlist" + + def __init__(self, param=None): + supermod.templateparamlistType.__init__(self, param) +supermod.templateparamlistType.subclass = templateparamlistTypeSub +# end class templateparamlistTypeSub + + +class paramTypeSub(supermod.paramType): + + node_type = "param" + + def __init__(self, type_=None, declname='', defname='', array='', defval=None, + briefdescription=None): + supermod.paramType.__init__(self, type_, declname, defname, array, defval, briefdescription) +supermod.paramType.subclass = paramTypeSub +# end class paramTypeSub + + +class linkedTextTypeSub(supermod.linkedTextType): + + node_type = "linkedtext" + + def __init__(self, ref=None, mixedclass_=None, content_=None): + supermod.linkedTextType.__init__(self, mixedclass_, content_) +supermod.linkedTextType.subclass = linkedTextTypeSub +# end class linkedTextTypeSub + + +class graphTypeSub(supermod.graphType): + + node_type = "graph" + + def __init__(self, node=None): + supermod.graphType.__init__(self, node) +supermod.graphType.subclass = graphTypeSub +# end class graphTypeSub + + +class nodeTypeSub(supermod.nodeType): + + node_type = "node" + + def __init__(self, id=None, label='', link=None, childnode=None): + supermod.nodeType.__init__(self, id, label, link, childnode) +supermod.nodeType.subclass = nodeTypeSub +# end class nodeTypeSub + + +class childnodeTypeSub(supermod.childnodeType): + + node_type = "childnode" + + def __init__(self, relation=None, refid=None, edgelabel=None): + supermod.childnodeType.__init__(self, relation, refid, edgelabel) +supermod.childnodeType.subclass = childnodeTypeSub +# end class childnodeTypeSub + + +class linkTypeSub(supermod.linkType): + + node_type = "link" + + def __init__(self, refid=None, external=None, valueOf_=''): + supermod.linkType.__init__(self, refid, external) +supermod.linkType.subclass = linkTypeSub +# end class linkTypeSub + + +class listingTypeSub(supermod.listingType): + + node_type = "listing" + + def __init__(self, codeline=None): + supermod.listingType.__init__(self, codeline) +supermod.listingType.subclass = listingTypeSub +# end class listingTypeSub + + +class codelineTypeSub(supermod.codelineType): + + node_type = "codeline" + + def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None): + supermod.codelineType.__init__(self, external, lineno, refkind, refid, highlight) +supermod.codelineType.subclass = codelineTypeSub +# end class codelineTypeSub + + +class highlightTypeSub(supermod.highlightType): + + node_type = "highlight" + + def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None): + supermod.highlightType.__init__(self, mixedclass_, content_) +supermod.highlightType.subclass = highlightTypeSub +# end class highlightTypeSub + + +class referenceTypeSub(supermod.referenceType): + + node_type = "reference" + + def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', + mixedclass_=None, content_=None): + supermod.referenceType.__init__(self, mixedclass_, content_) +supermod.referenceType.subclass = referenceTypeSub +# end class referenceTypeSub + + +class locationTypeSub(supermod.locationType): + + node_type = "location" + + def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, + valueOf_=''): + supermod.locationType.__init__(self, bodystart, line, bodyend, bodyfile, file) +supermod.locationType.subclass = locationTypeSub +# end class locationTypeSub + + +class docSect1TypeSub(supermod.docSect1Type): + + node_type = "docsect1" + + def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, + content_=None): + supermod.docSect1Type.__init__(self, mixedclass_, content_) +supermod.docSect1Type.subclass = docSect1TypeSub +# end class docSect1TypeSub + + +class docSect2TypeSub(supermod.docSect2Type): + + node_type = "docsect2" + + def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, + content_=None): + supermod.docSect2Type.__init__(self, mixedclass_, content_) +supermod.docSect2Type.subclass = docSect2TypeSub +# end class docSect2TypeSub + + +class docSect3TypeSub(supermod.docSect3Type): + + node_type = "docsect3" + + def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, + content_=None): + supermod.docSect3Type.__init__(self, mixedclass_, content_) +supermod.docSect3Type.subclass = docSect3TypeSub +# end class docSect3TypeSub + + +class docSect4TypeSub(supermod.docSect4Type): + + node_type = "docsect4" + + def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, + content_=None): + supermod.docSect4Type.__init__(self, mixedclass_, content_) +supermod.docSect4Type.subclass = docSect4TypeSub +# end class docSect4TypeSub + + +class docInternalTypeSub(supermod.docInternalType): + + node_type = "docinternal" + + def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None): + supermod.docInternalType.__init__(self, mixedclass_, content_) +supermod.docInternalType.subclass = docInternalTypeSub +# end class docInternalTypeSub + + +class docInternalS1TypeSub(supermod.docInternalS1Type): + + node_type = "docinternals1" + + def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None): + supermod.docInternalS1Type.__init__(self, mixedclass_, content_) +supermod.docInternalS1Type.subclass = docInternalS1TypeSub +# end class docInternalS1TypeSub + + +class docInternalS2TypeSub(supermod.docInternalS2Type): + + node_type = "docinternals2" + + def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): + supermod.docInternalS2Type.__init__(self, mixedclass_, content_) +supermod.docInternalS2Type.subclass = docInternalS2TypeSub +# end class docInternalS2TypeSub + + +class docInternalS3TypeSub(supermod.docInternalS3Type): + + node_type = "docinternals3" + + def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): + supermod.docInternalS3Type.__init__(self, mixedclass_, content_) +supermod.docInternalS3Type.subclass = docInternalS3TypeSub +# end class docInternalS3TypeSub + + +class docInternalS4TypeSub(supermod.docInternalS4Type): + + node_type = "docinternals4" + + def __init__(self, para=None, mixedclass_=None, content_=None): + supermod.docInternalS4Type.__init__(self, mixedclass_, content_) +supermod.docInternalS4Type.subclass = docInternalS4TypeSub +# end class docInternalS4TypeSub + + +class docURLLinkSub(supermod.docURLLink): + + node_type = "docurllink" + + def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None): + supermod.docURLLink.__init__(self, mixedclass_, content_) +supermod.docURLLink.subclass = docURLLinkSub +# end class docURLLinkSub + + +class docAnchorTypeSub(supermod.docAnchorType): + + node_type = "docanchor" + + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): + supermod.docAnchorType.__init__(self, mixedclass_, content_) +supermod.docAnchorType.subclass = docAnchorTypeSub +# end class docAnchorTypeSub + + +class docFormulaTypeSub(supermod.docFormulaType): + + node_type = "docformula" + + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): + supermod.docFormulaType.__init__(self, mixedclass_, content_) +supermod.docFormulaType.subclass = docFormulaTypeSub +# end class docFormulaTypeSub + + +class docIndexEntryTypeSub(supermod.docIndexEntryType): + + node_type = "docindexentry" + + def __init__(self, primaryie='', secondaryie=''): + supermod.docIndexEntryType.__init__(self, primaryie, secondaryie) +supermod.docIndexEntryType.subclass = docIndexEntryTypeSub +# end class docIndexEntryTypeSub + + +class docListTypeSub(supermod.docListType): + + node_type = "doclist" + + def __init__(self, listitem=None, subtype=""): + self.node_subtype = "itemized" + if subtype is not "": + self.node_subtype = subtype + supermod.docListType.__init__(self, listitem) +supermod.docListType.subclass = docListTypeSub +# end class docListTypeSub + + +class docListItemTypeSub(supermod.docListItemType): + + node_type = "doclistitem" + + def __init__(self, para=None): + supermod.docListItemType.__init__(self, para) +supermod.docListItemType.subclass = docListItemTypeSub +# end class docListItemTypeSub + + +class docSimpleSectTypeSub(supermod.docSimpleSectType): + + node_type = "docsimplesect" + + def __init__(self, kind=None, title=None, para=None): + supermod.docSimpleSectType.__init__(self, kind, title, para) +supermod.docSimpleSectType.subclass = docSimpleSectTypeSub +# end class docSimpleSectTypeSub + + +class docVarListEntryTypeSub(supermod.docVarListEntryType): + + node_type = "docvarlistentry" + + def __init__(self, term=None): + supermod.docVarListEntryType.__init__(self, term) +supermod.docVarListEntryType.subclass = docVarListEntryTypeSub +# end class docVarListEntryTypeSub + + +class docRefTextTypeSub(supermod.docRefTextType): + + node_type = "docreftext" + + def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, + content_=None): + supermod.docRefTextType.__init__(self, mixedclass_, content_) + + self.para = [] + + def buildChildren(self, child_, nodeName_): + supermod.docRefTextType.buildChildren(self, child_, nodeName_) + + if child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'para': + obj_ = supermod.docParaType.factory() + obj_.build(child_) + self.para.append(obj_) + +supermod.docRefTextType.subclass = docRefTextTypeSub +# end class docRefTextTypeSub + + +class docTableTypeSub(supermod.docTableType): + + node_type = "doctable" + + def __init__(self, rows=None, cols=None, row=None, caption=None): + supermod.docTableType.__init__(self, rows, cols, row, caption) +supermod.docTableType.subclass = docTableTypeSub +# end class docTableTypeSub + + +class docRowTypeSub(supermod.docRowType): + + node_type = "docrow" + + def __init__(self, entry=None): + supermod.docRowType.__init__(self, entry) +supermod.docRowType.subclass = docRowTypeSub +# end class docRowTypeSub + + +class docEntryTypeSub(supermod.docEntryType): + + node_type = "docentry" + + def __init__(self, thead=None, para=None): + supermod.docEntryType.__init__(self, thead, para) +supermod.docEntryType.subclass = docEntryTypeSub +# end class docEntryTypeSub + + +class docHeadingTypeSub(supermod.docHeadingType): + + node_type = "docheading" + + def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None): + supermod.docHeadingType.__init__(self, mixedclass_, content_) + + def buildChildren(self, child_, nodeName_): + supermod.docHeadingType.buildChildren(self, child_, nodeName_) + + # Account for styled content in the heading. This might need to be expanded to include other + # nodes as it seems from the xsd that headings can have a lot of different children but we + # really don't expect most of them to come up. + if child_.nodeType == Node.ELEMENT_NODE and ( + nodeName_ == 'bold' or + nodeName_ == 'emphasis' or + nodeName_ == 'computeroutput' or + nodeName_ == 'subscript' or + nodeName_ == 'superscript' or + nodeName_ == 'center' or + nodeName_ == 'small'): + obj_ = supermod.docMarkupType.factory() + obj_.build(child_) + obj_.type_ = nodeName_ + self.content_.append(obj_) + +supermod.docHeadingType.subclass = docHeadingTypeSub +# end class docHeadingTypeSub + + +class docImageTypeSub(supermod.docImageType): + + node_type = "docimage" + + def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', + mixedclass_=None, content_=None): + supermod.docImageType.__init__(self, mixedclass_, content_) +supermod.docImageType.subclass = docImageTypeSub +# end class docImageTypeSub + + +class docDotFileTypeSub(supermod.docDotFileType): + + node_type = "docdocfile" + + def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None): + supermod.docDotFileType.__init__(self, mixedclass_, content_) +supermod.docDotFileType.subclass = docDotFileTypeSub +# end class docDotFileTypeSub + + +class docTocItemTypeSub(supermod.docTocItemType): + + node_type = "doctocitem" + + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): + supermod.docTocItemType.__init__(self, mixedclass_, content_) +supermod.docTocItemType.subclass = docTocItemTypeSub +# end class docTocItemTypeSub + + +class docTocListTypeSub(supermod.docTocListType): + + node_type = "doctoclist" + + def __init__(self, tocitem=None): + supermod.docTocListType.__init__(self, tocitem) +supermod.docTocListType.subclass = docTocListTypeSub +# end class docTocListTypeSub + + +class docLanguageTypeSub(supermod.docLanguageType): + + node_type = "doclanguage" + + def __init__(self, langid=None, para=None): + supermod.docLanguageType.__init__(self, langid, para) +supermod.docLanguageType.subclass = docLanguageTypeSub +# end class docLanguageTypeSub + + +class docParamListTypeSub(supermod.docParamListType): + + node_type = "docparamlist" + + def __init__(self, kind=None, parameteritem=None): + supermod.docParamListType.__init__(self, kind, parameteritem) +supermod.docParamListType.subclass = docParamListTypeSub +# end class docParamListTypeSub + + +class docParamListItemSub(supermod.docParamListItem): + + node_type = "docparamlistitem" + + def __init__(self, parameternamelist=None, parameterdescription=None): + supermod.docParamListItem.__init__(self, parameternamelist, parameterdescription) +supermod.docParamListItem.subclass = docParamListItemSub +# end class docParamListItemSub + + +class docParamNameListSub(supermod.docParamNameList): + + node_type = "docparamnamelist" + + def __init__(self, parametername=None): + supermod.docParamNameList.__init__(self, parametername) +supermod.docParamNameList.subclass = docParamNameListSub +# end class docParamNameListSub + + +class docParamNameSub(supermod.docParamName): + + node_type = "docparamname" + + def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None): + supermod.docParamName.__init__(self, mixedclass_, content_) +supermod.docParamName.subclass = docParamNameSub +# end class docParamNameSub + + +class docXRefSectTypeSub(supermod.docXRefSectType): + + node_type = "docxrefsect" + + def __init__(self, id=None, xreftitle=None, xrefdescription=None): + supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription) +supermod.docXRefSectType.subclass = docXRefSectTypeSub +# end class docXRefSectTypeSub + + +class docCopyTypeSub(supermod.docCopyType): + + node_type = "doccopy" + + def __init__(self, link=None, para=None, sect1=None, internal=None): + supermod.docCopyType.__init__(self, link, para, sect1, internal) +supermod.docCopyType.subclass = docCopyTypeSub +# end class docCopyTypeSub + + +class docCharTypeSub(supermod.docCharType): + + node_type = "docchar" + + def __init__(self, char=None, valueOf_=''): + supermod.docCharType.__init__(self, char) +supermod.docCharType.subclass = docCharTypeSub +# end class docCharTypeSub + + +class verbatimTypeSub(object): + """ + New node type. Structure is largely pillaged from other nodes in order to + match the set. + """ + + node_type = "verbatim" + + def __init__(self, valueOf_='', mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + self.text = "" + + def factory(*args, **kwargs): + return verbatimTypeSub(*args, **kwargs) + + factory = staticmethod(factory) + + def buildAttributes(self, attrs): + pass + + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.text += child_.nodeValue + + +class docParaTypeSub(supermod.docParaType): + + node_type = "docpara" + + def __init__(self, char=None, valueOf_=''): + supermod.docParaType.__init__(self, char) + + self.parameterlist = [] + self.simplesects = [] + self.content = [] + self.programlisting = [] + self.images = [] + + def buildChildren(self, child_, nodeName_): + supermod.docParaType.buildChildren(self, child_, nodeName_) + + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "ref": + obj_ = supermod.docRefTextType.factory() + obj_.build(child_) + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'parameterlist': + obj_ = supermod.docParamListType.factory() + obj_.build(child_) + self.parameterlist.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'simplesect': + obj_ = supermod.docSimpleSectType.factory() + obj_.build(child_) + self.simplesects.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'programlisting': + obj_ = supermod.listingType.factory() + obj_.build(child_) + self.programlisting.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'image': + obj_ = supermod.docImageType.factory() + obj_.build(child_) + self.images.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and ( + nodeName_ == 'bold' or + nodeName_ == 'emphasis' or + nodeName_ == 'computeroutput' or + nodeName_ == 'subscript' or + nodeName_ == 'superscript' or + nodeName_ == 'center' or + nodeName_ == 'small'): + obj_ = supermod.docMarkupType.factory() + obj_.build(child_) + obj_.type_ = nodeName_ + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'verbatim': + childobj_ = verbatimTypeSub.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, + 'verbatim', childobj_) + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'formula': + childobj_ = docFormulaTypeSub.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, + 'formula', childobj_) + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "itemizedlist": + obj_ = supermod.docListType.factory(subtype="itemized") + obj_.build(child_) + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == "orderedlist": + obj_ = supermod.docListType.factory(subtype="ordered") + obj_.build(child_) + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'heading': + obj_ = supermod.docHeadingType.factory() + obj_.build(child_) + self.content.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'ulink': + obj_ = supermod.docURLLink.factory() + obj_.build(child_) + self.content.append(obj_) + +supermod.docParaType.subclass = docParaTypeSub +# end class docParaTypeSub + + +class docMarkupTypeSub(supermod.docMarkupType): + + node_type = "docmarkup" + + def __init__(self, valueOf_='', mixedclass_=None, content_=None): + supermod.docMarkupType.__init__(self, valueOf_, mixedclass_, content_) + self.type_ = None + + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, MixedContainer.TypeNone, '', + child_.nodeValue) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and nodeName_ == 'ref': + childobj_ = supermod.docRefTextType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, MixedContainer.TypeNone, 'ref', + childobj_) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' + +supermod.docMarkupType.subclass = docMarkupTypeSub +# end class docMarkupTypeSub + + +class docTitleTypeSub(supermod.docTitleType): + + node_type = "doctitle" + + def __init__(self, valueOf_='', mixedclass_=None, content_=None): + supermod.docTitleType.__init__(self, valueOf_, mixedclass_, content_) + self.type_ = None + +supermod.docTitleType.subclass = docTitleTypeSub +# end class docTitleTypeSub + + +class ParseError(Exception): + pass + + +class FileIOError(Exception): + pass + + +def parse(inFilename): + + try: + doc = minidom.parse(inFilename) + except IOError as e: + raise FileIOError(e) + except ExpatError as e: + raise ParseError(e) + + rootNode = doc.documentElement + rootObj = supermod.DoxygenType.factory() + rootObj.build(rootNode) + return rootObj + + diff --git a/doc/breathe/parser/doxygen/compound.pyc b/doc/breathe/parser/doxygen/compound.pyc new file mode 100644 index 0000000..bff7aae Binary files /dev/null and b/doc/breathe/parser/doxygen/compound.pyc differ diff --git a/doc/breathe/parser/doxygen/compoundsuper.py b/doc/breathe/parser/doxygen/compoundsuper.py new file mode 100644 index 0000000..418a85d --- /dev/null +++ b/doc/breathe/parser/doxygen/compoundsuper.py @@ -0,0 +1,5798 @@ +#!/usr/bin/env python + +# +# Generated Thu Jun 11 18:44:25 2009 by generateDS.py. +# + +import sys +import getopt +from xml.dom import minidom +from xml.dom import Node + +# +# User methods +# +# Calls to the methods in these classes are generated by generateDS.py. +# You can replace these methods by re-implementing the following class +# in a module named generatedssuper.py. + +try: + from generatedssuper import GeneratedsSuper +except ImportError as exp: + + class GeneratedsSuper: + def format_string(self, input_data, input_name=''): + return input_data + def format_integer(self, input_data, input_name=''): + return '%d' % input_data + def format_float(self, input_data, input_name=''): + return '%f' % input_data + def format_double(self, input_data, input_name=''): + return '%e' % input_data + def format_boolean(self, input_data, input_name=''): + return '%s' % input_data + + +# +# If you have installed IPython you can uncomment and use the following. +# IPython is available from http://ipython.scipy.org/. +# + +## from IPython.Shell import IPShellEmbed +## args = '' +## ipshell = IPShellEmbed(args, +## banner = 'Dropping into IPython', +## exit_msg = 'Leaving Interpreter, back to program.') + +# Then use the following line where and when you want to drop into the +# IPython shell: +# ipshell(' -- Entering ipshell.\nHit Ctrl-D to exit') + +# +# Globals +# + +ExternalEncoding = 'ascii' + +# +# Support/utility functions. +# + +def showIndent(outfile, level): + for idx in range(level): + outfile.write(' ') + +def quote_xml(inStr): + s1 = (isinstance(inStr, basestring) and inStr or + '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + return s1 + +def quote_attrib(inStr): + s1 = (isinstance(inStr, basestring) and inStr or + '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + if '"' in s1: + if "'" in s1: + s1 = '"%s"' % s1.replace('"', """) + else: + s1 = "'%s'" % s1 + else: + s1 = '"%s"' % s1 + return s1 + +def quote_python(inStr): + s1 = inStr + if s1.find("'") == -1: + if s1.find('\n') == -1: + return "'%s'" % s1 + else: + return "'''%s'''" % s1 + else: + if s1.find('"') != -1: + s1 = s1.replace('"', '\\"') + if s1.find('\n') == -1: + return '"%s"' % s1 + else: + return '"""%s"""' % s1 + + +class MixedContainer: + + node_type = "mixedcontainer" + + # Constants for category: + CategoryNone = 0 + CategoryText = 1 + CategorySimple = 2 + CategoryComplex = 3 + # Constants for content_type: + TypeNone = 0 + TypeText = 1 + TypeString = 2 + TypeInteger = 3 + TypeFloat = 4 + TypeDecimal = 5 + TypeDouble = 6 + TypeBoolean = 7 + def __init__(self, category, content_type, name, value): + self.category = category + self.content_type = content_type + self.name = name + self.value = value + def getCategory(self): + return self.category + def getContenttype(self, content_type): + return self.content_type + def getValue(self): + return self.value + def getName(self): + return self.name + + +class _MemberSpec(object): + def __init__(self, name='', data_type='', container=0): + self.name = name + self.data_type = data_type + self.container = container + def set_name(self, name): self.name = name + def get_name(self): return self.name + def set_data_type(self, data_type): self.data_type = data_type + def get_data_type(self): return self.data_type + def set_container(self, container): self.container = container + def get_container(self): return self.container + + +# +# Data representation classes. +# + +class DoxygenType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, version=None, compounddef=None): + self.version = version + self.compounddef = compounddef + def factory(*args_, **kwargs_): + if DoxygenType.subclass: + return DoxygenType.subclass(*args_, **kwargs_) + else: + return DoxygenType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_compounddef(self): return self.compounddef + def set_compounddef(self, compounddef): self.compounddef = compounddef + def get_version(self): return self.version + def set_version(self, version): self.version = version + def hasContent_(self): + if ( + self.compounddef is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('version'): + self.version = attrs.get('version').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'compounddef': + obj_ = compounddefType.factory() + obj_.build(child_) + self.set_compounddef(obj_) +# end class DoxygenType + + +class compounddefType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, kind=None, prot=None, id=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None): + self.kind = kind + self.prot = prot + self.id = id + self.compoundname = compoundname + self.title = title + if basecompoundref is None: + self.basecompoundref = [] + else: + self.basecompoundref = basecompoundref + if derivedcompoundref is None: + self.derivedcompoundref = [] + else: + self.derivedcompoundref = derivedcompoundref + if includes is None: + self.includes = [] + else: + self.includes = includes + if includedby is None: + self.includedby = [] + else: + self.includedby = includedby + self.incdepgraph = incdepgraph + self.invincdepgraph = invincdepgraph + if innerdir is None: + self.innerdir = [] + else: + self.innerdir = innerdir + if innerfile is None: + self.innerfile = [] + else: + self.innerfile = innerfile + if innerclass is None: + self.innerclass = [] + else: + self.innerclass = innerclass + if innernamespace is None: + self.innernamespace = [] + else: + self.innernamespace = innernamespace + if innerpage is None: + self.innerpage = [] + else: + self.innerpage = innerpage + if innergroup is None: + self.innergroup = [] + else: + self.innergroup = innergroup + self.templateparamlist = templateparamlist + if sectiondef is None: + self.sectiondef = [] + else: + self.sectiondef = sectiondef + self.briefdescription = briefdescription + self.detaileddescription = detaileddescription + self.inheritancegraph = inheritancegraph + self.collaborationgraph = collaborationgraph + self.programlisting = programlisting + self.location = location + self.listofallmembers = listofallmembers + self.namespaces = [] + def factory(*args_, **kwargs_): + if compounddefType.subclass: + return compounddefType.subclass(*args_, **kwargs_) + else: + return compounddefType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_compoundname(self): return self.compoundname + def set_compoundname(self, compoundname): self.compoundname = compoundname + def get_title(self): return self.title + def set_title(self, title): self.title = title + def get_basecompoundref(self): return self.basecompoundref + def set_basecompoundref(self, basecompoundref): self.basecompoundref = basecompoundref + def add_basecompoundref(self, value): self.basecompoundref.append(value) + def insert_basecompoundref(self, index, value): self.basecompoundref[index] = value + def get_derivedcompoundref(self): return self.derivedcompoundref + def set_derivedcompoundref(self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref + def add_derivedcompoundref(self, value): self.derivedcompoundref.append(value) + def insert_derivedcompoundref(self, index, value): self.derivedcompoundref[index] = value + def get_includes(self): return self.includes + def set_includes(self, includes): self.includes = includes + def add_includes(self, value): self.includes.append(value) + def insert_includes(self, index, value): self.includes[index] = value + def get_includedby(self): return self.includedby + def set_includedby(self, includedby): self.includedby = includedby + def add_includedby(self, value): self.includedby.append(value) + def insert_includedby(self, index, value): self.includedby[index] = value + def get_incdepgraph(self): return self.incdepgraph + def set_incdepgraph(self, incdepgraph): self.incdepgraph = incdepgraph + def get_invincdepgraph(self): return self.invincdepgraph + def set_invincdepgraph(self, invincdepgraph): self.invincdepgraph = invincdepgraph + def get_innerdir(self): return self.innerdir + def set_innerdir(self, innerdir): self.innerdir = innerdir + def add_innerdir(self, value): self.innerdir.append(value) + def insert_innerdir(self, index, value): self.innerdir[index] = value + def get_innerfile(self): return self.innerfile + def set_innerfile(self, innerfile): self.innerfile = innerfile + def add_innerfile(self, value): self.innerfile.append(value) + def insert_innerfile(self, index, value): self.innerfile[index] = value + def get_innerclass(self): return self.innerclass + def set_innerclass(self, innerclass): self.innerclass = innerclass + def add_innerclass(self, value): self.innerclass.append(value) + def insert_innerclass(self, index, value): self.innerclass[index] = value + def get_innernamespace(self): return self.innernamespace + def set_innernamespace(self, innernamespace): self.innernamespace = innernamespace + def add_innernamespace(self, value): self.innernamespace.append(value) + def insert_innernamespace(self, index, value): self.innernamespace[index] = value + def get_innerpage(self): return self.innerpage + def set_innerpage(self, innerpage): self.innerpage = innerpage + def add_innerpage(self, value): self.innerpage.append(value) + def insert_innerpage(self, index, value): self.innerpage[index] = value + def get_innergroup(self): return self.innergroup + def set_innergroup(self, innergroup): self.innergroup = innergroup + def add_innergroup(self, value): self.innergroup.append(value) + def insert_innergroup(self, index, value): self.innergroup[index] = value + def get_templateparamlist(self): return self.templateparamlist + def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist + def get_sectiondef(self): return self.sectiondef + def set_sectiondef(self, sectiondef): self.sectiondef = sectiondef + def add_sectiondef(self, value): self.sectiondef.append(value) + def insert_sectiondef(self, index, value): self.sectiondef[index] = value + def get_briefdescription(self): return self.briefdescription + def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + def get_detaileddescription(self): return self.detaileddescription + def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription + def get_inheritancegraph(self): return self.inheritancegraph + def set_inheritancegraph(self, inheritancegraph): self.inheritancegraph = inheritancegraph + def get_collaborationgraph(self): return self.collaborationgraph + def set_collaborationgraph(self, collaborationgraph): self.collaborationgraph = collaborationgraph + def get_programlisting(self): return self.programlisting + def set_programlisting(self, programlisting): self.programlisting = programlisting + def get_location(self): return self.location + def set_location(self, location): self.location = location + def get_listofallmembers(self): return self.listofallmembers + def set_listofallmembers(self, listofallmembers): self.listofallmembers = listofallmembers + def get_kind(self): return self.kind + def set_kind(self, kind): self.kind = kind + def get_prot(self): return self.prot + def set_prot(self, prot): self.prot = prot + def get_id(self): return self.id + def set_id(self, id): self.id = id + def hasContent_(self): + if ( + self.compoundname is not None or + self.title is not None or + self.basecompoundref is not None or + self.derivedcompoundref is not None or + self.includes is not None or + self.includedby is not None or + self.incdepgraph is not None or + self.invincdepgraph is not None or + self.innerdir is not None or + self.innerfile is not None or + self.innerclass is not None or + self.innernamespace is not None or + self.innerpage is not None or + self.innergroup is not None or + self.templateparamlist is not None or + self.sectiondef is not None or + self.briefdescription is not None or + self.detaileddescription is not None or + self.inheritancegraph is not None or + self.collaborationgraph is not None or + self.programlisting is not None or + self.location is not None or + self.listofallmembers is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('kind'): + self.kind = attrs.get('kind').value + if attrs.get('prot'): + self.prot = attrs.get('prot').value + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'compoundname': + compoundname_ = '' + for text__content_ in child_.childNodes: + compoundname_ += text__content_.nodeValue + self.compoundname = compoundname_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'title': + obj_ = docTitleType.factory() + obj_.build(child_) + self.set_title(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'basecompoundref': + obj_ = compoundRefType.factory() + obj_.build(child_) + self.basecompoundref.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'derivedcompoundref': + obj_ = compoundRefType.factory() + obj_.build(child_) + self.derivedcompoundref.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'includes': + obj_ = incType.factory() + obj_.build(child_) + self.includes.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'includedby': + obj_ = incType.factory() + obj_.build(child_) + self.includedby.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'incdepgraph': + obj_ = graphType.factory() + obj_.build(child_) + self.set_incdepgraph(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'invincdepgraph': + obj_ = graphType.factory() + obj_.build(child_) + self.set_invincdepgraph(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'innerdir': + obj_ = refType.factory(nodeName_) + obj_.build(child_) + self.innerdir.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'innerfile': + obj_ = refType.factory(nodeName_) + obj_.build(child_) + self.innerfile.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'innerclass': + obj_ = refType.factory(nodeName_) + obj_.build(child_) + self.innerclass.append(obj_) + self.namespaces.append(obj_.content_[0].getValue()) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'innernamespace': + obj_ = refType.factory(nodeName_) + obj_.build(child_) + self.innernamespace.append(obj_) + self.namespaces.append(obj_.content_[0].getValue()) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'innerpage': + obj_ = refType.factory(nodeName_) + obj_.build(child_) + self.innerpage.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'innergroup': + obj_ = refType.factory(nodeName_) + obj_.build(child_) + self.innergroup.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'templateparamlist': + obj_ = templateparamlistType.factory() + obj_.build(child_) + self.set_templateparamlist(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sectiondef': + obj_ = sectiondefType.factory() + obj_.build(child_) + self.sectiondef.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'briefdescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_briefdescription(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'detaileddescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_detaileddescription(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'inheritancegraph': + obj_ = graphType.factory() + obj_.build(child_) + self.set_inheritancegraph(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'collaborationgraph': + obj_ = graphType.factory() + obj_.build(child_) + self.set_collaborationgraph(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'programlisting': + obj_ = listingType.factory() + obj_.build(child_) + self.set_programlisting(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'location': + obj_ = locationType.factory() + obj_.build(child_) + self.set_location(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'listofallmembers': + obj_ = listofallmembersType.factory() + obj_.build(child_) + self.set_listofallmembers(obj_) +# end class compounddefType + + +class listofallmembersType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, member=None): + if member is None: + self.member = [] + else: + self.member = member + def factory(*args_, **kwargs_): + if listofallmembersType.subclass: + return listofallmembersType.subclass(*args_, **kwargs_) + else: + return listofallmembersType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_member(self): return self.member + def set_member(self, member): self.member = member + def add_member(self, value): self.member.append(value) + def insert_member(self, index, value): self.member[index] = value + def hasContent_(self): + if ( + self.member is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'member': + obj_ = memberRefType.factory() + obj_.build(child_) + self.member.append(obj_) +# end class listofallmembersType + + +class memberRefType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope=None, name=None): + self.virt = virt + self.prot = prot + self.refid = refid + self.ambiguityscope = ambiguityscope + self.scope = scope + self.name = name + def factory(*args_, **kwargs_): + if memberRefType.subclass: + return memberRefType.subclass(*args_, **kwargs_) + else: + return memberRefType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_scope(self): return self.scope + def set_scope(self, scope): self.scope = scope + def get_name(self): return self.name + def set_name(self, name): self.name = name + def get_virt(self): return self.virt + def set_virt(self, virt): self.virt = virt + def get_prot(self): return self.prot + def set_prot(self, prot): self.prot = prot + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def get_ambiguityscope(self): return self.ambiguityscope + def set_ambiguityscope(self, ambiguityscope): self.ambiguityscope = ambiguityscope + def hasContent_(self): + if ( + self.scope is not None or + self.name is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('virt'): + self.virt = attrs.get('virt').value + if attrs.get('prot'): + self.prot = attrs.get('prot').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + if attrs.get('ambiguityscope'): + self.ambiguityscope = attrs.get('ambiguityscope').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'scope': + scope_ = '' + for text__content_ in child_.childNodes: + scope_ += text__content_.nodeValue + self.scope = scope_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'name': + name_ = '' + for text__content_ in child_.childNodes: + name_ += text__content_.nodeValue + self.name = name_ +# end class memberRefType + + +class scope(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if scope.subclass: + return scope.subclass(*args_, **kwargs_) + else: + return scope(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class scope + + +class name(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if name.subclass: + return name.subclass(*args_, **kwargs_) + else: + return name(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class name + + +class compoundRefType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): + self.virt = virt + self.prot = prot + self.refid = refid + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if compoundRefType.subclass: + return compoundRefType.subclass(*args_, **kwargs_) + else: + return compoundRefType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_virt(self): return self.virt + def set_virt(self, virt): self.virt = virt + def get_prot(self): return self.prot + def set_prot(self, prot): self.prot = prot + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('virt'): + self.virt = attrs.get('virt').value + if attrs.get('prot'): + self.prot = attrs.get('prot').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class compoundRefType + + +class reimplementType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None): + self.refid = refid + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if reimplementType.subclass: + return reimplementType.subclass(*args_, **kwargs_) + else: + return reimplementType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class reimplementType + + +class incType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None): + self.local = local + self.refid = refid + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if incType.subclass: + return incType.subclass(*args_, **kwargs_) + else: + return incType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_local(self): return self.local + def set_local(self, local): self.local = local + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('local'): + self.local = attrs.get('local').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class incType + + +class refType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): + self.prot = prot + self.refid = refid + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if refType.subclass: + return refType.subclass(*args_, **kwargs_) + else: + return refType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_prot(self): return self.prot + def set_prot(self, prot): self.prot = prot + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('prot'): + self.prot = attrs.get('prot').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class refType + + +class refTextType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): + self.refid = refid + self.kindref = kindref + self.external = external + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if refTextType.subclass: + return refTextType.subclass(*args_, **kwargs_) + else: + return refTextType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def get_kindref(self): return self.kindref + def set_kindref(self, kindref): self.kindref = kindref + def get_external(self): return self.external + def set_external(self, external): self.external = external + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('refid'): + self.refid = attrs.get('refid').value + if attrs.get('kindref'): + self.kindref = attrs.get('kindref').value + if attrs.get('external'): + self.external = attrs.get('external').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class refTextType + + +class sectiondefType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, kind=None, header=None, description=None, memberdef=None): + self.kind = kind + self.header = header + self.description = description + if memberdef is None: + self.memberdef = [] + else: + self.memberdef = memberdef + def factory(*args_, **kwargs_): + if sectiondefType.subclass: + return sectiondefType.subclass(*args_, **kwargs_) + else: + return sectiondefType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_header(self): return self.header + def set_header(self, header): self.header = header + def get_description(self): return self.description + def set_description(self, description): self.description = description + def get_memberdef(self): return self.memberdef + def set_memberdef(self, memberdef): self.memberdef = memberdef + def add_memberdef(self, value): self.memberdef.append(value) + def insert_memberdef(self, index, value): self.memberdef[index] = value + def get_kind(self): return self.kind + def set_kind(self, kind): self.kind = kind + def hasContent_(self): + if ( + self.header is not None or + self.description is not None or + self.memberdef is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('kind'): + self.kind = attrs.get('kind').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'header': + header_ = '' + for text__content_ in child_.childNodes: + header_ += text__content_.nodeValue + self.header = header_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'description': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_description(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'memberdef': + obj_ = memberdefType.factory() + obj_.build(child_) + self.memberdef.append(obj_) +# end class sectiondefType + + +class memberdefType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None): + self.initonly = initonly + self.kind = kind + self.volatile = volatile + self.const = const + self.raisexx = raisexx + self.virt = virt + self.readable = readable + self.prot = prot + self.explicit = explicit + self.new = new + self.final = final + self.writable = writable + self.add = add + self.static = static + self.remove = remove + self.sealed = sealed + self.mutable = mutable + self.gettable = gettable + self.inline = inline + self.settable = settable + self.id = id + self.templateparamlist = templateparamlist + self.type_ = type_ + self.definition = definition + self.argsstring = argsstring + self.name = name + self.read = read + self.write = write + self.bitfield = bitfield + if reimplements is None: + self.reimplements = [] + else: + self.reimplements = reimplements + if reimplementedby is None: + self.reimplementedby = [] + else: + self.reimplementedby = reimplementedby + if param is None: + self.param = [] + else: + self.param = param + if enumvalue is None: + self.enumvalue = [] + else: + self.enumvalue = enumvalue + self.initializer = initializer + self.exceptions = exceptions + self.briefdescription = briefdescription + self.detaileddescription = detaileddescription + self.inbodydescription = inbodydescription + self.location = location + if references is None: + self.references = [] + else: + self.references = references + if referencedby is None: + self.referencedby = [] + else: + self.referencedby = referencedby + def factory(*args_, **kwargs_): + if memberdefType.subclass: + return memberdefType.subclass(*args_, **kwargs_) + else: + return memberdefType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_templateparamlist(self): return self.templateparamlist + def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist + def get_type(self): return self.type_ + def set_type(self, type_): self.type_ = type_ + def get_definition(self): return self.definition + def set_definition(self, definition): self.definition = definition + def get_argsstring(self): return self.argsstring + def set_argsstring(self, argsstring): self.argsstring = argsstring + def get_name(self): return self.name + def set_name(self, name): self.name = name + def get_read(self): return self.read + def set_read(self, read): self.read = read + def get_write(self): return self.write + def set_write(self, write): self.write = write + def get_bitfield(self): return self.bitfield + def set_bitfield(self, bitfield): self.bitfield = bitfield + def get_reimplements(self): return self.reimplements + def set_reimplements(self, reimplements): self.reimplements = reimplements + def add_reimplements(self, value): self.reimplements.append(value) + def insert_reimplements(self, index, value): self.reimplements[index] = value + def get_reimplementedby(self): return self.reimplementedby + def set_reimplementedby(self, reimplementedby): self.reimplementedby = reimplementedby + def add_reimplementedby(self, value): self.reimplementedby.append(value) + def insert_reimplementedby(self, index, value): self.reimplementedby[index] = value + def get_param(self): return self.param + def set_param(self, param): self.param = param + def add_param(self, value): self.param.append(value) + def insert_param(self, index, value): self.param[index] = value + def get_enumvalue(self): return self.enumvalue + def set_enumvalue(self, enumvalue): self.enumvalue = enumvalue + def add_enumvalue(self, value): self.enumvalue.append(value) + def insert_enumvalue(self, index, value): self.enumvalue[index] = value + def get_initializer(self): return self.initializer + def set_initializer(self, initializer): self.initializer = initializer + def get_exceptions(self): return self.exceptions + def set_exceptions(self, exceptions): self.exceptions = exceptions + def get_briefdescription(self): return self.briefdescription + def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + def get_detaileddescription(self): return self.detaileddescription + def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription + def get_inbodydescription(self): return self.inbodydescription + def set_inbodydescription(self, inbodydescription): self.inbodydescription = inbodydescription + def get_location(self): return self.location + def set_location(self, location): self.location = location + def get_references(self): return self.references + def set_references(self, references): self.references = references + def add_references(self, value): self.references.append(value) + def insert_references(self, index, value): self.references[index] = value + def get_referencedby(self): return self.referencedby + def set_referencedby(self, referencedby): self.referencedby = referencedby + def add_referencedby(self, value): self.referencedby.append(value) + def insert_referencedby(self, index, value): self.referencedby[index] = value + def get_initonly(self): return self.initonly + def set_initonly(self, initonly): self.initonly = initonly + def get_kind(self): return self.kind + def set_kind(self, kind): self.kind = kind + def get_volatile(self): return self.volatile + def set_volatile(self, volatile): self.volatile = volatile + def get_const(self): return self.const + def set_const(self, const): self.const = const + def get_raise(self): return self.raisexx + def set_raise(self, raisexx): self.raisexx = raisexx + def get_virt(self): return self.virt + def set_virt(self, virt): self.virt = virt + def get_readable(self): return self.readable + def set_readable(self, readable): self.readable = readable + def get_prot(self): return self.prot + def set_prot(self, prot): self.prot = prot + def get_explicit(self): return self.explicit + def set_explicit(self, explicit): self.explicit = explicit + def get_new(self): return self.new + def set_new(self, new): self.new = new + def get_final(self): return self.final + def set_final(self, final): self.final = final + def get_writable(self): return self.writable + def set_writable(self, writable): self.writable = writable + def get_add(self): return self.add + def set_add(self, add): self.add = add + def get_static(self): return self.static + def set_static(self, static): self.static = static + def get_remove(self): return self.remove + def set_remove(self, remove): self.remove = remove + def get_sealed(self): return self.sealed + def set_sealed(self, sealed): self.sealed = sealed + def get_mutable(self): return self.mutable + def set_mutable(self, mutable): self.mutable = mutable + def get_gettable(self): return self.gettable + def set_gettable(self, gettable): self.gettable = gettable + def get_inline(self): return self.inline + def set_inline(self, inline): self.inline = inline + def get_settable(self): return self.settable + def set_settable(self, settable): self.settable = settable + def get_id(self): return self.id + def set_id(self, id): self.id = id + def hasContent_(self): + if ( + self.templateparamlist is not None or + self.type_ is not None or + self.definition is not None or + self.argsstring is not None or + self.name is not None or + self.read is not None or + self.write is not None or + self.bitfield is not None or + self.reimplements is not None or + self.reimplementedby is not None or + self.param is not None or + self.enumvalue is not None or + self.initializer is not None or + self.exceptions is not None or + self.briefdescription is not None or + self.detaileddescription is not None or + self.inbodydescription is not None or + self.location is not None or + self.references is not None or + self.referencedby is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('initonly'): + self.initonly = attrs.get('initonly').value + if attrs.get('kind'): + self.kind = attrs.get('kind').value + if attrs.get('volatile'): + self.volatile = attrs.get('volatile').value + if attrs.get('const'): + self.const = attrs.get('const').value + if attrs.get('raise'): + self.raisexx = attrs.get('raise').value + if attrs.get('virt'): + self.virt = attrs.get('virt').value + if attrs.get('readable'): + self.readable = attrs.get('readable').value + if attrs.get('prot'): + self.prot = attrs.get('prot').value + if attrs.get('explicit'): + self.explicit = attrs.get('explicit').value + if attrs.get('new'): + self.new = attrs.get('new').value + if attrs.get('final'): + self.final = attrs.get('final').value + if attrs.get('writable'): + self.writable = attrs.get('writable').value + if attrs.get('add'): + self.add = attrs.get('add').value + if attrs.get('static'): + self.static = attrs.get('static').value + if attrs.get('remove'): + self.remove = attrs.get('remove').value + if attrs.get('sealed'): + self.sealed = attrs.get('sealed').value + if attrs.get('mutable'): + self.mutable = attrs.get('mutable').value + if attrs.get('gettable'): + self.gettable = attrs.get('gettable').value + if attrs.get('inline'): + self.inline = attrs.get('inline').value + if attrs.get('settable'): + self.settable = attrs.get('settable').value + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'templateparamlist': + obj_ = templateparamlistType.factory() + obj_.build(child_) + self.set_templateparamlist(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'type': + obj_ = linkedTextType.factory() + obj_.build(child_) + self.set_type(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'definition': + definition_ = '' + for text__content_ in child_.childNodes: + definition_ += text__content_.nodeValue + self.definition = definition_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'argsstring': + argsstring_ = '' + for text__content_ in child_.childNodes: + argsstring_ += text__content_.nodeValue + self.argsstring = argsstring_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'name': + name_ = '' + for text__content_ in child_.childNodes: + name_ += text__content_.nodeValue + self.name = name_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'read': + read_ = '' + for text__content_ in child_.childNodes: + read_ += text__content_.nodeValue + self.read = read_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'write': + write_ = '' + for text__content_ in child_.childNodes: + write_ += text__content_.nodeValue + self.write = write_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'bitfield': + bitfield_ = '' + for text__content_ in child_.childNodes: + bitfield_ += text__content_.nodeValue + self.bitfield = bitfield_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'reimplements': + obj_ = reimplementType.factory() + obj_.build(child_) + self.reimplements.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'reimplementedby': + obj_ = reimplementType.factory() + obj_.build(child_) + self.reimplementedby.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'param': + obj_ = paramType.factory() + obj_.build(child_) + self.param.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'enumvalue': + obj_ = enumvalueType.factory() + obj_.build(child_) + self.enumvalue.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'initializer': + obj_ = linkedTextType.factory() + obj_.build(child_) + self.set_initializer(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'exceptions': + obj_ = linkedTextType.factory() + obj_.build(child_) + self.set_exceptions(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'briefdescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_briefdescription(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'detaileddescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_detaileddescription(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'inbodydescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_inbodydescription(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'location': + obj_ = locationType.factory() + obj_.build(child_) + self.set_location(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'references': + obj_ = referenceType.factory() + obj_.build(child_) + self.references.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'referencedby': + obj_ = referenceType.factory() + obj_.build(child_) + self.referencedby.append(obj_) +# end class memberdefType + + +class definition(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if definition.subclass: + return definition.subclass(*args_, **kwargs_) + else: + return definition(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class definition + + +class argsstring(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if argsstring.subclass: + return argsstring.subclass(*args_, **kwargs_) + else: + return argsstring(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='argsstring', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='argsstring') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class argsstring + + +class read(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if read.subclass: + return read.subclass(*args_, **kwargs_) + else: + return read(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class read + + +class write(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if write.subclass: + return write.subclass(*args_, **kwargs_) + else: + return write(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class write + + +class bitfield(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if bitfield.subclass: + return bitfield.subclass(*args_, **kwargs_) + else: + return bitfield(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class bitfield + + +class descriptionType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, title=None, para=None, sect1=None, internal=None, mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if descriptionType.subclass: + return descriptionType.subclass(*args_, **kwargs_) + else: + return descriptionType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_title(self): return self.title + def set_title(self, title): self.title = title + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect1(self): return self.sect1 + def set_sect1(self, sect1): self.sect1 = sect1 + def add_sect1(self, value): self.sect1.append(value) + def insert_sect1(self, index, value): self.sect1[index] = value + def get_internal(self): return self.internal + def set_internal(self, internal): self.internal = internal + def hasContent_(self): + if ( + self.title is not None or + self.para is not None or + self.sect1 is not None or + self.internal is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'title': + childobj_ = docTitleType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'title', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect1': + childobj_ = docSect1Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect1', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'internal': + childobj_ = docInternalType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'internal', childobj_) + self.content_.append(obj_) +# end class descriptionType + + +class enumvalueType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, prot=None, id=None, name=None, initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None): + self.prot = prot + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if enumvalueType.subclass: + return enumvalueType.subclass(*args_, **kwargs_) + else: + return enumvalueType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_name(self): return self.name + def set_name(self, name): self.name = name + def get_initializer(self): return self.initializer + def set_initializer(self, initializer): self.initializer = initializer + def get_briefdescription(self): return self.briefdescription + def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + def get_detaileddescription(self): return self.detaileddescription + def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription + def get_prot(self): return self.prot + def set_prot(self, prot): self.prot = prot + def get_id(self): return self.id + def set_id(self, id): self.id = id + def hasContent_(self): + if ( + self.name is not None or + self.initializer is not None or + self.briefdescription is not None or + self.detaileddescription is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('prot'): + self.prot = attrs.get('prot').value + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'name': + value_ = [] + for text_ in child_.childNodes: + value_.append(text_.nodeValue) + valuestr_ = ''.join(value_) + obj_ = self.mixedclass_(MixedContainer.CategorySimple, + MixedContainer.TypeString, 'name', valuestr_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'initializer': + childobj_ = linkedTextType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'initializer', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'briefdescription': + childobj_ = descriptionType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'briefdescription', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'detaileddescription': + childobj_ = descriptionType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'detaileddescription', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class enumvalueType + + +class templateparamlistType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, param=None): + if param is None: + self.param = [] + else: + self.param = param + def factory(*args_, **kwargs_): + if templateparamlistType.subclass: + return templateparamlistType.subclass(*args_, **kwargs_) + else: + return templateparamlistType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_param(self): return self.param + def set_param(self, param): self.param = param + def add_param(self, value): self.param.append(value) + def insert_param(self, index, value): self.param[index] = value + def hasContent_(self): + if ( + self.param is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'param': + obj_ = paramType.factory() + obj_.build(child_) + self.param.append(obj_) +# end class templateparamlistType + + +class paramType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, type_=None, declname=None, defname=None, array=None, defval=None, briefdescription=None): + self.type_ = type_ + self.declname = declname + self.defname = defname + self.array = array + self.defval = defval + self.briefdescription = briefdescription + def factory(*args_, **kwargs_): + if paramType.subclass: + return paramType.subclass(*args_, **kwargs_) + else: + return paramType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_type(self): return self.type_ + def set_type(self, type_): self.type_ = type_ + def get_declname(self): return self.declname + def set_declname(self, declname): self.declname = declname + def get_defname(self): return self.defname + def set_defname(self, defname): self.defname = defname + def get_array(self): return self.array + def set_array(self, array): self.array = array + def get_defval(self): return self.defval + def set_defval(self, defval): self.defval = defval + def get_briefdescription(self): return self.briefdescription + def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + def hasContent_(self): + if ( + self.type_ is not None or + self.declname is not None or + self.defname is not None or + self.array is not None or + self.defval is not None or + self.briefdescription is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'type': + obj_ = linkedTextType.factory() + obj_.build(child_) + self.set_type(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'declname': + declname_ = '' + for text__content_ in child_.childNodes: + declname_ += text__content_.nodeValue + self.declname = declname_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'defname': + defname_ = '' + for text__content_ in child_.childNodes: + defname_ += text__content_.nodeValue + self.defname = defname_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'array': + array_ = '' + for text__content_ in child_.childNodes: + array_ += text__content_.nodeValue + self.array = array_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'defval': + obj_ = linkedTextType.factory() + obj_.build(child_) + self.set_defval(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'briefdescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_briefdescription(obj_) +# end class paramType + + +class declname(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if declname.subclass: + return declname.subclass(*args_, **kwargs_) + else: + return declname(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class declname + + +class defname(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if defname.subclass: + return defname.subclass(*args_, **kwargs_) + else: + return defname(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class defname + + +class array(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if array.subclass: + return array.subclass(*args_, **kwargs_) + else: + return array(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class array + + +class linkedTextType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, ref=None, mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if linkedTextType.subclass: + return linkedTextType.subclass(*args_, **kwargs_) + else: + return linkedTextType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_ref(self): return self.ref + def set_ref(self, ref): self.ref = ref + def add_ref(self, value): self.ref.append(value) + def insert_ref(self, index, value): self.ref[index] = value + def hasContent_(self): + if ( + self.ref is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'ref': + childobj_ = docRefTextType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'ref', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class linkedTextType + + +class graphType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, node=None): + if node is None: + self.node = [] + else: + self.node = node + def factory(*args_, **kwargs_): + if graphType.subclass: + return graphType.subclass(*args_, **kwargs_) + else: + return graphType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_node(self): return self.node + def set_node(self, node): self.node = node + def add_node(self, value): self.node.append(value) + def insert_node(self, index, value): self.node[index] = value + def hasContent_(self): + if ( + self.node is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'node': + obj_ = nodeType.factory() + obj_.build(child_) + self.node.append(obj_) +# end class graphType + + +class nodeType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, label=None, link=None, childnode=None): + self.id = id + self.label = label + self.link = link + if childnode is None: + self.childnode = [] + else: + self.childnode = childnode + def factory(*args_, **kwargs_): + if nodeType.subclass: + return nodeType.subclass(*args_, **kwargs_) + else: + return nodeType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_label(self): return self.label + def set_label(self, label): self.label = label + def get_link(self): return self.link + def set_link(self, link): self.link = link + def get_childnode(self): return self.childnode + def set_childnode(self, childnode): self.childnode = childnode + def add_childnode(self, value): self.childnode.append(value) + def insert_childnode(self, index, value): self.childnode[index] = value + def get_id(self): return self.id + def set_id(self, id): self.id = id + def hasContent_(self): + if ( + self.label is not None or + self.link is not None or + self.childnode is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'label': + label_ = '' + for text__content_ in child_.childNodes: + label_ += text__content_.nodeValue + self.label = label_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'link': + obj_ = linkType.factory() + obj_.build(child_) + self.set_link(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'childnode': + obj_ = childnodeType.factory() + obj_.build(child_) + self.childnode.append(obj_) +# end class nodeType + + +class label(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if label.subclass: + return label.subclass(*args_, **kwargs_) + else: + return label(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class label + + +class childnodeType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, relation=None, refid=None, edgelabel=None): + self.relation = relation + self.refid = refid + if edgelabel is None: + self.edgelabel = [] + else: + self.edgelabel = edgelabel + def factory(*args_, **kwargs_): + if childnodeType.subclass: + return childnodeType.subclass(*args_, **kwargs_) + else: + return childnodeType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_edgelabel(self): return self.edgelabel + def set_edgelabel(self, edgelabel): self.edgelabel = edgelabel + def add_edgelabel(self, value): self.edgelabel.append(value) + def insert_edgelabel(self, index, value): self.edgelabel[index] = value + def get_relation(self): return self.relation + def set_relation(self, relation): self.relation = relation + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def export(self, outfile, level, namespace_='', name_='childnodeType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='childnodeType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='childnodeType'): + if self.relation is not None: + outfile.write(' relation=%s' % (quote_attrib(self.relation), )) + if self.refid is not None: + outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='childnodeType'): + for edgelabel_ in self.edgelabel: + showIndent(outfile, level) + outfile.write('<%sedgelabel>%s\n' % (namespace_, self.format_string(quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_)) + def hasContent_(self): + if ( + self.edgelabel is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('relation'): + self.relation = attrs.get('relation').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'edgelabel': + edgelabel_ = '' + for text__content_ in child_.childNodes: + edgelabel_ += text__content_.nodeValue + self.edgelabel.append(edgelabel_) +# end class childnodeType + + +class edgelabel(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if edgelabel.subclass: + return edgelabel.subclass(*args_, **kwargs_) + else: + return edgelabel(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='edgelabel', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='edgelabel') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='edgelabel'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='edgelabel'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class edgelabel + + +class linkType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, refid=None, external=None, valueOf_=''): + self.refid = refid + self.external = external + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if linkType.subclass: + return linkType.subclass(*args_, **kwargs_) + else: + return linkType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def get_external(self): return self.external + def set_external(self, external): self.external = external + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='linkType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='linkType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='linkType'): + if self.refid is not None: + outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + if self.external is not None: + outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) + def exportChildren(self, outfile, level, namespace_='', name_='linkType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('refid'): + self.refid = attrs.get('refid').value + if attrs.get('external'): + self.external = attrs.get('external').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class linkType + + +class listingType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, codeline=None): + if codeline is None: + self.codeline = [] + else: + self.codeline = codeline + def factory(*args_, **kwargs_): + if listingType.subclass: + return listingType.subclass(*args_, **kwargs_) + else: + return listingType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_codeline(self): return self.codeline + def set_codeline(self, codeline): self.codeline = codeline + def add_codeline(self, value): self.codeline.append(value) + def insert_codeline(self, index, value): self.codeline[index] = value + def export(self, outfile, level, namespace_='', name_='listingType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='listingType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='listingType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='listingType'): + for codeline_ in self.codeline: + codeline_.export(outfile, level, namespace_, name_='codeline') + def hasContent_(self): + if ( + self.codeline is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'codeline': + obj_ = codelineType.factory() + obj_.build(child_) + self.codeline.append(obj_) +# end class listingType + + +class codelineType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None): + self.external = external + self.lineno = lineno + self.refkind = refkind + self.refid = refid + if highlight is None: + self.highlight = [] + else: + self.highlight = highlight + def factory(*args_, **kwargs_): + if codelineType.subclass: + return codelineType.subclass(*args_, **kwargs_) + else: + return codelineType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_highlight(self): return self.highlight + def set_highlight(self, highlight): self.highlight = highlight + def add_highlight(self, value): self.highlight.append(value) + def insert_highlight(self, index, value): self.highlight[index] = value + def get_external(self): return self.external + def set_external(self, external): self.external = external + def get_lineno(self): return self.lineno + def set_lineno(self, lineno): self.lineno = lineno + def get_refkind(self): return self.refkind + def set_refkind(self, refkind): self.refkind = refkind + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def export(self, outfile, level, namespace_='', name_='codelineType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='codelineType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='codelineType'): + if self.external is not None: + outfile.write(' external=%s' % (quote_attrib(self.external), )) + if self.lineno is not None: + outfile.write(' lineno="%s"' % self.format_integer(self.lineno, input_name='lineno')) + if self.refkind is not None: + outfile.write(' refkind=%s' % (quote_attrib(self.refkind), )) + if self.refid is not None: + outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='codelineType'): + for highlight_ in self.highlight: + highlight_.export(outfile, level, namespace_, name_='highlight') + def hasContent_(self): + if ( + self.highlight is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('external'): + self.external = attrs.get('external').value + if attrs.get('lineno'): + try: + self.lineno = int(attrs.get('lineno').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (lineno): %s' % exp) + if attrs.get('refkind'): + self.refkind = attrs.get('refkind').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'highlight': + obj_ = highlightType.factory() + obj_.build(child_) + self.highlight.append(obj_) +# end class codelineType + + +class highlightType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, classxx=None, sp=None, ref=None, mixedclass_=None, content_=None): + self.classxx = classxx + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if highlightType.subclass: + return highlightType.subclass(*args_, **kwargs_) + else: + return highlightType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_sp(self): return self.sp + def set_sp(self, sp): self.sp = sp + def add_sp(self, value): self.sp.append(value) + def insert_sp(self, index, value): self.sp[index] = value + def get_ref(self): return self.ref + def set_ref(self, ref): self.ref = ref + def add_ref(self, value): self.ref.append(value) + def insert_ref(self, index, value): self.ref[index] = value + def get_class(self): return self.classxx + def set_class(self, classxx): self.classxx = classxx + def export(self, outfile, level, namespace_='', name_='highlightType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='highlightType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='highlightType'): + if self.classxx is not None: + outfile.write(' class=%s' % (quote_attrib(self.classxx), )) + def exportChildren(self, outfile, level, namespace_='', name_='highlightType'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.sp is not None or + self.ref is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('class'): + self.classxx = attrs.get('class').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sp': + value_ = [] + for text_ in child_.childNodes: + value_.append(text_.nodeValue) + # We make this unicode so that our unicode renderer catch-all picks it up + # otherwise it would go through as 'str' and we'd have to pick it up too + valuestr_ = u' ' + obj_ = self.mixedclass_(MixedContainer.CategorySimple, + MixedContainer.TypeString, 'sp', valuestr_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'ref': + childobj_ = docRefTextType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'ref', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class highlightType + + +class sp(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if sp.subclass: + return sp.subclass(*args_, **kwargs_) + else: + return sp(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='sp', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='sp') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='sp'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='sp'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class sp + + +class referenceType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None): + self.endline = endline + self.startline = startline + self.refid = refid + self.compoundref = compoundref + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if referenceType.subclass: + return referenceType.subclass(*args_, **kwargs_) + else: + return referenceType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_endline(self): return self.endline + def set_endline(self, endline): self.endline = endline + def get_startline(self): return self.startline + def set_startline(self, startline): self.startline = startline + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def get_compoundref(self): return self.compoundref + def set_compoundref(self, compoundref): self.compoundref = compoundref + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='referenceType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='referenceType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='referenceType'): + if self.endline is not None: + outfile.write(' endline="%s"' % self.format_integer(self.endline, input_name='endline')) + if self.startline is not None: + outfile.write(' startline="%s"' % self.format_integer(self.startline, input_name='startline')) + if self.refid is not None: + outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + if self.compoundref is not None: + outfile.write(' compoundref=%s' % (self.format_string(quote_attrib(self.compoundref).encode(ExternalEncoding), input_name='compoundref'), )) + def exportChildren(self, outfile, level, namespace_='', name_='referenceType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('endline'): + try: + self.endline = int(attrs.get('endline').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (endline): %s' % exp) + if attrs.get('startline'): + try: + self.startline = int(attrs.get('startline').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (startline): %s' % exp) + if attrs.get('refid'): + self.refid = attrs.get('refid').value + if attrs.get('compoundref'): + self.compoundref = attrs.get('compoundref').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class referenceType + + +class locationType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''): + self.bodystart = bodystart + self.line = line + self.bodyend = bodyend + self.bodyfile = bodyfile + self.file = file + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if locationType.subclass: + return locationType.subclass(*args_, **kwargs_) + else: + return locationType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_bodystart(self): return self.bodystart + def set_bodystart(self, bodystart): self.bodystart = bodystart + def get_line(self): return self.line + def set_line(self, line): self.line = line + def get_bodyend(self): return self.bodyend + def set_bodyend(self, bodyend): self.bodyend = bodyend + def get_bodyfile(self): return self.bodyfile + def set_bodyfile(self, bodyfile): self.bodyfile = bodyfile + def get_file(self): return self.file + def set_file(self, file): self.file = file + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='locationType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='locationType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='locationType'): + if self.bodystart is not None: + outfile.write(' bodystart="%s"' % self.format_integer(self.bodystart, input_name='bodystart')) + if self.line is not None: + outfile.write(' line="%s"' % self.format_integer(self.line, input_name='line')) + if self.bodyend is not None: + outfile.write(' bodyend="%s"' % self.format_integer(self.bodyend, input_name='bodyend')) + if self.bodyfile is not None: + outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib(self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), )) + if self.file is not None: + outfile.write(' file=%s' % (self.format_string(quote_attrib(self.file).encode(ExternalEncoding), input_name='file'), )) + def exportChildren(self, outfile, level, namespace_='', name_='locationType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('bodystart'): + try: + self.bodystart = int(attrs.get('bodystart').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (bodystart): %s' % exp) + if attrs.get('line'): + try: + self.line = int(attrs.get('line').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (line): %s' % exp) + if attrs.get('bodyend'): + try: + self.bodyend = int(attrs.get('bodyend').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (bodyend): %s' % exp) + if attrs.get('bodyfile'): + self.bodyfile = attrs.get('bodyfile').value + if attrs.get('file'): + self.file = attrs.get('file').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class locationType + + +class docSect1Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mixedclass_=None, content_=None): + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docSect1Type.subclass: + return docSect1Type.subclass(*args_, **kwargs_) + else: + return docSect1Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_title(self): return self.title + def set_title(self, title): self.title = title + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect2(self): return self.sect2 + def set_sect2(self, sect2): self.sect2 = sect2 + def add_sect2(self, value): self.sect2.append(value) + def insert_sect2(self, index, value): self.sect2[index] = value + def get_internal(self): return self.internal + def set_internal(self, internal): self.internal = internal + def get_id(self): return self.id + def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect1Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docSect1Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect1Type'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect1Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.title is not None or + self.para is not None or + self.sect2 is not None or + self.internal is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'title': + childobj_ = docTitleType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'title', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect2': + childobj_ = docSect2Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect2', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'internal': + childobj_ = docInternalS1Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'internal', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docSect1Type + + +class docSect2Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mixedclass_=None, content_=None): + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docSect2Type.subclass: + return docSect2Type.subclass(*args_, **kwargs_) + else: + return docSect2Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_title(self): return self.title + def set_title(self, title): self.title = title + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect3(self): return self.sect3 + def set_sect3(self, sect3): self.sect3 = sect3 + def add_sect3(self, value): self.sect3.append(value) + def insert_sect3(self, index, value): self.sect3[index] = value + def get_internal(self): return self.internal + def set_internal(self, internal): self.internal = internal + def get_id(self): return self.id + def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect2Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docSect2Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect2Type'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect2Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.title is not None or + self.para is not None or + self.sect3 is not None or + self.internal is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'title': + childobj_ = docTitleType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'title', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect3': + childobj_ = docSect3Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect3', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'internal': + childobj_ = docInternalS2Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'internal', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docSect2Type + + +class docSect3Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mixedclass_=None, content_=None): + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docSect3Type.subclass: + return docSect3Type.subclass(*args_, **kwargs_) + else: + return docSect3Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_title(self): return self.title + def set_title(self, title): self.title = title + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect4(self): return self.sect4 + def set_sect4(self, sect4): self.sect4 = sect4 + def add_sect4(self, value): self.sect4.append(value) + def insert_sect4(self, index, value): self.sect4[index] = value + def get_internal(self): return self.internal + def set_internal(self, internal): self.internal = internal + def get_id(self): return self.id + def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect3Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docSect3Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect3Type'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect3Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.title is not None or + self.para is not None or + self.sect4 is not None or + self.internal is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'title': + childobj_ = docTitleType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'title', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect4': + childobj_ = docSect4Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect4', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'internal': + childobj_ = docInternalS3Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'internal', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docSect3Type + + +class docSect4Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, title=None, para=None, internal=None, mixedclass_=None, content_=None): + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docSect4Type.subclass: + return docSect4Type.subclass(*args_, **kwargs_) + else: + return docSect4Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_title(self): return self.title + def set_title(self, title): self.title = title + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_internal(self): return self.internal + def set_internal(self, internal): self.internal = internal + def get_id(self): return self.id + def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect4Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docSect4Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect4Type'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect4Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.title is not None or + self.para is not None or + self.internal is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'title': + childobj_ = docTitleType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'title', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'internal': + childobj_ = docInternalS4Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'internal', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docSect4Type + + +class docInternalType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docInternalType.subclass: + return docInternalType.subclass(*args_, **kwargs_) + else: + return docInternalType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect1(self): return self.sect1 + def set_sect1(self, sect1): self.sect1 = sect1 + def add_sect1(self, value): self.sect1.append(value) + def insert_sect1(self, index, value): self.sect1[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docInternalType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalType'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.para is not None or + self.sect1 is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect1': + childobj_ = docSect1Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect1', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docInternalType + + +class docInternalS1Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docInternalS1Type.subclass: + return docInternalS1Type.subclass(*args_, **kwargs_) + else: + return docInternalS1Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect2(self): return self.sect2 + def set_sect2(self, sect2): self.sect2 = sect2 + def add_sect2(self, value): self.sect2.append(value) + def insert_sect2(self, index, value): self.sect2[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS1Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docInternalS1Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS1Type'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS1Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.para is not None or + self.sect2 is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect2': + childobj_ = docSect2Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect2', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docInternalS1Type + + +class docInternalS2Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docInternalS2Type.subclass: + return docInternalS2Type.subclass(*args_, **kwargs_) + else: + return docInternalS2Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect3(self): return self.sect3 + def set_sect3(self, sect3): self.sect3 = sect3 + def add_sect3(self, value): self.sect3.append(value) + def insert_sect3(self, index, value): self.sect3[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS2Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docInternalS2Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS2Type'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS2Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.para is not None or + self.sect3 is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect3': + childobj_ = docSect3Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect3', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docInternalS2Type + + +class docInternalS3Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docInternalS3Type.subclass: + return docInternalS3Type.subclass(*args_, **kwargs_) + else: + return docInternalS3Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect3(self): return self.sect3 + def set_sect3(self, sect3): self.sect3 = sect3 + def add_sect3(self, value): self.sect3.append(value) + def insert_sect3(self, index, value): self.sect3[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS3Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docInternalS3Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS3Type'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS3Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.para is not None or + self.sect3 is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect3': + childobj_ = docSect4Type.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'sect3', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docInternalS3Type + + +class docInternalS4Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, para=None, mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docInternalS4Type.subclass: + return docInternalS4Type.subclass(*args_, **kwargs_) + else: + return docInternalS4Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS4Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docInternalS4Type') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS4Type'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS4Type'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.para is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + childobj_ = docParaType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'para', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docInternalS4Type + + +class docTitleType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docTitleType.subclass: + return docTitleType.subclass(*args_, **kwargs_) + else: + return docTitleType(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docTitleType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docTitleType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docTitleType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docTitleType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docTitleType + + +class docParaType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docParaType.subclass: + return docParaType.subclass(*args_, **kwargs_) + else: + return docParaType(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docParaType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docParaType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docParaType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docParaType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docParaType + + +class docMarkupType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docMarkupType.subclass: + return docMarkupType.subclass(*args_, **kwargs_) + else: + return docMarkupType(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docMarkupType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docMarkupType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docMarkupType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docMarkupType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docMarkupType + + +class docURLLink(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None): + self.url = url + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docURLLink.subclass: + return docURLLink.subclass(*args_, **kwargs_) + else: + return docURLLink(*args_, **kwargs_) + factory = staticmethod(factory) + def get_url(self): return self.url + def set_url(self, url): self.url = url + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docURLLink', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docURLLink') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docURLLink'): + if self.url is not None: + outfile.write(' url=%s' % (self.format_string(quote_attrib(self.url).encode(ExternalEncoding), input_name='url'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docURLLink'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('url'): + self.url = attrs.get('url').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docURLLink + + +class docAnchorType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docAnchorType.subclass: + return docAnchorType.subclass(*args_, **kwargs_) + else: + return docAnchorType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_id(self): return self.id + def set_id(self, id): self.id = id + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docAnchorType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docAnchorType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docAnchorType'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docAnchorType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docAnchorType + + +class docFormulaType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docFormulaType.subclass: + return docFormulaType.subclass(*args_, **kwargs_) + else: + return docFormulaType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_id(self): return self.id + def set_id(self, id): self.id = id + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docFormulaType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docFormulaType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docFormulaType'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docFormulaType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docFormulaType + + +class docIndexEntryType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, primaryie=None, secondaryie=None): + self.primaryie = primaryie + self.secondaryie = secondaryie + def factory(*args_, **kwargs_): + if docIndexEntryType.subclass: + return docIndexEntryType.subclass(*args_, **kwargs_) + else: + return docIndexEntryType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_primaryie(self): return self.primaryie + def set_primaryie(self, primaryie): self.primaryie = primaryie + def get_secondaryie(self): return self.secondaryie + def set_secondaryie(self, secondaryie): self.secondaryie = secondaryie + def export(self, outfile, level, namespace_='', name_='docIndexEntryType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docIndexEntryType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docIndexEntryType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docIndexEntryType'): + if self.primaryie is not None: + showIndent(outfile, level) + outfile.write('<%sprimaryie>%s\n' % (namespace_, self.format_string(quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_)) + if self.secondaryie is not None: + showIndent(outfile, level) + outfile.write('<%ssecondaryie>%s\n' % (namespace_, self.format_string(quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_)) + def hasContent_(self): + if ( + self.primaryie is not None or + self.secondaryie is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'primaryie': + primaryie_ = '' + for text__content_ in child_.childNodes: + primaryie_ += text__content_.nodeValue + self.primaryie = primaryie_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'secondaryie': + secondaryie_ = '' + for text__content_ in child_.childNodes: + secondaryie_ += text__content_.nodeValue + self.secondaryie = secondaryie_ +# end class docIndexEntryType + + +class docListType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, listitem=None): + if listitem is None: + self.listitem = [] + else: + self.listitem = listitem + def factory(*args_, **kwargs_): + if docListType.subclass: + return docListType.subclass(*args_, **kwargs_) + else: + return docListType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_listitem(self): return self.listitem + def set_listitem(self, listitem): self.listitem = listitem + def add_listitem(self, value): self.listitem.append(value) + def insert_listitem(self, index, value): self.listitem[index] = value + def export(self, outfile, level, namespace_='', name_='docListType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docListType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docListType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docListType'): + for listitem_ in self.listitem: + listitem_.export(outfile, level, namespace_, name_='listitem') + def hasContent_(self): + if ( + self.listitem is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'listitem': + obj_ = docListItemType.factory() + obj_.build(child_) + self.listitem.append(obj_) +# end class docListType + + +class docListItemType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, para=None): + if para is None: + self.para = [] + else: + self.para = para + def factory(*args_, **kwargs_): + if docListItemType.subclass: + return docListItemType.subclass(*args_, **kwargs_) + else: + return docListItemType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def export(self, outfile, level, namespace_='', name_='docListItemType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docListItemType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docListItemType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docListItemType'): + for para_ in self.para: + para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): + if ( + self.para is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + obj_ = docParaType.factory() + obj_.build(child_) + self.para.append(obj_) +# end class docListItemType + + +class docSimpleSectType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, kind=None, title=None, para=None): + self.kind = kind + self.title = title + if para is None: + self.para = [] + else: + self.para = para + def factory(*args_, **kwargs_): + if docSimpleSectType.subclass: + return docSimpleSectType.subclass(*args_, **kwargs_) + else: + return docSimpleSectType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_title(self): return self.title + def set_title(self, title): self.title = title + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_kind(self): return self.kind + def set_kind(self, kind): self.kind = kind + def export(self, outfile, level, namespace_='', name_='docSimpleSectType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docSimpleSectType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docSimpleSectType'): + if self.kind is not None: + outfile.write(' kind=%s' % (quote_attrib(self.kind), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSimpleSectType'): + if self.title: + self.title.export(outfile, level, namespace_, name_='title') + for para_ in self.para: + para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): + if ( + self.title is not None or + self.para is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('kind'): + self.kind = attrs.get('kind').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'title': + obj_ = docTitleType.factory() + obj_.build(child_) + self.set_title(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + obj_ = docParaType.factory() + obj_.build(child_) + self.para.append(obj_) +# end class docSimpleSectType + + +class docVarListEntryType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, term=None): + self.term = term + def factory(*args_, **kwargs_): + if docVarListEntryType.subclass: + return docVarListEntryType.subclass(*args_, **kwargs_) + else: + return docVarListEntryType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_term(self): return self.term + def set_term(self, term): self.term = term + def export(self, outfile, level, namespace_='', name_='docVarListEntryType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docVarListEntryType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docVarListEntryType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docVarListEntryType'): + if self.term: + self.term.export(outfile, level, namespace_, name_='term', ) + def hasContent_(self): + if ( + self.term is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'term': + obj_ = docTitleType.factory() + obj_.build(child_) + self.set_term(obj_) +# end class docVarListEntryType + + +class docVariableListType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if docVariableListType.subclass: + return docVariableListType.subclass(*args_, **kwargs_) + else: + return docVariableListType(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docVariableListType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docVariableListType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docVariableListType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docVariableListType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docVariableListType + + +class docRefTextType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): + self.refid = refid + self.kindref = kindref + self.external = external + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docRefTextType.subclass: + return docRefTextType.subclass(*args_, **kwargs_) + else: + return docRefTextType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def get_kindref(self): return self.kindref + def set_kindref(self, kindref): self.kindref = kindref + def get_external(self): return self.external + def set_external(self, external): self.external = external + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docRefTextType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docRefTextType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docRefTextType'): + if self.refid is not None: + outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + if self.kindref is not None: + outfile.write(' kindref=%s' % (quote_attrib(self.kindref), )) + if self.external is not None: + outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docRefTextType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('refid'): + self.refid = attrs.get('refid').value + if attrs.get('kindref'): + self.kindref = attrs.get('kindref').value + if attrs.get('external'): + self.external = attrs.get('external').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docRefTextType + + +class docTableType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, rows=None, cols=None, row=None, caption=None): + self.rows = rows + self.cols = cols + if row is None: + self.row = [] + else: + self.row = row + self.caption = caption + def factory(*args_, **kwargs_): + if docTableType.subclass: + return docTableType.subclass(*args_, **kwargs_) + else: + return docTableType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_row(self): return self.row + def set_row(self, row): self.row = row + def add_row(self, value): self.row.append(value) + def insert_row(self, index, value): self.row[index] = value + def get_caption(self): return self.caption + def set_caption(self, caption): self.caption = caption + def get_rows(self): return self.rows + def set_rows(self, rows): self.rows = rows + def get_cols(self): return self.cols + def set_cols(self, cols): self.cols = cols + def export(self, outfile, level, namespace_='', name_='docTableType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docTableType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docTableType'): + if self.rows is not None: + outfile.write(' rows="%s"' % self.format_integer(self.rows, input_name='rows')) + if self.cols is not None: + outfile.write(' cols="%s"' % self.format_integer(self.cols, input_name='cols')) + def exportChildren(self, outfile, level, namespace_='', name_='docTableType'): + for row_ in self.row: + row_.export(outfile, level, namespace_, name_='row') + if self.caption: + self.caption.export(outfile, level, namespace_, name_='caption') + def hasContent_(self): + if ( + self.row is not None or + self.caption is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('rows'): + try: + self.rows = int(attrs.get('rows').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (rows): %s' % exp) + if attrs.get('cols'): + try: + self.cols = int(attrs.get('cols').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (cols): %s' % exp) + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'row': + obj_ = docRowType.factory() + obj_.build(child_) + self.row.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'caption': + obj_ = docCaptionType.factory() + obj_.build(child_) + self.set_caption(obj_) +# end class docTableType + + +class docRowType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, entry=None): + if entry is None: + self.entry = [] + else: + self.entry = entry + def factory(*args_, **kwargs_): + if docRowType.subclass: + return docRowType.subclass(*args_, **kwargs_) + else: + return docRowType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_entry(self): return self.entry + def set_entry(self, entry): self.entry = entry + def add_entry(self, value): self.entry.append(value) + def insert_entry(self, index, value): self.entry[index] = value + def export(self, outfile, level, namespace_='', name_='docRowType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docRowType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docRowType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docRowType'): + for entry_ in self.entry: + entry_.export(outfile, level, namespace_, name_='entry') + def hasContent_(self): + if ( + self.entry is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'entry': + obj_ = docEntryType.factory() + obj_.build(child_) + self.entry.append(obj_) +# end class docRowType + + +class docEntryType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, thead=None, para=None): + self.thead = thead + if para is None: + self.para = [] + else: + self.para = para + def factory(*args_, **kwargs_): + if docEntryType.subclass: + return docEntryType.subclass(*args_, **kwargs_) + else: + return docEntryType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_thead(self): return self.thead + def set_thead(self, thead): self.thead = thead + def export(self, outfile, level, namespace_='', name_='docEntryType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docEntryType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docEntryType'): + if self.thead is not None: + outfile.write(' thead=%s' % (quote_attrib(self.thead), )) + def exportChildren(self, outfile, level, namespace_='', name_='docEntryType'): + for para_ in self.para: + para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): + if ( + self.para is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('thead'): + self.thead = attrs.get('thead').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + obj_ = docParaType.factory() + obj_.build(child_) + self.para.append(obj_) +# end class docEntryType + + +class docCaptionType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docCaptionType.subclass: + return docCaptionType.subclass(*args_, **kwargs_) + else: + return docCaptionType(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docCaptionType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docCaptionType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docCaptionType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docCaptionType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docCaptionType + + +class docHeadingType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None): + self.level = level + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docHeadingType.subclass: + return docHeadingType.subclass(*args_, **kwargs_) + else: + return docHeadingType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_level(self): return self.level + def set_level(self, level): self.level = level + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docHeadingType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docHeadingType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docHeadingType'): + if self.level is not None: + outfile.write(' level="%s"' % self.format_integer(self.level, input_name='level')) + def exportChildren(self, outfile, level, namespace_='', name_='docHeadingType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('level'): + try: + self.level = int(attrs.get('level').value) + except ValueError as exp: + raise ValueError('Bad integer attribute (level): %s' % exp) + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docHeadingType + + +class docImageType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None): + self.width = width + self.type_ = type_ + self.name = name + self.height = height + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docImageType.subclass: + return docImageType.subclass(*args_, **kwargs_) + else: + return docImageType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_width(self): return self.width + def set_width(self, width): self.width = width + def get_type(self): return self.type_ + def set_type(self, type_): self.type_ = type_ + def get_name(self): return self.name + def set_name(self, name): self.name = name + def get_height(self): return self.height + def set_height(self, height): self.height = height + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docImageType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docImageType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docImageType'): + if self.width is not None: + outfile.write(' width=%s' % (self.format_string(quote_attrib(self.width).encode(ExternalEncoding), input_name='width'), )) + if self.type_ is not None: + outfile.write(' type=%s' % (quote_attrib(self.type_), )) + if self.name is not None: + outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), )) + if self.height is not None: + outfile.write(' height=%s' % (self.format_string(quote_attrib(self.height).encode(ExternalEncoding), input_name='height'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docImageType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('width'): + self.width = attrs.get('width').value + if attrs.get('type'): + self.type_ = attrs.get('type').value + if attrs.get('name'): + self.name = attrs.get('name').value + if attrs.get('height'): + self.height = attrs.get('height').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docImageType + + +class docDotFileType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None): + self.name = name + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docDotFileType.subclass: + return docDotFileType.subclass(*args_, **kwargs_) + else: + return docDotFileType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_name(self): return self.name + def set_name(self, name): self.name = name + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docDotFileType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docDotFileType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docDotFileType'): + if self.name is not None: + outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docDotFileType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('name'): + self.name = attrs.get('name').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docDotFileType + + +class docTocItemType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): + self.id = id + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docTocItemType.subclass: + return docTocItemType.subclass(*args_, **kwargs_) + else: + return docTocItemType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_id(self): return self.id + def set_id(self, id): self.id = id + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docTocItemType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docTocItemType') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docTocItemType'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docTocItemType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docTocItemType + + +class docTocListType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, tocitem=None): + if tocitem is None: + self.tocitem = [] + else: + self.tocitem = tocitem + def factory(*args_, **kwargs_): + if docTocListType.subclass: + return docTocListType.subclass(*args_, **kwargs_) + else: + return docTocListType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_tocitem(self): return self.tocitem + def set_tocitem(self, tocitem): self.tocitem = tocitem + def add_tocitem(self, value): self.tocitem.append(value) + def insert_tocitem(self, index, value): self.tocitem[index] = value + def export(self, outfile, level, namespace_='', name_='docTocListType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docTocListType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docTocListType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docTocListType'): + for tocitem_ in self.tocitem: + tocitem_.export(outfile, level, namespace_, name_='tocitem') + def hasContent_(self): + if ( + self.tocitem is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'tocitem': + obj_ = docTocItemType.factory() + obj_.build(child_) + self.tocitem.append(obj_) +# end class docTocListType + + +class docLanguageType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, langid=None, para=None): + self.langid = langid + if para is None: + self.para = [] + else: + self.para = para + def factory(*args_, **kwargs_): + if docLanguageType.subclass: + return docLanguageType.subclass(*args_, **kwargs_) + else: + return docLanguageType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_langid(self): return self.langid + def set_langid(self, langid): self.langid = langid + def export(self, outfile, level, namespace_='', name_='docLanguageType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docLanguageType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docLanguageType'): + if self.langid is not None: + outfile.write(' langid=%s' % (self.format_string(quote_attrib(self.langid).encode(ExternalEncoding), input_name='langid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docLanguageType'): + for para_ in self.para: + para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): + if ( + self.para is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('langid'): + self.langid = attrs.get('langid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + obj_ = docParaType.factory() + obj_.build(child_) + self.para.append(obj_) +# end class docLanguageType + + +class docParamListType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, kind=None, parameteritem=None): + self.kind = kind + if parameteritem is None: + self.parameteritem = [] + else: + self.parameteritem = parameteritem + def factory(*args_, **kwargs_): + if docParamListType.subclass: + return docParamListType.subclass(*args_, **kwargs_) + else: + return docParamListType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_parameteritem(self): return self.parameteritem + def set_parameteritem(self, parameteritem): self.parameteritem = parameteritem + def add_parameteritem(self, value): self.parameteritem.append(value) + def insert_parameteritem(self, index, value): self.parameteritem[index] = value + def get_kind(self): return self.kind + def set_kind(self, kind): self.kind = kind + def export(self, outfile, level, namespace_='', name_='docParamListType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docParamListType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docParamListType'): + if self.kind is not None: + outfile.write(' kind=%s' % (quote_attrib(self.kind), )) + def exportChildren(self, outfile, level, namespace_='', name_='docParamListType'): + for parameteritem_ in self.parameteritem: + parameteritem_.export(outfile, level, namespace_, name_='parameteritem') + def hasContent_(self): + if ( + self.parameteritem is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('kind'): + self.kind = attrs.get('kind').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'parameteritem': + obj_ = docParamListItem.factory() + obj_.build(child_) + self.parameteritem.append(obj_) +# end class docParamListType + + +class docParamListItem(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, parameternamelist=None, parameterdescription=None): + if parameternamelist is None: + self.parameternamelist = [] + else: + self.parameternamelist = parameternamelist + self.parameterdescription = parameterdescription + def factory(*args_, **kwargs_): + if docParamListItem.subclass: + return docParamListItem.subclass(*args_, **kwargs_) + else: + return docParamListItem(*args_, **kwargs_) + factory = staticmethod(factory) + def get_parameternamelist(self): return self.parameternamelist + def set_parameternamelist(self, parameternamelist): self.parameternamelist = parameternamelist + def add_parameternamelist(self, value): self.parameternamelist.append(value) + def insert_parameternamelist(self, index, value): self.parameternamelist[index] = value + def get_parameterdescription(self): return self.parameterdescription + def set_parameterdescription(self, parameterdescription): self.parameterdescription = parameterdescription + def export(self, outfile, level, namespace_='', name_='docParamListItem', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docParamListItem') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docParamListItem'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docParamListItem'): + for parameternamelist_ in self.parameternamelist: + parameternamelist_.export(outfile, level, namespace_, name_='parameternamelist') + if self.parameterdescription: + self.parameterdescription.export(outfile, level, namespace_, name_='parameterdescription', ) + def hasContent_(self): + if ( + self.parameternamelist is not None or + self.parameterdescription is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'parameternamelist': + obj_ = docParamNameList.factory() + obj_.build(child_) + self.parameternamelist.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'parameterdescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_parameterdescription(obj_) +# end class docParamListItem + + +class docParamNameList(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, parametername=None): + if parametername is None: + self.parametername = [] + else: + self.parametername = parametername + def factory(*args_, **kwargs_): + if docParamNameList.subclass: + return docParamNameList.subclass(*args_, **kwargs_) + else: + return docParamNameList(*args_, **kwargs_) + factory = staticmethod(factory) + def get_parametername(self): return self.parametername + def set_parametername(self, parametername): self.parametername = parametername + def add_parametername(self, value): self.parametername.append(value) + def insert_parametername(self, index, value): self.parametername[index] = value + def export(self, outfile, level, namespace_='', name_='docParamNameList', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docParamNameList') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docParamNameList'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docParamNameList'): + for parametername_ in self.parametername: + parametername_.export(outfile, level, namespace_, name_='parametername') + def hasContent_(self): + if ( + self.parametername is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'parametername': + obj_ = docParamName.factory() + obj_.build(child_) + self.parametername.append(obj_) +# end class docParamNameList + + +class docParamName(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None): + self.direction = direction + if mixedclass_ is None: + self.mixedclass_ = MixedContainer + else: + self.mixedclass_ = mixedclass_ + if content_ is None: + self.content_ = [] + else: + self.content_ = content_ + def factory(*args_, **kwargs_): + if docParamName.subclass: + return docParamName.subclass(*args_, **kwargs_) + else: + return docParamName(*args_, **kwargs_) + factory = staticmethod(factory) + def get_ref(self): return self.ref + def set_ref(self, ref): self.ref = ref + def get_direction(self): return self.direction + def set_direction(self, direction): self.direction = direction + def export(self, outfile, level, namespace_='', name_='docParamName', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docParamName') + outfile.write('>') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docParamName'): + if self.direction is not None: + outfile.write(' direction=%s' % (quote_attrib(self.direction), )) + def exportChildren(self, outfile, level, namespace_='', name_='docParamName'): + for item_ in self.content_: + item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): + if ( + self.ref is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('direction'): + self.direction = attrs.get('direction').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'ref': + childobj_ = docRefTextType.factory() + childobj_.build(child_) + obj_ = self.mixedclass_(MixedContainer.CategoryComplex, + MixedContainer.TypeNone, 'ref', childobj_) + self.content_.append(obj_) + elif child_.nodeType == Node.TEXT_NODE: + obj_ = self.mixedclass_(MixedContainer.CategoryText, + MixedContainer.TypeNone, '', child_.nodeValue) + self.content_.append(obj_) +# end class docParamName + + +class docXRefSectType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, id=None, xreftitle=None, xrefdescription=None): + self.id = id + if xreftitle is None: + self.xreftitle = [] + else: + self.xreftitle = xreftitle + self.xrefdescription = xrefdescription + def factory(*args_, **kwargs_): + if docXRefSectType.subclass: + return docXRefSectType.subclass(*args_, **kwargs_) + else: + return docXRefSectType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_xreftitle(self): return self.xreftitle + def set_xreftitle(self, xreftitle): self.xreftitle = xreftitle + def add_xreftitle(self, value): self.xreftitle.append(value) + def insert_xreftitle(self, index, value): self.xreftitle[index] = value + def get_xrefdescription(self): return self.xrefdescription + def set_xrefdescription(self, xrefdescription): self.xrefdescription = xrefdescription + def get_id(self): return self.id + def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docXRefSectType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docXRefSectType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docXRefSectType'): + if self.id is not None: + outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docXRefSectType'): + for xreftitle_ in self.xreftitle: + showIndent(outfile, level) + outfile.write('<%sxreftitle>%s\n' % (namespace_, self.format_string(quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_)) + if self.xrefdescription: + self.xrefdescription.export(outfile, level, namespace_, name_='xrefdescription', ) + def hasContent_(self): + if ( + self.xreftitle is not None or + self.xrefdescription is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('id'): + self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'xreftitle': + xreftitle_ = '' + for text__content_ in child_.childNodes: + xreftitle_ += text__content_.nodeValue + self.xreftitle.append(xreftitle_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'xrefdescription': + obj_ = descriptionType.factory() + obj_.build(child_) + self.set_xrefdescription(obj_) +# end class docXRefSectType + + +class docCopyType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, link=None, para=None, sect1=None, internal=None): + self.link = link + if para is None: + self.para = [] + else: + self.para = para + if sect1 is None: + self.sect1 = [] + else: + self.sect1 = sect1 + self.internal = internal + def factory(*args_, **kwargs_): + if docCopyType.subclass: + return docCopyType.subclass(*args_, **kwargs_) + else: + return docCopyType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_para(self): return self.para + def set_para(self, para): self.para = para + def add_para(self, value): self.para.append(value) + def insert_para(self, index, value): self.para[index] = value + def get_sect1(self): return self.sect1 + def set_sect1(self, sect1): self.sect1 = sect1 + def add_sect1(self, value): self.sect1.append(value) + def insert_sect1(self, index, value): self.sect1[index] = value + def get_internal(self): return self.internal + def set_internal(self, internal): self.internal = internal + def get_link(self): return self.link + def set_link(self, link): self.link = link + def export(self, outfile, level, namespace_='', name_='docCopyType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docCopyType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docCopyType'): + if self.link is not None: + outfile.write(' link=%s' % (self.format_string(quote_attrib(self.link).encode(ExternalEncoding), input_name='link'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docCopyType'): + for para_ in self.para: + para_.export(outfile, level, namespace_, name_='para') + for sect1_ in self.sect1: + sect1_.export(outfile, level, namespace_, name_='sect1') + if self.internal: + self.internal.export(outfile, level, namespace_, name_='internal') + def hasContent_(self): + if ( + self.para is not None or + self.sect1 is not None or + self.internal is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('link'): + self.link = attrs.get('link').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'para': + obj_ = docParaType.factory() + obj_.build(child_) + self.para.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'sect1': + obj_ = docSect1Type.factory() + obj_.build(child_) + self.sect1.append(obj_) + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'internal': + obj_ = docInternalType.factory() + obj_.build(child_) + self.set_internal(obj_) +# end class docCopyType + + +class docCharType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, char=None, valueOf_=''): + self.char = char + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if docCharType.subclass: + return docCharType.subclass(*args_, **kwargs_) + else: + return docCharType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_char(self): return self.char + def set_char(self, char): self.char = char + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docCharType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docCharType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docCharType'): + if self.char is not None: + outfile.write(' char=%s' % (quote_attrib(self.char), )) + def exportChildren(self, outfile, level, namespace_='', name_='docCharType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('char'): + self.char = attrs.get('char').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docCharType + + +class docEmptyType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=''): + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if docEmptyType.subclass: + return docEmptyType.subclass(*args_, **kwargs_) + else: + return docEmptyType(*args_, **kwargs_) + factory = staticmethod(factory) + def getValueOf_(self): return self.valueOf_ + def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docEmptyType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) + self.exportAttributes(outfile, level, namespace_, name_='docEmptyType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docEmptyType'): + pass + def exportChildren(self, outfile, level, namespace_='', name_='docEmptyType'): + if self.valueOf_.find('![CDATA')>-1: + value=quote_xml('%s' % self.valueOf_) + value=value.replace('![CDATA','') + outfile.write(value) + else: + outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): + if ( + self.valueOf_ is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + self.valueOf_ = '' + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + pass + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.TEXT_NODE: + self.valueOf_ += child_.nodeValue + elif child_.nodeType == Node.CDATA_SECTION_NODE: + self.valueOf_ += '![CDATA['+child_.nodeValue+']]' +# end class docEmptyType + + +USAGE_TEXT = """ +Usage: python .py [ -s ] +Options: + -s Use the SAX parser, not the minidom parser. +""" + +def usage(): + print(USAGE_TEXT) + sys.exit(1) + + +def parse(inFileName): + doc = minidom.parse(inFileName) + rootNode = doc.documentElement + rootObj = DoxygenType.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('\n') + rootObj.export(sys.stdout, 0, name_="doxygen", + namespacedef_='') + return rootObj + + +def parseString(inString): + doc = minidom.parseString(inString) + rootNode = doc.documentElement + rootObj = DoxygenType.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('\n') + rootObj.export(sys.stdout, 0, name_="doxygen", + namespacedef_='') + return rootObj + + +def parseLiteral(inFileName): + doc = minidom.parse(inFileName) + rootNode = doc.documentElement + rootObj = DoxygenType.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('from compound import *\n\n') + sys.stdout.write('rootObj = doxygen(\n') + rootObj.exportLiteral(sys.stdout, 0, name_="doxygen") + sys.stdout.write(')\n') + return rootObj + + +def main(): + args = sys.argv[1:] + if len(args) == 1: + parse(args[0]) + else: + usage() + + +if __name__ == '__main__': + main() + #import pdb + #pdb.run('main()') + diff --git a/doc/breathe/parser/doxygen/compoundsuper.pyc b/doc/breathe/parser/doxygen/compoundsuper.pyc new file mode 100644 index 0000000..5b3f941 Binary files /dev/null and b/doc/breathe/parser/doxygen/compoundsuper.pyc differ diff --git a/doc/breathe/parser/doxygen/index.py b/doc/breathe/parser/doxygen/index.py new file mode 100644 index 0000000..da6015c --- /dev/null +++ b/doc/breathe/parser/doxygen/index.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +""" +Generated Mon Feb 9 19:08:05 2009 by generateDS.py. +""" + +from xml.dom import minidom +from xml.parsers.expat import ExpatError + + +from . import indexsuper as supermod + +class DoxygenTypeSub(supermod.DoxygenType): + + node_type = "doxygen" + + def __init__(self, version=None, compound=None): + supermod.DoxygenType.__init__(self, version, compound) +supermod.DoxygenType.subclass = DoxygenTypeSub +# end class DoxygenTypeSub + + +class CompoundTypeSub(supermod.CompoundType): + + node_type = "compound" + + def __init__(self, kind=None, refid=None, name='', member=None): + supermod.CompoundType.__init__(self, kind, refid, name, member) +supermod.CompoundType.subclass = CompoundTypeSub +# end class CompoundTypeSub + + +class MemberTypeSub(supermod.MemberType): + + node_type = "member" + + def __init__(self, kind=None, refid=None, name=''): + supermod.MemberType.__init__(self, kind, refid, name) +supermod.MemberType.subclass = MemberTypeSub +# end class MemberTypeSub + + +class ParseError(Exception): + pass + +class FileIOError(Exception): + pass + +def parse(inFilename): + + try: + doc = minidom.parse(inFilename) + except IOError as e: + raise FileIOError(e) + except ExpatError as e: + raise ParseError(e) + + rootNode = doc.documentElement + rootObj = supermod.DoxygenType.factory() + rootObj.build(rootNode) + + return rootObj + diff --git a/doc/breathe/parser/doxygen/index.pyc b/doc/breathe/parser/doxygen/index.pyc new file mode 100644 index 0000000..35c7928 Binary files /dev/null and b/doc/breathe/parser/doxygen/index.pyc differ diff --git a/doc/breathe/parser/doxygen/indexsuper.py b/doc/breathe/parser/doxygen/indexsuper.py new file mode 100644 index 0000000..5641e0b --- /dev/null +++ b/doc/breathe/parser/doxygen/indexsuper.py @@ -0,0 +1,362 @@ +#!/usr/bin/env python + +# +# Generated Thu Jun 11 18:43:54 2009 by generateDS.py. +# + +import sys +import getopt +from xml.dom import minidom +from xml.dom import Node + +# +# User methods +# +# Calls to the methods in these classes are generated by generateDS.py. +# You can replace these methods by re-implementing the following class +# in a module named generatedssuper.py. + +try: + from generatedssuper import GeneratedsSuper +except ImportError as exp: + + class GeneratedsSuper: + def format_string(self, input_data, input_name=''): + return input_data + def format_integer(self, input_data, input_name=''): + return '%d' % input_data + def format_float(self, input_data, input_name=''): + return '%f' % input_data + def format_double(self, input_data, input_name=''): + return '%e' % input_data + def format_boolean(self, input_data, input_name=''): + return '%s' % input_data + + +# +# If you have installed IPython you can uncomment and use the following. +# IPython is available from http://ipython.scipy.org/. +# + +## from IPython.Shell import IPShellEmbed +## args = '' +## ipshell = IPShellEmbed(args, +## banner = 'Dropping into IPython', +## exit_msg = 'Leaving Interpreter, back to program.') + +# Then use the following line where and when you want to drop into the +# IPython shell: +# ipshell(' -- Entering ipshell.\nHit Ctrl-D to exit') + +# +# Globals +# + +ExternalEncoding = 'ascii' + +# +# Support/utility functions. +# + +def showIndent(outfile, level): + for idx in range(level): + outfile.write(' ') + +def quote_xml(inStr): + s1 = (isinstance(inStr, basestring) and inStr or + '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + return s1 + +def quote_attrib(inStr): + s1 = (isinstance(inStr, basestring) and inStr or + '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + if '"' in s1: + if "'" in s1: + s1 = '"%s"' % s1.replace('"', """) + else: + s1 = "'%s'" % s1 + else: + s1 = '"%s"' % s1 + return s1 + +def quote_python(inStr): + s1 = inStr + if s1.find("'") == -1: + if s1.find('\n') == -1: + return "'%s'" % s1 + else: + return "'''%s'''" % s1 + else: + if s1.find('"') != -1: + s1 = s1.replace('"', '\\"') + if s1.find('\n') == -1: + return '"%s"' % s1 + else: + return '"""%s"""' % s1 + + +class MixedContainer: + # Constants for category: + CategoryNone = 0 + CategoryText = 1 + CategorySimple = 2 + CategoryComplex = 3 + # Constants for content_type: + TypeNone = 0 + TypeText = 1 + TypeString = 2 + TypeInteger = 3 + TypeFloat = 4 + TypeDecimal = 5 + TypeDouble = 6 + TypeBoolean = 7 + def __init__(self, category, content_type, name, value): + self.category = category + self.content_type = content_type + self.name = name + self.value = value + def getCategory(self): + return self.category + def getContenttype(self, content_type): + return self.content_type + def getValue(self): + return self.value + def getName(self): + return self.name + + +class _MemberSpec(object): + def __init__(self, name='', data_type='', container=0): + self.name = name + self.data_type = data_type + self.container = container + def set_name(self, name): self.name = name + def get_name(self): return self.name + def set_data_type(self, data_type): self.data_type = data_type + def get_data_type(self): return self.data_type + def set_container(self, container): self.container = container + def get_container(self): return self.container + + +# +# Data representation classes. +# + +class DoxygenType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, version=None, compound=None): + self.version = version + if compound is None: + self.compound = [] + else: + self.compound = compound + def factory(*args_, **kwargs_): + if DoxygenType.subclass: + return DoxygenType.subclass(*args_, **kwargs_) + else: + return DoxygenType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_compound(self): return self.compound + def set_compound(self, compound): self.compound = compound + def add_compound(self, value): self.compound.append(value) + def insert_compound(self, index, value): self.compound[index] = value + def get_version(self): return self.version + def set_version(self, version): self.version = version + def hasContent_(self): + if ( + self.compound is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('version'): + self.version = attrs.get('version').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'compound': + obj_ = CompoundType.factory() + obj_.build(child_) + self.compound.append(obj_) +# end class DoxygenType + + +class CompoundType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, kind=None, refid=None, name=None, member=None): + self.kind = kind + self.refid = refid + self.name = name + if member is None: + self.member = [] + else: + self.member = member + def factory(*args_, **kwargs_): + if CompoundType.subclass: + return CompoundType.subclass(*args_, **kwargs_) + else: + return CompoundType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_name(self): return self.name + def set_name(self, name): self.name = name + def get_member(self): return self.member + def set_member(self, member): self.member = member + def add_member(self, value): self.member.append(value) + def insert_member(self, index, value): self.member[index] = value + def get_kind(self): return self.kind + def set_kind(self, kind): self.kind = kind + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('kind'): + self.kind = attrs.get('kind').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'name': + name_ = '' + for text__content_ in child_.childNodes: + name_ += text__content_.nodeValue + self.name = name_ + elif child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'member': + obj_ = MemberType.factory() + obj_.build(child_) + self.member.append(obj_) +# end class CompoundType + + +class MemberType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, kind=None, refid=None, name=None): + self.kind = kind + self.refid = refid + self.name = name + def factory(*args_, **kwargs_): + if MemberType.subclass: + return MemberType.subclass(*args_, **kwargs_) + else: + return MemberType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_name(self): return self.name + def set_name(self, name): self.name = name + def get_kind(self): return self.kind + def set_kind(self, kind): self.kind = kind + def get_refid(self): return self.refid + def set_refid(self, refid): self.refid = refid + def hasContent_(self): + if ( + self.name is not None + ): + return True + else: + return False + def build(self, node_): + attrs = node_.attributes + self.buildAttributes(attrs) + for child_ in node_.childNodes: + nodeName_ = child_.nodeName.split(':')[-1] + self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): + if attrs.get('kind'): + self.kind = attrs.get('kind').value + if attrs.get('refid'): + self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): + if child_.nodeType == Node.ELEMENT_NODE and \ + nodeName_ == 'name': + name_ = '' + for text__content_ in child_.childNodes: + name_ += text__content_.nodeValue + self.name = name_ +# end class MemberType + + +USAGE_TEXT = """ +Usage: python .py [ -s ] +Options: + -s Use the SAX parser, not the minidom parser. +""" + +def usage(): + print(USAGE_TEXT) + sys.exit(1) + + +def parse(inFileName): + doc = minidom.parse(inFileName) + rootNode = doc.documentElement + rootObj = DoxygenType.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('\n') + rootObj.export(sys.stdout, 0, name_="doxygenindex", + namespacedef_='') + return rootObj + + +def parseString(inString): + doc = minidom.parseString(inString) + rootNode = doc.documentElement + rootObj = DoxygenType.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('\n') + rootObj.export(sys.stdout, 0, name_="doxygenindex", + namespacedef_='') + return rootObj + + +def parseLiteral(inFileName): + doc = minidom.parse(inFileName) + rootNode = doc.documentElement + rootObj = DoxygenType.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('from index import *\n\n') + sys.stdout.write('rootObj = doxygenindex(\n') + rootObj.exportLiteral(sys.stdout, 0, name_="doxygenindex") + sys.stdout.write(')\n') + return rootObj + + +def main(): + args = sys.argv[1:] + if len(args) == 1: + parse(args[0]) + else: + usage() + + + + +if __name__ == '__main__': + main() + #import pdb + #pdb.run('main()') + diff --git a/doc/breathe/parser/doxygen/indexsuper.pyc b/doc/breathe/parser/doxygen/indexsuper.pyc new file mode 100644 index 0000000..8576b83 Binary files /dev/null and b/doc/breathe/parser/doxygen/indexsuper.pyc differ diff --git a/doc/breathe/process.py b/doc/breathe/process.py new file mode 100644 index 0000000..0ddce84 --- /dev/null +++ b/doc/breathe/process.py @@ -0,0 +1,87 @@ + +AUTOCFG_TEMPLATE = r""" +PROJECT_NAME = "{project_name}" +OUTPUT_DIRECTORY = {output_dir} +GENERATE_LATEX = NO +GENERATE_MAN = NO +GENERATE_RTF = NO +CASE_SENSE_NAMES = NO +INPUT = {input} +ENABLE_PREPROCESSING = YES +QUIET = YES +JAVADOC_AUTOBRIEF = YES +JAVADOC_AUTOBRIEF = NO +GENERATE_HTML = NO +GENERATE_XML = YES +ALIASES = "rst=\verbatim embed:rst" +ALIASES += "endrst=\endverbatim" +""".strip() + + +class ProjectData(object): + "Simple handler for the files and project_info for each project" + + def __init__(self, auto_project_info, files): + + self.auto_project_info = auto_project_info + self.files = files + + +class AutoDoxygenProcessHandle(object): + + def __init__(self, path_handler, run_process, write_file, project_info_factory): + + self.path_handler = path_handler + self.run_process = run_process + self.write_file = write_file + self.project_info_factory = project_info_factory + + def generate_xml(self, app): + + project_files = {} + + # First collect together all the files which need to be doxygen processed for each project + for project_name, file_structure in app.config.breathe_projects_source.items(): + + folder = file_structure[0] + contents = file_structure[1] + + auto_project_info = self.project_info_factory.create_auto_project_info( + project_name, folder) + + project_files[project_name] = ProjectData(auto_project_info, contents) + + # Iterate over the projects and generate doxygen xml output for the files for each one into + # a directory in the Sphinx build area + for project_name, data in project_files.items(): + + project_path = self.process(data.auto_project_info, data.files) + + project_info = data.auto_project_info.create_project_info(project_path) + + self.project_info_factory.store_project_info_for_auto(project_name, project_info) + + def process(self, auto_project_info, files): + + name = auto_project_info.name() + cfgfile = "%s.cfg" % name + + full_paths = map(lambda x: auto_project_info.abs_path_to_source_file(x), files) + + cfg = AUTOCFG_TEMPLATE.format( + project_name=name, + output_dir=name, + input=" ".join(full_paths) + ) + + build_dir = self.path_handler.join( + auto_project_info.build_dir(), + "breathe", + "doxygen" + ) + + self.write_file(build_dir, cfgfile, cfg) + + self.run_process(['doxygen', cfgfile], cwd=build_dir) + + return self.path_handler.join(build_dir, name, "xml") diff --git a/doc/breathe/process.pyc b/doc/breathe/process.pyc new file mode 100644 index 0000000..1f97d1a Binary files /dev/null and b/doc/breathe/process.pyc differ diff --git a/doc/breathe/project.py b/doc/breathe/project.py new file mode 100644 index 0000000..6d2d37a --- /dev/null +++ b/doc/breathe/project.py @@ -0,0 +1,306 @@ + +from .exception import BreatheError + +import os + + +class ProjectError(BreatheError): + pass + + +class NoDefaultProjectError(ProjectError): + pass + + +class AutoProjectInfo(object): + """Created as a temporary step in the automatic xml generation process""" + + def __init__( + self, + name, + source_path, + build_dir, + reference, + source_dir, + config_dir, + domain_by_extension, + domain_by_file_pattern, + match + ): + + self._name = name + self._source_path = source_path + self._build_dir = build_dir + self._reference = reference + self._source_dir = source_dir + self._config_dir = config_dir + self._domain_by_extension = domain_by_extension + self._domain_by_file_pattern = domain_by_file_pattern + self._match = match + + def name(self): + return self._name + + def build_dir(self): + return self._build_dir + + def abs_path_to_source_file(self, file_): + """ + Returns full path to the provide file assuming that the provided path is relative to the + projects conf.py directory as specified in the breathe_projects_source config variable. + """ + + # os.path.join does the appropriate handling if _source_path is an absolute path + return os.path.join(self._config_dir, self._source_path, file_) + + def create_project_info(self, project_path): + """Creates a proper ProjectInfo object based on the information in this AutoProjectInfo""" + + return ProjectInfo( + self._name, + project_path, + self._source_path, + self._reference, + self._source_dir, + self._config_dir, + self._domain_by_extension, + self._domain_by_file_pattern, + self._match + ) + + +class ProjectInfo(object): + + def __init__( + self, + name, + path, + source_path, + reference, + source_dir, + config_dir, + domain_by_extension, + domain_by_file_pattern, + match + ): + + self._name = name + self._project_path = path + self._source_path = source_path + self._reference = reference + self._source_dir = source_dir + self._config_dir = config_dir + self._domain_by_extension = domain_by_extension + self._domain_by_file_pattern = domain_by_file_pattern + self._match = match + + def name(self): + return self._name + + def project_path(self): + return self._project_path + + def source_path(self): + return self._source_path + + def relative_path_to_xml_file(self, file_): + """ + Returns relative path from Sphinx documentation top-level source directory to the specified + file assuming that the specified file is a path relative to the doxygen xml output + directory. + """ + + # os.path.join does the appropriate handling if _project_path is an absolute path + full_xml_project_path = os.path.join(self._config_dir, self._project_path, file_) + + return os.path.relpath( + full_xml_project_path, + self._source_dir + ) + + def sphinx_abs_path_to_file(self, file_): + """ + Prepends os.path.sep to the value returned by relative_path_to_file. + + This is to match Sphinx's concept of an absolute path which starts from the top-level source + directory of the project. + """ + return os.path.sep + self.relative_path_to_xml_file(file_) + + def reference(self): + return self._reference + + def domain_for_file(self, file_): + + domain = "" + extension = file_.split(".")[-1] + + try: + domain = self._domain_by_extension[extension] + except KeyError: + pass + + for pattern, pattern_domain in self._domain_by_file_pattern.items(): + if self._match(file_, pattern): + domain = pattern_domain + + return domain + + +class ProjectInfoFactory(object): + + def __init__(self, source_dir, build_dir, config_dir, match): + + self.source_dir = source_dir + self.build_dir = build_dir + self.config_dir = config_dir + self.match = match + + self.projects = {} + self.default_project = None + self.domain_by_extension = {} + self.domain_by_file_pattern = {} + + self.project_count = 0 + self.project_info_store = {} + self.project_info_for_auto_store = {} + self.auto_project_info_store = {} + + def update( + self, + projects, + default_project, + domain_by_extension, + domain_by_file_pattern, + projects_source, + build_dir + ): + + self.projects = projects + self.default_project = default_project + self.domain_by_extension = domain_by_extension + self.domain_by_file_pattern = domain_by_file_pattern + self.projects_source = projects_source + + # If the breathe config values has a non-empty value for build_dir then use that otherwise + # stick with the default + if build_dir: + self.build_dir = build_dir + + def default_path(self): + + if not self.default_project: + raise NoDefaultProjectError( + "No breathe_default_project config setting to fall back on " + "for directive with no 'project' or 'path' specified." + ) + + try: + return self.projects[self.default_project] + except KeyError: + raise ProjectError( + ("breathe_default_project value '%s' does not seem to be a valid key for the " + "breathe_projects dictionary") % self.default_project + ) + + def create_project_info(self, options): + + name = "" + + if "project" in options: + try: + path = self.projects[options["project"]] + name = options["project"] + except KeyError: + raise ProjectError("Unable to find project '%s' in breathe_projects dictionary" + % options["project"]) + + elif "path" in options: + path = options["path"] + + else: + path = self.default_path() + + try: + return self.project_info_store[path] + except KeyError: + + reference = name + + if not name: + name = "project%s" % self.project_count + reference = path + self.project_count += 1 + + project_info = ProjectInfo( + name, + path, + "NoSourcePath", + reference, + self.source_dir, + self.config_dir, + self.domain_by_extension, + self.domain_by_file_pattern, + self.match + ) + + self.project_info_store[path] = project_info + + return project_info + + def store_project_info_for_auto(self, name, project_info): + """Stores the project info by name for later extraction by the auto directives. + + Stored separately to the non-auto project info objects as they should never overlap. + """ + + self.project_info_for_auto_store[name] = project_info + + def retrieve_project_info_for_auto(self, options): + """Retrieves the project info by name for later extraction by the auto directives. + + Looks for the 'project' entry in the options dictionary. This is a less than ideal API but + it is designed to match the use of 'create_project_info' above for which it makes much more + sense. + """ + + name = options.get('project', self.default_project) + + if name is None: + raise NoDefaultProjectError( + "No breathe_default_project config setting to fall back on " + "for directive with no 'project' or 'path' specified." + ) + + return self.project_info_for_auto_store[name] + + def create_auto_project_info(self, name, source_path): + + key = source_path + + try: + return self.auto_project_info_store[key] + except KeyError: + + reference = name + + if not name: + name = "project%s" % self.project_count + reference = source_path + self.project_count += 1 + + auto_project_info = AutoProjectInfo( + name, + source_path, + self.build_dir, + reference, + self.source_dir, + self.config_dir, + self.domain_by_extension, + self.domain_by_file_pattern, + self.match + ) + + self.auto_project_info_store[key] = auto_project_info + + return auto_project_info diff --git a/doc/breathe/project.pyc b/doc/breathe/project.pyc new file mode 100644 index 0000000..489ae42 Binary files /dev/null and b/doc/breathe/project.pyc differ diff --git a/doc/breathe/renderer/__init__.py b/doc/breathe/renderer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/doc/breathe/renderer/__init__.pyc b/doc/breathe/renderer/__init__.pyc new file mode 100644 index 0000000..7e178df Binary files /dev/null and b/doc/breathe/renderer/__init__.pyc differ diff --git a/doc/breathe/renderer/rst/__init__.py b/doc/breathe/renderer/rst/__init__.py new file mode 100644 index 0000000..139597f --- /dev/null +++ b/doc/breathe/renderer/rst/__init__.py @@ -0,0 +1,2 @@ + + diff --git a/doc/breathe/renderer/rst/__init__.pyc b/doc/breathe/renderer/rst/__init__.pyc new file mode 100644 index 0000000..434f51a Binary files /dev/null and b/doc/breathe/renderer/rst/__init__.pyc differ diff --git a/doc/breathe/renderer/rst/doxygen/__init__.py b/doc/breathe/renderer/rst/doxygen/__init__.py new file mode 100644 index 0000000..0dcc0b8 --- /dev/null +++ b/doc/breathe/renderer/rst/doxygen/__init__.py @@ -0,0 +1,383 @@ + +from .base import Renderer, RenderContext +from . import index as indexrenderer +from . import compound as compoundrenderer + +from docutils import nodes +import textwrap + +class RstContentCreator(object): + + def __init__(self, list_type, dedent): + + self.list_type = list_type + self.dedent = dedent + + def __call__(self, text): + + # Remove the first line which is "embed:rst[:leading-asterisk]" + text = "\n".join(text.split(u"\n")[1:]) + + # Remove starting whitespace + text = self.dedent(text) + + # Inspired by autodoc.py in Sphinx + result = self.list_type() + for line in text.split("\n"): + result.append(line, "") + + return result + +class UnicodeRenderer(Renderer): + + def render(self): + + # Skip any nodes that are pure whitespace + # Probably need a better way to do this as currently we're only doing + # it skip whitespace between higher-level nodes, but this will also + # skip any pure whitespace entries in actual content nodes + # + # We counter that second issue slightly by allowing through single white spaces + # + if self.data_object.strip(): + return [self.node_factory.Text(self.data_object)] + elif self.data_object == unicode(" "): + return [self.node_factory.Text(self.data_object)] + else: + return [] + +class NullRenderer(Renderer): + + def __init__(self): + pass + + def render(self): + return [] + + +class DoxygenToRstRendererFactory(object): + + def __init__( + self, + node_type, + renderers, + renderer_factory_creator, + node_factory, + project_info, + state, + document, + rst_content_creator, + filter_, + target_handler, + domain_directive_factory + ): + + self.node_type = node_type + self.node_factory = node_factory + self.project_info = project_info + self.renderers = renderers + self.renderer_factory_creator = renderer_factory_creator + self.state = state + self.document = document + self.rst_content_creator = rst_content_creator + self.filter_ = filter_ + self.target_handler = target_handler + self.domain_directive_factory = domain_directive_factory + + def create_renderer( + self, + context + ): + + parent_data_object = context.node_stack[1] + data_object = context.node_stack[0] + + if not self.filter_.allow(context.node_stack): + return NullRenderer() + + child_renderer_factory = self.renderer_factory_creator.create_child_factory( + self.project_info, + data_object, + self + ) + + try: + node_type = data_object.node_type + except AttributeError as e: + + # Horrible hack to silence errors on filtering unicode objects + # until we fix the parsing + if type(data_object) == unicode: + node_type = "unicode" + else: + raise e + + Renderer = self.renderers[node_type] + + common_args = [ + self.project_info, + context, + child_renderer_factory, + self.node_factory, + self.state, + self.document, + self.target_handler, + self.domain_directive_factory + ] + + if node_type == "docmarkup": + + creator = self.node_factory.inline + if data_object.type_ == "emphasis": + creator = self.node_factory.emphasis + elif data_object.type_ == "computeroutput": + creator = self.node_factory.literal + elif data_object.type_ == "bold": + creator = self.node_factory.strong + elif data_object.type_ == "superscript": + creator = self.node_factory.superscript + elif data_object.type_ == "subscript": + creator = self.node_factory.subscript + elif data_object.type_ == "center": + print("Warning: does not currently handle 'center' text display") + elif data_object.type_ == "small": + print("Warning: does not currently handle 'small' text display") + + return Renderer( + creator, + *common_args + ) + + if node_type == "verbatim": + + return Renderer( + self.rst_content_creator, + *common_args + ) + + if node_type == "compound": + + kind = data_object.kind + if kind in ["file", "dir", "page", "example", "group"]: + return Renderer(indexrenderer.FileRenderer, *common_args) + + class_ = indexrenderer.CompoundTypeSubRenderer + + # For compound node types Renderer is CreateCompoundTypeSubRenderer + # as defined below. This could be cleaner + return Renderer( + class_, + *common_args + ) + + if node_type == "memberdef": + + if data_object.kind in ("function", "slot") or (data_object.kind == 'friend' and data_object.argsstring): + Renderer = compoundrenderer.FuncMemberDefTypeSubRenderer + elif data_object.kind == "enum": + Renderer = compoundrenderer.EnumMemberDefTypeSubRenderer + elif data_object.kind == "typedef": + Renderer = compoundrenderer.TypedefMemberDefTypeSubRenderer + elif data_object.kind == "variable": + Renderer = compoundrenderer.VariableMemberDefTypeSubRenderer + elif data_object.kind == "define": + Renderer = compoundrenderer.DefineMemberDefTypeSubRenderer + + if node_type == "param": + return Renderer( + parent_data_object.node_type != "templateparamlist", + *common_args + ) + + if node_type == "docsimplesect": + if data_object.kind == "par": + Renderer = compoundrenderer.ParDocSimpleSectTypeSubRenderer + + return Renderer( + *common_args + ) + +class CreateCompoundTypeSubRenderer(object): + + def __init__(self, parser_factory): + + self.parser_factory = parser_factory + + def __call__(self, class_, project_info, *args): + + compound_parser = self.parser_factory.create_compound_parser(project_info) + return class_(compound_parser, project_info, *args) + + +class CreateRefTypeSubRenderer(object): + + def __init__(self, parser_factory): + + self.parser_factory = parser_factory + + def __call__(self, project_info, *args): + + compound_parser = self.parser_factory.create_compound_parser(project_info) + return compoundrenderer.RefTypeSubRenderer(compound_parser, project_info, *args) + + +class DoxygenToRstRendererFactoryCreator(object): + + def __init__( + self, + node_factory, + parser_factory, + domain_directive_factory, + rst_content_creator, + project_info + ): + + self.node_factory = node_factory + self.parser_factory = parser_factory + self.domain_directive_factory = domain_directive_factory + self.rst_content_creator = rst_content_creator + self.project_info = project_info + + def create_factory(self, node_stack, state, document, filter_, target_handler): + + data_object = node_stack[0] + + renderers = { + "doxygen" : indexrenderer.DoxygenTypeSubRenderer, + "compound" : CreateCompoundTypeSubRenderer(self.parser_factory), + "doxygendef" : compoundrenderer.DoxygenTypeSubRenderer, + "compounddef" : compoundrenderer.CompoundDefTypeSubRenderer, + "sectiondef" : compoundrenderer.SectionDefTypeSubRenderer, + "memberdef" : compoundrenderer.MemberDefTypeSubRenderer, + "enumvalue" : compoundrenderer.EnumvalueTypeSubRenderer, + "linkedtext" : compoundrenderer.LinkedTextTypeSubRenderer, + "description" : compoundrenderer.DescriptionTypeSubRenderer, + "param" : compoundrenderer.ParamTypeSubRenderer, + "docreftext" : compoundrenderer.DocRefTextTypeSubRenderer, + "docheading" : compoundrenderer.DocHeadingTypeSubRenderer, + "docpara" : compoundrenderer.DocParaTypeSubRenderer, + "docmarkup" : compoundrenderer.DocMarkupTypeSubRenderer, + "docparamlist" : compoundrenderer.DocParamListTypeSubRenderer, + "docparamlistitem" : compoundrenderer.DocParamListItemSubRenderer, + "docparamnamelist" : compoundrenderer.DocParamNameListSubRenderer, + "docparamname" : compoundrenderer.DocParamNameSubRenderer, + "docsect1" : compoundrenderer.DocSect1TypeSubRenderer, + "docsimplesect" : compoundrenderer.DocSimpleSectTypeSubRenderer, + "doctitle" : compoundrenderer.DocTitleTypeSubRenderer, + "docformula" : compoundrenderer.DocForumlaTypeSubRenderer, + "docimage" : compoundrenderer.DocImageTypeSubRenderer, + "docurllink" : compoundrenderer.DocURLLinkSubRenderer, + "listing" : compoundrenderer.ListingTypeSubRenderer, + "codeline" : compoundrenderer.CodeLineTypeSubRenderer, + "highlight" : compoundrenderer.HighlightTypeSubRenderer, + "templateparamlist" : compoundrenderer.TemplateParamListRenderer, + "inc" : compoundrenderer.IncTypeSubRenderer, + "ref" : CreateRefTypeSubRenderer(self.parser_factory), + "verbatim" : compoundrenderer.VerbatimTypeSubRenderer, + "mixedcontainer" : compoundrenderer.MixedContainerRenderer, + "unicode" : UnicodeRenderer, + "doclist": compoundrenderer.DocListTypeSubRenderer, + "doclistitem": compoundrenderer.DocListItemTypeSubRenderer, + } + + try: + node_type = data_object.node_type + except AttributeError as e: + + # Horrible hack to silence errors on filtering unicode objects + # until we fix the parsing + if type(data_object) == unicode: + node_type = "unicode" + else: + raise e + + return DoxygenToRstRendererFactory( + "root", + renderers, + self, + self.node_factory, + self.project_info, + state, + document, + self.rst_content_creator, + filter_, + target_handler, + self.domain_directive_factory + ) + + def create_child_factory( self, project_info, data_object, parent_renderer_factory ): + + try: + node_type = data_object.node_type + except AttributeError as e: + + # Horrible hack to silence errors on filtering unicode objects + # until we fix the parsing + if type(data_object) == unicode: + node_type = "unicode" + else: + raise e + + return DoxygenToRstRendererFactory( + node_type, + parent_renderer_factory.renderers, + self, + self.node_factory, + parent_renderer_factory.project_info, + parent_renderer_factory.state, + parent_renderer_factory.document, + self.rst_content_creator, + parent_renderer_factory.filter_, + parent_renderer_factory.target_handler, + parent_renderer_factory.domain_directive_factory + ) + + +# FactoryFactoryFactory. Ridiculous but necessary. +class DoxygenToRstRendererFactoryCreatorConstructor(object): + + def __init__( + self, + node_factory, + parser_factory, + domain_directive_factory, + rst_content_creator + ): + + self.node_factory = node_factory + self.parser_factory = parser_factory + self.domain_directive_factory = domain_directive_factory + self.rst_content_creator = rst_content_creator + + def create_factory_creator(self, project_info, document, options, target_handler): + + return DoxygenToRstRendererFactoryCreator( + self.node_factory, + self.parser_factory, + self.domain_directive_factory, + self.rst_content_creator, + project_info, + ) + + +def format_parser_error(name, error, filename, state, lineno, do_unicode_warning): + + warning = '%s: Unable to parse xml file "%s". ' % (name, filename) + explanation = 'Reported error: %s. ' % error + + unicode_explanation_text = "" + unicode_explanation = [] + if do_unicode_warning: + unicode_explanation_text = textwrap.dedent(""" + Parsing errors are often due to unicode errors associated with the encoding of the original + source files. Doxygen propagates invalid characters from the input source files to the + output xml.""").strip().replace("\n", " ") + unicode_explanation = [nodes.paragraph("", "", nodes.Text(unicode_explanation_text))] + + return [nodes.warning("", + nodes.paragraph("", "", nodes.Text(warning)), + nodes.paragraph("", "", nodes.Text(explanation)), + *unicode_explanation + ), + state.document.reporter.warning(warning + explanation + unicode_explanation_text, line=lineno) + ] diff --git a/doc/breathe/renderer/rst/doxygen/__init__.pyc b/doc/breathe/renderer/rst/doxygen/__init__.pyc new file mode 100644 index 0000000..8ae1c17 Binary files /dev/null and b/doc/breathe/renderer/rst/doxygen/__init__.pyc differ diff --git a/doc/breathe/renderer/rst/doxygen/base.py b/doc/breathe/renderer/rst/doxygen/base.py new file mode 100644 index 0000000..9506751 --- /dev/null +++ b/doc/breathe/renderer/rst/doxygen/base.py @@ -0,0 +1,127 @@ + +class Renderer(object): + + def __init__(self, + project_info, + context, + renderer_factory, + node_factory, + state, + document, + target_handler, + domain_directive_factory, + ): + + self.project_info = project_info + self.context = context + self.data_object = context.node_stack[0] + self.renderer_factory = renderer_factory + self.node_factory = node_factory + self.state = state + self.document = document + self.target_handler = target_handler + self.domain_directive_factory = domain_directive_factory + + if self.context.domain == '': + self.context.domain = self.get_domain() + + def get_domain(self): + """Returns the domain for the current node.""" + + def get_filename(node): + """Returns the name of a file where the declaration represented by node is located.""" + try: + return node.location.file + except AttributeError: + return None + + node_stack = self.context.node_stack + node = node_stack[0] + # An enumvalue node doesn't have location, so use its parent node for detecting the domain instead. + if type(node) == unicode or node.node_type == "enumvalue": + node = node_stack[1] + filename = get_filename(node) + if not filename and node.node_type == "compound": + file_data = self.compound_parser.parse(node.refid) + filename = get_filename(file_data.compounddef) + return self.project_info.domain_for_file(filename) if filename else '' + + def get_fully_qualified_name(self): + + names = [] + node_stack = self.context.node_stack + node = node_stack[0] + if node.node_type == 'enumvalue': + names.append(node.name) + # Skip the name of the containing enum because it is not a part of the fully qualified name. + node_stack = node_stack[2:] + + # If the node is a namespace, use its name because namespaces are skipped in the main loop. + if node.node_type == 'compound' and node.kind == 'namespace': + names.append(node.name) + + for node in node_stack: + if node.node_type == 'ref' and len(names) == 0: + return node.valueOf_ + if (node.node_type == 'compound' and node.kind not in ['file', 'namespace']) or \ + node.node_type == 'memberdef': + # We skip the 'file' entries because the file name doesn't form part of the + # qualified name for the identifier. We skip the 'namespace' entries because if we + # find an object through the namespace 'compound' entry in the index.xml then we'll + # also have the 'compounddef' entry in our node stack and we'll get it from that. We + # need the 'compounddef' entry because if we find the object through the 'file' + # entry in the index.xml file then we need to get the namespace name from somewhere + names.insert(0, node.name) + if (node.node_type == 'compounddef' and node.kind == 'namespace'): + # Nested namespaces include their parent namespace(s) in compoundname. ie, + # compoundname is 'foo::bar' instead of just 'bar' for namespace 'bar' nested in + # namespace 'foo'. We need full compoundname because node_stack doesn't necessarily + # include parent namespaces and we stop here in case it does. + names.insert(0, node.compoundname) + break + + return '::'.join(names) + + def create_template_node(self, decl): + """Creates a node for the ``template <...>`` part of the declaration.""" + if not decl.templateparamlist: + return None + context = self.context.create_child_context(decl.templateparamlist) + renderer = self.renderer_factory.create_renderer(context) + nodes = [self.node_factory.Text("template <")] + nodes.extend(renderer.render()) + nodes.append(self.node_factory.Text(">")) + signode = self.node_factory.desc_signature() + signode.extend(nodes) + return signode + + def run_domain_directive(self, kind, names): + domain_directive = self.renderer_factory.domain_directive_factory.create( + self.context.domain, [kind, names] + self.context.directive_args[2:]) + + # Translate Breathe's no-link option into the standard noindex option. + if 'no-link' in self.context.directive_args[2]: + domain_directive.options['noindex'] = True + nodes = domain_directive.run() + + # Filter out outer class names if we are rendering a member as a part of a class content. + signode = nodes[1].children[0] + if len(names) > 0 and self.context.child: + signode.children = [n for n in signode.children if not n.tagname == 'desc_addname'] + return nodes + + +class RenderContext(object): + + def __init__(self, node_stack, mask_factory, directive_args, domain='', child=False): + self.node_stack = node_stack + self.mask_factory = mask_factory + self.directive_args = directive_args + self.domain = domain + self.child = child + + def create_child_context(self, data_object): + + node_stack = self.node_stack[:] + node_stack.insert(0, self.mask_factory.mask(data_object)) + return RenderContext(node_stack, self.mask_factory, self.directive_args, self.domain, True) diff --git a/doc/breathe/renderer/rst/doxygen/base.pyc b/doc/breathe/renderer/rst/doxygen/base.pyc new file mode 100644 index 0000000..cefbec0 Binary files /dev/null and b/doc/breathe/renderer/rst/doxygen/base.pyc differ diff --git a/doc/breathe/renderer/rst/doxygen/compound.py b/doc/breathe/renderer/rst/doxygen/compound.py new file mode 100644 index 0000000..ec82e19 --- /dev/null +++ b/doc/breathe/renderer/rst/doxygen/compound.py @@ -0,0 +1,1004 @@ + +from .base import Renderer +from .index import CompoundRenderer + +class DoxygenTypeSubRenderer(Renderer): + + def render(self): + + context = self.context.create_child_context(self.data_object.compounddef) + compound_renderer = self.renderer_factory.create_renderer(context) + return compound_renderer.render() + + +class CompoundDefTypeSubRenderer(Renderer): + + # We store both the identified and appropriate title text here as we want to define the order + # here and the titles for the SectionDefTypeSubRenderer but we don't want the repetition of + # having two lists in case they fall out of sync + sections = [ + ("user-defined", "User Defined"), + ("public-type", "Public Types"), + ("public-func", "Public Functions"), + ("public-attrib", "Public Members"), + ("public-slot", "Public Slots"), + ("signal", "Signal"), + ("dcop-func", "DCOP Function"), + ("property", "Property"), + ("event", "Event"), + ("public-static-func", "Public Static Functions"), + ("public-static-attrib", "Public Static Attributes"), + ("protected-type", "Protected Types"), + ("protected-func", "Protected Functions"), + ("protected-attrib", "Protected Attributes"), + ("protected-slot", "Protected Slots"), + ("protected-static-func", "Protected Static Functions"), + ("protected-static-attrib", "Protected Static Attributes"), + ("package-type", "Package Types"), + ("package-func", "Package Functions"), + ("package-attrib", "Package Attributes"), + ("package-static-func", "Package Static Functions"), + ("package-static-attrib", "Package Static Attributes"), + ("private-type", "Private Types"), + ("private-func", "Private Functions"), + ("private-attrib", "Private Members"), + ("private-slot", "Private Slots"), + ("private-static-func", "Private Static Functions"), + ("private-static-attrib", "Private Static Attributes"), + ("friend", "Friends"), + ("related", "Related"), + ("define", "Defines"), + ("prototype", "Prototypes"), + ("typedef", "Typedefs"), + ("enum", "Enums"), + ("func", "Functions"), + ("var", "Variables"), + ] + + def render(self): + + nodelist = [] + + if self.data_object.briefdescription: + context = self.context.create_child_context(self.data_object.briefdescription) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + if self.data_object.detaileddescription: + context = self.context.create_child_context(self.data_object.detaileddescription) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + section_nodelists = {} + + # Get all sub sections + for sectiondef in self.data_object.sectiondef: + context = self.context.create_child_context(sectiondef) + renderer = self.renderer_factory.create_renderer(context) + child_nodes = renderer.render() + if not child_nodes: + # Skip empty section + continue + kind = sectiondef.kind + node = self.node_factory.container(classes=['breathe-sectiondef']) + node.document = self.state.document + node['objtype'] = kind + node.extend(child_nodes) + # We store the nodes as a list against the kind in a dictionary as the kind can be + # 'user-edited' and that can repeat so this allows us to collect all the 'user-edited' + # entries together + nodes = section_nodelists.setdefault(kind, []) + nodes += [node] + + # Order the results in an appropriate manner + for kind, _ in self.sections: + nodelist.extend(section_nodelists.get(kind, [])) + + # Take care of innerclasses + for innerclass in self.data_object.innerclass: + context = self.context.create_child_context(innerclass) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + for innernamespace in self.data_object.innernamespace: + context = self.context.create_child_context(innernamespace) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + + +class SectionDefTypeSubRenderer(Renderer): + + section_titles = dict(CompoundDefTypeSubRenderer.sections) + + def render(self): + + node_list = [] + + if self.data_object.description: + context = self.context.create_child_context(self.data_object.description) + renderer = self.renderer_factory.create_renderer(context) + node_list.extend(renderer.render()) + + # Get all the memberdef info + for memberdef in self.data_object.memberdef: + context = self.context.create_child_context(memberdef) + renderer = self.renderer_factory.create_renderer(context) + node_list.extend(renderer.render()) + + if node_list: + + text = self.section_titles[self.data_object.kind] + + # Override default name for user-defined sections. Use "Unnamed + # Group" if the user didn't name the section + # This is different to Doxygen which will track the groups and name + # them Group1, Group2, Group3, etc. + if self.data_object.kind == "user-defined": + if self.data_object.header: + text = self.data_object.header + else: + text = "Unnamed Group" + + # Use rubric for the title because, unlike the docutils element "section", + # it doesn't interfere with the document structure. + rubric = self.node_factory.rubric(text=text, classes=['breathe-sectiondef-title']) + + return [rubric] + node_list + + return [] + + +class MemberDefTypeSubRenderer(Renderer): + + def create_doxygen_target(self): + """Can be overridden to create a target node which uses the doxygen refid information + which can be used for creating links between internal doxygen elements. + + The default implementation should suffice most of the time. + """ + + refid = "%s%s" % (self.project_info.name(), self.data_object.id) + return self.target_handler.create_target(refid) + + def title(self): + + nodes = [] + + # Variable type or function return type + if self.data_object.type_: + context = self.context.create_child_context(self.data_object.type_) + renderer = self.renderer_factory.create_renderer(context) + nodes.extend(renderer.render()) + + if nodes: + nodes.append(self.node_factory.Text(" ")) + + nodes.append(self.node_factory.desc_name(text=self.data_object.name)) + + return nodes + + def description(self): + + nodes = [] + + if self.data_object.briefdescription: + context = self.context.create_child_context(self.data_object.briefdescription) + renderer = self.renderer_factory.create_renderer(context) + nodes.extend(renderer.render()) + + if self.data_object.detaileddescription: + context = self.context.create_child_context(self.data_object.detaileddescription) + renderer = self.renderer_factory.create_renderer(context) + nodes.extend(renderer.render()) + + return nodes + + def objtype(self): + """Return the type of the rendered object.""" + return self.data_object.kind + + def declaration(self): + """Return the declaration of the rendered object.""" + return self.get_fully_qualified_name() + + def update_signature(self, signode): + """Update the signature node if necessary, e.g. add qualifiers.""" + prefix = self.objtype() + ' ' + annotation = self.node_factory.desc_annotation(prefix, prefix) + if signode[0].tagname != 'desc_name': + signode[0] = annotation + else: + signode.insert(0, annotation) + + def render(self): + nodes = self.run_domain_directive(self.objtype(), [self.declaration().replace('\n', ' ')]) + node = nodes[1] + signode = node[0] + contentnode = node[-1] + self.update_signature(signode) + signode.insert(0, self.create_doxygen_target()) + contentnode.extend(self.description()) + return nodes + + +class FuncMemberDefTypeSubRenderer(MemberDefTypeSubRenderer): + + def update_signature(self, signode): + + # Note whether a member function is virtual + if self.data_object.virt != 'non-virtual': + signode.insert(0, self.node_factory.Text('virtual ')) + + # Add CV-qualifiers + if self.data_object.const == 'yes': + signode.append(self.node_factory.Text(' const')) + # The doxygen xml output doesn't seem to properly register 'volatile' as the xml attribute + # 'volatile' so we have to check the argsstring for the moment. Maybe it'll change in + # doxygen at some point. Registered as bug: + # https://bugzilla.gnome.org/show_bug.cgi?id=733451 + if self.data_object.volatile == 'yes' or self.data_object.argsstring.endswith('volatile'): + signode.append(self.node_factory.Text(' volatile')) + + # Add `= 0` for pure virtual members. + if self.data_object.virt == 'pure-virtual': + signode.append(self.node_factory.Text(' = 0')) + + def render(self): + # Get full function signature for the domain directive. + params = [] + for param in self.data_object.param: + param = self.context.mask_factory.mask(param) + param_type = [] + for p in param.type_.content_: + value = p.value + if not isinstance(value, unicode): + value = value.valueOf_ + param_type.append(value) + param_type = ' '.join(param_type) + param_name = param.declname if param.declname else param.defname + params.append(param_type if not param_name else param_type + ' ' + param_name) + signature = '{0}({1})'.format(self.data_object.definition, ', '.join(params)) + # Remove 'virtual' keyword as Sphinx 1.2 doesn't support virtual functions. + virtual = 'virtual ' + if signature.startswith(virtual): + signature = signature[len(virtual):] + self.context.directive_args[1] = [signature] + + nodes = self.run_domain_directive(self.data_object.kind, self.context.directive_args[1]) + node = nodes[1] + signode, contentnode = node.children + signode.insert(0, self.create_doxygen_target()) + self.update_signature(signode) + contentnode.extend(self.description()) + + template_node = self.create_template_node(self.data_object) + if template_node: + node.insert(0, template_node) + return nodes + + +class DefineMemberDefTypeSubRenderer(MemberDefTypeSubRenderer): + + def declaration(self): + decl = self.data_object.name + if self.data_object.param: + decl += "(" + for i, parameter in enumerate(self.data_object.param): + if i: + decl += ", " + decl += parameter.defname + decl += ")" + return decl + + def update_signature(self, signode): + pass + + def description(self): + + return MemberDefTypeSubRenderer.description(self) + + +class EnumMemberDefTypeSubRenderer(MemberDefTypeSubRenderer): + + def declaration(self): + + # Sphinx requires a name to be a valid identifier, so replace anonymous enum name of the form @id + # generated by Doxygen with "anonymous". + name = self.get_fully_qualified_name() + return name.replace("@", "__anonymous") if self.data_object.name.startswith("@") else name + + def description(self): + + description_nodes = MemberDefTypeSubRenderer.description(self) + + name = self.node_factory.emphasis("", self.node_factory.Text("Values:")) + title = self.node_factory.paragraph("", "", name) + description_nodes.append(title) + + enums = [] + for item in self.data_object.enumvalue: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + enums.extend(renderer.render()) + + description_nodes.extend(enums) + + return description_nodes + + def update_signature(self, signode): + # Replace "type" with "enum" in the signature. This is needed because Sphinx cpp domain doesn't have an enum + # directive and we use a type directive instead. + signode.children[0][0] = self.node_factory.Text("enum ") + if self.data_object.name.startswith("@"): + signode.children[1][0] = self.node_factory.strong(text="[anonymous]") + + +class TypedefMemberDefTypeSubRenderer(MemberDefTypeSubRenderer): + + def declaration(self): + decl = self.data_object.definition + typedef = "typedef " + if decl.startswith(typedef): + decl = decl[len(typedef):] + return decl + + +class VariableMemberDefTypeSubRenderer(MemberDefTypeSubRenderer): + + def declaration(self): + decl = self.data_object.definition + enum = 'enum ' + return decl[len(enum):] if decl.startswith(enum) else decl + + def update_signature(self, signode): + pass + + +class EnumvalueTypeSubRenderer(MemberDefTypeSubRenderer): + + def objtype(self): + + return 'enumvalue' + + def update_signature(self, signode): + # Remove "class" from the signature. This is needed because Sphinx cpp domain doesn't have an enum value + # directive and we use a class directive instead. + signode.children.pop(0) + initializer = self.data_object.initializer + if initializer: + context = self.context.create_child_context(initializer) + renderer = self.renderer_factory.create_renderer(context) + nodes = renderer.render() + separator = ' ' + if not nodes[0].startswith('='): + separator += '= ' + signode.append(self.node_factory.Text(separator)) + signode.extend(nodes) + + +class DescriptionTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + + # Get description in rst_nodes if possible + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + + +class LinkedTextTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + + # Recursively process where possible + for i, entry in enumerate(self.data_object.content_): + context = self.context.create_child_context(entry) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + + +class ParamTypeSubRenderer(Renderer): + + def __init__( + self, + output_defname, + *args + ): + + Renderer.__init__( self, *args ) + + self.output_defname = output_defname + + def render(self): + + nodelist = [] + + # Parameter type + if self.data_object.type_: + context = self.context.create_child_context(self.data_object.type_) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + # Parameter name + if self.data_object.declname: + if nodelist: nodelist.append(self.node_factory.Text(" ")) + nodelist.append(self.node_factory.emphasis(text=self.data_object.declname)) + + elif self.output_defname and self.data_object.defname: + # We only want to output the definition name (from the cpp file) if the declaration name + # (from header file) isn't present + if nodelist: nodelist.append(self.node_factory.Text(" ")) + nodelist.append(self.node_factory.emphasis(text=self.data_object.defname)) + + # array information + if self.data_object.array: + nodelist.append(self.node_factory.Text(self.data_object.array)) + + # Default value + if self.data_object.defval: + nodelist.append(self.node_factory.Text(" = ")) + context = self.context.create_child_context(self.data_object.defval) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + + + +class DocRefTextTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + for item in self.data_object.para: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + refid = "%s%s" % (self.project_info.name(), self.data_object.refid) + nodelist = [ + self.node_factory.pending_xref( + "", + reftype="ref", + refdomain="std", + refexplicit=True, + refid=refid, + reftarget=refid, + *nodelist + ) + ] + + return nodelist + + +class DocParaTypeSubRenderer(Renderer): + """ + tags in the Doxygen output tend to contain either text or a single other tag of interest. + So whilst it looks like we're combined descriptions and program listings and other things, in + the end we generally only deal with one per para tag. Multiple neighbouring instances of these + things tend to each be in a separate neighbouring para tag. + """ + + def render(self): + + nodelist = [] + for item in self.data_object.content: # Description + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + for item in self.data_object.programlisting: # Program listings + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + for item in self.data_object.images: # Images + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + definition_nodes = [] + for item in self.data_object.simplesects: # Returns, user par's, etc + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + definition_nodes.extend(renderer.render()) + + for item in self.data_object.parameterlist: # Parameters/Exceptions + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + definition_nodes.extend(renderer.render()) + + if definition_nodes: + definition_list = self.node_factory.definition_list("", *definition_nodes) + nodelist.append(definition_list) + + return [self.node_factory.paragraph("", "", *nodelist)] + + +class DocImageTypeSubRenderer(Renderer): + """Output docutils image node using name attribute from xml as the uri""" + + def render(self): + + path_to_image = self.project_info.sphinx_abs_path_to_file( + self.data_object.name + ) + + options = { "uri" : path_to_image } + + return [self.node_factory.image("", **options)] + +class DocMarkupTypeSubRenderer(Renderer): + + def __init__( + self, + creator, + *args + ): + + Renderer.__init__( self, *args ) + + self.creator = creator + + def render(self): + + nodelist = [] + + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return [self.creator("", "", *nodelist)] + + +class DocParamListTypeSubRenderer(Renderer): + """Parameter/Exception documentation""" + + lookup = { + "param" : "Parameters", + "exception" : "Exceptions", + "templateparam" : "Templates", + "retval" : "Return Value", + } + + def render(self): + + nodelist = [] + for item in self.data_object.parameteritem: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + # Fild list entry + nodelist_list = self.node_factory.bullet_list("", classes=["breatheparameterlist"], *nodelist) + + term_text = self.lookup[self.data_object.kind] + term = self.node_factory.term("", "", self.node_factory.strong( "", term_text ) ) + definition = self.node_factory.definition('', nodelist_list) + + return [self.node_factory.definition_list_item('', term, definition)] + + +class DocParamListItemSubRenderer(Renderer): + """ Parameter Description Renderer """ + + def render(self): + + nodelist = [] + for item in self.data_object.parameternamelist: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + term = self.node_factory.literal("","", *nodelist) + + separator = self.node_factory.Text(" - ") + + nodelist = [] + + if self.data_object.parameterdescription: + context = self.context.create_child_context(self.data_object.parameterdescription) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return [self.node_factory.list_item("", term, separator, *nodelist)] + +class DocParamNameListSubRenderer(Renderer): + """ Parameter Name Renderer """ + + def render(self): + + nodelist = [] + for item in self.data_object.parametername: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + +class DocParamNameSubRenderer(Renderer): + + def render(self): + + nodelist = [] + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + +class DocSect1TypeSubRenderer(Renderer): + + def render(self): + + return [] + + +class DocSimpleSectTypeSubRenderer(Renderer): + """Other Type documentation such as Warning, Note, Returns, etc""" + + def title(self): + + text = self.node_factory.Text(self.data_object.kind.capitalize()) + + return [self.node_factory.strong( "", text )] + + def render(self): + + nodelist = [] + for item in self.data_object.para: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.append(self.node_factory.paragraph("", "", *renderer.render())) + + term = self.node_factory.term("", "", *self.title()) + definition = self.node_factory.definition("", *nodelist) + + return [self.node_factory.definition_list_item("", term, definition)] + + +class ParDocSimpleSectTypeSubRenderer(DocSimpleSectTypeSubRenderer): + + def title(self): + + context = self.context.create_child_context(self.data_object.title) + renderer = self.renderer_factory.create_renderer(context) + + return [self.node_factory.strong( "", *renderer.render() )] + + +class DocTitleTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + + +class DocForumlaTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + + for item in self.data_object.content_: + + latex = item.getValue() + + # Somewhat hacky if statements to strip out the doxygen markup that slips through + + node = None + + # Either inline + if latex.startswith("$") and latex.endswith("$"): + latex = latex[1:-1] + + # If we're inline create a math node like the :math: role + node = self.node_factory.math() + else: + # Else we're multiline + node = self.node_factory.displaymath() + + # Or multiline + if latex.startswith("\[") and latex.endswith("\]"): + latex = latex[2:-2:] + + # Here we steal the core of the mathbase "math" directive handling code from: + # sphinx.ext.mathbase + node["latex"] = latex + + # Required parameters which we don't have values for + node["label"] = None + node["nowrap"] = False + node["docname"] = self.state.document.settings.env.docname + + nodelist.append(node) + + return nodelist + + +class ListingTypeSubRenderer(Renderer): + + def render(self): + + lines = [] + nodelist = [] + for i, item in enumerate(self.data_object.codeline): + # Put new lines between the lines. There must be a more pythonic way of doing this + if i: + nodelist.append(self.node_factory.Text("\n")) + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + # Add blank string at the start otherwise for some reason it renders + # the pending_xref tags around the kind in plain text + block = self.node_factory.literal_block( + "", + "", + *nodelist + ) + + return [block] + +class CodeLineTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + for item in self.data_object.highlight: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + +class HighlightTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + +class TemplateParamListRenderer(Renderer): + + def render(self): + + nodelist = [] + + for i, item in enumerate(self.data_object.param): + if i: + nodelist.append(self.node_factory.Text(", ")) + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + +class IncTypeSubRenderer(Renderer): + + def render(self): + + if self.data_object.local == u"yes": + text = '#include "%s"' % self.data_object.content_[0].getValue() + else: + text = '#include <%s>' % self.data_object.content_[0].getValue() + + return [self.node_factory.emphasis(text=text)] + + +class RefTypeSubRenderer(CompoundRenderer): + + def __init__(self, compound_parser, *args): + CompoundRenderer.__init__(self, compound_parser, False, *args) + + def get_node_info(self, file_data): + name = self.data_object.content_[0].getValue() + name = name.rsplit("::", 1)[-1] + return name, file_data.compounddef.kind + + +class VerbatimTypeSubRenderer(Renderer): + + def __init__(self, content_creator, *args): + Renderer.__init__(self, *args) + + self.content_creator = content_creator + + def render(self): + + if not self.data_object.text.strip().startswith("embed:rst"): + + # Remove trailing new lines. Purely subjective call from viewing results + text = self.data_object.text.rstrip() + + # Handle has a preformatted text + return [self.node_factory.literal_block(text, text)] + + # do we need to strip leading asterisks? + # NOTE: We could choose to guess this based on every line starting with '*'. + # However This would have a side-effect for any users who have an rst-block + # consisting of a simple bullet list. + # For now we just look for an extended embed tag + if self.data_object.text.strip().startswith("embed:rst:leading-asterisk"): + + lines = self.data_object.text.splitlines() + # Replace the first * on each line with a blank space + lines = map(lambda text: text.replace("*", " ", 1), lines) + self.data_object.text = "\n".join(lines) + + # do we need to strip leading ///? + elif self.data_object.text.strip().startswith("embed:rst:leading-slashes"): + + lines = self.data_object.text.splitlines() + # Replace the /// on each line with three blank spaces + lines = map(lambda text: text.replace("///", " ", 1), lines) + self.data_object.text = "\n".join(lines) + + rst = self.content_creator(self.data_object.text) + + # Parent node for the generated node subtree + node = self.node_factory.paragraph() + node.document = self.state.document + + # Generate node subtree + self.state.nested_parse(rst, 0, node) + + return node + + +class MixedContainerRenderer(Renderer): + + def render(self): + context = self.context.create_child_context(self.data_object.getValue()) + renderer = self.renderer_factory.create_renderer(context) + return renderer.render() + + +class DocListNestedRenderer(object): + """Decorator for the list type renderer. + + Creates the proper docutils node based on the sub-type + of the underlying data object. Takes care of proper numbering + for deeply nested enumerated lists. + """ + + numeral_kind = ['arabic', 'loweralpha', 'lowerroman', 'upperalpha', 'upperroman'] + + def __init__(self, f): + self.__render = f + self.__nesting_level = 0 + + def __get__(self, obj, objtype): + """ Support instance methods. """ + import functools + return functools.partial(self.__call__, obj) + + def __call__(self, rend_self): + """ Call the wrapped render function. Update the nesting level for the enumerated lists. """ + rend_instance = rend_self + if rend_instance.data_object.node_subtype is "itemized": + val = self.__render(rend_instance) + return DocListNestedRenderer.render_unordered(rend_instance, children=val) + elif rend_instance.data_object.node_subtype is "ordered": + self.__nesting_level += 1 + val = self.__render(rend_instance) + self.__nesting_level -= 1 + return DocListNestedRenderer.render_enumerated(rend_instance, children=val, + nesting_level=self.__nesting_level) + + return [] + + @staticmethod + def render_unordered(renderer, children): + nodelist_list = renderer.node_factory.bullet_list("", *children) + + return [nodelist_list] + + @staticmethod + def render_enumerated(renderer, children, nesting_level): + nodelist_list = renderer.node_factory.enumerated_list("", *children) + idx = nesting_level % len(DocListNestedRenderer.numeral_kind) + nodelist_list['enumtype'] = DocListNestedRenderer.numeral_kind[idx] + nodelist_list['prefix'] = '' + nodelist_list['suffix'] = '.' + + return [nodelist_list] + + +class DocListTypeSubRenderer(Renderer): + """List renderer + + The specifics of the actual list rendering are handled by the + decorator around the generic render function. + """ + + @DocListNestedRenderer + def render(self): + """ Render all the children depth-first. """ + nodelist = [] + for item in self.data_object.listitem: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return nodelist + + +class DocListItemTypeSubRenderer(Renderer): + """List item renderer. + """ + + def render(self): + """ Render all the children depth-first. + Upon return expand the children node list into a docutils list-item. + """ + nodelist = [] + for item in self.data_object.para: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return [self.node_factory.list_item("", *nodelist)] + + +class DocHeadingTypeSubRenderer(Renderer): + """Heading renderer. + + Renders embedded headlines as emphasized text. Different heading levels + are not supported. + """ + + def render(self): + + nodelist = [] + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return [self.node_factory.emphasis("", "", *nodelist)] + + +class DocURLLinkSubRenderer(Renderer): + """Url Link Renderer""" + + def render(self): + + nodelist = [] + for item in self.data_object.content_: + context = self.context.create_child_context(item) + renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(renderer.render()) + + return [self.node_factory.reference("", "", refuri=self.data_object.url, *nodelist)] diff --git a/doc/breathe/renderer/rst/doxygen/compound.pyc b/doc/breathe/renderer/rst/doxygen/compound.pyc new file mode 100644 index 0000000..44fa4fe Binary files /dev/null and b/doc/breathe/renderer/rst/doxygen/compound.pyc differ diff --git a/doc/breathe/renderer/rst/doxygen/filter.py b/doc/breathe/renderer/rst/doxygen/filter.py new file mode 100644 index 0000000..328bf89 --- /dev/null +++ b/doc/breathe/renderer/rst/doxygen/filter.py @@ -0,0 +1,1138 @@ +""" +Filters +------- + +Filters are an interesting and somewhat challenging part of the code base. They are used for +two different purposes: + + - To figure out which nodes in the xml hierarchy to start rendering from. These are called + 'finder filters' or 'content filters'. This is done before rendering starts. + - To figure out which nodes under a selected nodes in the xml hierarchy should be rendered. These + are called 'render filters'. This is done during the render process with a test in the + DoxygenToRstRendererFactory. + + +General Implementation +~~~~~~~~~~~~~~~~~~~~~~ + +Filters are essential just tests to see if a node matches certain parameters that are needed to +decide whether or not to include it in some output. + +As these filters are declared once and then used on multiple nodes, we model them as object +hierarchies that encapsulate the required test and take a node (with its context) and return True or +False. + +If you wanted a test which figures out if a node has the node_type 'memberdef' you might create the +following object hierarchy: + + node_is_memberdef = InFilter(AttributeAccessor(Node(), 'node_type'), ['memberdef']) + +This reads from the inside out, as get the node, then get the node_type attribute from it, and see +if the value of the attribute is in the list ['memberdef']. + +The Node() is called a 'Selector'. Parent() is also a selector. It means given the current context, +work with the parent of the current node rather than the node itself. This allows you to frame tests +in terms of a node's parent as well as the node which helps when we want nodes with particular +parents and not others. + +The AttributeAccessor() is called an 'Accessor'. It wraps up an attempt to access a particular +attribute on the selected node. There are quite a few different specific accessors but they can +mostly be generalised with the AttributeAccessor. This code has evolved over time and initially the +implementation involved specific accessor classes (which are still used in large parts of it.) + +The InFilter() is unsurprisingly called a 'Filter'. There are lots of different filters. Filters +either act on the results of Accessors or on the results of other Filters and they always return +True or False. The AndFilter and the OrFilter can be used to combine the outputs of other Filters +with logical 'and' and 'or' operations. + +You can build up some pretty complex expressions with this level of freedom as you +might imagine. The complexity is unfortunate but necessary as the nature of filtering the xml is +quite complex. + + +Finder Filters +~~~~~~~~~~~~~~ + +The implementation of the filters can change a little depending on how they are called. Finder +filters are called from the breathe.finder.doxygen.index and breathe.finder.doxygen.compound files. +They are called like this: + + # Descend down the hierarchy + # ... + + if filter_.allow(node_stack): + matches.append(self.data_object) + + # Keep on descending + # ... + +This means that the result of the filter does not stop us descending down the hierarchy and testing +more nodes. This simplifies the filters as they only have to return true for the exact nodes they +are interested in and they don't have to worry about allowing the iteration down the hierarchy to +continue for nodes which don't match. + +An example of a finder filter is: + + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compound"]), + InFilter(KindAccessor(Node()), ["group"]), + InFilter(NameAccessor(Node()), ["mygroup"]) + ) + +This says, return True for all the nodes of node_type 'compound' with 'kind' set to 'group' which +have the name 'mygroup'. It returns false for everything else, but when a node matching this is +found then it is added to the matches list by the code above. + +It is therefore relatively easy to write finder filters. If you have two separate node filters like +the one above and you want to match on both of them then you can do: + + OrFilter( + node_filter_1, + node_filter_2 + ) + +To combine them. + + +Content Filters +~~~~~~~~~~~~~~~ + +Content filters are harder than the finder filters as they are responsible for halting the iteration +down the hierarchy if they return false. This means that if you're interested in memberdef nodes +with a particular attribute then you have to check for that but also include a clause which allows +all other non-memberdef nodes to pass through as you don't want to interrupt them. + +This means you end up with filters like this: + + OrFilter( + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compound"]), + InFilter(KindAccessor(Node()), ["group"]), + InFilter(NameAccessor(Node()), ["mygroup"]) + ), + NotFilter( + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compound"]), + InFilter(KindAccessor(Node()), ["group"]), + ) + ) + ) + +Which is to say that we want to let through a compound, with kind group, with name 'mygroup' but +we're also happy if the node is **not** a compund with kind group. Really we just don't want to let +through any compounds with kind group with name other than 'mygroup'. As such, we can rephrase this +as: + + NotFilter( + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compound"]), + InFilter(KindAccessor(Node()), ["group"]), + NotFilter(InFilter(NameAccessor(Node()), ["mygroup"])) + ) + ) + +Using logical manipulation we can rewrite this as: + + OrFilter( + NotFilter(InFilter(NodeTypeAccessor(Node()), ["compound"])), + NotFilter(InFilter(KindAccessor(Node()), ["group"])), + InFilter(NameAccessor(Node()), ["mygroup"]) + ) + +We reads: allow if it isn't a compound, or if it is a compound but doesn't have a 'kind' of 'group', +but if it is a compound and has a 'kind' of 'group then only allow it if it is named 'mygroup'. + + +Helper Syntax +~~~~~~~~~~~~~ + +Some of these filter declarations get a little awkward to read and write. They are not laid out in +manner which reads smoothly. Additional helper methods and operator overloads have been introduced +to help with this. + +AttributeAccessor objects are created in property methods on the Selector classes so: + + node.kind + +Where node has been declared as a Node() instance. Results in: + + AttributeAccessor(Node(), 'kind') + +The '==' and '!=' operators on the Accessors have been overloaded to return the appropriate filters +so that: + + node.kind == 'group' + +Results in: + + InFilter(AttributeAccessor(Node(), 'kind'), ['kind']) + +We also override the binary 'and' (&), 'or' (|) and 'not' (~) operators in Python to apply +AndFilters, OrFilters and NotFilters respectively. We have to override the binary operators as they +actual 'and', 'or' and 'not' operators cannot be overridden. So: + + (node.node_type == 'compound') & (node.name == 'mygroup') + +Translates to: + + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compound"])), + InFilter(NameAccessor(Node()), ["mygroup"]) + ) + +Where the former is hopefully more readable without sacrificing too much to the abstract magic of +operator overloads. + + +Operator Precedences & Extra Parenthesis +'''''''''''''''''''''''''''''''''''''''' + +As the binary operators have a lower operator precedence than '==' and '!=' and some other operators +we have to include additional parenthesis in the expressions to group them as we want. So instead of +writing: + + node.node_type == 'compound' & node.name == 'mygroup' + +We have to write: + + (node.node_type == 'compound') & (node.name == 'mygroup') + +""" + + +class UnrecognisedKindError(Exception): + pass + + +class Selector(object): + + @property + def node_type(self): + return NodeTypeAccessor(self) + + @property + def kind(self): + return AttributeAccessor(self, 'kind') + + @property + def node_name(self): + return AttributeAccessor(self, 'node_name') + + @property + def name(self): + return AttributeAccessor(self, 'name') + + @property + def briefdescription(self): + return AttributeAccessor(self, 'briefdescription') + + @property + def detaileddescription(self): + return AttributeAccessor(self, 'detaileddescription') + + @property + def prot(self): + return AttributeAccessor(self, 'prot') + + @property + def valueOf(self): + return AttributeAccessor(self, 'valueOf_') + + @property + def id(self): + return AttributeAccessor(self, 'id') + + +class Ancestor(Selector): + + def __init__(self, generations): + self.generations = generations + + def __call__(self, node_stack): + return node_stack[self.generations] + + +class Parent(Selector): + + def __call__(self, node_stack): + return node_stack[1] + + +class Node(Selector): + + def __call__(self, node_stack): + return node_stack[0] + + +class Accessor(object): + + def __init__(self, selector): + self.selector = selector + + def __eq__(self, value): + return InFilter(self, [value]) + + def __ne__(self, value): + return NotFilter(InFilter(self, [value])) + + def is_one_of(self, collection): + return InFilter(self, collection) + + def has_content(self): + return HasContentFilter(self) + + def endswith(self, options): + return EndsWithFilter(self, options) + + +class NameAccessor(Accessor): + + def __call__(self, node_stack): + return self.selector(node_stack).name + + +class NodeNameAccessor(Accessor): + """Check the .node_name member which is declared on refTypeSub nodes + + It distinguishes between innerclass, innernamespace, etc. + """ + + def __call__(self, node_stack): + return self.selector(node_stack).node_name + + +class NodeTypeAccessor(Accessor): + + def __call__(self, node_stack): + + data_object = self.selector(node_stack) + try: + return data_object.node_type + except AttributeError as e: + + # Horrible hack to silence errors on filtering unicode objects + # until we fix the parsing + if type(data_object) == unicode: + return "unicode" + else: + raise e + + +class KindAccessor(Accessor): + + def __call__(self, node_stack): + return self.selector(node_stack).kind + + +class AttributeAccessor(Accessor): + """Returns the value of a particular attribute on the selected node. + + AttributeAccessor(Node(), 'name') returns the value of ``node.name``. + """ + + def __init__(self, selector, attribute_name): + Accessor.__init__(self, selector) + + self.attribute_name = attribute_name + + def __call__(self, node_stack): + return getattr(self.selector(node_stack), self.attribute_name) + + +class LambdaAccessor(Accessor): + + def __init__(self, selector, func): + Accessor.__init__(self, selector) + + self.func = func + + def __call__(self, node_stack): + return self.func(self.selector(node_stack)) + + +class NamespaceAccessor(Accessor): + + def __call__(self, node_stack): + return self.selector(node_stack).namespaces + + +class Filter(object): + + def __and__(self, other): + return AndFilter(self, other) + + def __or__(self, other): + return OrFilter(self, other) + + def __invert__(self): + return NotFilter(self) + + +class HasAncestorFilter(Filter): + + def __init__(self, generations): + self.generations = generations + + def allow(self, node_stack): + return len(node_stack) > self.generations + + +class HasContentFilter(Filter): + + def __init__(self, accessor): + self.accessor = accessor + + def allow(self, node_stack): + """Detects if the node in questions has an empty .content_ property. + """ + + return bool(self.accessor(node_stack).content_) + + +class EndsWithFilter(Filter): + """Detects if the string result of the accessor ends with any of the strings in the ``options`` + iterable parameter. + """ + + def __init__(self, accessor, options): + self.accessor = accessor + self.options = options + + def allow(self, node_stack): + string = self.accessor(node_stack) + for entry in self.options: + if string.endswith(entry): + return True + + return False + + +class InFilter(Filter): + """Checks if what is returned from the accessor is 'in' in the members""" + + def __init__(self, accessor, members): + + self.accessor = accessor + self.members = members + + def allow(self, node_stack): + + name = self.accessor(node_stack) + + return name in self.members + + +class GlobFilter(Filter): + + def __init__(self, accessor, glob): + + self.accessor = accessor + self.glob = glob + + def allow(self, node_stack): + + text = self.accessor(node_stack) + return self.glob.match(text) + + +class FilePathFilter(Filter): + + def __init__(self, accessor, target_file, path_handler): + + self.accessor = accessor + self.target_file = target_file + self.path_handler = path_handler + + def allow(self, node_stack): + + location = self.accessor(node_stack).file + + if self.path_handler.includes_directory(self.target_file): + # If the target_file contains directory separators then + # match against the same length at the end of the location + # + location_match = location[-len(self.target_file):] + return location_match == self.target_file + + else: + # If there are no separators, match against the whole filename + # at the end of the location + # + # This is to prevent "Util.cpp" matching "PathUtil.cpp" + # + location_basename = self.path_handler.basename(location) + return location_basename == self.target_file + + +class NamespaceFilter(Filter): + + def __init__(self, namespace_accessor, name_accessor): + + self.namespace_accessor = namespace_accessor + self.name_accessor = name_accessor + + def allow(self, node_stack): + + namespaces = self.namespace_accessor(node_stack) + name = self.name_accessor(node_stack) + + try: + namespace, name = name.rsplit("::", 1) + except ValueError: + namespace, name = "", name + + return namespace in namespaces + + +class OpenFilter(Filter): + + def allow(self, node_stack): + + return True + + +class ClosedFilter(Filter): + + def allow(self, node_stack): + + return False + + +class NotFilter(Filter): + + def __init__(self, child_filter): + self.child_filter = child_filter + + def allow(self, node_stack): + + return not self.child_filter.allow(node_stack) + + +class AndFilter(Filter): + + def __init__(self, *filters): + + self.filters = filters + + def allow(self, node_stack): + + # If any filter returns False then return False + for filter_ in self.filters: + if not filter_.allow(node_stack): + return False + + return True + + +class OrFilter(Filter): + """Provides a short-cutted 'or' operation between two filters""" + + def __init__(self, *filters): + + self.filters = filters + + def allow(self, node_stack): + + # If any filter returns True then return True + for filter_ in self.filters: + if filter_.allow(node_stack): + return True + + return False + + +class IfFilter(Filter): + + def __init__(self, condition, if_true, if_false): + self.condition = condition + self.if_true = if_true + self.if_false = if_false + + def allow(self, node_stack): + + if self.condition.allow(node_stack): + return self.if_true.allow(node_stack) + else: + return self.if_false.allow(node_stack) + + +class Glob(object): + + def __init__(self, method, pattern): + + self.method = method + self.pattern = pattern + + def match(self, name): + + return self.method(name, self.pattern) + + +class GlobFactory(object): + + def __init__(self, method): + + self.method = method + + def create(self, pattern): + + return Glob(self.method, pattern) + + +class Gather(object): + + def __init__(self, accessor, names): + + self.accessor = accessor + self.names = names + + def allow(self, node_stack): + + self.names.extend(self.accessor(node_stack)) + + return False + + +class FilterFactory(object): + + # C++ style public entries + public_kinds = set([ + "public-type", + "public-func", + "public-attrib", + "public-slot", + "public-static-func", + "public-static-attrib", + ]) + + def __init__(self, globber_factory, path_handler): + + self.globber_factory = globber_factory + self.path_handler = path_handler + self.default_members = () + self.implementation_filename_extensions = () + + def create_render_filter(self, kind, options): + """Render filter for group & namespace blocks""" + + if kind not in ['group', 'namespace']: + raise UnrecognisedKindError(kind) + + # Generate new dictionary from defaults + filter_options = dict((entry, u'') for entry in self.default_members) + + # Update from the actual options + filter_options.update(options) + + # Convert the doxygengroup members flag (which just stores None as the value) to an empty + # string to allow the create_class_member_filter to process it properly + if 'members' in filter_options: + filter_options['members'] = u'' + + node = Node() + parent = Parent() + grandparent = Ancestor(2) + has_grandparent = HasAncestorFilter(2) + + non_class_memberdef = \ + has_grandparent \ + & (grandparent.node_type == 'compounddef') \ + & (grandparent.kind != 'class') \ + & (grandparent.kind != 'struct') \ + & (node.node_type == 'memberdef') + + node_is_public = node.prot == 'public' + + non_class_public_memberdefs = non_class_memberdef & node_is_public | ~ non_class_memberdef + + return ( self.create_class_member_filter(filter_options) | non_class_memberdef ) \ + & self.create_innerclass_filter(filter_options) \ + & self.create_outline_filter(filter_options) + + def create_class_filter(self, target, options): + """Content filter for classes based on various directive options""" + + # Generate new dictionary from defaults + filter_options = dict((entry, u'') for entry in self.default_members) + + # Update from the actual options + filter_options.update(options) + + return AndFilter( + self.create_class_member_filter(filter_options), + self.create_innerclass_filter(filter_options, outerclass=target), + self.create_outline_filter(filter_options), + self.create_show_filter(filter_options), + ) + + def create_innerclass_filter(self, options, outerclass=''): + """ + :param outerclass: Should be the class/struct being target by the directive calling this + code. If it is a group or namespace directive then it should be left + blank. It is used when looking for names listed in the :members: option. + + The name should include any additional namespaces that the target class + is in. + """ + + node = Node() + node_is_innerclass = (node.node_type == "ref") & (node.node_name == "innerclass") + + parent = Parent() + parent_is_compounddef = parent.node_type == 'compounddef' + parent_is_class = parent.kind.is_one_of(['class', 'struct']) + + allowed = set() + all_options = { + 'protected-members': 'protected', + 'private-members': 'private', + } + + for option, scope in all_options.iteritems(): + if option in options: + allowed.add(scope) + + node_is_innerclass_in_class = parent_is_compounddef & parent_is_class & node_is_innerclass + + public_innerclass_filter = ClosedFilter() + + if 'members' in options: + + if options['members'].strip(): + + text = options["members"] + + prefix = ('%s::' % outerclass) if outerclass else '' + + # Matches sphinx-autodoc behaviour of comma separated values + members = set(['%s%s' % (prefix, x.strip()) for x in text.split(",")]) + + node_valueOf_is_in_members = node.valueOf.is_one_of(members) + + # Accept any nodes which don't have a "sectiondef" as a parent or, if they do, only + # accept them if their names are in the members list + public_innerclass_filter = ~ node_is_innerclass_in_class | node_valueOf_is_in_members + + else: + allowed.add('public') + + + node_is_in_allowed_scope = node.prot.is_one_of(allowed) + + innerclass = ~ node_is_innerclass_in_class | node_is_in_allowed_scope + description = self._create_description_filter(True, 'compounddef', options) + + # Put parent check last as we only want to check parents of innerclass's otherwise we have + # to check the parent's type as well + return innerclass | public_innerclass_filter | description + + def create_show_filter(self, options): + """Currently only handles the header-file entry""" + + try: + text = options["show"] + except KeyError: + # Allow through everything except the header-file includes nodes + return OrFilter( + NotFilter(InFilter(NodeTypeAccessor(Parent()), ["compounddef"])), + NotFilter(InFilter(NodeTypeAccessor(Node()), ["inc"])) + ) + + if text == "header-file": + # Allow through everything, including header-file includes + return OpenFilter() + + # Allow through everything except the header-file includes nodes + return OrFilter( + NotFilter(InFilter(NodeTypeAccessor(Parent()), ["compounddef"])), + NotFilter(InFilter(NodeTypeAccessor(Node()), ["inc"])) + ) + + def _create_description_filter(self, allow, level, options): + """Whether or not we allow descriptions is determined by the calling function and we just do + whatever the 'allow' function parameter tells us. + """ + + node = Node() + node_is_description = node.node_type == 'description' + parent = Parent() + parent_is_level = parent.node_type == level + + # Nothing with a parent that's a sectiondef + description_filter = ~ parent_is_level + + # Let through any description children of sectiondefs if we output any kind members + if allow: + + description_filter = \ + (parent_is_level & node_is_description) | ~ parent_is_level + + return description_filter + + def _create_public_members_filter(self, options): + + node = Node() + node_is_memberdef = node.node_type == "memberdef" + node_is_public = node.prot == "public" + + parent = Parent() + parent_is_sectiondef = parent.node_type == "sectiondef" + + # Nothing with a parent that's a sectiondef + is_memberdef = parent_is_sectiondef & node_is_memberdef + public_members_filter = ~ is_memberdef + + # If the user has specified the 'members' option with arguments then we only pay attention + # to that and not to any other member settings + if "members" in options: + + if options['members'].strip(): + + text = options["members"] + + # Matches sphinx-autodoc behaviour of comma separated values + members = set([x.strip() for x in text.split(",")]) + + node_name_is_in_members = node.name.is_one_of(members) + + # Accept any nodes which don't have a "sectiondef" as a parent or, if they do, only + # accept them if their names are in the members list + public_members_filter = \ + (parent_is_sectiondef & node_name_is_in_members) | ~ parent_is_sectiondef + + else: + + # Select anything that doesn't have a parent which is a sectiondef, or, if it does, + # only select the public ones + public_members_filter = \ + (is_memberdef & node_is_public) | ~ is_memberdef + + return public_members_filter + + def _create_non_public_members_filter(self, prot, option_name, options): + """'prot' is the doxygen xml term for 'public', 'protected' and 'private' categories.""" + + node = Node() + node_is_memberdef = node.node_type == "memberdef" + node_is_public = node.prot == prot + + parent = Parent() + parent_is_sectiondef = parent.node_type == "sectiondef" + + # Nothing with a parent that's a sectiondef + is_memberdef = parent_is_sectiondef & node_is_memberdef + filter_ = ~ is_memberdef + + if option_name in options: + + # Allow anything that isn't a memberdef, or if it is only allow the public ones + filter_ = ~ is_memberdef | node_is_public + + return filter_ + + def _create_undoc_members_filter(self, options): + + node = Node() + node_is_memberdef = node.node_type == 'memberdef' + + node_has_description = node.briefdescription.has_content() \ + | node.detaileddescription.has_content() + + # Allow anything that isn't a memberdef, or if it is only allow the ones with a description + undoc_members_filter = ~ node_is_memberdef | node_has_description + + if 'undoc-members' in options: + + undoc_members_filter = OpenFilter() + + return undoc_members_filter + + def create_class_member_filter(self, options): + """Content filter based on :members: and :private-members: classes""" + + # I can't fully explain the filtering of descriptions here. More testing needed to figure + # out when it is needed. This approach reflects the old code that was here but it wasn't + # commented (my fault.) I wonder if maybe the public and private declarations themselves can + # be documented and we need to let them through. Not sure. + allow = 'members' in options \ + or 'protected-members' in options \ + or 'private-members' in options + + description = self._create_description_filter(allow, 'sectiondef', options) + + # Create all necessary filters and combine them + public_members = self._create_public_members_filter(options) + + protected_members = self._create_non_public_members_filter( + 'protected', + 'protected-members', + options + ) + + private_members = self._create_non_public_members_filter( + 'private', + 'private-members', + options + ) + + undoc_members = self._create_undoc_members_filter(options) + + # Allow any public/private members which also fit the undoc filter and all the descriptions + allowed_members = ( public_members | protected_members | private_members ) & undoc_members + return allowed_members | description + + def create_outline_filter(self, options): + if 'outline' in options: + node = Node() + return ~ node.node_type.is_one_of(["description", "inc"]) + else: + return OpenFilter() + + def create_file_filter(self, filename, options): + + valid_names = [] + + filter_ = AndFilter( + NotFilter( + # Gather the "namespaces" attribute from the + # compounddef for the file we're rendering and + # store the information in the "valid_names" list + # + # Gather always returns false, so, combined with + # the NotFilter this chunk always returns true and + # so does not affect the result of the filtering + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compounddef"]), + InFilter(KindAccessor(Node()), ["file"]), + FilePathFilter( + LambdaAccessor(Node(), lambda x: x.location), + filename, self.path_handler + ), + Gather(LambdaAccessor(Node(), lambda x: x.namespaces), valid_names) + ) + ), + NotFilter( + # Take the valid_names and everytime we handle an + # innerclass or innernamespace, check that its name + # was one of those initial valid names so that we + # never end up rendering a namespace or class that + # wasn't in the initial file. Notably this is + # required as the location attribute for the + # namespace in the xml is unreliable. + AndFilter( + InFilter(NodeTypeAccessor(Parent()), ["compounddef"]), + InFilter(NodeTypeAccessor(Node()), ["ref"]), + InFilter(NodeNameAccessor(Node()), ["innerclass", "innernamespace"]), + NotFilter( + InFilter( + LambdaAccessor(Node(), lambda x: x.content_[0].getValue()), + valid_names + ) + ) + ) + ), + NotFilter( + # Ignore innerclasses and innernamespaces that are inside a + # namespace that is going to be rendered as they will be + # rendered with that namespace and we don't want them twice + AndFilter( + InFilter(NodeTypeAccessor(Parent()), ["compounddef"]), + InFilter(NodeTypeAccessor(Node()), ["ref"]), + InFilter(NodeNameAccessor(Node()), ["innerclass", "innernamespace"]), + NamespaceFilter( + NamespaceAccessor(Parent()), + LambdaAccessor(Node(), lambda x: x.content_[0].getValue()) + ) + ) + ), + NotFilter( + # Ignore memberdefs from files which are different to + # the one we're rendering. This happens when we have to + # cross into a namespace xml file which has entries + # from multiple files in it + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["memberdef"]), + NotFilter( + FilePathFilter(LambdaAccessor(Node(), lambda x: x.location), + filename, self.path_handler) + ) + ) + ), + NotFilter( + # Ignore compounddefs which are from another file + # (normally means classes and structs which are in a + # namespace that we have other interests in) but only + # check it if the compounddef is not a namespace + # itself, as for some reason compounddefs for + # namespaces are registered with just a single file + # location even if they namespace is spread over + # multiple files + AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compounddef"]), + NotFilter(InFilter(KindAccessor(Node()), ["namespace"])), + NotFilter( + FilePathFilter(LambdaAccessor(Node(), lambda x: x.location), + filename, self.path_handler) + ) + ) + ) + ) + + return AndFilter( + self.create_outline_filter(options), + filter_ + ) + + def create_content_filter(self, kind, options): + """Returns a filter which matches the contents of the or namespace but not the group or + namepace name or description. + + This allows the groups to be used to structure sections of the documentation rather than to + structure and further document groups of documentation + + As a finder/content filter we only need to match exactly what we're interested in. + """ + + if kind not in ['group', 'namespace']: + raise UnrecognisedKindError(kind) + + node = Node() + + # Filter for public memberdefs + node_is_memberdef = node.node_type == 'memberdef' + node_is_public = node.prot == 'public' + + public_members = node_is_memberdef & node_is_public + + # Filter for public innerclasses + parent = Parent() + parent_is_compounddef = parent.node_type == 'compounddef' + parent_is_class = parent.kind == kind + + node_is_innerclass = (node.node_type == "ref") & (node.node_name == "innerclass") + node_is_public = node.prot == 'public' + + public_innerclass = parent_is_compounddef & parent_is_class \ + & node_is_innerclass & node_is_public + + return public_members | public_innerclass + + def create_index_filter(self, options): + + filter_ = AndFilter( + NotFilter( + AndFilter( + InFilter(NodeTypeAccessor(Parent()), ["compounddef"]), + InFilter(NodeTypeAccessor(Node()), ["ref"]), + InFilter(NodeNameAccessor(Node()), ["innerclass", "innernamespace"]) + ) + ), + NotFilter( + AndFilter( + InFilter(NodeTypeAccessor(Parent()), ["compounddef"]), + InFilter(KindAccessor(Parent()), ["group"]), + InFilter(NodeTypeAccessor(Node()), ["sectiondef"]), + InFilter(KindAccessor(Node()), ["func"]) + ) + ) + ) + + return AndFilter( + self.create_outline_filter(options), + filter_ + ) + + def create_open_filter(self): + """Returns a completely open filter which matches everything""" + + return OpenFilter() + + def create_id_filter(self, node_type, refid): + + node = Node() + return (node.node_type == node_type) & (node.id == refid) + + def create_file_finder_filter(self, filename): + + filter_ = AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compounddef"]), + InFilter(KindAccessor(Node()), ["file"]), + FilePathFilter(LambdaAccessor(Node(), lambda x: x.location), filename, + self.path_handler) + ) + + return filter_ + + def create_member_finder_filter(self, namespace, name, kind): + """Returns a filter which looks for a member with the specified name and kind.""" + + node = Node() + parent = Parent() + + node_matches = (node.node_type == 'member') \ + & (node.kind == kind) \ + & (node.name == name) + + if namespace: + parent_matches = (parent.node_type == 'compound') \ + & ((parent.kind == 'namespace') | (parent.kind == 'class')) \ + & (parent.name == namespace) + + return parent_matches & node_matches + + else: + is_implementation_file = parent.name.endswith(self.implementation_filename_extensions) + parent_is_compound = parent.node_type == 'compound' + parent_is_file = (parent.kind == 'file') & (~ is_implementation_file) + parent_is_not_file = parent.kind != 'file' + + return (parent_is_compound & parent_is_file & node_matches) \ + | (parent_is_compound & parent_is_not_file & node_matches) + + def create_enumvalue_finder_filter(self, name): + """Returns a filter which looks for an enumvalue with the specified name.""" + + node = Node() + return (node.node_type == 'enumvalue') & (node.name == name) + + def create_compound_finder_filter(self, name, kind): + """Returns a filter which looks for a compound with the specified name and kind.""" + + node = Node() + return (node.node_type == 'compound') & (node.kind == kind) & (node.name == name) + + def create_finder_filter(self, kind, name): + """Returns a filter which looks for the compound node from the index which is a group node + (kind=group) and has the appropriate name + + The compound node should reference the group file which we can parse for the group + contents. + """ + + if kind == 'group': + + filter_ = AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compound"]), + InFilter(KindAccessor(Node()), ["group"]), + InFilter(NameAccessor(Node()), [name]) + ) + else: + # Assume kind == 'namespace' + filter_ = AndFilter( + InFilter(NodeTypeAccessor(Node()), ["compound"]), + InFilter(KindAccessor(Node()), ["namespace"]), + InFilter(NameAccessor(Node()), [name]) + ) + + return filter_ + + def get_config_values(self, app): + """Extract the breathe_default_members config value and store it. + + This method is called on the 'builder-init' event in Sphinx""" + + self.default_members = app.config.breathe_default_members + + self.implementation_filename_extensions = \ + app.config.breathe_implementation_filename_extensions + diff --git a/doc/breathe/renderer/rst/doxygen/filter.pyc b/doc/breathe/renderer/rst/doxygen/filter.pyc new file mode 100644 index 0000000..13c5acb Binary files /dev/null and b/doc/breathe/renderer/rst/doxygen/filter.pyc differ diff --git a/doc/breathe/renderer/rst/doxygen/index.py b/doc/breathe/renderer/rst/doxygen/index.py new file mode 100644 index 0000000..9ef04f0 --- /dev/null +++ b/doc/breathe/renderer/rst/doxygen/index.py @@ -0,0 +1,115 @@ + +from .base import Renderer + +class DoxygenTypeSubRenderer(Renderer): + + def render(self): + + nodelist = [] + + # Process all the compound children + for compound in self.data_object.get_compound(): + context = self.context.create_child_context(compound) + compound_renderer = self.renderer_factory.create_renderer(context) + nodelist.extend(compound_renderer.render()) + + return nodelist + + +class CompoundRenderer(Renderer): + """Base class for CompoundTypeSubRenderer and RefTypeSubRenderer.""" + + def __init__(self, compound_parser, render_empty_node, *args): + self.compound_parser = compound_parser + self.render_empty_node = render_empty_node + Renderer.__init__(self, *args) + + def create_doxygen_target(self): + """Can be overridden to create a target node which uses the doxygen refid information + which can be used for creating links between internal doxygen elements. + + The default implementation should suffice most of the time. + """ + + refid = "%s%s" % (self.project_info.name(), self.data_object.refid) + return self.target_handler.create_target(refid) + + def render_signature(self, file_data, doxygen_target): + # Defer to domains specific directive. + name, kind = self.get_node_info(file_data) + self.context.directive_args[1] = [self.get_fully_qualified_name()] + nodes = self.run_domain_directive(kind, self.context.directive_args[1]) + node = nodes[1] + signode, contentnode = node.children + + # The cpp domain in Sphinx doesn't support structs at the moment, so change the text from "class " + # to the correct kind which can be "class " or "struct ". + signode[0] = self.node_factory.desc_annotation(kind + ' ', kind + ' ') + + # Check if there is template information and format it as desired + template_signode = self.create_template_node(file_data.compounddef) + if template_signode: + node.insert(0, template_signode) + node.children[0].insert(0, doxygen_target) + return nodes, contentnode + + def render(self): + + # Read in the corresponding xml file and process + file_data = self.compound_parser.parse(self.data_object.refid) + + parent_context = self.context.create_child_context(file_data) + data_renderer = self.renderer_factory.create_renderer(parent_context) + rendered_data = data_renderer.render() + + if not rendered_data and not self.render_empty_node: + return [] + + file_data = parent_context.node_stack[0] + new_context = parent_context.create_child_context(file_data.compounddef) + + nodes, contentnode = self.render_signature(file_data, self.create_doxygen_target()) + + if file_data.compounddef.includes: + for include in file_data.compounddef.includes: + context = new_context.create_child_context(include) + renderer = self.renderer_factory.create_renderer(context) + contentnode.extend(renderer.render()) + + contentnode.extend(rendered_data) + return nodes + + +class CompoundTypeSubRenderer(CompoundRenderer): + + def __init__(self, compound_parser, *args): + CompoundRenderer.__init__(self, compound_parser, True, *args) + + def get_node_info(self, file_data): + return self.data_object.name, self.data_object.kind + + +class FileRenderer(CompoundTypeSubRenderer): + + def render_signature(self, file_data, doxygen_target): + # Build targets for linking + targets = [] + targets.extend(doxygen_target) + + title_signode = self.node_factory.desc_signature() + title_signode.extend(targets) + + # Set up the title + name, kind = self.get_node_info(file_data) + title_signode.append(self.node_factory.emphasis(text=kind)) + title_signode.append(self.node_factory.Text(" ")) + title_signode.append(self.node_factory.desc_name(text=name)) + + contentnode = self.node_factory.desc_content() + + node = self.node_factory.desc() + node.document = self.state.document + node['objtype'] = kind + node.append(title_signode) + node.append(contentnode) + return [node], contentnode diff --git a/doc/breathe/renderer/rst/doxygen/index.pyc b/doc/breathe/renderer/rst/doxygen/index.pyc new file mode 100644 index 0000000..2d8e49a Binary files /dev/null and b/doc/breathe/renderer/rst/doxygen/index.pyc differ diff --git a/doc/breathe/renderer/rst/doxygen/mask.py b/doc/breathe/renderer/rst/doxygen/mask.py new file mode 100644 index 0000000..49a2d4e --- /dev/null +++ b/doc/breathe/renderer/rst/doxygen/mask.py @@ -0,0 +1,62 @@ +""" +Masks +===== + +Masks are related to filters. Filters can block the processing of particular parts of the xml +hierarchy but they can only work on node level. If the part of the xml hierarchy that you want to +filter out is read in as an instance of one of the classes in parser/doxygen/*.py then you can use +the filters. However, if you want to filter out an attribute from one of the nodes (and some of the +xml child nodes are read in as attributes on their parents) then you can't use a filter. + +We introduce the Mask's to fulfil this need. The masks are designed to be applied to a particular +node type and to limit the access to particular attributes on the node. For example, then +NoParameterNamesMask wraps a node a returns all its standard attributes but returns None for the +'declname' and 'defname' attributes. + +Currently the Mask functionality is only used for the text signature rendering for doing function +matching. + +""" + +class NoParameterNamesMask(object): + + def __init__(self, data_object): + self.data_object = data_object + + def __getattr__(self, attr): + + if attr in ['declname', 'defname', 'defval']: + return None + + return getattr(self.data_object, attr) + +class MaskFactory(object): + + def __init__(self, lookup): + self.lookup = lookup + + def mask(self, data_object): + + try: + node_type = data_object.node_type + except AttributeError as e: + + # Horrible hack to silence errors on filtering unicode objects + # until we fix the parsing + if type(data_object) == unicode: + node_type = "unicode" + else: + raise e + + if node_type in self.lookup: + Mask = self.lookup[node_type] + return Mask(data_object) + + return data_object + + +class NullMaskFactory(object): + + def mask(self, data_object): + return data_object + diff --git a/doc/breathe/renderer/rst/doxygen/mask.pyc b/doc/breathe/renderer/rst/doxygen/mask.pyc new file mode 100644 index 0000000..b385206 Binary files /dev/null and b/doc/breathe/renderer/rst/doxygen/mask.pyc differ diff --git a/doc/breathe/renderer/rst/doxygen/target.py b/doc/breathe/renderer/rst/doxygen/target.py new file mode 100644 index 0000000..c1ddd18 --- /dev/null +++ b/doc/breathe/renderer/rst/doxygen/target.py @@ -0,0 +1,40 @@ + +class TargetHandler(object): + + def __init__(self, project_info, node_factory, document): + + self.project_info = project_info + self.node_factory = node_factory + self.document = document + + def create_target(self, id_): + """Creates a target node and registers it with the document and returns it in a list""" + + target = self.node_factory.target(ids=[id_], names=[id_]) + + try: + self.document.note_explicit_target(target) + except Exception: + # TODO: We should really return a docutils warning node here + print("Warning: Duplicate target detected: %s" % id_) + + return [target] + +class NullTargetHandler(object): + + def create_target(self, refid): + return [] + +class TargetHandlerFactory(object): + + def __init__(self, node_factory): + + self.node_factory = node_factory + + def create_target_handler(self, options, project_info, document): + + if options.has_key("no-link"): + return NullTargetHandler() + + return TargetHandler(project_info, self.node_factory, document) + diff --git a/doc/breathe/renderer/rst/doxygen/target.pyc b/doc/breathe/renderer/rst/doxygen/target.pyc new file mode 100644 index 0000000..f0cf8fe Binary files /dev/null and b/doc/breathe/renderer/rst/doxygen/target.pyc differ