• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python declarations.full_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_name_based

    def test_name_based( self ):
        cls = self.global_ns.class_( name='class_for_nested_enums_t' )

        cls_demangled_name = cls.name
        self.failUnless( cls.cache.demangled_name == cls_demangled_name )

        cls_full_name = declarations.full_name( cls )
        self.failUnless( cls.cache.full_name == cls_full_name )

        cls_declaration_path = declarations.declaration_path( cls )
        self.failUnless( cls.cache.declaration_path == cls_declaration_path )

        enum = cls.enum( 'ENestedPublic' )

        enum_full_name = declarations.full_name( enum )
        self.failUnless( enum.cache.full_name == enum_full_name )

        enum_declaration_path = declarations.declaration_path( enum )
        self.failUnless( enum.cache.declaration_path == enum_declaration_path )

        #now we change class name, all internal decls cache should be cleared
        cls.name = "new_name"
        self.failUnless( not cls.cache.full_name )
        self.failUnless( not cls.cache.demangled_name )
        self.failUnless( not cls.cache.declaration_path )

        self.failUnless( not enum.cache.full_name )
        self.failUnless( not enum.cache.demangled_name )
        self.failUnless( not enum.cache.declaration_path )
开发者ID:glehmann,项目名称:WrapITK-unstable,代码行数:29,代码来源:algorithms_cache_tester.py


示例2: __fix_constructor_call

    def __fix_constructor_call(self, func, arg):
        call_invocation = declarations.call_invocation
        dv = arg.default_value
        if not call_invocation.is_call_invocation(dv):
            return False
        base_type = declarations.base_type(arg.type)
        decl = base_type.declaration
        name, args = call_invocation.split(dv)
        if decl.name != name:
            # we have some alias to the class
            relevant_typedefs = [
                typedef for typedef in decl.aliases if typedef.name == name]
            if 1 == len(relevant_typedefs):
                f_q_name = self.__join_names(
                    declarations.full_name(
                        relevant_typedefs[0].parent),
                    name)
            else:  # in this case we can not say which typedef user uses:
                f_q_name = self.__join_names(
                    declarations.full_name(
                        decl.parent),
                    decl.name)
        else:
            f_q_name = self.__join_names(
                declarations.full_name(
                    decl.parent),
                name)

        return call_invocation.join(f_q_name, args)
开发者ID:praetorian20,项目名称:pygccxml,代码行数:29,代码来源:patcher.py


示例3: __str__

 def __str__( self ):
     desc = []
     desc.append( 'fget=%s' % declarations.full_name( self.fget ) )
     if self.fset:
         desc.append( ', ' )
         desc.append( 'fset=%s' % declarations.full_name( self.fset ) )
     return 'property "%s"[%s]' % ( self.name, ''.join( desc ) )
开发者ID:alekob,项目名称:tce,代码行数:7,代码来源:properties.py


示例4: test_name_based

    def test_name_based(self):
        cls = self.global_ns.class_(name='class_for_nested_enums_t')

        if "CastXML" in utils.xml_generator:
            self.assertRaises(Exception, lambda: cls.cache.demangled_name)
        elif "GCCXML" in utils.xml_generator:
            self.failUnless(cls.cache.demangled_name == cls.name)

        cls_full_name = declarations.full_name(cls)
        self.failUnless(cls.cache.full_name == cls_full_name)

        cls_declaration_path = declarations.declaration_path(cls)
        self.failUnless(cls.cache.declaration_path == cls_declaration_path)

        enum = cls.enum('ENestedPublic')

        enum_full_name = declarations.full_name(enum)
        self.failUnless(enum.cache.full_name == enum_full_name)

        enum_declaration_path = declarations.declaration_path(enum)
        self.failUnless(enum.cache.declaration_path == enum_declaration_path)

        # now we change class name, all internal decls cache should be cleared
        cls.name = "new_name"
        self.failUnless(not cls.cache.full_name)
        if "GCCXML" in utils.xml_generator:
            self.failUnless(not cls.cache.demangled_name)
        self.failUnless(not cls.cache.declaration_path)

        self.failUnless(not enum.cache.full_name)
        if "GCCXML" in utils.xml_generator:
            self.failUnless(not enum.cache.demangled_name)
        self.failUnless(not enum.cache.declaration_path)
开发者ID:iMichka,项目名称:pygccxml,代码行数:33,代码来源:algorithms_cache_tester.py


