示例#1
0
文件: menus.py 项目: nbstar/dxr
def type_menu(tree, type):
    """Return menu for type reference."""
    qualname, kind = type['qualname'], type.get('kind')
    menu = [{'html': "Find declarations",
             'title': "Find declarations of this class",
             'href': search_url(tree, "+type-decl:%s" % quote(qualname)),
             'icon': 'reference'}]
    if kind == 'class' or kind == 'struct':
        menu.append({'html': "Find subclasses",
                     'title': "Find subclasses of this class",
                     'href': search_url(tree, "+derived:%s" % quote(qualname)),
                     'icon': 'type'})
        menu.append({'html': "Find base classes",
                     'title': "Find base classes of this class",
                     'href': search_url(tree, "+bases:%s" % quote(qualname)),
                     'icon': 'type'})
    menu.append({'html': "Find members",
                 'title': "Find members of this class",
                 'href': search_url(tree, "+member:%s" % quote(qualname)),
                 'icon': 'members'})
    menu.append({'html': "Find references",
                 'title': "Find references to this class",
                 'href': search_url(tree, "+type-ref:%s" % quote(qualname)),
                 'icon': 'reference'})
    return menu
示例#2
0
文件: menus.py 项目: nbstar/dxr
def function_menu(tree, func):
    """Build menu for a function."""
    qualname = func['qualname']
    isvirtual = 'override' in func
    # Things we can do with qualified name
    menu = [{'html': "Find declarations",
             'title': "Find declarations of this function",
             'href': search_url(tree, "+function-decl:%s" % quote(qualname)),
             'icon': 'reference'},
            {'html': "Find callers",
             'title': "Find functions that call this function",
             'href': search_url(tree, "+callers:%s" % quote(qualname)),
             'icon': 'method'},
            {'html': "Find references",
             'title': "Find references to this function",
             'href': search_url(tree, "+function-ref:%s" % quote(qualname)),
             'icon': 'reference'}]
    if isvirtual:
        menu.append({'html': "Find overridden",
                     'title': "Find functions that this function overrides",
                     'href': search_url(tree, "+overridden:%s" % quote(qualname)),
                     'icon': 'method'})
        menu.append({'html': "Find overrides",
                     'title': "Find overrides of this function",
                     'href': search_url(tree, "+overrides:%s" % quote(qualname)),
                     'icon': 'method'})
    return menu
示例#3
0
def function_menu_generic(tree, datum, tree_config):
    menu = []
    menu.append({
        'html':
        "Find callers",
        'title':
        "Find functions that call this function",
        'href':
        search_url(tree_config, "+callers:%s" % quote(datum['qualname'])),
        'icon':
        'method'
    })
    menu.append({
        'html':
        "Find callees",
        'title':
        "Find functions that are called by this function",
        'href':
        search_url(tree_config, "+called-by:%s" % quote(datum['qualname'])),
        'icon':
        'method'
    })
    add_find_references(tree_config, menu, datum['qualname'], "function-ref",
                        "function")
    return menu
示例#4
0
def type_menu(tree, type):
    """Return menu for type reference."""
    qualname, kind = type['qualname'], type.get('kind')
    menu = [{
        'html': "Find declarations",
        'title': "Find declarations of this class",
        'href': search_url(tree, "+type-decl:%s" % quote(qualname)),
        'icon': 'reference'
    }]
    if kind == 'class' or kind == 'struct':
        menu.append({
            'html': "Find subclasses",
            'title': "Find subclasses of this class",
            'href': search_url(tree, "+derived:%s" % quote(qualname)),
            'icon': 'type'
        })
        menu.append({
            'html': "Find base classes",
            'title': "Find base classes of this class",
            'href': search_url(tree, "+bases:%s" % quote(qualname)),
            'icon': 'type'
        })
    menu.append({
        'html': "Find members",
        'title': "Find members of this class",
        'href': search_url(tree, "+member:%s" % quote(qualname)),
        'icon': 'members'
    })
    menu.append({
        'html': "Find references",
        'title': "Find references to this class",
        'href': search_url(tree, "+type-ref:%s" % quote(qualname)),
        'icon': 'reference'
    })
    return menu
