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

Python call_policies.return_value_policy函数代码示例

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

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



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

示例1: ParseClient

 def ParseClient(self, mb):
     # Free functions that don't start with 'UTIL_'
     mb.free_functions('ScreenHeight').include()
     mb.free_functions('ScreenWidth').include()
     mb.free_functions('GetVectorInScreenSpace').include()
     mb.free_functions('GetTargetInScreenSpace').include()
     
     # Main view
     mb.free_function('MainViewOrigin').include()
     mb.free_function('MainViewAngles').include()
     mb.free_function('MainViewForward').include()
     mb.free_function('MainViewRight').include()
     mb.free_function('MainViewUp').include()
     mb.free_function('MainWorldToViewMatrix').include()
     
     # Call policies and excludes
     if self.settings.branch == 'swarm':
         mb.free_function('UTIL_GetLocalizedKeyString').exclude()
         mb.free_function('UTIL_MessageText').exclude()
         mb.free_functions('UTIL_EntityFromUserMessageEHandle').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
     mb.free_functions('UTIL_PlayerByUserId').call_policies = call_policies.return_value_policy( call_policies.return_by_value )   
         
     # Transformations
     mb.free_functions( 'GetVectorInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
     mb.free_functions( 'GetTargetInScreenSpace' ).add_transformation( FT.output('iX'), FT.output('iY') )
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:25,代码来源:_utils.py


示例2: ManualFixes

def ManualFixes ( mb, ns ):    
    global_ns = mb.global_ns
#     if MAIN_NAMESPACE:
#         main_ns = global_ns.namespace( MAIN_NAMESPACE )
#     else:
#         main_ns = global_ns
    if ns == 'OgreOde': # we only need to do this once
        ## here we adjust for functions that return poiners to ODE "ID's", which are really C structs
        ## I may have been over agressive in identifing these functions but hopefully not...
        for func in mb.namespace( 'OgreOde' ).member_functions():  
            if func.return_type.decl_string.endswith('ID'):
                print "Setting ", func.name, "to Opaque"
                func.opaque = True
                func.call_policies = call_policies.return_value_policy(
                    call_policies.return_opaque_pointer )

    ## Functions that return objects we need to manage
    FunctionsToMemoryManage=[\
        '::OgreOde::EntityInformer::createStaticTriangleMesh',
        '::OgreOde::EntityInformer::createSingleStaticBox',
        '::OgreOde::EntityInformer::createSingleDynamicBox',
        '::OgreOde::EntityInformer::createSingleDynamicSphere'        
        ]
    for cls in FunctionsToMemoryManage:
        global_ns.mem_fun(cls).call_policies = call_policies.return_value_policy( call_policies.manage_new_object )  
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:25,代码来源:generate_code.py


示例3: Parse

 def Parse(self, mb):
     # Exclude everything by default
     mb.decls().exclude()
     
     mb.class_('kbutton_t').include()
     if self.settings.branch == 'swarm':
         mb.class_('kbutton_t').mem_funs('GetPerUser').exclude()
     
     # Include input class
     cls = mb.class_('CInput')
     cls.include()
     cls.mem_funs().virtuality = 'not virtual'
     if self.settings.branch == 'swarm':
         #mb.mem_funs('FindKey').exclude() # FIXME
         mb.mem_funs('FindKey').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) 
     else:
         mb.mem_funs('FindKey').call_policies = call_policies.return_value_policy( call_policies.manage_new_object )  
     mb.mem_funs('GetUserCmd').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) # Can't exclude due being abstract
     
     mb.mem_funs( 'CAM_OrthographicSize' ).add_transformation( FT.output('w'), FT.output('h') )
     
     mb.add_declaration_code( "CInput *wrap_Input()\r\n{\r\n\treturn (CInput *)::input;\r\n}\r\n" )
     mb.add_registration_code( 'bp::def( "input", wrap_Input, bp::return_value_policy<bp::reference_existing_object>() );' )
     
     # ButtonCode.  
     mb.enums('ButtonCode_t').include()
     
     # Remove any protected function 
     mb.calldefs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:29,代码来源:_input.py


