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


Python class_declaration.class_t方法代码示例

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


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

示例1: scan_types

# 需要导入模块: from pygccxml.declarations import class_declaration [as 别名]
# 或者: from pygccxml.declarations.class_declaration import class_t [as 别名]
def scan_types(self):
        self._stage = 'scan types'
        self._registered_classes = {} # class_t -> CppClass
        self._scan_namespace_types(self.module, self.module_namespace, pygen_register_function_name="register_types")
        self._types_scanned = True 
开发者ID:KTH,项目名称:royal-chaos,代码行数:7,代码来源:gccxmlparser.py

示例2: _apply_class_annotations

# 需要导入模块: from pygccxml.declarations import class_declaration [as 别名]
# 或者: from pygccxml.declarations.class_declaration import class_t [as 别名]
def _apply_class_annotations(self, cls, annotations, kwargs):
        is_exception = False
        for name, value in annotations.items():
            if name == 'allow_subclassing':
                kwargs.setdefault('allow_subclassing', annotations_scanner.parse_boolean(value))
            elif name == 'is_singleton':
                kwargs.setdefault('is_singleton', annotations_scanner.parse_boolean(value))
            elif name == 'incref_method':
                kwargs.setdefault('memory_policy', ReferenceCountingMethodsPolicy(
                        incref_method=value, decref_method=annotations.get('decref_method', None),
                        peekref_method=annotations.get('peekref_method', None)))
            elif name == 'decref_method':
                pass
            elif name == 'peekref_method':
                pass
            elif name == 'automatic_type_narrowing':
                kwargs.setdefault('automatic_type_narrowing', annotations_scanner.parse_boolean(value))
            elif name == 'free_function':
                kwargs.setdefault('memory_policy', FreeFunctionPolicy(value))
            elif name == 'incref_function':
                kwargs.setdefault('memory_policy', ReferenceCountingFunctionsPolicy(
                        incref_function=value, decref_function=annotations.get('decref_function', None)))
            elif name == 'decref_function':
                pass
            elif name == 'python_name':
                kwargs.setdefault('custom_name', value)
                warnings.warn_explicit("Class annotation 'python_name' is deprecated in favour of 'custom_name'",
                                       AnnotationsWarning, cls.location.file_name, cls.location.line)
            elif name == 'custom_name':
                kwargs.setdefault('custom_name', value)
            elif name == 'pygen_comment':
                pass
            elif name == 'exception':
                is_exception = True
            elif name == 'import_from_module':
                kwargs.setdefault('import_from_module', value)
            else:
                warnings.warn_explicit("Class annotation %r ignored" % name,
                                       AnnotationsWarning, cls.location.file_name, cls.location.line)
        if isinstance(cls, class_t):
            if self._class_has_virtual_methods(cls) and not cls.bases:
                kwargs.setdefault('allow_subclassing', True)

            #if not self._has_public_destructor(cls):
            #    kwargs.setdefault('is_singleton', True)
            #    #print >> sys.stderr, "##### class %s has no public destructor" % cls.decl_string

            des = self._get_destructor_visibility(cls)
            #print >> sys.stderr, "##### class %s destructor is %s" % (cls.decl_string, des)
            if des != 'public':
                kwargs.setdefault('destructor_visibility', des)

        return is_exception 
开发者ID:KTH,项目名称:royal-chaos,代码行数:55,代码来源:gccxmlparser.py


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