当前位置: 首页>>代码示例>>Python>>正文


Python declarations.access_type_matcher_t函数代码示例

本文整理汇总了Python中pygccxml.declarations.access_type_matcher_t函数的典型用法代码示例。如果您正苦于以下问题:Python access_type_matcher_t函数的具体用法?Python access_type_matcher_t怎么用?Python access_type_matcher_t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了access_type_matcher_t函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AutoExclude

def AutoExclude( mb ):
    """ Automaticaly exclude a range of things that don't convert well from C++ to Python
    """
    global_ns = mb.global_ns
    for ns in NAMESPACES:
        main_ns = global_ns.namespace( ns )
    
        # vars that are static consts but have their values set in the header file are bad
        Remove_Static_Consts ( main_ns )
        
        ## Exclude protected and private that are not pure virtual
        query = declarations.access_type_matcher_t( 'private' ) \
                & ~declarations.virtuality_type_matcher_t( declarations.VIRTUALITY_TYPES.PURE_VIRTUAL )
        try:
            non_public_non_pure_virtual = main_ns.calldefs( query )
            non_public_non_pure_virtual.exclude()
        except:
            pass
    
        #Virtual functions that return reference could not be overriden from Python
        query = declarations.virtuality_type_matcher_t( declarations.VIRTUALITY_TYPES.VIRTUAL ) \
                & declarations.custom_matcher_t( lambda decl: declarations.is_reference( decl.return_type ) )
        try:
            main_ns.calldefs( query ).virtuality = declarations.VIRTUALITY_TYPES.NOT_VIRTUAL
        except:
            pass
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:26,代码来源:generate_code.py

示例2: test_and_matcher

 def test_and_matcher( self ):
     criteria1 = declarations.regex_matcher_t( 'oper.*'
                                                , lambda decl: decl.name )
     criteria2 = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
     found = declarations.matcher.find( criteria1 & criteria2, self.global_ns )
     found = filter( lambda d: not d.is_artificial, found )
     self.failUnless( len( found ) <= 6 )
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:7,代码来源:filters_tester.py

示例3: emitClassMethods

def emitClassMethods(c):
    global hSrc, cppSrc, chsSrc
    #chsSrc += '-- *** Constructors\n'
    query = declarations.access_type_matcher_t( 'public' )
    #query = declarations.custom_matcher_t( lambda f: len(f.overloads) == 0) & declarations.access_type_matcher_t( 'public' )
    if not c.is_abstract:
        tc = []
        if c.find_trivial_constructor() != None:
            tc.append(c.find_trivial_constructor())
        ok = False
        cons = [a for a in c.constructors(allow_empty=True, function=query, recursive = False) if not a.is_copy_constructor]
        if len(cons) == 1:
            emitConstructorBinding(c,cons[0])
        else:
            cnt = 0
            for mf in cons: # + tc:
                emitConstructorBinding(c,mf,str(cnt))
                cnt += 1
        emitDestructorBinding(c)
    #chsSrc += '-- *** Methods\n'
    methods = {}
    for mf in c.mem_funs(allow_empty=True, function=query, recursive = False):
        if methods.has_key(mf.name):
            methods[mf.name].append(mf)
        else:
            methods[mf.name] = [mf]
    for mname,mlist in methods.iteritems():
        if len(mlist) == 1:
            emitMethodBinding(c,mlist[0]) # default method is the first one
        else:
            emitMethodBinding(c,mlist[0],'','0')
            cnt = 0
            for mf in mlist:
                emitMethodBinding(c,mf,str(cnt),str(cnt))
                cnt += 1
开发者ID:csabahruska,项目名称:bullet,代码行数:35,代码来源:bullet.py

示例4: test_access_type

 def test_access_type( self ):       
     criteria = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
     public_members = declarations.matcher.find( criteria, self.declarations )
     if '0.9' in public_members[0].compiler:
         #2 empty classes, this compiler doesn't generate constructor and copy constructor
         self.failUnless( 15 == len( public_members ) ) 
     else:
         self.failUnless( 19 == len( public_members ) )