示例5: test

    def test(self):
        module_builder.set_logger_level( logging.CRITICAL )
        messages.disable( *messages.all_warning_msgs )

        ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' )
        ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre.1.7.xml' ) )

        mb = module_builder.module_builder_t(
                [ ogre_file ]
                , gccxml_path=autoconfig.gccxml.executable
                , indexing_suite_version=2
                , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler())

        mb.global_ns.exclude()
        mb.namespace('Ogre').include()

        x = mb.global_ns.decls( lambda d: 'Animation*' in d.name and 'MapIterator' in d.name )
        for y in x:
            print y.name
            print y.partial_name
            print declarations.full_name( y, with_defaults=False )

        target_dir = os.path.join( autoconfig.build_directory, 'ogre' )
        #~ if os.path.exists( target_dir ):
            #~ shutil.rmtree( target_dir )
        #~ os.mkdir( target_dir )

        mb.build_code_creator( 'Ogre3d' )
        mb.split_module( target_dir )
开发者ID:CTrauma,项目名称:pypp11,代码行数:29,代码来源:ogre_generate_tester.py


示例6: test_name_based

    def test_name_based(self):
        cls = self.global_ns.class_(name='class_for_nested_enums_t')

        if self.xml_generator_from_xml_file.is_castxml:
            self.assertIsNone(cls.cache.demangled_name)
        elif self.xml_generator_from_xml_file.is_gccxml:
            self.assertTrue(cls.cache.demangled_name == cls.name)

        cls_full_name = declarations.full_name(cls)
        self.assertTrue(cls.cache.full_name == cls_full_name)

        cls_declaration_path = declarations.declaration_path(cls)
        self.assertTrue(cls.cache.declaration_path == cls_declaration_path)

        enum = cls.enumeration('ENestedPublic')

        enum_full_name = declarations.full_name(enum)
        self.assertTrue(enum.cache.full_name == enum_full_name)

        enum_declaration_path = declarations.declaration_path(enum)
        self.assertTrue(enum.cache.declaration_path == enum_declaration_path)

        # now we change class name, all internal decls cache should be cleared
        cls.name = "new_name"
        self.assertTrue(not cls.cache.full_name)
        if self.xml_generator_from_xml_file.is_gccxml:
            self.assertTrue(not cls.cache.demangled_name)
        self.assertTrue(not cls.cache.declaration_path)

        self.assertTrue(not enum.cache.full_name)
        if self.xml_generator_from_xml_file.is_gccxml:
            self.assertTrue(not enum.cache.demangled_name)
        self.assertTrue(not enum.cache.declaration_path)
开发者ID:gccxml,项目名称:pygccxml,代码行数:33,代码来源:algorithms_cache_tester.py


示例7: print_

 def print_( extmodule ):
     creators = filter( missing_call_policies._selector
                        , code_creators.make_flatten_generator( extmodule.creators ) )
     for creator in creators:
         print creator.declaration.__class__.__name__, ': ', declarations.full_name( creator.declaration )
         print '  *** MISSING CALL POLICY', creator.declaration.function_type().decl_string
         print 
开发者ID:CTrauma,项目名称:pypp11,代码行数:7,代码来源:__init__.py


示例8: _create_function_type_alias_code

def _create_function_type_alias_code( self, exported_class_alias=None  ):
    f_type = self.declaration.function_type()
    falias = self.function_type_alias
    fname = declarations.full_name( self.declaration, with_defaults=False )
    fvalue = re.sub("_type$", "_value", falias )

    return "typedef %s;\n%s %s( &%s );" % (f_type.create_typedef( falias, with_defaults=False ),
                                           falias, fvalue, fname)
开发者ID:chryswoods,项目名称:Sire,代码行数:8,代码来源:create_wrappers.py


示例9: _create_function_ref_code

def _create_function_ref_code(self, use_function_alias=False):
    fname = declarations.full_name( self.declaration, with_defaults=False )
    if use_function_alias:
        falias = self.function_type_alias
        fvalue = re.sub("_type$", "_value", falias)
        return fvalue
    elif self.declaration.create_with_signature:
        return '(%s)( &%s )' % ( self.declaration.function_type().partial_decl_string, fname )
    else:
        return '&%s' % fname
开发者ID:chryswoods,项目名称:Sire,代码行数:10,代码来源:create_wrappers.py


示例10: _create_impl

    def _create_impl(self):
        if self.declaration.already_exposed:
            return ""

        answer = [self._create_namespaces_name()]
        answer.append(self.wrapper_type.decl_string)
        answer.append("".join([self.wrapper_creator_name, "(){"]))
        temp = "".join(
            ["return ", self.wrapper_type.decl_string, "( ", declarations.full_name(self.declaration), " );"]
        )
        answer.append(self.indent(temp))
        answer.append("}")
        answer.append("}" * len(self._create_namespaces()))
        return os.linesep.join(answer)
