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


Python declarations.remove_alias函数代码示例

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


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

示例1: set_call_policies_pointee

def set_call_policies_pointee( mb ):
    # Set the default policy to deal with pointer/reference return types to reference_existing object
    # as this is the ogrenewt Default.
    ## NOTE AJM 1/1/07 -- this function not used as change to ref_existing_object..
    from pyplusplus import module_creator
    mem_funs = mb.calldefs ()
    mem_funs.create_with_signature = True 
    #MSVC 7.1 if function has throw modifier.
    resolver = module_creator.built_in_resolver_t()
    for mem_fun in mem_funs:
        if mem_fun.call_policies:
            continue
        decl_call_policies = resolver( mem_fun )
        if decl_call_policies:
            mem_fun.call_policies = decl_call_policies
            continue
        rtype = declarations.remove_alias( mem_fun.return_type )
        if declarations.is_pointer(rtype) or declarations.is_reference(rtype):
#             mem_fun.call_policies \
#                 = call_policies.return_value_policy( call_policies.reference_existing_object )
            mem_fun.call_policies \
               = call_policies.return_value_policy( '::boost::python::return_pointee_value' )
               
    ## now we fix a problem where the getSingleton policy isn't right               
    mb.mem_funs( 'getSingleton' ).call_policies = call_policies.return_value_policy(
                call_policies.reference_existing_object )
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:26,代码来源:generate_code.py

示例2: _update_containers_db

    def _update_containers_db( self, type_ ):
        #will return True is type was treated
        type_ = declarations.remove_alias( type_ )
        type_ = declarations.remove_pointer( type_ )
        type_ = declarations.remove_reference( type_ )
        type_ = declarations.remove_cv( type_ )
        type_ = declarations.remove_declarated( type_ )

        class_traits = declarations.class_traits
        class_declaration_traits = declarations.class_declaration_traits
        if not class_traits.is_my_case( type_ ) and not class_declaration_traits.is_my_case( type_ ):
            return False

        if class_traits.is_my_case( type_ ):
            container_cls = class_traits.get_declaration( type_ )
        else:
            container_cls = class_declaration_traits.get_declaration( type_ )

        if None is container_cls.indexing_suite:
            return False

        try:
            #check extraction of element type from container
            container_cls.indexing_suite.element_type
        except RuntimeError:
            decls_logger = _logging_.loggers.declarations
            if not messages.filter_disabled_msgs([messages.W1042], container_cls.disabled_messages ):
                return #user disabled property warning
            decls_logger.warn( "%s;%s" % ( container_cls, messages.W1042 ) )
        self.__containers.add( container_cls )
        return True
开发者ID:CTrauma,项目名称:pypp11,代码行数:31,代码来源:types_database.py

示例3: call_traits

def call_traits( type_ ):
    """http://boost.org/libs/utility/call_traits.htm"""
    type_ = declarations.remove_alias( type_ )
    if is_immutable( type_ ):
        return "%(arg)s" #pass by value
    elif declarations.is_reference( type_ ):
        no_ref = declarations.remove_reference( type_ )
        if is_immutable( no_ref ):
            return "%(arg)s" #pass by value
        else:
            return "boost::ref(%(arg)s)" #pass by ref
    elif declarations.is_pointer( type_ ) \
         and not is_immutable( type_.base ) \
         and not declarations.is_pointer( type_.base ):
        base = type_.base
        while hasattr(base, 'base'):
            base = base.base
        if hasattr(base.declaration, 'custom_call_trait'):
            custom_call_trait = base.declaration.custom_call_trait
            call_trait = custom_call_trait(type_) if custom_call_trait else None
            if call_trait:
                return call_trait
        return "boost::python::ptr(%(arg)s)" #pass by ptr
    else:
        return "%(arg)s" #pass by value
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:25,代码来源:python_traits.py

示例4: keywords_args

 def keywords_args(self):
     if not self.__args:
         return ""
     boost_arg = self.__id_creator("::boost::python::arg")
     boost_obj = self.__id_creator("::boost::python::object")
     result = ["( "]
     for arg in self.__args:
         if 1 < len(result):
             result.append(self.PARAM_SEPARATOR)
         result.append(boost_arg)
         result.append('("%s")' % arg.name)
         if self.__decl.use_default_arguments and arg.default_value:
             if not declarations.is_pointer(arg.type) or arg.default_value != "0":
                 arg_type_no_alias = declarations.remove_alias(arg.type)
                 if (
                     declarations.is_fundamental(arg_type_no_alias)
                     and declarations.is_integral(arg_type_no_alias)
                     and not arg.default_value.startswith(arg_type_no_alias.decl_string)
                 ):
                     result.append("=(%s)(%s)" % (arg_type_no_alias.partial_decl_string, arg.default_value))
                 elif self.__should_use_enum_wa(arg):
                     # Work around for bug/missing functionality in boost.python.
                     # registration order
                     result.append("=(long)(%s)" % arg.default_value)
                 else:
                     result.append("=%s" % arg.default_value)
             else:
                 result.append("=%s()" % boost_obj)
     result.append(" )")
     return "".join(result)