示例#5
0
文件: menus.py 项目: bitslab/dxr
 def _more_menu_items(self):
     qualname, has_overriddens, has_overrides = self.menu_data[1:]
     qualname = quote(qualname)
     tree = self.tree.name
     yield {'html': "Find declarations",
            'title': "Find declarations of this function",
            'href': search_url(tree, "+function-decl:%s" % qualname),
            'icon': 'reference'}
     yield {'html': "Find callers",
            'title': "Find functions that call this function",
            'href': search_url(tree, "+callers:%s" % qualname),
            'icon': 'method'}
     yield {'html': "Find references",
            'title': "Find references to this function",
            'href': search_url(tree, "+function-ref:%s" % qualname),
            'icon': 'reference'}
     if has_overriddens:
         yield {'html': "Find overridden",
                'title': "Find functions that this function overrides",
                'href': search_url(tree, "+overridden:%s" % qualname),
                'icon': 'method'}
     if has_overrides:
         yield {'html': "Find overrides",
                'title': "Find overrides of this function",
                'href': search_url(tree, "+overrides:%s" % qualname),
                'icon': 'method'}
示例#6
0
文件: menu.py 项目: nbstar/dxr
def type_menu_generic(tree, datum, tree_config):
    menu = []
    kind = datum['kind']
    if kind == 'trait':
        menu.append({
            'html':   "Find sub-traits",
            'title':  "Find sub-traits of this trait",
            'href':   search_url(tree_config, "+derived:%s" % quote(datum['qualname'])),
            'icon':   'type'
        })
        menu.append({
            'html':   "Find super-traits",
            'title':  "Find super-traits of this trait",
            'href':   search_url(tree_config, "+bases:%s" % quote(datum['qualname'])),
            'icon':   'type'
        })
    
    if kind == 'struct' or kind == 'enum' or kind == 'trait':
        menu.append({
            'html':   "Find impls",
            'title':  "Find impls which involve this " + kind,
            'href':   search_url(tree_config, "+impl:%s" % quote(datum['qualname'])),
            'icon':   'reference'
        })
    add_find_references(tree_config, menu, datum['qualname'], "type-ref", kind)
    return menu
示例#7
0
class FunctionRef(_RefWithDefinition):
    """Ref for function definitions or references"""
    @classmethod
    def _condensed_menu_data(cls, tree, prop):
        return prop[
            'qualname'], 'has_overriddens' in prop, 'has_overrides' in prop

    def _more_menu_items(self, (qualname, has_overriddens, has_overrides)):
        yield {
            'html':
            "Find declarations",
            'title':
            "Find declarations of this function",
            'href':
            search_url(self.tree.name, "+function-decl:%s" % quote(qualname)),
            'icon':
            'reference'
        }
        yield {
            'html': "Find callers",
            'title': "Find functions that call this function",
            'href': search_url(self.tree.name,
                               "+callers:%s" % quote(qualname)),
            'icon': 'method'
        }
        yield {
            'html':
            "Find references",
            'title':
            "Find references to this function",
            'href':
            search_url(self.tree.name, "+function-ref:%s" % quote(qualname)),
            'icon':
            'reference'
        }
        if has_overriddens:
            yield {
                'html':
                "Find overridden",
                'title':
                "Find functions that this function overrides",
                'href':
                search_url(self.tree.name, "+overridden:%s" % quote(qualname)),
                'icon':
                'method'
            }
        if has_overrides:
            yield {
                'html':
                "Find overrides",
                'title':
                "Find overrides of this function",
                'href':
                search_url(self.tree.name, "+overrides:%s" % quote(qualname)),
                'icon':
                'method'
            }
示例#8
0
文件: menu.py 项目: gartung/dxr
def call_menu(qualname, tree):
    return [{'html': "Find callers",
             'title': "Find functions that call this function",
             'href': search_url(tree, "+callers:%s" % quote(qualname)),
             'icon': 'method'},
            {'html': "Find callees",  # TODO: Probably useless. Remove.
             'title': "Find functions that are called by this function",
             'href': search_url(tree, "+called-by:%s" % quote(qualname)),
             'icon': 'method'}]
示例#9
0
文件: menus.py 项目: gartung/dxr
 def menu_items(self):
     qualname = self.menu_data
     yield {'html': 'Find subclasses',
            'title': 'Find subclasses of this class',
            'href': search_url(self.tree, '+derived:' + qualname),
            'icon': 'type'}
     yield {'html': 'Find base classes',
            'title': 'Find base classes of this class',
            'href': search_url(self.tree, '+bases:' + qualname),
            'icon': 'type'}