开发者ID:rhinton,项目名称:tce,代码行数:14,代码来源:global_variable.py


示例11: create_default

    def create_default(self):
        cntrl = self.controller.default_controller

        make_object = algorithm.create_identifier( self, 'pyplusplus::call_policies::make_object' )
        make_tuple = algorithm.create_identifier( self, 'boost::python::make_tuple' )
        
        tmpl_values = dict()

        tmpl_values['unique_function_name'] = self.default_name()
        tmpl_values['return_type'] = cntrl.wrapper_return_type.decl_string
        tmpl_values['arg_declarations'] = self.args_default_declaration()        
        tmpl_values['wrapper_class'] = self.parent.wrapper_alias
        tmpl_values['wrapped_class'] = declarations.full_name( self.declaration.parent )
        tmpl_values['wrapped_inst'] = cntrl.inst_arg.name
        tmpl_values['wrapped_inst_constness'] = ''
        if declarations.is_const( declarations.remove_reference( cntrl.inst_arg.type ) ):
            tmpl_values['wrapped_inst_constness'] = 'const'
            
        decl_vars = cntrl.variables[:]
        if not declarations.is_void( self.declaration.return_type ):
            decl_vars.append( cntrl.result_variable )
        tmpl_values['declare_variables'] \
            = os.linesep + os.linesep.join( map( lambda var: self.indent( var.declare_var_string() )
                                                 , decl_vars ) )
                
        tmpl_values['pre_call'] = os.linesep + self.indent( os.linesep.join( cntrl.pre_call ) )

        tmpl_values['save_result'] = ''
        if not declarations.is_void( self.declaration.return_type ):
            tmpl_tmp = '%(result_var_name)s = '
            if declarations.is_reference( self.declaration.return_type ):
                tmpl_tmp = tmpl_tmp + '&'
            tmpl_values['save_result'] = tmpl_tmp % dict( result_var_name=cntrl.result_variable.name )

        tmpl_values['function_name'] = self.declaration.name
        tmpl_values['arg_expressions'] = self.PARAM_SEPARATOR.join( cntrl.arg_expressions )
        return_stmt_creator = calldef_utils.return_stmt_creator_t( self
                                    , cntrl
                                    , cntrl.result_variable
                                    , cntrl.return_variables )

        tmpl_values['post_call'] = os.linesep + self.indent( os.linesep.join( cntrl.post_call ) )
        if return_stmt_creator.pre_return_code:
            tmpl_values['post_call'] \
                = os.linesep.join([ tmpl_values['post_call']
                                    , self.indent( return_stmt_creator.pre_return_code )])
        tmpl_values['return'] = os.linesep + self.indent( return_stmt_creator.statement )
            
        f_def = cntrl.template.substitute(tmpl_values)
        return remove_duplicate_linesep( f_def )
开发者ID:CTrauma,项目名称:pypp11,代码行数:50,代码来源:calldef_transformed.py


示例12: create_accessor_code

 def create_accessor_code( self, f, ftype_alias ):
     f_ref_code = '%s( &%s )' % ( ftype_alias, declarations.full_name( f ) )
     if f.call_policies and f.call_policies.is_default():
         return f_ref_code
     result = [ self.make_function_identifier ]
     result.append( '( ' )
     result.append( os.linesep )
     result.append( self.indent( '  ', 2 ) )
     result.append( f_ref_code )
     if f.call_policies:
         result.append( os.linesep )
         result.append( self.indent( ', ', 2 ) )
         result.append( f.call_policies.create( self ) )
     else:
         result.append( os.linesep )
         result.append( self.indent( '  ', 2 ) )
         result.append( '/* undefined call policies */' )
     result.append( ' ) ' )
     return ''.join( result )
开发者ID:alekob,项目名称:tce,代码行数:19,代码来源:properties.py