示例4: customize

    def customize(self, mb ):
        mb.calldef( 'return_second_arg' ).call_policies = call_policies.return_arg( 2 )
        mb.calldef( 'return_self' ).call_policies = call_policies.return_self()

        mb.class_( 'impl_details_t' ).opaque = True

        mb.calldef( 'get_opaque' ).call_policies \
            = call_policies.return_value_policy( call_policies.return_opaque_pointer )

        mb.calldef( 'get_fundamental_ptr_value' ).call_policies \
            = call_policies.return_value_policy( call_policies.return_pointee_value )

        mb.calldef( 'get_fundamental_ptr_value_null' ).call_policies \
            = call_policies.return_value_policy( call_policies.return_pointee_value )

        mb.calldef( 'create_arr_3' ).call_policies \
            = call_policies.convert_array_to_tuple( 3, call_policies.memory_managers.delete_ )

        image = mb.class_('return_range_image_t')
        image.add_declaration_code( get_size_code )
        image.add_declaration_code( get_create_images_size )
        get_raw_data = image.mem_fun( 'get_raw_data' )
        get_raw_data.call_policies \
            = call_policies.return_range( get_raw_data, 'raw_data_size_t' )
        get_raw_data_const = image.mem_fun( 'get_raw_data_const' )
        get_raw_data_const.call_policies \
            = call_policies.return_range( get_raw_data_const, 'raw_data_size_t' )
        create_images = image.mem_fun( 'create_images' )
        create_images.call_policies \
            = call_policies.return_range( create_images
                                          , 'get_create_images_size_t'
                                          , call_policies.return_value_policy(call_policies.reference_existing_object) )
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:32,代码来源:call_policies_tester.py


