Esempio n. 1
0
    def ParseTextEntry(self, mb):
        # List of overridables
        mb.mem_funs('SetText').virtuality = 'virtual'
        mb.mem_funs('MoveCursor').virtuality = 'virtual'
        mb.mem_funs('SetDisabledBgColor').virtuality = 'virtual'
        mb.mem_funs('SetMultiline').virtuality = 'virtual'
        mb.mem_funs('SetVerticalScrollbar').virtuality = 'virtual'

        #
        mb.mem_funs('GetEditMenu').exclude(
        )  # Exclude for now, add back later when we found out call policies.

        mb.mem_funs('GetSelectedRange').add_transformation(
            FT.output('cx0'), FT.output('cx1'))
        mb.mem_funs('CursorToPixelSpace').add_transformation(
            FT.inout('cx'), FT.inout('cy'))
        mb.mem_funs('AddAnotherLine').add_transformation(
            FT.output('cx'), FT.output('cy'))
        mb.mem_funs('GetStartDrawIndex').add_transformation(
            FT.output('lineBreakIndexIndex'))

        charstrexcludetypes = [pointer_t(const_t(declarated_t(char_t())))]

        # Wrap GetText manual
        cls = mb.class_('TextEntry')
        cls.mem_funs('GetText').exclude()
        cls.add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    const char *buf = (const char *)malloc( (GetTextLength()+1)*sizeof(char) );\r\n' + \
            '    TextEntry::GetText((char *)buf, GetTextLength()+1);\r\n' + \
            '    boost::python::object rv(buf);\r\n' + \
            '    delete buf;\r\n' + \
            '    return rv;\r\n' + \
            '}'
        )

        cls.add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextEntry_wrapper::* )())( &TextEntry_wrapper::GetText ) )'
        )

        cls.calldefs(
            name='SetText',
            function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(
            name='InsertString',
            function=calldef_withtypes(charstrexcludetypes)).exclude()

        # RichText
        cls = mb.class_('RichText')
        cls.calldefs(
            name='SetText',
            function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(
            name='InsertString',
            function=calldef_withtypes(charstrexcludetypes)).exclude()
        if self.settings.branch == 'swarm':
            mb.mem_funs('GetScrollBar').exclude()
 def visit_reference( self ):
     no_ref = declarations.remove_const( declarations.remove_reference( self.user_type ) )
     if declarations.is_same( declarations.char_t(), no_ref ):
         return "ctypes.c_char_p"
     elif declarations.is_same( declarations.wchar_t(), no_ref ):
         return "ctypes.c_wchar_p"
     elif declarations.is_same( declarations.void_t(), no_ref ):
         return "ctypes.c_void_p"
     else:
         base_visitor = self.create_converter( self.user_type.base )
         internal_type_str = declarations.apply_visitor( base_visitor, base_visitor.user_type )
         return "ctypes.POINTER( %s )" % internal_type_str
Esempio n. 3
0
 def visit_reference(self):
     no_ref = declarations.remove_const(
         declarations.remove_reference(self.user_type))
     if declarations.is_same(declarations.char_t(), no_ref):
         return "ctypes.c_char_p"
     elif declarations.is_same(declarations.wchar_t(), no_ref):
         return "ctypes.c_wchar_p"
     elif declarations.is_same(declarations.void_t(), no_ref):
         return "ctypes.c_void_p"
     else:
         base_visitor = self.create_converter(self.user_type.base)
         internal_type_str = declarations.apply_visitor(
             base_visitor, base_visitor.user_type)
         return "ctypes.POINTER( %s )" % internal_type_str
 def visit_pointer( self ):
     no_ptr = declarations.remove_const( declarations.remove_pointer( self.user_type ) )
     if declarations.is_same( declarations.char_t(), no_ptr ) and self.treat_char_ptr_as_binary_data == False:
         return "ctypes.c_char_p"
     elif declarations.is_same( declarations.wchar_t(), no_ptr ) and self.treat_char_ptr_as_binary_data == False:
         return "ctypes.c_wchar_p"
     elif declarations.is_same( declarations.void_t(), no_ptr ):
         return "ctypes.c_void_p"
     else:
         base_visitor = self.create_converter( self.user_type.base )
         internal_type_str = declarations.apply_visitor( base_visitor, base_visitor.user_type )
         if declarations.is_calldef_pointer( self.user_type ):
             return internal_type_str
         else:
             return "ctypes.POINTER( %s )" % internal_type_str
Esempio n. 5
0
    def ParseTextEntry(self, mb):
        # List of overridables
        mb.mem_funs('SetText').virtuality = 'virtual'
        mb.mem_funs('MoveCursor').virtuality = 'virtual'
        mb.mem_funs('SetDisabledBgColor').virtuality = 'virtual'
        mb.mem_funs('SetMultiline').virtuality = 'virtual'
        mb.mem_funs('SetVerticalScrollbar').virtuality = 'virtual'

        #
        mb.mem_funs('GetEditMenu').exclude()        # Exclude for now, add back later when we found out call policies.
        
        mb.mem_funs( 'GetSelectedRange' ).add_transformation( FT.output('cx0'), FT.output('cx1') )   
        mb.mem_funs( 'CursorToPixelSpace' ).add_transformation( FT.inout('cx'), FT.inout('cy') ) 
        mb.mem_funs( 'AddAnotherLine' ).add_transformation( FT.output('cx'), FT.output('cy') ) 
        mb.mem_funs( 'GetStartDrawIndex' ).add_transformation( FT.output('lineBreakIndexIndex') )
        
        charstrexcludetypes = [pointer_t(const_t(declarated_t(char_t())))]
        
        # Wrap GetText manual
        cls = mb.class_('TextEntry')
        cls.mem_funs('GetText').exclude()
        cls.add_wrapper_code(
            'boost::python::object GetText() {\r\n' + \
            '    const char *buf = (const char *)malloc( (GetTextLength()+1)*sizeof(char) );\r\n' + \
            '    TextEntry::GetText((char *)buf, GetTextLength()+1);\r\n' + \
            '    boost::python::object rv(buf);\r\n' + \
            '    delete buf;\r\n' + \
            '    return rv;\r\n' + \
            '}'
        )
        
        cls.add_registration_code(
            'def( \r\n' + \
            '    "GetText"\r\n' + \
            '    , (boost::python::object ( TextEntry_wrapper::* )())( &TextEntry_wrapper::GetText ) )'
        )
        
        cls.calldefs(name='SetText', function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(name='InsertString', function=calldef_withtypes(charstrexcludetypes)).exclude()

        # RichText
        cls = mb.class_('RichText')
        cls.calldefs(name='SetText', function=calldef_withtypes(charstrexcludetypes)).exclude()
        cls.calldefs(name='InsertString', function=calldef_withtypes(charstrexcludetypes)).exclude()
        if self.settings.branch == 'swarm':
            mb.mem_funs('GetScrollBar').exclude()
Esempio n. 6
0
 def visit_pointer(self):
     no_ptr = declarations.remove_const(
         declarations.remove_pointer(self.user_type))
     if declarations.is_same(
             declarations.char_t(),
             no_ptr) and self.treat_char_ptr_as_binary_data == False:
         return "ctypes.c_char_p"
     elif declarations.is_same(
             declarations.wchar_t(),
             no_ptr) and self.treat_char_ptr_as_binary_data == False:
         return "ctypes.c_wchar_p"
     elif declarations.is_same(declarations.void_t(), no_ptr):
         return "ctypes.c_void_p"
     else:
         base_visitor = self.create_converter(self.user_type.base)
         internal_type_str = declarations.apply_visitor(
             base_visitor, base_visitor.user_type)
         if declarations.is_calldef_pointer(self.user_type):
             return internal_type_str
         else:
             return "ctypes.POINTER( %s )" % internal_type_str
Esempio n. 7
0
    def prepare_special_cases():
        """
        Creates a map of special cases ( aliases ) for casting operator.
        """
        special_cases = {}
        const_t = declarations.const_t
        pointer_t = declarations.pointer_t
        for type_ in declarations.FUNDAMENTAL_TYPES.values():
            alias = None
            if declarations.is_same(type_, declarations.bool_t()):
                alias = "__int__"
            elif declarations.is_integral(type_):
                if "long" in type_.decl_string:
                    alias = "__long__"
                else:
                    alias = "__int__"
            elif declarations.is_floating_point(type_):
                alias = "__float__"
            else:
                continue  # void
            if alias:
                special_cases[type_] = alias
                special_cases[const_t(type_)] = alias
        special_cases[pointer_t(const_t(declarations.char_t()))] = "__str__"
        std_string = "::std::basic_string<char,std::char_traits<char>,std::allocator<char> >"
        std_wstring1 = "::std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >"
        std_wstring2 = "::std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >"
        special_cases[std_string] = "__str__"
        special_cases[std_wstring1] = "__str__"
        special_cases[std_wstring2] = "__str__"
        special_cases["::std::string"] = "__str__"
        special_cases["::std::wstring"] = "__str__"

        # TODO: add
        #          std::complex<SomeType> some type should be converted to double
        return special_cases
Esempio n. 8
0
    def prepare_special_cases():
        """
        Creates a map of special cases ( aliases ) for casting operator.
        """
        special_cases = {}
        const_t = declarations.const_t
        pointer_t = declarations.pointer_t
        for type_ in declarations.FUNDAMENTAL_TYPES.values():
            alias = None
            if declarations.is_same( type_, declarations.bool_t() ):
                alias = '__int__'
            elif declarations.is_integral( type_ ):
                if 'long' in type_.decl_string:
                    alias = '__long__'
                else:
                    alias = '__int__'
            elif declarations.is_floating_point( type_ ):
                alias = '__float__'
            else:
                continue #void
            if alias:
                special_cases[ type_ ] = alias
                special_cases[ const_t( type_ ) ] = alias
        special_cases[ pointer_t( const_t( declarations.char_t() ) ) ] = '__str__'
        std_string = '::std::basic_string<char,std::char_traits<char>,std::allocator<char> >'
        std_wstring1 = '::std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >'
        std_wstring2 = '::std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >'
        special_cases[ std_string ] = '__str__'
        special_cases[ std_wstring1 ] = '__str__'
        special_cases[ std_wstring2 ] = '__str__'
        special_cases[ '::std::string' ] = '__str__'
        special_cases[ '::std::wstring' ] = '__str__'

        #TODO: add
        #          std::complex<SomeType> some type should be converted to double
        return special_cases
Esempio n. 9
0
    def Parse(self, mb):
        if self.settings.branch == 'source2013':
            self.steamsdkversion = (1, 30)
    
        # Exclude everything by default
        mb.decls().exclude()  

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(matchers.calldef_matcher_t(arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude() # No definition...
        cls.mem_funs('SetFromSteam2String').exclude() # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude() # No definition...
        
        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()
        
        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()
        
        # Accessor class client
        mb.add_registration_code( "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);" )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()
        
        if self.steamsdkversion > (1, 11):
            cls.mem_fun('SteamHTTP').exclude()
        if self.steamsdkversion > (1, 15):
            cls.mem_fun('SteamScreenshots').exclude()
        if self.steamsdkversion > (1, 20):
            cls.mem_fun('SteamUnifiedMessages').exclude()
            
        cls.mem_fun('SteamMatchmakingServers').exclude() # Full python class wrapper

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()
        if self.steamsdkversion > (1, 16):
            cls.mem_fun('SteamAppList').exclude()
            cls.mem_fun('SteamController').exclude()
            cls.mem_fun('SteamMusic').exclude()
            cls.mem_fun('SteamMusicRemote').exclude()
            cls.mem_fun('SteamUGC').exclude() 
            cls.mem_fun('SteamHTMLSurface').exclude()
            
        cls.mem_funs('SteamApps').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamFriends').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUtils').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamMatchmaking').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamMatchmakingServers').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUser').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUserStats').call_policies = call_policies.return_internal_reference()
        
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;" )
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;" )
        
        self.ParseSteamApps(mb)
        self.ParseSteamFriends(mb)
        
        # User
        cls = mb.class_('ISteamUser')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'
        
        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()
        
        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)
        
        #mb.class_('ISteamUtils').mem_funs('GetImageSize').add_transformation( FT.output('pnWidth'), FT.output('pnHeight'))
        #mb.class_('ISteamUtils').mem_funs('GetCSERIPPort').add_transformation( FT.output('unIP'), FT.output('usPort'))
        
        if self.isserver:
            self.ParseServerOnly(mb)
Esempio n. 10
0
    def Parse(self, mb):
        if self.settings.branch == 'source2013':
            self.steamsdkversion = (1, 30)

        # Exclude everything by default
        mb.decls().exclude()

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(
            matchers.calldef_matcher_t(
                arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude()  # No definition...
        cls.mem_funs('SetFromSteam2String').exclude()  # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude()  # No definition...

        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()

        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()

        # Accessor class client
        mb.add_registration_code(
            "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);"
        )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()

        if self.steamsdkversion > (1, 11):
            cls.mem_fun('SteamHTTP').exclude()
        if self.steamsdkversion > (1, 15):
            cls.mem_fun('SteamScreenshots').exclude()
        if self.steamsdkversion > (1, 20):
            cls.mem_fun('SteamUnifiedMessages').exclude()

        cls.mem_fun(
            'SteamMatchmakingServers').exclude()  # Full python class wrapper

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()
        if self.steamsdkversion > (1, 16):
            cls.mem_fun('SteamAppList').exclude()
            cls.mem_fun('SteamController').exclude()
            cls.mem_fun('SteamMusic').exclude()
            cls.mem_fun('SteamMusicRemote').exclude()
            cls.mem_fun('SteamUGC').exclude()
            cls.mem_fun('SteamHTMLSurface').exclude()

        cls.mem_funs(
            'SteamApps'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamFriends'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUtils'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamMatchmaking'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamMatchmakingServers'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUser'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUserStats'
        ).call_policies = call_policies.return_internal_reference()

        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;"
        )
        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;"
        )

        self.ParseSteamApps(mb)
        self.ParseSteamFriends(mb)

        # User
        cls = mb.class_('ISteamUser')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'

        cls.mem_fun('DecompressVoice').exclude()
        cls.mem_fun('GetAuthSessionTicket').exclude()
        cls.mem_fun('GetEncryptedAppTicket').exclude()
        cls.mem_fun('GetVoice').exclude()
        cls.mem_fun('InitiateGameConnection').exclude()
        cls.mem_fun('RequestEncryptedAppTicket').exclude()
        cls.mem_fun('BeginAuthSession').exclude()

        mb.free_function('PySteamUser_GetAuthSessionTicket').include()
        mb.free_function('PySteamUser_GetAuthSessionTicket').rename(
            'SteamUser_GetAuthSessionTicket')

        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.no_init = True
        cls.noncopyable = True
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()
        cls.mem_fun('GetAPICallResult').exclude()

        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)

        #mb.class_('ISteamUtils').mem_funs('GetImageSize').add_transformation( FT.output('pnWidth'), FT.output('pnHeight'))
        #mb.class_('ISteamUtils').mem_funs('GetCSERIPPort').add_transformation( FT.output('unIP'), FT.output('usPort'))

        if self.isserver:
            self.ParseServerOnly(mb)