示例13: _generate_code_with_scope

    def _generate_code_with_scope(self):
        result = []
        scope_var_name = self.alias + '_scope'
        base_classes, base_creators = self._exported_base_classes()
        result.append( 'typedef ' + self._generate_class_definition(base_creators) + ' ' + self.typedef_name + ';')
        result.append( self.typedef_name + ' ' + self.class_var_name )
        result[-1] = result[-1] + ' = '
        class_constructor, used_init = self._generate_constructor()
        result[-1] = result[-1] + self.typedef_name + class_constructor
        result[-1] = result[-1] + ';'

        result.append( algorithm.create_identifier( self, '::boost::python::scope' ) )
        result[-1] = result[-1] + ' ' + scope_var_name
        result[-1] = result[-1] + '( %s );' % self.class_var_name

        creators = self.creators
        if self.declaration.redefine_operators:
            creators = self.creators + self._get_base_operators(base_classes, base_creators)

        for x in creators:
            if x is used_init:
                continue
            if isinstance( x, ( calldef.calldef_t, calldef.calldef_overloads_t ) ):
                x.works_on_instance = False
                code = x.create()
                if code:
                    result.append( code )
                continue
            if not x.works_on_instance:
                code = x.create()
                if code:
                    result.append( code )
            else:
                result.append( '%s.%s;' % ( self.class_var_name, x.create() ) )

        code = os.linesep.join( result )

        result = [ '{ //%s' % declarations.full_name( self.declaration, with_defaults=False ) ]
        result.append( self.indent( code ) )
        result.append( '}' )

        return os.linesep.join( result )
开发者ID:CTrauma,项目名称:pypp11,代码行数:42,代码来源:class_declaration.py


示例14: _create_impl

 def _create_impl(self):
     answer = []
     if self.declaration.type_qualifiers.has_static:
         substitutions = {
             'type' : self.declaration.type.decl_string
             , 'name' : self.declaration.name
             , 'cls_type' : declarations.full_name( self.declaration.parent )
         }
         answer.append( self.MV_STATIC_GET_TEMPLATE % substitutions)
         if self.has_setter:
             answer.append( self.MV_STATIC_SET_TEMPLATE % substitutions )
     else:
         answer.append( self.MV_GET_TEMPLATE % {
             'type' : self.declaration.type.decl_string
             , 'name' : self.declaration.name
             , 'cls_type' : self.inst_arg_type( has_const=True ) })
         if self.has_setter:
             answer.append( self.MV_SET_TEMPLATE % {
             'type' : self.declaration.type.decl_string
             , 'name' : self.declaration.name
             , 'cls_type' : self.inst_arg_type( has_const=False ) })
     return os.linesep.join( answer )
开发者ID:CTrauma,项目名称:pypp11,代码行数:22,代码来源:member_variable.py


示例15: add_code

    def add_code(self, mb):
        mb.classes().add_properties(exclude_accessors=True)

        as_number_template = (
            'def( "as_number", &%(class_def)s::operator %(class_def)s::value_type, bp::default_call_policies() )'
        )

        classes = mb.classes()
        classes.always_expose_using_scope = True  # better error reporting from compiler

        classes = mb.classes(lambda decl: decl.alias != "local_date_time")
        classes.redefine_operators = True  # redefine all operators found in base classes

        classes = mb.classes(lambda decl: decl.name.startswith("constrained_value<"))
        for cls in classes:
            cls.add_code(as_number_template % {"class_def": declarations.full_name(cls)})

        classes = mb.classes(lambda decl: decl.alias in ["date_duration", "time_duration"])
        for operator in [">", ">=", "<=", "<", "+", "-"]:
            classes.add_code("def( bp::self %s  bp::self )" % operator)

        ptime = mb.class_(lambda decl: decl.alias == "ptime")
        for operator in [">", ">=", "<=", "<", "-"]:
            ptime.add_code("def( bp::self %s  bp::self )" % operator)
开发者ID:ISoirar,项目名称:pypp11,代码行数:24,代码来源:generate_code.py