示例#10
0
文件: menus.py 项目: zz22zz222/dxr
class TypeRef(_QualnameRef):
    @classmethod
    def _condensed_menu_data(cls, tree, prop):
        return (super(TypeRef, cls)._condensed_menu_data(tree, prop) +
                (prop.get('kind', 'type'), 'has_subclass'
                 in prop, 'has_base_class' in prop))

    def _more_menu_items(self, (qualname, kind, has_subclass, has_base_class)):
        """Return menu for type reference."""
        def kind_plural():
            if kind == 'class':
                return 'classes'
            elif kind == 'struct':
                return 'structs'
            else:
                return 'types'

        yield {
            'html': "Find declarations",
            'title': "Find declarations of this %s" % kind,
            'href': search_url(self.tree.name,
                               "+type-decl:%s" % quote(qualname)),
            'icon': 'reference'
        }
        if has_subclass:
            kinds = kind_plural()
            yield {
                'html': "Find sub%s" % kinds,
                'title': "Find sub%s of this %s" % (kinds, kind),
                'href': search_url(self.tree.name,
                                   "+derived:%s" % quote(qualname)),
                'icon': 'type'
            }
        if has_base_class:
            kinds = kind_plural()
            yield {
                'html': "Find base %s" % kinds,
                'title': "Find base %s of this %s" % (kinds, kind),
                'href': search_url(self.tree.name,
                                   "+bases:%s" % quote(qualname)),
                'icon': 'type'
            }
        yield {
            'html': "Find members",
            'title': "Find members of this %s" % kind,
            'href': search_url(self.tree.name, "+member:%s" % quote(qualname)),
            'icon': 'members'
        }
        yield {
            'html': "Find references",
            'title': "Find references to this %s" % kind,
            'href': search_url(self.tree.name,
                               "+type-ref:%s" % quote(qualname)),
            'icon': 'reference'
        }
示例#11
0
文件: menus.py 项目: nbstar/dxr
def variable_menu(tree, variable):
    """Build menu for a variable."""
    qualname = variable['qualname']
    return [{'html': "Find declarations",
             'title': "Find declarations of this variable",
             'href': search_url(tree, "+var-decl:%s" % quote(qualname)),
             'icon': 'reference'},
            {'html': "Find references",
             'title': "Find reference to this variable",
             'href': search_url(tree, "+var-ref:%s" % quote(qualname)),
             'icon': 'field'}]
示例#12
0
文件: menus.py 项目: nbstar/dxr
def namespace_menu(tree, namespace):
    """Build menu for a namespace."""
    qualname = namespace['qualname']
    return [{'html': "Find definitions",
             'title': "Find definitions of this namespace",
             'href': search_url(tree, "+namespace:%s" % quote(qualname)),
             'icon': 'jump'},
            {'html': "Find references",
             'title': "Find references to this namespace",
             'href': search_url(tree, "+namespace-ref:%s" % quote(qualname)),
             'icon': 'reference'}]
示例#13
0
文件: menus.py 项目: nbstar/dxr
def class_menu(tree, qualname):
    """Generate menu for a class definition."""
    return [
        {'html': 'Find subclasses',
         'title': 'Find subclasses of this class',
         'href': search_url(tree, '+derived:' + qualname),
         'icon': 'type'},
        {'html': 'Find base classes',
         'title': 'Find base classes of this class',
         'href': search_url(tree, '+bases:' + qualname),
         'icon': 'type'},
    ]
示例#14
0
文件: menus.py 项目: carriercomm/dxr
 def menu_items(self):
     qualname = self.menu_data
     yield {
         "html": "Find subclasses",
         "title": "Find subclasses of this class",
         "href": search_url(self.tree.name, "+derived:" + qualname),
         "icon": "type",
     }
     yield {
         "html": "Find base classes",
         "title": "Find base classes of this class",
         "href": search_url(self.tree.name, "+bases:" + qualname),
         "icon": "type",
     }
示例#15
0
def variable_menu(tree, variable):
    """Build menu for a variable."""
    qualname = variable['qualname']
    return [{
        'html': "Find declarations",
        'title': "Find declarations of this variable",
        'href': search_url(tree, "+var-decl:%s" % quote(qualname)),
        'icon': 'reference'
    }, {
        'html': "Find references",
        'title': "Find reference to this variable",
        'href': search_url(tree, "+var-ref:%s" % quote(qualname)),
        'icon': 'field'
    }]
示例#16
0
文件: menus.py 项目: zz22zz222/dxr
 def menu_items(self):
     qualname = self.menu_data
     yield {
         'html': 'Find subclasses',
         'title': 'Find subclasses of this class',
         'href': search_url(self.tree.name, '+derived:' + qualname),
         'icon': 'type'
     }
     yield {
         'html': 'Find base classes',
         'title': 'Find base classes of this class',
         'href': search_url(self.tree.name, '+bases:' + qualname),
         'icon': 'type'
     }