示例5: ParseISurface

 def ParseISurface(self, mb):
     cls = mb.class_('CWrapSurface')
     cls.include()
     cls.rename('ISurface')
     mb.free_function('wrapsurface').include()
     mb.free_function( 'wrapsurface' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
     mb.free_function( 'wrapsurface' ).rename('surface')    
     
     mb.enum('CursorCode').include()
     mb.enum('FontDrawType_t').include()
     if self.settings.branch == 'swarm':
         mb.class_('FontVertex_t').include()
     else:
         mb.class_('Vertex_t').include()
     mb.class_('IntRect').include()
     
     cls.mem_funs( 'DrawGetTextPos' ).add_transformation( FT.output('x'), FT.output('y') )
     cls.mem_funs( 'DrawGetTextureSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
     cls.mem_funs( 'GetScreenSize' ).add_transformation( FT.output('wide'), FT.output('tall') )
     cls.mem_funs( 'GetCharABCwide' ).add_transformation( FT.output('a'), FT.output('b'), FT.output('c') )
     cls.mem_funs( 'GetWorkspaceBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
     cls.mem_funs( 'GetAbsoluteWindowBounds' ).add_transformation( FT.output('x'), FT.output('y'), FT.output('wide'), FT.output('tall') )
     cls.mem_funs( 'GetProportionalBase' ).add_transformation( FT.output('width'), FT.output('height') )
     cls.mem_funs( 'SurfaceGetCursorPos' ).add_transformation( FT.output('x'), FT.output('y') )
     
     cls.mem_funs( 'CreateHTMLWindow' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
     cls.mem_funs( 'DrawGetTextureMatInfoFactory' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
     cls.mem_funs( 'GetIconImageForFullPath' ).call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
开发者ID:detoxhby,项目名称:lambdawars,代码行数:28,代码来源:_vgui.py


示例6: set_call_policies_pointee

def set_call_policies_pointee( mb ):
    # Set the default policy to deal with pointer/reference return types to reference_existing object
    # as this is the ogrenewt Default.
    ## NOTE AJM 1/1/07 -- this function not used as change to ref_existing_object..
    from pyplusplus import module_creator
    mem_funs = mb.calldefs ()
    mem_funs.create_with_signature = True 
    #MSVC 7.1 if function has throw modifier.
    resolver = module_creator.built_in_resolver_t()
    for mem_fun in mem_funs:
        if mem_fun.call_policies:
            continue
        decl_call_policies = resolver( mem_fun )
        if decl_call_policies:
            mem_fun.call_policies = decl_call_policies
            continue
        rtype = declarations.remove_alias( mem_fun.return_type )
        if declarations.is_pointer(rtype) or declarations.is_reference(rtype):
#             mem_fun.call_policies \
#                 = call_policies.return_value_policy( call_policies.reference_existing_object )
            mem_fun.call_policies \
               = call_policies.return_value_policy( '::boost::python::return_pointee_value' )
               
    ## now we fix a problem where the getSingleton policy isn't right               
    mb.mem_funs( 'getSingleton' ).call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object )
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:26,代码来源:generate_code.py


示例7: ParseHUD

    def ParseHUD(self, mb):
        # CHud
        cls = mb.class_('CHud')
        cls.include()
        
        if self.settings.branch == 'swarm':
            mb.free_function('GetHud').include()
            mb.free_function('GetHud').call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
        else:
            mb.variables('gHUD').include()
        
        cls.member_functions( 'FindElement' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
        if self.settings.branch != 'swarm': # ASW should use HudIcons() / CHudIcons
            #cls.member_functions( 'GetIcon' ).call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
            #cls.member_functions( 'AddUnsearchableHudIconToList' ).call_policies = call_policies.return_value_policy( call_policies.manage_new_object ) 
            #cls.member_functions( 'AddSearchableHudIconToList' ).call_policies = call_policies.return_value_policy( call_policies.manage_new_object )
            # The HUD only cleans up when you close the game, so internal references should't be a problem.
            cls.member_functions( 'GetIcon' ).call_policies = call_policies.return_internal_reference()
            cls.member_functions( 'AddUnsearchableHudIconToList' ).call_policies = call_policies.return_internal_reference()
            cls.member_functions( 'AddSearchableHudIconToList' ).call_policies = call_policies.return_internal_reference()
        cls.variables('m_HudList').exclude()
        
        if self.settings.branch == 'swarm':
            cls.member_functions('GetHudList').exclude()
            cls.member_functions('GetHudPanelList').exclude()
            
        cls = mb.class_('CHudElement')
        cls.include()
        cls.member_functions('GetName').exclude()
        cls.variables('m_pyInstance').exclude()
        cls.member_functions('SetActive').virtuality = 'not virtual' 
        cls.member_functions('IsActive').virtuality = 'not virtual'
        cls.member_functions('ShouldDraw').virtuality = 'not virtual' # TODO: What if we need better control in Python?
        cls.member_functions('ProcessInput').virtuality = 'not virtual' # TODO: Do we ever need this in Python?
        
        cls = mb.class_('CPyHudElementHelper')
        cls.include()
        cls.rename('CHudElementHelper')
        cls.member_functions('GetNext').exclude()

        # HudIcons
        if self.settings.branch == 'swarm':
            cls = mb.class_('CHudIcons')
            cls.include()
            # FIXME
            cls.member_functions( 'GetIcon' ).call_policies = call_policies.return_internal_reference()
            #cls.member_functions('GetIcon').call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
            #cls.member_functions('GetIcon' ).call_policies = call_policies.return_value_policy( call_policies.manage_new_object ) 
            cls.member_functions('AddUnsearchableHudIconToList').exclude()
            cls.member_functions('AddSearchableHudIconToList').exclude()
            #cls.member_functions('AddUnsearchableHudIconToList').call_policies = call_policies.return_value_policy( call_policies.manage_new_object ) 
            #cls.member_functions('AddSearchableHudIconToList').call_policies = call_policies.return_value_policy( call_policies.manage_new_object ) 
            mb.free_function('HudIcons').include()
            mb.free_function('HudIcons').call_policies = call_policies.return_value_policy(call_policies.reference_existing_object) 
            
        # CHudTexture
        cls = mb.class_('CHudTexture')
        cls.include()
        cls.variables().exclude()
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:59,代码来源:_vgui.py


示例8: ScrollBar

    def ScrollBar(self, mb):
        mb.mem_funs( 'GetButton' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        mb.mem_funs( 'GetSlider' ).call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        
        mb.mem_funs( 'GetRange' ).add_transformation( FT.output('min'), FT.output('max') ) 

        # ScrollBarSlider
        mb.mem_funs( 'GetNobPos' ).add_transformation( FT.output('min'), FT.output('max') ) 
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:8,代码来源:_vguicontrols.py


示例9: ParseClientEntityRelated

    def ParseClientEntityRelated(self, mb):    
        # Creating a client class
        cls =  mb.class_('NetworkedClass')
        cls.include()
        cls.vars('m_pClientClass').exclude()
        
        cls = self.IncludeEmptyClass(mb, 'ClientClass')
        cls.no_init = True
        cls.calldefs('ClientClass').exclude()
        cls.mem_fun('GetName').include() # For debugging purposes
        
        # Client Entity List
        cls = mb.class_('CClientEntityList')
        cls.include()
        cls.calldefs().virtuality = 'not virtual'
        cls.no_init = True

        cls.mem_funs().exclude()
        
        cls.mem_fun('NumberOfEntities').include()
        cls.mem_fun('GetHighestEntityIndex').include()
        cls.mem_fun('GetBaseEntity').include()
        cls.mem_fun('GetBaseEntity').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        cls.mem_fun('GetBaseEntityFromHandle').include()
        cls.mem_fun('GetBaseEntityFromHandle').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        cls.mem_fun('EntIndexToHandle').include()
        cls.mem_fun('HandleToEntIndex').include()
        cls.mem_fun('IsHandleValid').include()
        cls.mem_fun('FirstBaseEntity').include()
        cls.mem_fun('FirstBaseEntity').call_policies = call_policies.return_value_policy(call_policies.return_by_value)
        cls.mem_fun('NextBaseEntity').include()
        cls.mem_fun('NextBaseEntity').call_policies = call_policies.return_value_policy(call_policies.return_by_value)

        mb.free_function('ClientEntityList').include()
        mb.free_function('ClientEntityList').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
        
        # PyEntityFactory    
        self.IncludeEmptyClass(mb, 'PyEntityFactory')
        mb.class_('PyEntityFactory').rename('EntityFactory')
        mb.free_function('PyGetClassByClassname').include()
        mb.free_function('PyGetClassByClassname').rename('GetClassByClassname')
        mb.free_function('PyGetAllClassnames').include()
        mb.free_function('PyGetAllClassnames').rename('GetAllClassnames')
        if self.isserver or self.settings.branch == 'swarm':
            mb.free_function('PyReadDataDesc').include()
            mb.free_function('PyReadDataDesc').rename('ReadDataDesc')
        
        # Client only structs
        cls = mb.class_('SpatializationInfo_t')
        cls.include()
        cls.var('pOrigin').exclude()
        cls.var('pAngles').exclude()
        cls.var('pflRadius').exclude()
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:53,代码来源:_entitiesmisc.py


示例10: Parse

    def Parse(self, mb):
        # Exclude everything, then add what we need
        mb.decls().exclude() 
        
        mb.free_function('PyMKCreateSession').include()
        mb.free_function('PyMKCreateSession').rename('CreateSession')
        mb.free_function('PyMKMatchSession').include()
        mb.free_function('PyMKMatchSession').rename('MatchSession')
        mb.free_function('PyMKCloseSession').include()
        mb.free_function('PyMKCloseSession').rename('CloseSession')
        mb.free_function('PyMKIsSessionActive').include()
        mb.free_function('PyMKIsSessionActive').rename('IsSessionActive')

        cls = mb.class_('PyMatchEventsSubscription')
        cls.include()
        cls.rename('matcheventssubscription')
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetEventData').call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
        
        cls = mb.class_('PyMatchSession')
        cls.include()
        cls.rename('matchsession')
        cls.mem_funs().virtuality = 'not virtual' 
        cls.mem_fun('GetSessionSystemData').call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
        cls.mem_fun('GetSessionSettings').call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
        
        cls = mb.class_('PyMatchSystem')
        cls.include()
        cls.rename('matchsystem')
        cls.mem_funs().virtuality = 'not virtual' 
        
        cls = mb.class_('PySearchManager')
        cls.include()
        cls.rename('SearchManager')
        #cls.calldefs('PySearchManager').exclude()
        cls.mem_funs().virtuality = 'not virtual' 
        cls.mem_fun('SetSearchManagerInternal').exclude()
        
        cls = mb.class_('PyMatchSearchResult')
        cls.include()
        cls.rename('MatchSearchResult')
        cls.mem_funs().virtuality = 'not virtual'
        #cls.calldefs('PyMatchSearchResult').exclude()
        cls.mem_fun('GetGameDetails').call_policies = call_policies.return_value_policy( call_policies.return_by_value )  
        
        cls = mb.class_('PyMatchEventsSink')
        cls.include()
        cls.rename('MatchEventsSink')

        cls = mb.class_('PySteamMatchmaking')
        cls.include()
        cls.rename('steammatchmaking')
开发者ID:detoxhby,项目名称:lambdawars,代码行数:52,代码来源:matchmaking.py


示例11: Parse

    def Parse(self, mb):
        mb.decls().exclude()  

        # Material reference
        cls = mb.class_('CMaterialReference')
        cls.include()
        mb.global_ns.member_operators('*').call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
        mb.global_ns.member_operators().exclude()
        mb.global_ns.casting_operators().exclude()

        if self.isclient:
            # Glow Outline manager
            cls = mb.class_('CGlowObjectManager')
            cls.include()
            cls.member_functions().virtuality = 'not virtual'
            cls.no_init = True
            
            mb.add_registration_code( "bp::scope().attr( \"glowobjectmanager\" ) = boost::ref(g_GlowObjectManager);" )
            
            # A way for creating procedural materials in Python
            cls = mb.class_('PyProceduralTexture')
            cls.rename('ProceduralTexture')
            cls.include()
            
            mb.enumeration('ImageFormat').include()
            
            # Material lights
            cls = mb.class_('LightDesc_t')
            cls.include()
        
        # Remove any protected function 
        mb.calldefs( matchers.access_type_matcher_t( 'protected' ) ).exclude()
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:32,代码来源:materials.py


示例12: ApplyCommonRules

 def ApplyCommonRules(self, mb):
     # Common function added for getting the "PyObject" of an entity
     mb.member_functions('GetPySelf').exclude()
     
     ihandleentity = mb.class_('IHandleEntity')
     
     # All return values derived from IHandleEntity entity will be returned by value.
     # This ensures the converter is called
     testinherit = MatcherTestInheritClass(ihandleentity)
     decls = mb.calldefs(matchers.custom_matcher_t(testinherit))
     decls.call_policies = call_policies.return_value_policy(call_policies.return_by_value)
     
     # All CBaseEntity related classes should have a custom call trait
     self.baseentcls = mb.class_('CBaseEntity' if self.isserver else 'C_BaseEntity')
     def ent_call_trait(type_):
         return '%(arg)s ? %(arg)s->GetPyHandle() : boost::python::object()'
     entclasses = mb.classes(self.TestCBaseEntity)
     for entcls in entclasses:
         entcls.custom_call_trait = ent_call_trait
         
     # All functions receiving an IHandleEntity argument should be converted
     def ihandleentity_call_trait(type_):
         return 'PyEntityFromEntityHandle( %(arg)s )'
     ihandleentity.custom_call_trait = ihandleentity_call_trait
     
     # Anything returning KeyValues should be returned by value so it calls the converter
     keyvalues = mb.class_('KeyValues')
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(declarated_t(keyvalues))), allow_empty=True).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(const_t(declarated_t(keyvalues)))), allow_empty=True).call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
     
     # Anything returning a void pointer is excluded by default
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(declarated_t(void_t()))), allow_empty=True).exclude()
     mb.calldefs(calldef_matcher_t(return_type=pointer_t(const_t(declarated_t(void_t())))), allow_empty=True).exclude()
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:33,代码来源:basesource.py