开发者ID:rhinton,项目名称:tce,代码行数:30,代码来源:calldef_utils.py

示例5: _exportable_impl

    def _exportable_impl( self ):
        if not self.name:
            return messages.W1033
        if self.bits == 0 and self.name == "":
            return messages.W1034
        if declarations.is_array( self.type ) and declarations.array_size( self.type ) < 1:
            return messages.W1045
        type_ = declarations.remove_alias( self.type )
        type_ = declarations.remove_const( type_ )
        if declarations.is_pointer( type_ ):
            if self.type_qualifiers.has_static:
                return messages.W1035
            if python_traits.is_immutable( type_.base ):
                return messages.W1036

            units = declarations.decompose_type( type_ )
            ptr2functions = filter( lambda unit: isinstance( unit, declarations.calldef_type_t )
                                    , units )
            if ptr2functions:
                return messages.W1037
        type_ = declarations.remove_pointer( type_ )
        if declarations.class_traits.is_my_case( type_ ):
            cls = declarations.class_traits.get_declaration( type_ )
            if not cls.name:
                return messages.W1038
        if isinstance( self.parent, declarations.class_t ):
            if self.access_type != declarations.ACCESS_TYPES.PUBLIC:
                return messages.W1039
        return ''
开发者ID:alekob,项目名称:tce,代码行数:29,代码来源:variable_wrapper.py

示例6: bind_aliases

def bind_aliases(decls):
    """
    This function binds between class and it's typedefs.

    :param decls: list of all declarations
    :type all_classes: list of :class:`declarations.declaration_t` items

    :rtype: None

    """

    visited = set()
    typedefs = [
        decl for decl in decls if isinstance(decl, declarations.typedef_t)]
    for decl in typedefs:
        type_ = declarations.remove_alias(decl.type)
        if not isinstance(type_, declarations.declarated_t):
            continue
        cls_inst = type_.declaration
        if not isinstance(cls_inst, declarations.class_types):
            continue
        if id(cls_inst) not in visited:
            visited.add(id(cls_inst))
            del cls_inst.aliases[:]
        cls_inst.aliases.append(decl)
开发者ID:iMichka,项目名称:pygccxml,代码行数:25,代码来源:source_reader.py

示例7: _resolve_by_type

 def _resolve_by_type( self, some_type ):
     temp_type = declarations.remove_alias( some_type )
     temp_type = declarations.remove_cv( temp_type )
     if isinstance( temp_type, declarations.fundamental_t ) \
        or isinstance( temp_type, declarations.declarated_t ):
         return decl_wrappers.default_call_policies()
     if declarations.is_same( some_type, self.__const_char_pointer ):
         return decl_wrappers.default_call_policies()
     return None
开发者ID:alekob,项目名称:tce,代码行数:9,代码来源:call_policies_resolver.py

示例8: find_out_depend_on_declaration

 def find_out_depend_on_declaration( self ):
     """if declaration depends on other declaration and not on some type
        this function will return reference to it. Otherwise None will be returned
     """
     #prevent recursive import
     from pygccxml import declarations
     
     if isinstance( self.depend_on_it, declarations.declaration_t ):
         return self.depend_on_it
     base_type = declarations.base_type( declarations.remove_alias( self.depend_on_it ) )
     if isinstance( base_type, cpptypes.declarated_t ):
         return base_type.declaration
     return None
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:13,代码来源:dependencies.py

示例9: __call__

    def __call__( self, calldef, hint=None ):
        if not isinstance( calldef, declarations.calldef_t ):
            return None

        if isinstance( calldef, declarations.constructor_t ):
            return None
        return_type = declarations.remove_alias( calldef.return_type )
        void_ptr = declarations.pointer_t( declarations.void_t() )
        const_void_ptr = declarations.pointer_t( declarations.const_t( declarations.void_t() ) )
        if declarations.is_same( return_type, void_ptr ) \
           or declarations.is_same( return_type, const_void_ptr ):
            return decl_wrappers.return_value_policy( decl_wrappers.return_opaque_pointer )
        return None
开发者ID:alekob,项目名称:tce,代码行数:13,代码来源:call_policies_resolver.py

示例10: __should_be_exposed_by_address_only

 def __should_be_exposed_by_address_only(self):
     type_ = declarations.remove_alias( self.type )
     type_ = declarations.remove_const( type_ )
     type_ = declarations.remove_pointer( type_ )
     if not declarations.class_traits.is_my_case( type_ ):
         return False
     cls = declarations.class_traits.get_declaration( type_ )
     if cls.class_type == declarations.CLASS_TYPES.UNION:
         return True
     elif not cls.name:
         return True
     else:
         return False
开发者ID:CTrauma,项目名称:pypp11,代码行数:13,代码来源:variable_wrapper.py