Esempio n. 11
0
 def __init__(self):
     resolver_t.__init__(self)
     self.__const_char_pointer \
         = declarations.pointer_t( declarations.const_t( declarations.char_t() ) )
Esempio n. 12
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(
            matchers.calldef_matcher_t(
                arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude()  # No definition...
        cls.mem_funs('SetFromSteam2String').exclude()  # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude()  # No definition...

        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()

        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()

        # Accessor class for all
        mb.add_registration_code(
            "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);"
        )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()
        cls.mem_fun('SteamApps').exclude()
        cls.mem_fun('SteamMatchmakingServers').exclude()

        cls.mem_fun('SteamHTTP').exclude()
        cls.mem_fun('SteamScreenshots').exclude()
        cls.mem_fun('SteamUnifiedMessages').exclude()

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()

        cls.mem_funs(
            'SteamFriends'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUtils'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamMatchmaking'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUser'
        ).call_policies = call_policies.return_internal_reference()
        cls.mem_funs(
            'SteamUserStats'
        ).call_policies = call_policies.return_internal_reference()

        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;"
        )
        mb.add_registration_code(
            "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;"
        )

        # Friends
        cls = mb.class_('ISteamFriends')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetFriendGamePlayed').exclude()

        mb.enum('EFriendRelationship').include()
        mb.enum('EPersonaState').include()
        mb.add_registration_code(
            "bp::scope().attr( \"k_cchPersonaNameMax\" ) = (int)k_cchPersonaNameMax;"
        )

        # User
        cls = mb.class_('ISteamUser')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'

        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()

        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)
