os/graphics/graphicsresourceservices/graphicsresourceinterface/inc/sgresource.inl
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Graphics Resource - general inline functions
    15 //
    16 
    17 #ifndef SGRESOURCE_INL
    18 #define SGRESOURCE_INL
    19 
    20 _LIT(KSgResourcePanicCategory, "SGRES");
    21 
    22 inline void Panic(TSgResourcePanicReason aReason)
    23 	{
    24 	User::Panic(KSgResourcePanicCategory, aReason);
    25 	}
    26 
    27 inline TSgAttribute::TSgAttribute()
    28 	{
    29 	}
    30 
    31 inline TSgAttribute::TSgAttribute(TUid aUid, TInt aValue)
    32 	: iUid(aUid), iValue(aValue)
    33 	{
    34 	}
    35 
    36 inline TSgAttributeArrayBase::TSgAttributeArrayBase(TInt aCount)
    37 	: iCount(aCount)
    38 	{
    39 	}
    40 
    41 inline void TSgAttributeArrayBase::operator =(const TSgAttributeArrayBase&)
    42 	{
    43 	}
    44 
    45 inline TInt TSgAttributeArrayBase::Count() const
    46 	{
    47 	return iCount;
    48 	}
    49 
    50 inline TSgAttribute& TSgAttributeArrayBase::operator [](TInt aIndex)
    51 	{
    52 	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < iCount, Panic(ESgPanicBadAttributeArrayIndex));
    53 	return reinterpret_cast<TSgAttribute*>(this + 1)[aIndex];
    54 	}
    55 
    56 inline const TSgAttribute& TSgAttributeArrayBase::operator [](TInt aIndex) const
    57 	{
    58 	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < iCount, Panic(ESgPanicBadAttributeArrayIndex));
    59 	return reinterpret_cast<const TSgAttribute*>(this + 1)[aIndex];
    60 	}
    61 
    62 template<TInt S>
    63 inline TSgAttributeArray<S>::TSgAttributeArray()
    64 	: TSgAttributeArrayBase(S)
    65 	{
    66 	}
    67 
    68 inline TBool TSgDrawableId::operator ==(TSgDrawableId aId) const
    69 	{
    70 	return iId == aId.iId;
    71 	}
    72 
    73 inline TBool TSgDrawableId::operator !=(TSgDrawableId aId) const
    74 	{
    75 	return iId != aId.iId;
    76 	}
    77 
    78 inline RSgDriver::RSgDriver()
    79 	: iImpl(NULL)
    80 	{
    81 	}
    82 
    83 template<class M>
    84 inline TInt RSgDriver::GetInterface(M*& aInterfacePtr) const
    85 	{
    86 	return GetInterface(TUid::Uid(M::EInterfaceUid), (TAny*&)aInterfacePtr);
    87 	}
    88 
    89 inline RSgDrawable::RSgDrawable()
    90 	: iHandleType(KSgDrawableTypeUid), iImpl(NULL)
    91 	{
    92 	}
    93 
    94 inline RSgDrawable::RSgDrawable(TUid aHandleType)
    95 	: iHandleType(aHandleType), iImpl(NULL)
    96 	{
    97 	}
    98 
    99 inline TBool RSgDrawable::IsNull() const
   100 	{
   101 	return !iImpl;
   102 	}
   103 
   104 template<class M>
   105 inline TInt RSgDrawable::GetInterface(M*& aInterfacePtr) const
   106 	{
   107 	return GetInterface(TUid::Uid(M::EInterfaceUid), (TAny*&)aInterfacePtr);
   108 	}
   109 
   110 #endif // SGRESOURCE_INL