示例#17
0
def namespace_menu(tree, namespace):
    """Build menu for a namespace."""
    qualname = namespace['qualname']
    return [{
        'html': "Find definitions",
        'title': "Find definitions of this namespace",
        'href': search_url(tree, "+namespace:%s" % quote(qualname)),
        'icon': 'jump'
    }, {
        'html': "Find references",
        'title': "Find references to this namespace",
        'href': search_url(tree, "+namespace-ref:%s" % quote(qualname)),
        'icon': 'reference'
    }]
示例#18
0
文件: menu.py 项目: gartung/dxr
def type_menu(tree_config, kind, qualname):
    if kind == 'trait':
        yield {'html': "Find sub-traits",
               'title': "Find sub-traits of this trait",
               'href': search_url(tree_config, "+derived:%s" % quote(qualname)),
               'icon': 'type'}
        yield {'html': "Find super-traits",
               'title': "Find super-traits of this trait",
               'href': search_url(tree_config, "+bases:%s" % quote(qualname)),
               'icon': 'type'}
    if kind == 'struct' or kind == 'enum' or kind == 'trait':
        yield {'html': "Find impls",
               'title': "Find impls which involve this " + kind,
               'href': search_url(tree_config, "+impl:%s" % quote(qualname)),
               'icon': 'reference'}
示例#19
0
def function_menu(tree, datum, tree_config):
    menu = function_menu_generic(tree, datum, tree_config)

    if 'declid' in datum and datum['declid'] in tree.data.functions:
        # it's an implementation, find the decl
        decl = tree.data.functions[datum['declid']]
        add_jump_definition(tree, tree_config, menu, decl,
                            "Jump to trait method")
    else:
        # it's a decl, find implementations
        impls = tree.data.index('functions', 'declid')
        count = len(impls[datum['id']]) if datum['id'] in impls else 0
        if count > 0:
            menu.append({
                'html':
                "Find implementations (%d)" % count,
                'title':
                "Find implementations of this trait method",
                'href':
                search_url(tree_config,
                           "+fn-impls:%s" % quote(datum['qualname'])),
                'icon':
                'method'
            })

    return Ref(menu)
示例#20
0
文件: menus.py 项目: mcphail/dxr
def class_menu(tree, qualname):
    """Generate menu for a class definition."""
    return [
        {
            'html': 'Find subclasses',
            'title': 'Find subclasses of this class',
            'href': search_url(tree, '+derived:' + qualname),
            'icon': 'type'
        },
        {
            'html': 'Find base classes',
            'title': 'Find base classes of this class',
            'href': search_url(tree, '+bases:' + qualname),
            'icon': 'type'
        },
    ]
示例#21
0
文件: menus.py 项目: nbstar/dxr
def typedef_menu(tree, typedef):
    """Build menu for typedef."""
    qualname = typedef['qualname']
    return [{'html': "Find references",
             'title': "Find references to this typedef",
             'href': search_url(tree, "+type-ref:%s" % quote(qualname)),
             'icon': 'reference'}]
示例#22
0
 def test_search_url(self):
     """Test unicode of various widths, slashes, and spaces."""
     with self.app().test_request_context():
         eq_(
             search_url(u'tr éé', u'ev il:searcheß/ªre/bes†'),
             '/tr%20%C3%A9%C3%A9/search?q=ev+il%3Asearche%C3%9F%2F%C2%AAre%2Fbes%E2%80%A0'
         )
示例#23
0
文件: menus.py 项目: nbstar/dxr
def macro_menu(tree, macro):
    """Return menu for macro reference."""
    name = macro['name']
    return [{'html': "Find references",
             'title': "Find references to macros with this name",
             'href': search_url(tree, "+macro-ref:%s" % name),
             'icon': 'reference'}]
示例#24
0
文件: menus.py 项目: nbstar/dxr
def namespace_alias_menu(tree, namespace_alias):
    """Build menu for a namespace."""
    qualname = namespace_alias['qualname']
    return [{'html': "Find references",
             'title': "Find references to this namespace alias",
             'href': search_url(tree, "+namespace-alias-ref:%s" % quote(qualname)),
             'icon': 'reference'}]
示例#25
0
文件: menus.py 项目: zz22zz222/dxr
class VariableRef(_QualnameRef):
    def _more_menu_items(self, (qualname, )):
        yield {
            'html': "Find declarations",
            'title': "Find declarations of this variable",
            'href': search_url(self.tree.name,
                               "+var-decl:%s" % quote(qualname)),
            'icon': 'reference'
        }
        yield {
            'html': "Find references",
            'title': "Find reference to this variable",
            'href': search_url(self.tree.name,
                               "+var-ref:%s" % quote(qualname)),
            'icon': 'field'
        }
