Exemple #1
0
    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 ''
Exemple #2
0
    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 ''
Exemple #3
0
    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 ''
Exemple #4
0
    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 ''
Exemple #5
0
def return_range(function, get_size_class, value_policies=None):
    """create `Py++` defined return_range call policies code generator"""
    r_type = function.return_type
    if not declarations.is_pointer(r_type):
        raise TypeError('Function "%s" return type should be pointer, got "%s"' % r_type.decl_string)

    value_type = declarations.remove_pointer(r_type)
    if None is value_policies:
        if python_traits.is_immutable(value_type):
            value_policies = default_call_policies()
        else:
            raise RuntimeError("return_range call policies requieres specification of value_policies")
    return return_range_t(get_size_class, value_type, value_policies)
Exemple #6
0
def return_range(function, get_size_class, value_policies=None):
    """create Py++ defined return_range call policies code generator"""
    r_type = function.return_type
    if not declarations.is_pointer(r_type):
        raise TypeError(
            'Function "%s" return type should be pointer, got "%s"' %
            r_type.decl_string)

    value_type = declarations.remove_pointer(r_type)
    if None is value_policies:
        if python_traits.is_immutable(value_type):
            value_policies = default_call_policies()
        else:
            raise RuntimeError(
                "return_range call policies requieres specification of value_policies"
            )
    return return_range_t(get_size_class, value_type, value_policies)
 def _get_no_proxy( self ):
     if self.__no_proxy is None:
         self.__no_proxy = python_traits.is_immutable( self.element_type )
     return self.__no_proxy
Exemple #8
0
 def _get_no_proxy(self):
     if self.__no_proxy is None:
         self.__no_proxy = python_traits.is_immutable(self.element_type)
     return self.__no_proxy