os/graphics/graphicsresourceservices/graphicsresourceinterface/inc/sgresource.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresourceinterface/inc/sgresource.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,110 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Graphics Resource - general inline functions
    1.18 +//
    1.19 +
    1.20 +#ifndef SGRESOURCE_INL
    1.21 +#define SGRESOURCE_INL
    1.22 +
    1.23 +_LIT(KSgResourcePanicCategory, "SGRES");
    1.24 +
    1.25 +inline void Panic(TSgResourcePanicReason aReason)
    1.26 +	{
    1.27 +	User::Panic(KSgResourcePanicCategory, aReason);
    1.28 +	}
    1.29 +
    1.30 +inline TSgAttribute::TSgAttribute()
    1.31 +	{
    1.32 +	}
    1.33 +
    1.34 +inline TSgAttribute::TSgAttribute(TUid aUid, TInt aValue)
    1.35 +	: iUid(aUid), iValue(aValue)
    1.36 +	{
    1.37 +	}
    1.38 +
    1.39 +inline TSgAttributeArrayBase::TSgAttributeArrayBase(TInt aCount)
    1.40 +	: iCount(aCount)
    1.41 +	{
    1.42 +	}
    1.43 +
    1.44 +inline void TSgAttributeArrayBase::operator =(const TSgAttributeArrayBase&)
    1.45 +	{
    1.46 +	}
    1.47 +
    1.48 +inline TInt TSgAttributeArrayBase::Count() const
    1.49 +	{
    1.50 +	return iCount;
    1.51 +	}
    1.52 +
    1.53 +inline TSgAttribute& TSgAttributeArrayBase::operator [](TInt aIndex)
    1.54 +	{
    1.55 +	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < iCount, Panic(ESgPanicBadAttributeArrayIndex));
    1.56 +	return reinterpret_cast<TSgAttribute*>(this + 1)[aIndex];
    1.57 +	}
    1.58 +
    1.59 +inline const TSgAttribute& TSgAttributeArrayBase::operator [](TInt aIndex) const
    1.60 +	{
    1.61 +	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < iCount, Panic(ESgPanicBadAttributeArrayIndex));
    1.62 +	return reinterpret_cast<const TSgAttribute*>(this + 1)[aIndex];
    1.63 +	}
    1.64 +
    1.65 +template<TInt S>
    1.66 +inline TSgAttributeArray<S>::TSgAttributeArray()
    1.67 +	: TSgAttributeArrayBase(S)
    1.68 +	{
    1.69 +	}
    1.70 +
    1.71 +inline TBool TSgDrawableId::operator ==(TSgDrawableId aId) const
    1.72 +	{
    1.73 +	return iId == aId.iId;
    1.74 +	}
    1.75 +
    1.76 +inline TBool TSgDrawableId::operator !=(TSgDrawableId aId) const
    1.77 +	{
    1.78 +	return iId != aId.iId;
    1.79 +	}
    1.80 +
    1.81 +inline RSgDriver::RSgDriver()
    1.82 +	: iImpl(NULL)
    1.83 +	{
    1.84 +	}
    1.85 +
    1.86 +template<class M>
    1.87 +inline TInt RSgDriver::GetInterface(M*& aInterfacePtr) const
    1.88 +	{
    1.89 +	return GetInterface(TUid::Uid(M::EInterfaceUid), (TAny*&)aInterfacePtr);
    1.90 +	}
    1.91 +
    1.92 +inline RSgDrawable::RSgDrawable()
    1.93 +	: iHandleType(KSgDrawableTypeUid), iImpl(NULL)
    1.94 +	{
    1.95 +	}
    1.96 +
    1.97 +inline RSgDrawable::RSgDrawable(TUid aHandleType)
    1.98 +	: iHandleType(aHandleType), iImpl(NULL)
    1.99 +	{
   1.100 +	}
   1.101 +
   1.102 +inline TBool RSgDrawable::IsNull() const
   1.103 +	{
   1.104 +	return !iImpl;
   1.105 +	}
   1.106 +
   1.107 +template<class M>
   1.108 +inline TInt RSgDrawable::GetInterface(M*& aInterfacePtr) const
   1.109 +	{
   1.110 +	return GetInterface(TUid::Uid(M::EInterfaceUid), (TAny*&)aInterfacePtr);
   1.111 +	}
   1.112 +
   1.113 +#endif // SGRESOURCE_INL