本文整理汇总了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
示例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