Esempio n. 13
0
    def Parse(self, mb):
        # Exclude everything by default
        mb.decls().exclude()  

        # Generic steam api call return result
        mb.typedef('SteamAPICall_t').include()

        # CSteamID
        cls = mb.class_('CSteamID')
        cls.include()
        constpchararg = pointer_t(const_t(declarated_t(char_t())))
        cls.constructors(matchers.calldef_matcher_t(arg_types=[constpchararg, None])).exclude()
        cls.mem_funs('Render').exclude()
        cls.mem_funs('SetFromStringStrict').exclude()
        cls.mem_funs('SetFromString').exclude()      # No definition...
        cls.mem_funs('SetFromSteam2String').exclude()      # No definition...
        cls.mem_funs('BValidExternalSteamID').exclude()      # No definition...
        
        mb.enum('EResult').include()
        mb.enum('EDenyReason').include()
        mb.enum('EUniverse').include()
        mb.enum('EAccountType').include()
        mb.enum('ESteamUserStatType').include()
        mb.enum('EChatEntryType').include()
        mb.enum('EChatRoomEnterResponse').include()
        mb.enum('EChatMemberStateChange').include()
        
        # Generic API functions
        mb.free_function('SteamAPI_RunCallbacks').include()
        
        # Accessor class for all
        mb.add_registration_code( "bp::scope().attr( \"steamapicontext\" ) = boost::ref(steamapicontext);" )
        cls = mb.class_('CSteamAPIContext')
        cls.include()
        cls.mem_fun('Init').exclude()
        cls.mem_fun('Clear').exclude()
        cls.mem_fun('SteamApps').exclude()
        cls.mem_fun('SteamMatchmakingServers').exclude()
        
        cls.mem_fun('SteamHTTP').exclude()
        cls.mem_fun('SteamScreenshots').exclude()
        cls.mem_fun('SteamUnifiedMessages').exclude()

        cls.mem_fun('SteamNetworking').exclude()
        cls.mem_fun('SteamRemoteStorage').exclude()
        
        cls.mem_funs('SteamFriends').call_policies = call_policies.return_internal_reference() 
        cls.mem_funs('SteamUtils').call_policies = call_policies.return_internal_reference() 
        cls.mem_funs('SteamMatchmaking').call_policies = call_policies.return_internal_reference() 
        cls.mem_funs('SteamUser').call_policies = call_policies.return_internal_reference()
        cls.mem_funs('SteamUserStats').call_policies = call_policies.return_internal_reference()
        
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_NOT_INITIALIZED\" ) = (int)QUERY_PORT_NOT_INITIALIZED;" )
        mb.add_registration_code( "bp::scope().attr( \"QUERY_PORT_ERROR\" ) = (int)QUERY_PORT_ERROR;" )
        
        # Friends
        cls = mb.class_('ISteamFriends')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetFriendGamePlayed').exclude()
        
        mb.enum('EFriendRelationship').include()
        mb.enum('EPersonaState').include()
        mb.add_registration_code( "bp::scope().attr( \"k_cchPersonaNameMax\" ) = (int)k_cchPersonaNameMax;" )
        
        # User
        cls = mb.class_('ISteamUser')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        
        # Utils
        cls = mb.class_('ISteamUtils')
        cls.include()
        cls.mem_funs().virtuality = 'not virtual'
        cls.mem_fun('GetImageRGBA').exclude()
        cls.mem_fun('GetImageSize').exclude()
        
        self.ParseMatchmaking(mb)
        self.ParseUserStats(mb)
        
        #mb.class_('ISteamUtils').mem_funs('GetImageSize').add_transformation( FT.output('pnWidth'), FT.output('pnHeight'))
        #mb.class_('ISteamUtils').mem_funs('GetCSERIPPort').add_transformation( FT.output('unIP'), FT.output('usPort'))
        
Esempio n. 14
0
 def __init__( self ):
     resolver_t.__init__( self )
     self.__const_char_pointer \
         = declarations.pointer_t( declarations.const_t( declarations.char_t() ) )