Ejemplo n.º 1
0
 def __test_trivial( self, source, target ):
     if not ( source and target ):
         return False
     if is_same( source, target ):
         return True #X => X
     if is_const( target ) and is_same( source, target.base ):
         return True #X => const X
     if is_reference( target ) and is_same( source, target.base ):
         return True #X => X&
     if is_reference( target ) and is_const( target.base ) and is_same( source, target.base.base ):
         return True #X => const X&
     if is_same( target, cpptypes.pointer_t( cpptypes.void_t() ) ):
         if is_integral( source ) or is_enum( source ):
             return False
         else:
             return True #X => void*
     if is_pointer( source ) and is_pointer( target ):
         if is_const( target.base ) and is_same( source.base, target.base.base ):
             return True#X* => const X*
     if is_reference( source ) and is_reference( target ):
         if is_const( target.base ) and is_same( source.base, target.base.base ):
             return True#X& => const X&
     if not is_const( source ) and is_array( source ) and is_pointer( target ):
         if is_same( base_type(source), target.base ):
             return True#X[2] => X*
     if is_array( source ) and is_pointer( target ) and is_const( target.base ):
         if is_same( base_type(source), target.base.base ):
             return True
Ejemplo n.º 2
0
 def __test_trivial( self, source, target ):
     if not ( source and target ):
         return False
     if is_same( source, target ):
         return True #X => X
     if is_const( target ) and is_same( source, target.base ):
         return True #X => const X
     if is_reference( target ) and is_same( source, target.base ):
         return True #X => X&
     if is_reference( target ) and is_const( target.base ) and is_same( source, target.base.base ):
         return True #X => const X&
     if is_same( target, cpptypes.pointer_t( cpptypes.void_t() ) ):
         if is_integral( source ) or is_enum( source ):
             return False
         else:
             return True #X => void*
     if is_pointer( source ) and is_pointer( target ):
         if is_const( target.base ) and is_same( source.base, target.base.base ):
             return True#X* => const X*
     if is_reference( source ) and is_reference( target ):
         if is_const( target.base ) and is_same( source.base, target.base.base ):
             return True#X& => const X&
     if not is_const( source ) and is_array( source ) and is_pointer( target ):
         if is_same( base_type(source), target.base ):
             return True#X[2] => X*
     if is_array( source ) and is_pointer( target ) and is_const( target.base ):
         if is_same( base_type(source), target.base.base ):
             return True
Ejemplo n.º 3
0
def is_void_pointer( type ):
    """returns True, if type represents `void*`, False otherwise"""
    return is_same( type, cpptypes.pointer_t( cpptypes.void_t() ) )
Ejemplo n.º 4
0
def is_void( type ):
    """returns True, if type represents `void`, False otherwise"""
    return remove_alias( type ) in create_cv_types( cpptypes.void_t() )
Ejemplo n.º 5
0
def is_void_pointer( type ):
    """returns True, if type represents `void*`, False otherwise"""
    return is_same( type, cpptypes.pointer_t( cpptypes.void_t() ) )
Ejemplo n.º 6
0
def is_void( type ):
    """returns True, if type represents `void`, False otherwise"""
    return remove_alias( type ) in create_cv_types( cpptypes.void_t() )