The results object holds information about the files and directories which will be generated by the template processor. It includes files and directories from all templates being processed, and can therefore be used to allow seamless integration of templates.

For example, if a template includes a file whose contents depend on the directory tree below a certain directory, you can walk the results object and extract the directory tree. The following example does so to include all non-detail include directories for the sandbox template:

doxy_source_files = list()
for root, dirs, files in results.walk(
    # we want the returned root to be relative to $template_library$
    template.replace_name('$template_library$'),
    # and want to walk the boost/$template_library$ directory underneath that
    template.replace_name('boost/$template_library$')):
    if os.path.basename(root) != 'detail':
        doxy_source_files.append(
            template.replace_name(os.path.join(os.path.join('../../..',
            root), '*.hpp').replace('\\','/')))

A similar example uses the files_in and directories_in functions of the result object to construct the list of files and filters for a MSVC IDE:

    def vc_list_files(level, output_base, destination_base, directory):
        tabs = ''.join(['\t' for x in range(level)])
        output_base_directory = os.path.join(output_base, directory)
        destination_base_directory = os.path.join(destination_base, directory)
        for name in results.files_in(destination_base_directory):
            template.append_content("""
""" + tabs + """<File
""" + tabs + '\tRelativePath="'+os.path.join(output_base_directory,name)+""""
""" + tabs + """\t>
""" + tabs + """</File>""")

        for name in results.directories_in(destination_base_directory):
            template.append_content("""
""" + tabs + """<Filter
""" + tabs + '\tName="'+name+""""
""" + tabs + """\t>""")
            vc_list_files(level+1, output_base_directory, destination_base_directory, name)
            template.append_content("""
""" + tabs + """</Filter>""")