1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/cmarkedstack.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,84 @@
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 +// Template class to implement a marked stack. Conatins a stack itself of marks
1.18 +// providing basic marking functionality.
1.19 +//
1.20 +//
1.21 +
1.22 +#ifndef __CMARKEDSTACK_H__
1.23 +#define __CMARKEDSTACK_H__
1.24 +
1.25 +// includes
1.26 +#include <e32base.h>
1.27 +#include <cstack.h>
1.28 +
1.29 +//##ModelId=3B666BCD0001
1.30 +
1.31 +template <class T, TBool Owner>
1.32 +class CMarkedStack : public CStack<T, Owner>
1.33 +/** Provides a templated stack that allows items in the stack to be marked.
1.34 +
1.35 +The class allows each mark to have an associated TInt value, which allows different
1.36 +types of mark to be used on the same stack.
1.37 +
1.38 +Template parameter T specifies the type of object on the stack. Owner should be set to
1.39 +ETrue if the object's destructor should delete the objects on the stack.
1.40 + @publishedAll
1.41 + @released
1.42 +
1.43 +*/
1.44 +{
1.45 +protected:
1.46 +class TMarkPoint
1.47 +/** Represents a mark.
1.48 + */
1.49 +{
1.50 +public:
1.51 + /** Represents a mark. */
1.52 + TMarkPoint(TInt aMarkType
1.53 + , TInt aIndex)
1.54 + : iMarkType(aMarkType)
1.55 + , iStackIndex(aIndex)
1.56 + {}
1.57 + /** Mark type. */
1.58 + TInt iMarkType;
1.59 + /** Index of the marked stack item. */
1.60 + TInt iStackIndex;
1.61 +};
1.62 +/** Defines a stack of marks. */
1.63 +typedef CStack<TMarkPoint, ETrue> CMarks;
1.64 +public:
1.65 + //##ModelId=3B666BCD0048
1.66 + inline virtual ~CMarkedStack();
1.67 +
1.68 + //##ModelId=3B666BCD0041
1.69 + inline void MarkL(TInt aMarkType);
1.70 + //##ModelId=3B666BCD003F
1.71 + inline TInt RemoveMark(TInt aMarkType);
1.72 + //##ModelId=3B666BCD003D
1.73 + inline void DeleteToMark(TInt aMarkType);
1.74 + //##ModelId=3B666BCD0033
1.75 + inline void ResetToMark(TInt aMarkType);
1.76 +protected:
1.77 + /** A stack of marks.
1.78 +
1.79 + Items are added and removed from this stack by MarkL(), RemoveMark() etc.
1.80 + */
1.81 + //##ModelId=3B666BCD002D
1.82 + CMarks iMarks;
1.83 +};
1.84 +
1.85 +#include <cmarkedstack.inl>
1.86 +
1.87 +#endif // __CMARKEDSTACK_H__