diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/cstack.inl --- a/epoc32/include/cstack.inl Wed Mar 31 12:27:01 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef __CSTACK_INL__ -#define __CSTACK_INL__ - -// constants -const TInt KStackGranularity=32; - -enum TCStackPanic - { - ECStackErrStackIsEmpty, - ECStackDeleteWhenNotOwner, - ECStackPopsWhenOwner - }; - -_LIT(KCStackPanicName, "CStack"); - -inline void Panic(TCStackPanic aPanic) - { - User::Panic(KCStackPanicName, aPanic); - } - -// -// CStack -// - -template -inline CStack::CStack() -: CArrayPtrSeg(KStackGranularity) - { - this->Reset(); - } - -template -inline CStack::~CStack() - { - Clear(); - } - -template -inline void CStack::Clear() - { - if (StackOwnsEntry) - this->ResetAndDestroy(); - else - this->Reset(); - } - -template -inline TBool CStack::IsEmpty() const - { - return this->Count()==0; - } - -template -inline void CStack::PushL(T* aItem) - { - if (StackOwnsEntry) - CleanupStack::PushL(aItem); - this->AppendL(aItem); - if (StackOwnsEntry) - CleanupStack::Pop(); - } - -template -inline T* CStack::Pop() - { - __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty)); - T* item=Head(); - this->Delete(this->Count()-1); - return item; - } - -template -inline T* CStack::Head() const - { - __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty)); - return this->At(this->Count()-1); - } - -template -inline T* CStack::Last() const - { - __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty)); - return this->At(0); - } - - -#endif // __CSTACK_INL__