示例#26
0
文件: menu.py 项目: zz22zz222/dxr
def trait_impl_menu_item(tree_config, qualname, count):
    return {
        'html': "Find implementations (%d)" % count,
        'title': "Find implementations of this trait method",
        'href': search_url(tree_config.name, "+fn-impls:%s" % quote(qualname)),
        'icon': 'method'
    }
示例#27
0
文件: menu.py 项目: nbstar/dxr
def function_menu_generic(tree, datum, tree_config):
    menu = []
    menu.append({
        'html':   "Find callers",
        'title':  "Find functions that call this function",
        'href':   search_url(tree_config, "+callers:%s" % quote(datum['qualname'])),
        'icon':   'method'
    })
    menu.append({
        'html':   "Find callees",
        'title':  "Find functions that are called by this function",
        'href':   search_url(tree_config, "+called-by:%s" % quote(datum['qualname'])),
        'icon':   'method'
    })
    add_find_references(tree_config, menu, datum['qualname'], "function-ref", "function")
    return menu
示例#28
0
文件: menu.py 项目: bozzmob/dxr
def trait_impl_menu_item(tree_config, qualname, count):
    return {
        "html": "Find implementations (%d)" % count,
        "title": "Find implementations of this trait method",
        "href": search_url(tree_config, "+fn-impls:%s" % quote(qualname)),
        "icon": "method",
    }
示例#29
0
文件: menu.py 项目: zz22zz222/dxr
def call_menu(qualname, tree):
    return [{
        'html': "Find callers",
        'title': "Find calls of this function",
        'href': search_url(tree.name, "+callers:%s" % quote(qualname)),
        'icon': 'method'
    }]
示例#30
0
文件: menu.py 项目: bozzmob/dxr
def use_items_menu_item(tree_config, qualname):
    return {
        "html": "Find use items",
        "title": "Find instances of this module in 'use' items",
        "href": search_url(tree_config, "+module-use:%s" % quote(qualname)),
        "icon": "reference",
    }
示例#31
0
文件: menu.py 项目: nbstar/dxr
def add_find_references(tree_config, menu, qualname, search_term, kind):
    menu.append({
        'html':   "Find references",
        'title':  "Find references to this " + kind,
        'href':   search_url(tree_config, "+" + search_term + ":%s" % quote(qualname)),
        'icon':   'reference'
    })
示例#32
0
文件: visitor.py 项目: mcphail/dxr
 def filtered_search_menu(self, filter_name, name, html='Find declaration',
                          title='Search for declarations.', icon='class'):
     return {
         'html': html,
         'title': title,
         'href': search_url(self.tree, '%s:%s' % (filter_name, name)),
         'icon': icon
     }
示例#33
0
文件: menu.py 项目: zz22zz222/dxr
def use_items_menu_item(tree_config, qualname):
    return {
        'html': "Find use items",
        'title': "Find instances of this module in 'use' items",
        'href': search_url(tree_config.name,
                           "+module-use:%s" % quote(qualname)),
        'icon': 'reference'
    }
示例#34
0
def filtered_search_menu(tree, term, html, title, filter_name, icon):
    """Return a menu for searching in given tree for a specific term using a filter."""

    return {
        'html': html,
        'title': title,
        'href': search_url(tree.name, '%s:%s' % (filter_name, term)),
        'icon': icon
    }
示例#35
0
def macro_menu(tree, macro):
    """Return menu for macro reference."""
    name = macro['name']
    return [{
        'html': "Find references",
        'title': "Find references to macros with this name",
        'href': search_url(tree, "+macro-ref:%s" % name),
        'icon': 'reference'
    }]
示例#36
0
文件: menu.py 项目: bozzmob/dxr
def call_menu(qualname, tree):
    return [
        {
            "html": "Find callers",
            "title": "Find calls of this function",
            "href": search_url(tree, "+callers:%s" % quote(qualname)),
            "icon": "method",
        }
    ]
示例#37
0
文件: menus.py 项目: zz22zz222/dxr
class TypedefRef(_QualnameRef):
    def _more_menu_items(self, (qualname, )):
        yield {
            'html': "Find references",
            'title': "Find references to this typedef",
            'href': search_url(self.tree.name,
                               "+type-ref:%s" % quote(qualname)),
            'icon': 'reference'
        }
示例#38
0
文件: menus.py 项目: Darshnik/dxr
def filtered_search_menu(tree, term, html, title, filter_name, icon):
    """Return a menu for searching in given tree for a specific term using a filter."""

    return {
        'html': html,
        'title': title,
        'href': search_url(tree.name, '%s:%s' % (filter_name, term)),
        'icon': icon
    }
