diff -r 7fdc9a71d314 -r 8ad140f3dd41 stif/Parser/inc/cstackdeprecated.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/Parser/inc/cstackdeprecated.inl Wed Oct 13 16:17:58 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __CSTACKDEPRECATED_INL__ +#define __CSTACKDEPRECATED_INL__ + +// constants +const TInt KStackGranularity=32; + +enum TCStackPanic + { + ECStackErrStackIsEmpty, + ECStackDeleteWhenNotOwner, + ECStackPopsWhenOwner + }; + +_LIT(KCStackPanicName, "CStackDeprecated"); + +inline void Panic(TCStackPanic aPanic) + { + User::Panic(KCStackPanicName, aPanic); + } + +// +// CStack +// + +template +inline CStackDeprecated::CStackDeprecated() +: CArrayPtrSeg(KStackGranularity) + { + this->Reset(); + } + +template +inline CStackDeprecated::~CStackDeprecated() + { + Clear(); + } + +template +inline void CStackDeprecated::Clear() + { + if (StackOwnsEntry) + this->ResetAndDestroy(); + else + this->Reset(); + } + +template +inline TBool CStackDeprecated::IsEmpty() const + { + return this->Count()==0; + } + +template +inline void CStackDeprecated::PushL(T* aItem) + { + if (StackOwnsEntry) + CleanupStack::PushL(aItem); + this->AppendL(aItem); + if (StackOwnsEntry) + CleanupStack::Pop(); + } + +template +inline T* CStackDeprecated::Pop() + { + __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty)); + T* item=Head(); + this->Delete(this->Count()-1); + return item; + } + +template +inline T* CStackDeprecated::Head() const + { + __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty)); + return this->At(this->Count()-1); + } + +template +inline T* CStackDeprecated::Last() const + { + __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty)); + return this->At(0); + } + + +#endif // __CSTACKDEPRECATED_INL__ + +// End of File