示例16: parse

   def parse(self):
      """Parse the header files and setup the known declarations.
      
      Currently this method can only be called once.
      This method can be called anytime after initialization and all
      Template() calls have been made.

      @returns: Returns the root of the declaration tree
      @rtype: L{IDecl<declwrapper.IDecl>}
      @postcondition: This class can act as a wrapper for namespace("::") and all declarations are set to be ignored.
      """
      if self.mHeaderFiles==[]:
         raise ValueError, "No header files specified"
      
      if self.mVerbose:
         print "Parsing headers: ", self.mHeaderFiles

      # Record the time when parsing started...
      self.mStartTime = time.time()

      # Create and initialize the config object
      parser_cfg = parser.config_t(self.mGccXmlPath,
                                   self.mWorkingDir,
                                   self.mIncludePaths,
                                   define_symbols=self.mDefines,
                                   undefine_symbols=self.mUndefines,
                                   start_with_declarations=None)

      full_header_list = self.mHeaderFiles[:]
      
      # Handle template instantiation as needed      
      temp_file, temp_filename = (None,None)
      template_instantiation_text = self.buildTemplateFileContents()
      if None != template_instantiation_text:
         temp_filename = pygccxml.utils.create_temp_file_name(suffix=".h")
         temp_file = file(temp_filename, 'w')
         temp_file.write(template_instantiation_text)
         temp_file.close()
         if self.mVerbose:
            print "   creating template instantiation file: ", temp_filename
         full_header_list.append(temp_filename)      

      # Create the cache object...
      if self.mCacheDir!=None:
         if self.mVerbose:
            print "Using directory cache in '%s'"%self.mCacheDir
         cache = parser.directory_cache_t(self.mCacheDir)
      elif self.mCacheFile!=None:
         if self.mVerbose:
            print "Using file cache '%s'"%self.mCacheFile
         cache = parser.file_cache_t(self.mCacheFile)         
      else:
         if self.mVerbose:
            print "No cache in use"
         cache = None

      # Create the parser object...
      the_parser = parser.project_reader_t(config=parser_cfg, 
                                           cache=cache,
                                           decl_factory=decl_wrappers.dwfactory_t())
      # ...and parse the headers
      parsed_decls = the_parser.read_files(full_header_list, 
                                           parser.project_reader.COMPILATION_MODE.FILE_BY_FILE)
      
      assert len(parsed_decls) == 1    # assume that we get root of full tree
      self.mDeclRoot = parsed_decls[0]
      
      # Parse the files and add to decl root
      # - then traverse tree setting everything to ignore
      self.mDeclRootWrapper = DeclWrapper(self.mDeclRoot)
      # Set the module builder instance (this is done here and not in the
      # constructor so that Allen's DeclWrapper object still work as well)
      self.mDeclRootWrapper.modulebuilder = self
      self.mDeclRootWrapper.ignore()
      
      # Cleanup
      if temp_filename:
         pygccxml.utils.remove_file_no_raise( temp_filename )
      
      typedef_decls = declarations.make_flatten(parsed_decls)
      typedef_decls = decls = filter( lambda x: (isinstance( x, declarations.typedef_t ) and 
                                                 not x.name.startswith('__') and 
                                                 x.location.file_name != "<internal>")
                                      , typedef_decls )

      self.mTypeDefMap = {}
      for d in typedef_decls:
         type_def_name = d.name
         full_name = declarations.full_name(d)
         if full_name.startswith("::"):    # Remove the base namespace
            full_name = full_name[2:]
         real_type_name = d.type.decl_string
         if real_type_name.startswith("::"):    # Remove base namespace
            real_type_name = real_type_name[2:]   
         self.mTypeDefMap[full_name] = real_type_name

      self.mParseEndTime = time.time()
      if self.mVerbose:
         print "Completed parsing in %s."%self._time2str(self.mParseEndTime-self.mStartTime)

#.........这里部分代码省略.........
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:101,代码来源:modulebuilder.py


示例17: is_excluded

def is_excluded( decl ):
    fullname = declarations.full_name( decl )
    return fullname in to_be_excluded or is_deprecated( decl )
开发者ID:ned14,项目名称:tnfox,代码行数:3,代码来源:declarations_to_exclude.py


示例18: _create_impl

 def _create_impl(self):
     template = 'add_property( "%(name)s", &%(getter)s, &%(setter)s )'
     property_name = self.__get_function.name[4:] #get_
     return template % dict( name=property_name
                             , getter=declarations.full_name( self.__get_function )
                             , setter=declarations.full_name( self.__set_function ) )
开发者ID:CTrauma,项目名称:pypp11,代码行数:6,代码来源:generate_code.py


示例19: wrapped_class_identifier

 def wrapped_class_identifier( self ):
     return algorithm.create_identifier( self, declarations.full_name( self.declaration.parent ) )
开发者ID:BackupTheBerlios,项目名称:slon,代码行数:2,代码来源:calldef_transformed.py


示例20: resolve_function_ref

 def resolve_function_ref( self ):
     if self.controller.inst_arg:
         return self.controller.inst_arg.name + '.' + self.declaration.name
     else:
         return declarations.full_name( self.declaration )
开发者ID:BackupTheBerlios,项目名称:slon,代码行数:5,代码来源:calldef_transformed.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python declarations.get_global_namespace函数代码示例发布时间:2022-05-25
下一篇:
Python declarations.find_declaration函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap