Пример #1
0
Match
Argument::
isConvertibleTo(const Argument& target) const
{
    static const Type* valueType = reflect::type<Value>();

    if (*this == target) return Match::Exact;

    if ((type() == valueType) ^ (target.type() == valueType))
        return Match::Exact;

    bool isExact = false;

    if (type()->hasConverter(target.type())) {
        if (target.refType() != RefType::LValue) return Match::Partial;
        return Match::None;
    }

    if (target.refType() != RefType::Copy) {
        if (!testConstConversion(isConst(), target.isConst()))
            return Match::None;
    }
    else isExact = refType() == RefType::RValue;

    if (target.refType() == RefType::LValue) {
        if (target.isConst()) {}
        else if (isConst()) return Match::None;
        else if (refType() != RefType::LValue) return Match::None;
    }

    else if (target.refType() == RefType::RValue) {
        if (refType() != RefType::RValue) return Match::None;
    }

    if (!target.type()->isParentOf(type())) return Match::None;

    if (isExact) return Match::Exact;
    if (isConst() == target.isConst() && refType() == target.refType())
        return Match::Exact;

    return Match::Partial;
}
Пример #2
0
	//--------------------------------------------------------------------------------
	CDeferWindowPos::refType CDeferWindowPos::FromHandle( CDeferWindowPosHandle::refType hDWP )
	{
		_WINQ_SFCONTEXT( "CDeferWindowPos::FromHandle" );
		CDeferWindowPos* pDWP = 0;
		bool bOwningRef = false;
		__QOR_PROTECT
		{
			pDWP = hDWP->Object< CDeferWindowPos >();
			if( pDWP == 0 && p_tDeferWindowPosHandleMap != 0 )
			{
				pDWP = p_tDeferWindowPosHandleMap->FindHandle( hDWP );
			}
			if( pDWP == 0 )
			{
				pDWP = new CDeferWindowPos( hDWP );
				bOwningRef = true;
			}
		}__QOR_ENDPROTECT

		return refType( pDWP, bOwningRef );
	}
Пример #3
0
	//--------------------------------------------------------------------------------
	CImageList::refType CImageList::FromHandle( CImageListHandle::refType hImageList )
	{
		_WINQ_SFCONTEXT( "CImageList::FromHandle" );
		CImageList* pImageList = 0;
		bool bOwningRef = false;
		__QOR_PROTECT
		{
			pImageList = hImageList->Object< CImageList >();

			if( pImageList == 0 && p_tImageListHandleMap != 0 )
			{
				pImageList = p_tImageListHandleMap->FindHandle( hImageList );
			}

			if( pImageList == 0 )
			{
				pImageList = new CImageList( hImageList );
				bOwningRef = true;
			}
		}__QOR_ENDPROTECT
		return refType( pImageList, bOwningRef );
	}
Пример #4
0
	//--------------------------------------------------------------------------------
	CImageList::refType CImageList::Read( void* pstm )
	{
		_WINQ_SFCONTEXT( "CImageList::Read" );
		return refType( new CImageList( pstm ), true );
	}
Пример #5
0
	//--------------------------------------------------------------------------------
	CImageList::refType CImageList::Merger( CImageList& Im1, int i1, CImageList& Im2, int i2, int dx, int dy )
	{
		_WINQ_SFCONTEXT( "CImageList:Merger" );
		return refType( new CImageList( Im1, i1, Im2, i2, dx, dy ), true );
	}
Пример #6
0
	//--------------------------------------------------------------------------------
	CImageList::refType CImageList::Load( InstanceHandle hi, const TCHAR* lpbmp, int cx, int cGrow, unsigned long crMask, unsigned int uType, unsigned int uFlags )
	{
		_WINQ_SFCONTEXT( "CImageList::Load" );
		return refType( new CImageList( hi, lpbmp, cx, cGrow, crMask, uType, uFlags ), true );
	}
Пример #7
0
	//--------------------------------------------------------------------------------
	CImageList::refType CImageList::Create( int cx, int cy, unsigned int uiFlags, int cInitial, int cGrow )
	{
		_WINQ_SFCONTEXT( "CImageList::Create" );
		return refType( new CImageList( cx, cy, uiFlags, cInitial, cGrow ), true );
	}
Пример #8
0
	//--------------------------------------------------------------------------------
	CConsoleScreenBuffer::refType CConsoleScreenBuffer::Ref( void )
	{
		_WINQ_FCONTEXT( "CConsoleScreenBuffer::Ref" );
		return refType( this, false );
	}