示例13: ParseMisc

    def ParseMisc(self, mb):
        # Include some empty classes
        #IncludeEmptyClass(mb, 'CViewSetup')    <- TODO: Needed?
        
        # Animation Controller
        mb.free_function('GetAnimationController').include()
        mb.free_function('GetAnimationController').call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
        
        # Screen
        cls = mb.class_('WarsVGUIScreen')
        cls.include()

        # IVGUI/Tick signals
        mb.add_declaration_code( "void wrap_AddTickSignal( VPANEL panel, int intervalMilliseconds = 0 )\r\n{\r\n\tvgui::ivgui()->AddTickSignal(panel, intervalMilliseconds);\r\n}\r\n" )
        mb.add_declaration_code( "void wrap_RemoveTickSignal( VPANEL panel)\r\n{\r\n\tvgui::ivgui()->RemoveTickSignal(panel);\r\n}\r\n" )
        mb.add_registration_code( 'bp::def( "AddTickSignal", wrap_AddTickSignal, (bp::arg("panel"), bp::arg("intervalMilliseconds")=0 ) );' )
        mb.add_registration_code( 'bp::def( "RemoveTickSignal", wrap_RemoveTickSignal, bp::arg("panel") );' )
        
        # Gameui open?
        mb.free_function('PyIsGameUIVisible').include()
        mb.free_function('PyIsGameUIVisible').rename('IsGameUIVisible')
        mb.free_function('PyGetPanel').include()
        mb.free_function('PyGetPanel').rename('GetPanel')
        #mb.free_function('PyGetPanel').call_policies = call_policies.return_value_policy(call_policies.return_by_value) 
        mb.enum('VGuiPanel_t').include()
        mb.free_function('PyGameUICommand').include() # Temporary function
        mb.free_function('PyGameUICommand').rename('GameUICommand')
        
        # Message map types
        mb.enum('DataType_t').include()

        # Some defines
        mb.add_registration_code( "bp::scope().attr( \"INVALID_FONT\" ) = (int)0;" )
        mb.add_registration_code( "bp::scope().attr( \"INVALID_PANEL\" ) = (int)0xffffffff;" )
