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


Python FFIRename类代码示例

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


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

示例1: constructEnumTypeDescriptor

    def constructEnumTypeDescriptor(self, typeIndex):
        if self.isDefinedType(typeIndex):
            return self.typeIndexMap[typeIndex]
        else:
            descriptor = FFITypes.EnumTypeDescriptor()
            #descriptor.environment = self.environment
            descriptor.isNested = interrogate_type_is_nested(typeIndex)
            if descriptor.isNested:
                outerTypeIndex = interrogate_type_outer_class(typeIndex)
                descriptor.outerType = self.constructDescriptor(outerTypeIndex)
            if interrogate_type_has_module_name(typeIndex):
                descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex)

            # Enums are ints in C++ but we do not want to redefine the int type
            # So we will just call them enums
            descriptor.enumName = FFIRename.classNameFromCppName(getTypeName(typeIndex))
            descriptor.foreignTypeName = '__enum__' + descriptor.enumName
            numValues = interrogate_type_number_of_enum_values(typeIndex)

            # Store the names and values of the enum in a dictionary
            for i in range(numValues):
                value = interrogate_type_enum_value(typeIndex, i)
                name = FFIRename.classNameFromCppName(
                    interrogate_type_enum_value_name(typeIndex, i))
                scopedName = FFIRename.classNameFromCppName(
                    interrogate_type_enum_value_scoped_name(typeIndex, i))
                descriptor.values[name] = value
            
            descriptor.typeIndex = typeIndex
            self.typeIndexMap[typeIndex] = descriptor
            return descriptor
开发者ID:kralf,项目名称:panda3d,代码行数:31,代码来源:FFIInterrogateDatabase.py

示例2: constructManifest

    def constructManifest(self, manifestIndex):
        descriptor = None
        intValue = None
        getter = None

        if interrogate_manifest_has_type(manifestIndex):
            typeIndex = interrogate_manifest_get_type(manifestIndex)
            descriptor = self.constructDescriptor(typeIndex)

        definition = interrogate_manifest_definition(manifestIndex)

        # See if this manifest is an int. There are shortcuts if it is.
        # If it does have an int value, there will be no getter, we will
        # just output the value in the generated code
        if interrogate_manifest_has_int_value(manifestIndex):
            intValue = interrogate_manifest_get_int_value(manifestIndex)
        else:
            # See if this manifest has a getter
            if interrogate_manifest_has_getter(manifestIndex):
                getterIndex = interrogate_manifest_getter(manifestIndex)
                getter = self.constructGlobalFunction(getterIndex)

        manifestSpec = FFISpecs.ManifestSpecification()
        manifestSpec.typeDescriptor = descriptor
        manifestSpec.definition = definition
        manifestSpec.intValue = intValue
        manifestSpec.getter = getter
        cppName = interrogate_manifest_name(manifestIndex)
        manifestSpec.name = FFIRename.classNameFromCppName(cppName)
        return manifestSpec
开发者ID:kralf,项目名称:panda3d,代码行数:30,代码来源:FFIInterrogateDatabase.py

示例3: constructGlobal

    def constructGlobal(self, globalIndex, CModuleName):
        # We really do not need the descriptor for the value, just
        # the getter and setter
        # typeIndex = interrogate_element_type(globalIndex)
        # descriptor = self.constructDescriptor(typeIndex)
        
        if interrogate_element_has_getter(globalIndex):
            getterIndex = interrogate_element_getter(globalIndex)
            # If this function is not in this Cmodule just return
            if not self.functionInCModule(getterIndex, CModuleName):
                return None
            getter = self.constructGlobalFunction(getterIndex)
        else:
            getter = None

        if interrogate_element_has_setter(globalIndex):
            setterIndex = interrogate_element_setter(globalIndex)
            # If this function is not in this Cmodule just return
            if not self.functionInCModule(setterIndex, CModuleName):
                return None
            setter = self.constructGlobalFunction(setterIndex)
        else:
            setter = None
        globalSpec = FFISpecs.GlobalValueSpecification()
        globalSpec.getter = getter
        globalSpec.setter = setter
        # globalSpec.typeDescriptor = descriptor
        cppName = interrogate_element_name(globalIndex)
        globalSpec.name = FFIRename.classNameFromCppName(cppName)
        return globalSpec
开发者ID:kralf,项目名称:panda3d,代码行数:30,代码来源:FFIInterrogateDatabase.py