示例#39
0
def typedef_menu(tree, typedef):
    """Build menu for typedef."""
    qualname = typedef['qualname']
    return [{
        'html': "Find references",
        'title': "Find references to this typedef",
        'href': search_url(tree, "+type-ref:%s" % quote(qualname)),
        'icon': 'reference'
    }]
示例#40
0
class TypeRef(_QualnameRef):
    @classmethod
    def _condensed_menu_data(cls, tree, prop):
        """Hang onto qualname *and* kind."""
        return (super(TypeRef, cls)._condensed_menu_data(tree, prop) +
                (prop.get('kind', ''), ))

    def _more_menu_items(self, (qualname, kind)):
        """Return menu for type reference."""
        yield {
            'html': "Find declarations",
            'title': "Find declarations of this class",
            'href': search_url(self.tree.name,
                               "+type-decl:%s" % quote(qualname)),
            'icon': 'reference'
        }
        if kind == 'class' or kind == 'struct':
            yield {
                'html': "Find subclasses",
                'title': "Find subclasses of this class",
                'href': search_url(self.tree.name,
                                   "+derived:%s" % quote(qualname)),
                'icon': 'type'
            }
            yield {
                'html': "Find base classes",
                'title': "Find base classes of this class",
                'href': search_url(self.tree.name,
                                   "+bases:%s" % quote(qualname)),
                'icon': 'type'
            }
        yield {
            'html': "Find members",
            'title': "Find members of this class",
            'href': search_url(self.tree.name, "+member:%s" % quote(qualname)),
            'icon': 'members'
        }
        yield {
            'html': "Find references",
            'title': "Find references to this class",
            'href': search_url(self.tree.name,
                               "+type-ref:%s" % quote(qualname)),
            'icon': 'reference'
        }
示例#41
0
文件: menu.py 项目: nbstar/dxr
def module_menu_generic(tree, datum, tree_config):
    menu = []
    menu.append({
        'html':   "Find use items",
        'title':  "Find instances of this module in 'use' items",
        'href':   search_url(tree_config, "+module-use:%s" % quote(datum['qualname'])),
        'icon':   'reference'
    })
    add_find_references(tree_config, menu, datum['qualname'], "module-ref", "module")
    return menu
示例#42
0
文件: menus.py 项目: zz22zz222/dxr
class NamespaceRef(_QualnameRef):
    def _more_menu_items(self, (qualname, )):
        yield {
            'html': "Find definitions",
            'title': "Find definitions of this namespace",
            'href': search_url(self.tree.name,
                               "+namespace:%s" % quote(qualname)),
            'icon': 'jump'
        }
        yield {
            'html':
            "Find references",
            'title':
            "Find references to this namespace",
            'href':
            search_url(self.tree.name, "+namespace-ref:%s" % quote(qualname)),
            'icon':
            'reference'
        }
示例#43
0
def add_find_references(tree_config, menu, qualname, search_term, kind):
    menu.append({
        'html':
        "Find references",
        'title':
        "Find references to this " + kind,
        'href':
        search_url(tree_config, "+" + search_term + ":%s" % quote(qualname)),
        'icon':
        'reference'
    })
示例#44
0
文件: menu.py 项目: gartung/dxr
def find_references_menu_item(tree_config, qualname, filter_name, kind):
    """A sort of compound menu that handles finding various sorts of
    references

    Should be broken into several.

    """
    return {'html':   "Find references",
            'title':  "Find references to this " + kind,
            'href':   search_url(tree_config, "+" + filter_name + ":%s" % quote(qualname)),
            'icon':   'reference'}
示例#45
0
文件: refs.py 项目: carriercomm/dxr
 def menu_items(self):
     qualname, name, typename = self.menu_data
     for text, filtername, title, icon in [
         ("Find definition of %s %s" % (typename, name), "id", "Find definition", "class"),
         ("Find references to %s %s" % (typename, name), "ref", "Find references", "method"),
     ]:
         yield {
             "html": text,
             "title": title,
             "href": search_url(self.tree.name, '+%s:"%s"' % (filtername, qualname)),
             "icon": icon,
         }