开发者ID:detoxhby,项目名称:lambdawars,代码行数:34,代码来源:_vgui.py


示例14: customize

    def customize( self, mb ):
        mb.global_ns.exclude()

        nm_t = declarations.remove_declarated( mb.global_ns.typedef( 'naive_matrix_t' ).type )
        nm_t.include()

        exposed_db = utils.exposed_decls_db_t()

        exposed_db.register_decls( mb.global_ns, [] )
        exposed_db.save( autoconfig.build_dir )
        mb.register_module_dependency( autoconfig.build_dir )

        sm = mb.global_ns.namespace( name='split_module' )
        sm.include()
        sm.class_( 'op_struct' ).exclude()

        mb.free_function( 'check_overload' ).add_declaration_code( '//hello check_overload' )
        mb.free_function( 'get_opaque' ).add_declaration_code( '//hello get_opaque' )

        mb.calldefs( 'check_overload' ).use_overload_macro = True
        mb.calldefs( 'get_opaque' ).call_policies \
          = call_policies.return_value_policy( call_policies.return_opaque_pointer )

        mb.class_( 'op_struct' ).exclude()
        item = mb.class_( 'item_t' )
        item.add_declaration_code( '//hello world' )
        nested = item.class_( 'nested_t' )
        nested.add_declaration_code( '//hello nested decl' )
        nested.add_registration_code( '//hello nested reg', False )
        mb.free_fun( 'create_empty_mapping' ).include()