开发者ID:atemysemicolon,项目名称:pyplusplusclone,代码行数:8,代码来源:filters_tester.py

示例5: test_access_type

 def test_access_type( self ):       
     criteria = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
     public_members = declarations.matcher.find( criteria, self.global_ns )
     if '0.9' in public_members[0].compiler:
         public_members = filter( lambda d: not d.is_artificial, public_members )
         self.failUnless( 16 == len( public_members ) ) 
     else:
         self.failUnless( 20 == len( public_members ) )
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:8,代码来源:filters_tester.py

示例6: test_access_type

 def test_access_type(self):
     criteria = declarations.access_type_matcher_t(
         declarations.ACCESS_TYPES.PUBLIC)
     public_members = declarations.matcher.find(criteria, self.global_ns)
     if '0.9' in public_members[0].compiler:
         public_members = [d for d in public_members if not d.is_artificial]
         self.failUnless(17 == len(public_members))
     else:
         self.failUnless(21 == len(public_members))
开发者ID:programmdesign,项目名称:pygccxml,代码行数:9,代码来源:filters_tester.py

示例7: test_and_matcher

 def test_and_matcher(self):
     criteria1 = declarations.regex_matcher_t(
         'oper.*',
         lambda decl: decl.name)
     criteria2 = declarations.access_type_matcher_t(
         declarations.ACCESS_TYPES.PUBLIC)
     found = declarations.matcher.find(
         criteria1 & criteria2,
         self.global_ns)
     found = [d for d in found if not d.is_artificial]
     self.assertTrue(len(found) <= 6)
开发者ID:gccxml,项目名称:pygccxml,代码行数:11,代码来源:filters_tester.py

示例8: test_or_matcher

    def test_or_matcher( self ):
        criteria1 = declarations.regex_matcher_t( 'oper.*'
                                                   , lambda decl: decl.name )
        criteria2 = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
        found = declarations.matcher.find( criteria1 | criteria2, self.declarations )

        if '0.9' in found[0].compiler:
            #2 empty classes, this compiler doesn't generate constructor and copy constructor
            self.failUnless( 15 <= len( found ) <= 21) 
        else:
            self.failUnless( 19 <= len( found ) <= 25)
开发者ID:atemysemicolon,项目名称:pyplusplusclone,代码行数:11,代码来源:filters_tester.py

示例9: test_or_matcher

    def test_or_matcher( self ):
        criteria1 = declarations.regex_matcher_t( 'oper.*'
                                                   , lambda decl: decl.name )
        criteria2 = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
        found = declarations.matcher.find( criteria1 | criteria2, self.global_ns )

        if '0.9' in found[0].compiler:
            found = filter( lambda d: not d.is_artificial, found )
            self.failUnless( 15 <= len( found ) <= 21) 
        else:
            self.failUnless( 19 <= len( found ) <= 25)
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:11,代码来源:filters_tester.py

示例10: test_access_type

 def test_access_type(self):
     criteria = declarations.access_type_matcher_t(
         declarations.ACCESS_TYPES.PUBLIC)
     public_members = declarations.matcher.find(criteria, self.global_ns)
     if "CastXML" in utils.xml_generator:
         public_members = [d for d in public_members if not d.is_artificial]
         self.failUnless(21 == len(public_members))
     if "0.9" in utils.xml_generator:
         public_members = [d for d in public_members if not d.is_artificial]
         self.failUnless(17 == len(public_members))
     else:
         self.failUnless(21 == len(public_members))
开发者ID:iMichka,项目名称:pygccxml,代码行数:12,代码来源:filters_tester.py

示例11: filter_declarations