示例11: _get_alias

 def _get_alias(self):
     if not self._alias or self.name == super(casting_operator_t, self)._get_alias():
         return_type = declarations.remove_alias(self.return_type)
         decl_string = return_type.decl_string
         for type_, alias in self.SPECIAL_CASES.items():
             if isinstance(type_, declarations.type_t):
                 if declarations.is_same(return_type, type_):
                     self._alias = alias
                     break
             else:
                 if decl_string == type_:
                     self._alias = alias
                     break
         else:
             self._alias = "as_" + self._generate_valid_name(self.return_type.decl_string)
     return self._alias
开发者ID:ISoirar,项目名称:pypp11,代码行数:16,代码来源:calldef_wrapper.py

示例12: __format_type_as_undecorated

    def __format_type_as_undecorated( self, type_, is_argument, hint ):
        result = []
        type_ = declarations.remove_alias( type_ )
        if declarations.is_array( type_ ):
            result.append( declarations.array_item_type( type_ ).decl_string )
            result.append( '*' )
            if is_argument:
                result.append( 'const' )
        else:
            result.append( self.__remove_leading_scope( type_.decl_string ) )

        result = ' '.join( result )
        if hint == 'nm':
            for x in ( '*', '&' ):
                result = result.replace( ' ' + x, x )
        return result
开发者ID:Noitidart,项目名称:osxtypes,代码行数:16,代码来源:undname.py

示例13: call_traits

def call_traits( type_ ):
    """http://boost.org/libs/utility/call_traits.htm"""
    type_ = declarations.remove_alias( type_ )
    if is_immutable( type_ ):
        return "%s" #pass by value
    elif declarations.is_reference( type_ ):
        no_ref = declarations.remove_reference( type_ )
        if is_immutable( no_ref ):
            return "%s" #pass by value
        else:
            return "boost::ref(%s)" #pass by ref
    elif declarations.is_pointer( type_ ) \
         and not is_immutable( type_.base ) \
         and not declarations.is_pointer( type_.base ):
        return "boost::python::ptr(%s)" #pass by ptr
    else:
        return "%s" #pass by value
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:17,代码来源:python_traits.py

示例14: dig_declarations

    def dig_declarations( depend_on_it ):
        #prevent recursive import
        from pygccxml import declarations

        if isinstance( depend_on_it, declarations.declaration_t ):
            return [depend_on_it]
        base_type = declarations.base_type( declarations.remove_alias( depend_on_it ) )
        if isinstance( base_type, cpptypes.declarated_t ):
            return [base_type.declaration]
        elif isinstance( base_type, cpptypes.calldef_type_t ):
            result = []
            result.extend( impl_details.dig_declarations( base_type.return_type ) )
            for argtype in base_type.arguments_types:
                result.extend( impl_details.dig_declarations( argtype ) )
            if isinstance( base_type, cpptypes.member_function_type_t ):
                result.extend( impl_details.dig_declarations( base_type.class_inst ) )
            return result
        return []
开发者ID:Noitidart,项目名称:osxtypes,代码行数:18,代码来源:dependencies.py

示例15: _exportable_impl

    def _exportable_impl( self ):
        if not self.parent.name and self.is_wrapper_needed():
            #return messages.W1057 % str( self )
            return messages.W1058 % str( self )
        if not self.name:
            return messages.W1033
        if self.bits == 0 and self.name == "":
            return messages.W1034
        if not self.expose_address:
            if declarations.is_array( self.type ) and declarations.array_size( self.type ) < 1:
                return messages.W1045
        type_ = declarations.remove_alias( self.type )
        type_ = declarations.remove_const( type_ )
        if declarations.is_pointer( type_ ):
            if not self.expose_address and self.type_qualifiers.has_static:
                return messages.W1035
            if not self.expose_address and python_traits.is_immutable( type_.base ):
                return messages.W1036

            units = declarations.decompose_type( type_ )
            ptr2functions = filter( lambda unit: isinstance( unit, declarations.calldef_type_t )
                                    , units )
            if ptr2functions:
                return messages.W1037
        type_ = declarations.remove_pointer( type_ )
        if declarations.class_traits.is_my_case( type_ ):
            cls = declarations.class_traits.get_declaration( type_ )
            if not cls.name:
                return messages.W1038
            #if cls.class_type == declarations.CLASS_TYPES.UNION:
            #    return messages.W1061 % ( str( self ), str( cls ) )
        if isinstance( self.parent, declarations.class_t ):
            if self.access_type != declarations.ACCESS_TYPES.PUBLIC:
                return messages.W1039
        if declarations.is_array( type_ ):
            item_type = declarations.array_item_type( type_ )
            if declarations.is_pointer( item_type ):
                item_type_no_ptr = declarations.remove_pointer( item_type )
                if python_traits.is_immutable( item_type_no_ptr ):
                    return messages.W1056
        return ''
开发者ID:CTrauma,项目名称:pypp11,代码行数:41,代码来源:variable_wrapper.py


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