开发者ID:CTrauma,项目名称:pypp11,代码行数:30,代码来源:balanced_files_tester.py


示例15: Parse

 def Parse(self, mb):
     # Exclude everything, then add what we need
     # Otherwise we get very big source code and dll's
     mb.decls().exclude() 
     
     cls = mb.class_('CFogOfWarMgr')
     cls.include()
     cls.mem_funs().virtuality = 'not virtual'
     cls.no_init = True
     
     cls.mem_funs().exclude()
     
     cls.mem_fun('GetGridSize').include()
     cls.mem_fun('GetTileSize').include()
     cls.mem_fun('ComputeFOWPosition').include()
     cls.mem_fun('ComputeWorldPosition').include()
     cls.mem_fun('DebugPrintEntities').include()
     cls.mem_fun('ModifyHeightAtTile').include()
     cls.mem_fun('ModifyHeightAtPoint').include()
     cls.mem_fun('ModifyHeightAtExtent').include()
     cls.mem_fun('GetHeightAtTile').include()
     cls.mem_fun('GetHeightAtPoint').include()
     
     if self.isserver:
         cls.mem_fun('PointInFOW').include()
         cls.mem_fun('ForceTransmitUpdateEntity').include()
     if self.isclient:
         cls.mem_fun('ResetExplored').include()
             
     mb.free_function('FogOfWarMgr').include()
     mb.free_function('FogOfWarMgr').call_policies = call_policies.return_value_policy( call_policies.reference_existing_object )
