コード例 #1
0
 def is_related( t1, t2 ):
     """Check whether two types\\classes t1 and t2 could introduce the problem"""
     
     if declarations.is_pointer( t1 ) and declarations.is_pointer( t2 ):
         return registration_order.is_related( declarations.remove_pointer( t1 )
                                               , declarations.remove_pointer( t2 ) )
     elif declarations.is_pointer( t1 ) and not declarations.is_pointer( t2 ):
         t1 = declarations.remove_cv( declarations.remove_pointer( t1 ) )
         t2 = declarations.remove_cv( t2 )
         if declarations.is_same( t1, t2 ):
             return 1
     elif not declarations.is_pointer( t1 ) and declarations.is_pointer( t2 ):
         t1 = declarations.remove_cv( t1 )
         t2 = declarations.remove_cv( declarations.remove_pointer( t2 ) )
         if declarations.is_same( t1, t2 ):
             return -1
     else: #not is_pointer( t1 ) and not is_pointer( t2 ):     
         if declarations.is_integral( t1 ) and not declarations.is_bool( t1 ) \
            and declarations.is_bool( t2 ):
             return -1
         elif declarations.is_bool( t1 ) \
              and declarations.is_integral( t2 ) and not declarations.is_bool( t2 ):
             return 1
         else:
             pass
     return None
コード例 #2
0
ファイル: algorithm.py プロジェクト: laxris/pyplusplus
    def is_related(t1, t2):
        """Check whether two types\\classes t1 and t2 could introduce the problem"""

        if declarations.is_pointer(t1) and declarations.is_pointer(t2):
            return registration_order.is_related(
                declarations.remove_pointer(t1),
                declarations.remove_pointer(t2))
        elif declarations.is_pointer(t1) and not declarations.is_pointer(t2):
            t1 = declarations.remove_cv(declarations.remove_pointer(t1))
            t2 = declarations.remove_cv(t2)
            if declarations.is_same(t1, t2):
                return 1
        elif not declarations.is_pointer(t1) and declarations.is_pointer(t2):
            t1 = declarations.remove_cv(t1)
            t2 = declarations.remove_cv(declarations.remove_pointer(t2))
            if declarations.is_same(t1, t2):
                return -1
        else:  #not is_pointer( t1 ) and not is_pointer( t2 ):
            if declarations.is_integral( t1 ) and not declarations.is_bool( t1 ) \
               and declarations.is_bool( t2 ):
                return -1
            elif declarations.is_bool( t1 ) \
                 and declarations.is_integral( t2 ) and not declarations.is_bool( t2 ):
                return 1
            else:
                pass
        return None