示例4: constructGlobalFunction

 def constructGlobalFunction(self, globalIndex):
     descriptors = self.constructFunctionTypeDescriptors(globalIndex)
     if len(descriptors) == 0:
         return None
     funcSpecs = []
     for descriptor in descriptors:
         funcSpec = FFISpecs.GlobalFunctionSpecification()
         funcSpec.typeDescriptor = descriptor
         funcSpec.name = FFIRename.methodNameFromCppName(funcSpec.typeDescriptor.foreignTypeName)
         funcSpec.index = globalIndex
         funcSpecs.append(funcSpec)
     return funcSpecs
开发者ID:Wilee999,项目名称:TTRInjector,代码行数:12,代码来源:FFIInterrogateDatabase.py

示例5: constructPrimitiveTypeDescriptor

 def constructPrimitiveTypeDescriptor(self, typeIndex):
     if self.isDefinedType(typeIndex):
         return self.typeIndexMap[typeIndex]
     else:
         descriptor = FFITypes.PrimitiveTypeDescriptor()
         # descriptor.environment = self.environment
         descriptor.atomicType = interrogate_type_atomic_token(typeIndex)
         if interrogate_type_has_module_name(typeIndex):
             descriptor.moduleName = "lib" + interrogate_type_module_name(typeIndex)
         descriptor.foreignTypeName = FFIRename.nonClassNameFromCppName(getTypeName(typeIndex))
         descriptor.typeIndex = typeIndex
         self.typeIndexMap[typeIndex] = descriptor
         return descriptor
开发者ID:Wilee999,项目名称:TTRInjector,代码行数:13,代码来源:FFIInterrogateDatabase.py

示例6: constructMemberFunctionSpecifications

 def constructMemberFunctionSpecifications(self, typeIndex):
     funcSpecs = []
     numFuncs = interrogate_type_number_of_methods(typeIndex)
     for i in range(numFuncs):
         funcIndex = interrogate_type_get_method(typeIndex, i)
         typeDescs = self.constructFunctionTypeDescriptors(funcIndex)
         for typeDesc in typeDescs:
             funcSpec = FFISpecs.MethodSpecification()
             funcSpec.name = FFIRename.methodNameFromCppName(
                 interrogate_function_name(funcIndex),
                 getTypeName(typeIndex))
             funcSpec.typeDescriptor = typeDesc
             funcSpec.index = funcIndex
             funcSpecs.append(funcSpec)
     return funcSpecs
开发者ID:kralf,项目名称:panda3d,代码行数:15,代码来源:FFIInterrogateDatabase.py

示例7: constructFunctionArgumentTypes

    def constructFunctionArgumentTypes(self, functionIndex):
        numArgs = interrogate_wrapper_number_of_parameters(functionIndex)
        arguments = []
        for argIndex in range(numArgs):
            if interrogate_wrapper_parameter_has_name(functionIndex, argIndex):
                name = FFIRename.nonClassNameFromCppName(interrogate_wrapper_parameter_name(functionIndex, argIndex))
            else:
                name = "parameter" + ` argIndex `
            descriptor = self.constructDescriptor(interrogate_wrapper_parameter_type(functionIndex, argIndex))

            argSpec = FFISpecs.MethodArgumentSpecification()
            if interrogate_wrapper_parameter_is_this(functionIndex, argIndex):
                argSpec.isThis = 1
            argSpec.name = name
            argSpec.typeDescriptor = descriptor
            arguments.append(argSpec)
        return arguments
开发者ID:Wilee999,项目名称:TTRInjector,代码行数:17,代码来源:FFIInterrogateDatabase.py

示例8: constructConstTypeDescriptor

 def constructConstTypeDescriptor(self, typeIndex):
     if self.isDefinedType(typeIndex):
         return self.typeIndexMap[typeIndex]
     descriptor = FFITypes.ConstTypeDescriptor()
     # descriptor.environment = self.environment
     descriptor.isNested = interrogate_type_is_nested(typeIndex)
     if descriptor.isNested:
         outerTypeIndex = interrogate_type_outer_class(typeIndex)
         descriptor.outerType = self.constructDescriptor(outerTypeIndex)
     if interrogate_type_has_module_name(typeIndex):
         descriptor.moduleName = "lib" + interrogate_type_module_name(typeIndex)
     descriptor.foreignTypeName = FFIRename.nonClassNameFromCppName(getTypeName(typeIndex))
     descriptor.typeIndex = typeIndex
     wrappedTypeIndex = interrogate_type_wrapped_type(typeIndex)
     wrappedTypeDescriptor = self.constructDescriptor(wrappedTypeIndex)
     descriptor.typeDescriptor = wrappedTypeDescriptor
     self.typeIndexMap[typeIndex] = descriptor
     return descriptor