开发者ID:detoxhby,项目名称:lambdawars,代码行数:31,代码来源:_fow.py


示例16: call_policies

 def call_policies(self):
     """Define default call policies: for anything that returns a reference,
     return a reference to the existing object. This is potentially dangerous."""
     decllist = [ self.mb.member_functions(returns_reference),
         self.mb.free_functions(returns_reference),
         self.mb.operators(returns_reference) ]
     for decls in decllist:
         for decl in decls:
             if decl.return_type.decl_string[-7:]=='const &':
                 decl.call_policies = \
                     call_policies.return_value_policy(
                         call_policies.copy_const_reference)
             else:
                 decl.call_policies = \
                     call_policies.return_value_policy(
                         call_policies.reference_existing_object)
开发者ID:lugiger,项目名称:omplapp,代码行数:16,代码来源:bindings_generator.py


示例17: setMemberFunctionCallPolicieByReturn

def setMemberFunctionCallPolicieByReturn(mb, MemberRetRef, callPolicie):
    for ref in MemberRetRef:
        memFuns = mb.global_ns.member_functions(return_type=ref, allow_empty=True)
        print(ref, len(memFuns))

        for memFun in memFuns:
            if memFun.call_policies:
                continue
            else:
                memFun.call_policies = \
                call_policies.return_value_policy(callPolicie)
开发者ID:wk1984,项目名称:gimli,代码行数:11,代码来源:generate_pygimli_code.py


示例18: setDefaultCallPolicies

def setDefaultCallPolicies(ns):
    # Set the default policy to deal with pointer/reference return types to reference_existing object
    # as this is the CEGUI Default.
    mem_funs = ns.calldefs()
    mem_funs.create_with_signature = True #Generated code will not compile on
    #MSVC 7.1 if function has throw modifier.
    for mem_fun in mem_funs:
        if mem_fun.call_policies:
            continue
        if declarations.is_pointer (mem_fun.return_type) or declarations.is_reference (mem_fun.return_type):
            mem_fun.call_policies = call_policies.return_value_policy(call_policies.reference_existing_object)
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:11,代码来源:common_utils.py


示例19: customize

    def customize(self, mb ):
        opaqueDecls = {
                'Path': ['reverse'],
                'RailTracking': ['getPath'],
                'Track': ['getPath', 'getDefaultPath']
                }

        mb.class_('Path').include()

        for decl in list(opaqueDecls.items()):
            cls = mb.class_(decl[0])
            for methodName in decl[1]:
                cls.member_function(methodName).call_policies = call_policies.return_value_policy(call_policies.return_opaque_pointer);
开发者ID:asford,项目名称:pyplusplus,代码行数:13,代码来源:mem_var_compile_error_bug_tester.py


示例20: Set_Call_Policies

def Set_Call_Policies( mb ):
    """ set the return call policies on classes that this hasn't already been done for.
    Set the default policy to deal with pointer/reference return types to reference_existing object
    """
    mem_funs = mb.calldefs ()
    mem_funs.create_with_signature = True #Generated code will not compile on
    #MSVC 7.1 if function has throw modifier.
    for mem_fun in mem_funs:
        if mem_fun.call_policies:
            continue
        if not mem_fun.call_policies and \
                    (declarations.is_reference (mem_fun.return_type) or declarations.is_pointer (mem_fun.return_type) ):
            mem_fun.call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object )
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:14,代码来源:generate_code.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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