sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Graphics Resource - general inline functions sl@0: // sl@0: sl@0: #ifndef SGRESOURCE_INL sl@0: #define SGRESOURCE_INL sl@0: sl@0: _LIT(KSgResourcePanicCategory, "SGRES"); sl@0: sl@0: inline void Panic(TSgResourcePanicReason aReason) sl@0: { sl@0: User::Panic(KSgResourcePanicCategory, aReason); sl@0: } sl@0: sl@0: inline TSgAttribute::TSgAttribute() sl@0: { sl@0: } sl@0: sl@0: inline TSgAttribute::TSgAttribute(TUid aUid, TInt aValue) sl@0: : iUid(aUid), iValue(aValue) sl@0: { sl@0: } sl@0: sl@0: inline TSgAttributeArrayBase::TSgAttributeArrayBase(TInt aCount) sl@0: : iCount(aCount) sl@0: { sl@0: } sl@0: sl@0: inline void TSgAttributeArrayBase::operator =(const TSgAttributeArrayBase&) sl@0: { sl@0: } sl@0: sl@0: inline TInt TSgAttributeArrayBase::Count() const sl@0: { sl@0: return iCount; sl@0: } sl@0: sl@0: inline TSgAttribute& TSgAttributeArrayBase::operator [](TInt aIndex) sl@0: { sl@0: __ASSERT_ALWAYS(aIndex >= 0 && aIndex < iCount, Panic(ESgPanicBadAttributeArrayIndex)); sl@0: return reinterpret_cast(this + 1)[aIndex]; sl@0: } sl@0: sl@0: inline const TSgAttribute& TSgAttributeArrayBase::operator [](TInt aIndex) const sl@0: { sl@0: __ASSERT_ALWAYS(aIndex >= 0 && aIndex < iCount, Panic(ESgPanicBadAttributeArrayIndex)); sl@0: return reinterpret_cast(this + 1)[aIndex]; sl@0: } sl@0: sl@0: template sl@0: inline TSgAttributeArray::TSgAttributeArray() sl@0: : TSgAttributeArrayBase(S) sl@0: { sl@0: } sl@0: sl@0: inline TBool TSgDrawableId::operator ==(TSgDrawableId aId) const sl@0: { sl@0: return iId == aId.iId; sl@0: } sl@0: sl@0: inline TBool TSgDrawableId::operator !=(TSgDrawableId aId) const sl@0: { sl@0: return iId != aId.iId; sl@0: } sl@0: sl@0: inline RSgDriver::RSgDriver() sl@0: : iImpl(NULL) sl@0: { sl@0: } sl@0: sl@0: template sl@0: inline TInt RSgDriver::GetInterface(M*& aInterfacePtr) const sl@0: { sl@0: return GetInterface(TUid::Uid(M::EInterfaceUid), (TAny*&)aInterfacePtr); sl@0: } sl@0: sl@0: inline RSgDrawable::RSgDrawable() sl@0: : iHandleType(KSgDrawableTypeUid), iImpl(NULL) sl@0: { sl@0: } sl@0: sl@0: inline RSgDrawable::RSgDrawable(TUid aHandleType) sl@0: : iHandleType(aHandleType), iImpl(NULL) sl@0: { sl@0: } sl@0: sl@0: inline TBool RSgDrawable::IsNull() const sl@0: { sl@0: return !iImpl; sl@0: } sl@0: sl@0: template sl@0: inline TInt RSgDrawable::GetInterface(M*& aInterfacePtr) const sl@0: { sl@0: return GetInterface(TUid::Uid(M::EInterfaceUid), (TAny*&)aInterfacePtr); sl@0: } sl@0: sl@0: #endif // SGRESOURCE_INL