开发者ID:Wilee999,项目名称:TTRInjector,代码行数:18,代码来源:FFIInterrogateDatabase.py

示例9: constructClassTypeDescriptor

    def constructClassTypeDescriptor(self, typeIndex):
        if self.isDefinedType(typeIndex):
            return self.typeIndexMap[typeIndex]
        typeName = FFIRename.classNameFromCppName(getTypeName(typeIndex))
        if typeName == "PyObject":
            # A special case: the PyObject type is really a native
            # Python object, not to be molested--it's not really an
            # FFI class object.
            descriptor = FFITypes.PyObjectTypeDescriptor()
            self.typeIndexMap[typeIndex] = descriptor
            return descriptor
            
        descriptor = FFITypes.ClassTypeDescriptor()
        self.typeIndexMap[typeIndex] = descriptor
        #descriptor.environment = self.environment
        descriptor.foreignTypeName = typeName

        if (typeName == "TypedObject"):
            FFITypes.TypedObjectDescriptor = descriptor
        
        descriptor.isNested = interrogate_type_is_nested(typeIndex)
        if descriptor.isNested:
            outerTypeIndex = interrogate_type_outer_class(typeIndex)
            descriptor.outerType = self.constructDescriptor(outerTypeIndex)
        if interrogate_type_has_module_name(typeIndex):
            descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex)
        if FFIConstants.wantComments:
            if interrogate_type_has_comment(typeIndex):
                descriptor.comment = interrogate_type_comment(typeIndex)
        descriptor.typeIndex = typeIndex
        descriptor.instanceMethods = self.constructMemberFunctionSpecifications(typeIndex)
        descriptor.upcastMethods = self.constructUpcastFunctionSpecifications(typeIndex)
        # Constructing downcasts does not return the functions, it just puts them in the class
        # See the comment in that function
        self.constructDowncastFunctionSpecifications(typeIndex)
        descriptor.filterOutStaticMethods()
        descriptor.constructors = self.constructConstructorSpecifications(typeIndex)
        descriptor.destructor = self.constructDestructorSpecification(typeIndex)
        descriptor.parentTypes = self.constructParentTypeDescriptors(typeIndex)
        descriptor.nestedTypes = self.constructNestedTypeDescriptors(typeIndex)
        return descriptor
开发者ID:kralf,项目名称:panda3d,代码行数:41,代码来源:FFIInterrogateDatabase.py

示例10: constructDowncastFunctionSpecifications

    def constructDowncastFunctionSpecifications(self, typeIndex):
        """
        The strange thing about downcast functions is that they appear in the
        class they are being downcast TO, not downcast FROM. But they should be
        built into the class they are being downcast from. For instance, a method
        downcastToNode(ptrBoundedObject) will appear in Node's list of methods
        but should be compiled into BoundedObject's class
        UPDATE: These are no longer compiled into the from-class. That was
        preventing the libraries from being independent since the from class
        now had knowledge of the to class which is potentially in a library
        downstream. Now these functions are just global functions
        """
        numFuncs = interrogate_type_number_of_derivations(typeIndex)
        for i in range(numFuncs):
            # Make sure this downcast is possible
            if (not interrogate_type_derivation_downcast_is_impossible(typeIndex, i)):
                if interrogate_type_derivation_has_downcast(typeIndex, i):
                    funcIndex = interrogate_type_get_downcast(typeIndex, i)
                    typeDescs = self.constructFunctionTypeDescriptors(funcIndex)
                    for typeDesc in typeDescs:
                        funcSpec = FFISpecs.GlobalFunctionSpecification()
                        funcSpec.name = FFIRename.methodNameFromCppName(
                            interrogate_function_name(funcIndex),
                            getTypeName(typeIndex))
                        funcSpec.typeDescriptor = typeDesc
                        funcSpec.index = funcIndex
                        # Here we look for the class in the first argument
                        fromClass = typeDesc.argumentTypes[0].typeDescriptor.recursiveTypeDescriptor()

                        # Append the from class name on the method to uniquify it now
                        # that these are global methods
                        funcSpec.name = funcSpec.name + 'From' + fromClass.foreignTypeName
                        
                        # Append this funcSpec to that class's downcast methods
                        # fromClass.downcastMethods.append(funcSpec)
                        self.environment.addDowncastFunction(funcSpec)
开发者ID:kralf,项目名称:panda3d,代码行数:36,代码来源:FFIInterrogateDatabase.py


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