示例#46
0
文件: menu.py 项目: bozzmob/dxr
def type_menu(tree_config, kind, qualname):
    if kind == "trait":
        yield {
            "html": "Find sub-traits",
            "title": "Find sub-traits of this trait",
            "href": search_url(tree_config, "+derived:%s" % quote(qualname)),
            "icon": "type",
        }
        yield {
            "html": "Find super-traits",
            "title": "Find super-traits of this trait",
            "href": search_url(tree_config, "+bases:%s" % quote(qualname)),
            "icon": "type",
        }
    if kind == "struct" or kind == "enum" or kind == "trait":
        yield {
            "html": "Find impls",
            "title": "Find impls which involve this " + kind,
            "href": search_url(tree_config, "+impl:%s" % quote(qualname)),
            "icon": "reference",
        }
示例#47
0
文件: menu.py 项目: bozzmob/dxr
def find_references_menu_item(tree_config, qualname, filter_name, kind):
    """A sort of compound menu that handles finding various sorts of
    references

    Should be broken into several.

    """
    return {
        "html": "Find references",
        "title": "Find references to this " + kind,
        "href": search_url(tree_config, "+" + filter_name + ":%s" % quote(qualname)),
        "icon": "reference",
    }
示例#48
0
文件: menus.py 项目: bitslab/dxr
 def menu_items(self):
     search_for_def, qualname = self.menu_data[:2]
     if search_for_def:
         menu = [{'html': "Jump to definition",
                  'title': "Jump to definition",
                  'href': '%s&%s' % (search_url(self.tree.name,
                                                '+function:%s' % quote(qualname)),
                                     'redirect=true'),
                  'icon': 'jump'}]
     else:
         menu = []
     menu.extend(self._more_menu_items())
     return menu
示例#49
0
def function_menu(tree, func):
    """Build menu for a function."""
    qualname = func['qualname']
    isvirtual = 'override' in func
    # Things we can do with qualified name
    menu = [{
        'html': "Find declarations",
        'title': "Find declarations of this function",
        'href': search_url(tree, "+function-decl:%s" % quote(qualname)),
        'icon': 'reference'
    }, {
        'html': "Find callers",
        'title': "Find functions that call this function",
        'href': search_url(tree, "+callers:%s" % quote(qualname)),
        'icon': 'method'
    }, {
        'html': "Find references",
        'title': "Find references to this function",
        'href': search_url(tree, "+function-ref:%s" % quote(qualname)),
        'icon': 'reference'
    }]
    if isvirtual:
        menu.append({
            'html':
            "Find overridden",
            'title':
            "Find functions that this function overrides",
            'href':
            search_url(tree, "+overridden:%s" % quote(qualname)),
            'icon':
            'method'
        })
        menu.append({
            'html': "Find overrides",
            'title': "Find overrides of this function",
            'href': search_url(tree, "+overrides:%s" % quote(qualname)),
            'icon': 'method'
        })
    return menu
示例#50
0
def namespace_alias_menu(tree, namespace_alias):
    """Build menu for a namespace."""
    qualname = namespace_alias['qualname']
    return [{
        'html':
        "Find references",
        'title':
        "Find references to this namespace alias",
        'href':
        search_url(tree, "+namespace-alias-ref:%s" % quote(qualname)),
        'icon':
        'reference'
    }]
示例#51
0
def type_menu_generic(tree, datum, tree_config):
    menu = []
    kind = datum['kind']
    if kind == 'trait':
        menu.append({
            'html':
            "Find sub-traits",
            'title':
            "Find sub-traits of this trait",
            'href':
            search_url(tree_config, "+derived:%s" % quote(datum['qualname'])),
            'icon':
            'type'
        })
        menu.append({
            'html':
            "Find super-traits",
            'title':
            "Find super-traits of this trait",
            'href':
            search_url(tree_config, "+bases:%s" % quote(datum['qualname'])),
            'icon':
            'type'
        })

    if kind == 'struct' or kind == 'enum' or kind == 'trait':
        menu.append({
            'html':
            "Find impls",
            'title':
            "Find impls which involve this " + kind,
            'href':
            search_url(tree_config, "+impl:%s" % quote(datum['qualname'])),
            'icon':
            'reference'
        })
    add_find_references(tree_config, menu, datum['qualname'], "type-ref", kind)
    return menu
示例#52
0
文件: menu.py 项目: zz22zz222/dxr
def type_menu(tree_config, kind, qualname):
    if kind == 'trait':
        yield {
            'html': "Find sub-traits",
            'title': "Find sub-traits of this trait",
            'href': search_url(tree_config.name,
                               "+derived:%s" % quote(qualname)),
            'icon': 'type'
        }
        yield {
            'html': "Find super-traits",
            'title': "Find super-traits of this trait",
            'href': search_url(tree_config.name,
                               "+bases:%s" % quote(qualname)),
            'icon': 'type'
        }
    if kind == 'struct' or kind == 'enum' or kind == 'trait':
        yield {
            'html': "Find impls",
            'title': "Find impls which involve this " + kind,
            'href': search_url(tree_config.name, "+impl:%s" % quote(qualname)),
            'icon': 'reference'
        }
