1.1 --- a/epoc32/include/cstack.inl Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,102 +0,0 @@
1.4 -// Copyright (c) 2000-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 -//
1.18 -
1.19 -#ifndef __CSTACK_INL__
1.20 -#define __CSTACK_INL__
1.21 -
1.22 -// constants
1.23 -const TInt KStackGranularity=32;
1.24 -
1.25 -enum TCStackPanic
1.26 - {
1.27 - ECStackErrStackIsEmpty,
1.28 - ECStackDeleteWhenNotOwner,
1.29 - ECStackPopsWhenOwner
1.30 - };
1.31 -
1.32 -_LIT(KCStackPanicName, "CStack");
1.33 -
1.34 -inline void Panic(TCStackPanic aPanic)
1.35 - {
1.36 - User::Panic(KCStackPanicName, aPanic);
1.37 - }
1.38 -
1.39 -//
1.40 -// CStack
1.41 -//
1.42 -
1.43 -template <class T, TBool StackOwnsEntry>
1.44 -inline CStack<T, StackOwnsEntry>::CStack()
1.45 -: CArrayPtrSeg<T>(KStackGranularity)
1.46 - {
1.47 - this->Reset();
1.48 - }
1.49 -
1.50 -template <class T, TBool StackOwnsEntry>
1.51 -inline CStack<T, StackOwnsEntry>::~CStack()
1.52 - {
1.53 - Clear();
1.54 - }
1.55 -
1.56 -template <class T, TBool StackOwnsEntry>
1.57 -inline void CStack<T, StackOwnsEntry>::Clear()
1.58 - {
1.59 - if (StackOwnsEntry)
1.60 - this->ResetAndDestroy();
1.61 - else
1.62 - this->Reset();
1.63 - }
1.64 -
1.65 -template <class T, TBool StackOwnsEntry>
1.66 -inline TBool CStack<T, StackOwnsEntry>::IsEmpty() const
1.67 - {
1.68 - return this->Count()==0;
1.69 - }
1.70 -
1.71 -template <class T, TBool StackOwnsEntry>
1.72 -inline void CStack<T, StackOwnsEntry>::PushL(T* aItem)
1.73 - {
1.74 - if (StackOwnsEntry)
1.75 - CleanupStack::PushL(aItem);
1.76 - this->AppendL(aItem);
1.77 - if (StackOwnsEntry)
1.78 - CleanupStack::Pop();
1.79 - }
1.80 -
1.81 -template <class T, TBool StackOwnsEntry>
1.82 -inline T* CStack<T, StackOwnsEntry>::Pop()
1.83 - {
1.84 - __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty));
1.85 - T* item=Head();
1.86 - this->Delete(this->Count()-1);
1.87 - return item;
1.88 - }
1.89 -
1.90 -template <class T, TBool StackOwnsEntry>
1.91 -inline T* CStack<T, StackOwnsEntry>::Head() const
1.92 - {
1.93 - __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty));
1.94 - return this->At(this->Count()-1);
1.95 - }
1.96 -
1.97 -template <class T, TBool StackOwnsEntry>
1.98 -inline T* CStack<T, StackOwnsEntry>::Last() const
1.99 - {
1.100 - __ASSERT_DEBUG(!IsEmpty(), Panic(ECStackErrStackIsEmpty));
1.101 - return this->At(0);
1.102 - }
1.103 -
1.104 -
1.105 -#endif // __CSTACK_INL__