當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。