示例#53
0
文件: menus.py 项目: zz22zz222/dxr
class NamespaceAliasRef(_QualnameRef):
    def _more_menu_items(self, (qualname, )):
        """Build menu for a namespace."""
        yield {
            'html':
            "Find references",
            'title':
            "Find references to this namespace alias",
            'href':
            search_url(self.tree.name,
                       "+namespace-alias-ref:%s" % quote(qualname)),
            'icon':
            'reference'
        }
示例#54
0
def module_menu_generic(tree, datum, tree_config):
    menu = []
    menu.append({
        'html':
        "Find use items",
        'title':
        "Find instances of this module in 'use' items",
        'href':
        search_url(tree_config, "+module-use:%s" % quote(datum['qualname'])),
        'icon':
        'reference'
    })
    add_find_references(tree_config, menu, datum['qualname'], "module-ref",
                        "module")
    return menu
示例#55
0
文件: menus.py 项目: zz22zz222/dxr
 def _more_menu_items(self):
     qualname, has_overriddens, has_overrides = self.menu_data[1:]
     qualname = quote(qualname)
     tree = self.tree.name
     yield {
         'html': "Find declarations",
         'title': "Find declarations of this function",
         'href': search_url(tree, "+function-decl:%s" % qualname),
         'icon': 'reference'
     }
     yield {
         'html': "Find callers",
         'title': "Find functions that call this function",
         'href': search_url(tree, "+callers:%s" % qualname),
         'icon': 'method'
     }
     yield {
         'html': "Find references",
         'title': "Find references to this function",
         'href': search_url(tree, "+function-ref:%s" % qualname),
         'icon': 'reference'
     }
     if has_overriddens:
         yield {
             'html': "Find overridden",
             'title': "Find functions that this function overrides",
             'href': search_url(tree, "+overridden:%s" % qualname),
             'icon': 'method'
         }
     if has_overrides:
         yield {
             'html': "Find overrides",
             'title': "Find overrides of this function",
             'href': search_url(tree, "+overrides:%s" % qualname),
             'icon': 'method'
         }
示例#56
0
文件: menus.py 项目: zz22zz222/dxr
 def menu_items(self):
     search_for_def, qualname = self.menu_data[:2]
     if search_for_def:
         menu = [{
             'html':
             "Jump to definition",
             'title':
             "Jump to definition",
             'href':
             '%s&%s' % (search_url(self.tree.name, '+function:%s' %
                                   quote(qualname)), 'redirect=true'),
             'icon':
             'jump'
         }]
     else:
         menu = []
     menu.extend(self._more_menu_items())
     return menu
示例#57
0
文件: menu.py 项目: nbstar/dxr
def function_menu(tree, datum, tree_config):
    menu = function_menu_generic(tree, datum, tree_config)

    if 'declid' in datum and datum['declid'] in tree.data.functions:
        # it's an implementation, find the decl
        decl = tree.data.functions[datum['declid']]
        add_jump_definition(tree, tree_config, menu, decl, "Jump to trait method")
    else:
        # it's a decl, find implementations
        impls = tree.data.index('functions', 'declid')
        count = len(impls[datum['id']]) if datum['id'] in impls else 0
        if count > 0:
            menu.append({
                'html':   "Find implementations (%d)"%count,
                'title':  "Find implementations of this trait method",
                'href':   search_url(tree_config, "+fn-impls:%s" % quote(datum['qualname'])),
                'icon':   'method'
            })

    return Ref(menu)
示例#58
0
文件: htmlifier.py 项目: pnewman1/dxr
 def search(self, query):
     """ Auxiliary function for getting the search url for query """
     return search_url(self.tree.config.wwwroot,
                       self.tree.name,
                       query)
示例#59
0
文件: menu.py 项目: gartung/dxr
def use_items_menu_item(tree_config, qualname):
    return {'html': "Find use items",
            'title': "Find instances of this module in 'use' items",
            'href': search_url(tree_config, "+module-use:%s" % quote(qualname)),
            'icon': 'reference'}
示例#60
0
文件: menu.py 项目: gartung/dxr
def trait_impl_menu_item(tree_config, qualname, count):
    return {'html': "Find implementations (%d)" % count,
            'title': "Find implementations of this trait method",
            'href': search_url(tree_config, "+fn-impls:%s" % quote(qualname)),
            'icon': 'method'}