def filter_declarations( mb ):
    global_ns = mb.global_ns
    global_ns.exclude()
    ogrerefapp_ns = global_ns.namespace( 'OgreRefApp' )
    ogrerefapp_ns.include()
    
 
    ## Exclude protected and private that are not pure virtual
    query = ~declarations.access_type_matcher_t( 'public' ) \
            & ~declarations.virtuality_type_matcher_t( declarations.VIRTUALITY_TYPES.PURE_VIRTUAL )
    non_public_non_pure_virtual = ogrerefapp_ns.calldefs( query )
    non_public_non_pure_virtual.exclude()
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:12,代码来源:generate_code.py

示例12: Auto_Document

def Auto_Document ( mb, namespace=None ):
    """Indicate that the functions being exposed are declated protected or private in the C++ code
    this should warn people to be careful using them :) """
    global_ns = mb.global_ns
    if namespace:
        main_ns = global_ns.namespace( namespace )
    else:
        main_ns = global_ns
    query = declarations.access_type_matcher_t( 'private' ) 
    for c in main_ns.calldefs( query, allow_empty=True ):
#         print "PRIVATE:", c
        s = c.documentation
        if not s:
            s = ""
        c.documentation="Private declaration.\\n"+s
    query = declarations.access_type_matcher_t( 'protected' ) 
    for c in main_ns.calldefs( query, allow_empty=True ):
#         print "PROTECTED:", c
        s = c.documentation
        if not s:
            s = ""
        c.documentation="Protected declaration.\\n"+s
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:22,代码来源:__init__.py

示例13: test_access_type

 def test_access_type(self):
     criteria = declarations.access_type_matcher_t(
         declarations.ACCESS_TYPES.PUBLIC)
     public_members = declarations.matcher.find(criteria, self.global_ns)
     public_members = [d for d in public_members if not d.is_artificial]
     if self.xml_generator_from_xml_file.is_castxml:
         nbr = len(public_members)
         self.assertTrue(nbr in [17, 21])
         if nbr == 21:
             # We are using llvm 3.9, see bug #32. Make sure the 4 names
             # are still there
             ll = ["isa", "flags", "str", "length"]
             for l in ll:
                 self.assertTrue(l in [mbr.name for mbr in public_members])
     else:
         self.assertTrue(17 == len(public_members))
开发者ID:gccxml,项目名称:pygccxml,代码行数:16,代码来源:filters_tester.py

示例14: test_or_matcher

    def test_or_matcher(self):
        criteria1 = declarations.regex_matcher_t(
            "oper.*",
            lambda decl: decl.name)
        criteria2 = declarations.access_type_matcher_t(
            declarations.ACCESS_TYPES.PUBLIC)
        found = declarations.matcher.find(
            criteria1 | criteria2,
            self.global_ns)

        if "CastXML" in utils.xml_generator:
            found = [d for d in found if not d.is_artificial]
            self.assertTrue(len(found) != 35)
        elif "0.9" in utils.xml_generator:
            found = [d for d in found if not d.is_artificial]
            self.assertTrue(15 <= len(found) <= 21)
        else:
            self.assertTrue(19 <= len(found) <= 25)
开发者ID:Artoria2e5,项目名称:pygccxml,代码行数:18,代码来源:filters_tester.py

示例15: test_or_matcher

    def test_or_matcher(self):
        criteria1 = declarations.regex_matcher_t(
            "oper.*",
            lambda decl: decl.name)
        criteria2 = declarations.access_type_matcher_t(
            declarations.ACCESS_TYPES.PUBLIC)
        found = declarations.matcher.find(
            criteria1 | criteria2,
            self.global_ns)

        if self.xml_generator_from_xml_file.is_castxml:
            found = [d for d in found if not d.is_artificial]
            self.assertTrue(len(found) != 35)
        elif self.xml_generator_from_xml_file.is_gccxml_09 or \
                self.xml_generator_from_xml_file.is_gccxml_09_buggy:
            found = [d for d in found if not d.is_artificial]
            self.assertTrue(15 <= len(found) <= 21)
        else:
            self.assertTrue(19 <= len(found) <= 25)
开发者ID:gccxml,项目名称:pygccxml,代码行数:19,代码来源:filters_tester.py


注:本文中的pygccxml.declarations.access_type_matcher_t函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。