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


Python FFIRename.classNameFromCppName方法代码示例

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


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

示例1: constructEnumTypeDescriptor

# 需要导入模块: import FFIRename [as 别名]
# 或者: from FFIRename import classNameFromCppName [as 别名]
    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,代码行数:33,代码来源:FFIInterrogateDatabase.py

示例2: constructManifest

# 需要导入模块: import FFIRename [as 别名]
# 或者: from FFIRename import classNameFromCppName [as 别名]
    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,代码行数:32,代码来源:FFIInterrogateDatabase.py

示例3: constructGlobal

# 需要导入模块: import FFIRename [as 别名]
# 或者: from FFIRename import classNameFromCppName [as 别名]
    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,代码行数:32,代码来源:FFIInterrogateDatabase.py

示例4: constructClassTypeDescriptor

# 需要导入模块: import FFIRename [as 别名]
# 或者: from FFIRename import classNameFromCppName [as 别名]
    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,代码行数:43,代码来源:FFIInterrogateDatabase.py


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