epoc32/include/cmarkedstack.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/cmarkedstack.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/cmarkedstack.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,84 @@
     1.4 -cmarkedstack.h
     1.5 +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +// Template class to implement a marked stack. Conatins a stack itself of marks 
    1.19 +// providing basic marking functionality.
    1.20 +// 
    1.21 +//
    1.22 +
    1.23 +#ifndef __CMARKEDSTACK_H__
    1.24 +#define __CMARKEDSTACK_H__
    1.25 +
    1.26 +// includes
    1.27 +#include <e32base.h>
    1.28 +#include <cstack.h>
    1.29 +
    1.30 +//##ModelId=3B666BCD0001
    1.31 +
    1.32 +template <class T, TBool Owner>
    1.33 +class CMarkedStack : public CStack<T, Owner>
    1.34 +/** Provides a templated stack that allows items in the stack to be marked.
    1.35 +
    1.36 +The class allows each mark to have an associated TInt value, which allows different 
    1.37 +types of mark to be used on the same stack.
    1.38 +
    1.39 +Template parameter T specifies the type of object on the stack. Owner should be set to 
    1.40 +ETrue if the object's destructor should delete the objects on the stack.
    1.41 +    @publishedAll
    1.42 +    @released
    1.43 + 
    1.44 +*/
    1.45 +{
    1.46 +protected:
    1.47 +class TMarkPoint
    1.48 +/** Represents a mark.
    1.49 + */
    1.50 +{
    1.51 +public:
    1.52 +	/** Represents a mark. */	
    1.53 +	TMarkPoint(TInt aMarkType
    1.54 +		   , TInt aIndex)
    1.55 +	  : iMarkType(aMarkType)
    1.56 +	  , iStackIndex(aIndex)
    1.57 +	{}
    1.58 +	/** Mark type. */
    1.59 +	TInt iMarkType;
    1.60 +	/** Index of the marked stack item. */
    1.61 +	TInt iStackIndex;
    1.62 +};
    1.63 +/** Defines a stack of marks. */
    1.64 +typedef CStack<TMarkPoint, ETrue> CMarks;
    1.65 +public:
    1.66 +	//##ModelId=3B666BCD0048
    1.67 +	inline virtual ~CMarkedStack();
    1.68 +
    1.69 +	//##ModelId=3B666BCD0041
    1.70 +	inline void MarkL(TInt aMarkType);
    1.71 +	//##ModelId=3B666BCD003F
    1.72 +	inline TInt RemoveMark(TInt aMarkType);
    1.73 +	//##ModelId=3B666BCD003D
    1.74 +	inline void DeleteToMark(TInt aMarkType);
    1.75 +	//##ModelId=3B666BCD0033
    1.76 +	inline void ResetToMark(TInt aMarkType);
    1.77 +protected:
    1.78 +	/** A stack of marks.
    1.79 +
    1.80 +	Items are added and removed from this stack by MarkL(), RemoveMark() etc.
    1.81 +	*/
    1.82 +	//##ModelId=3B666BCD002D
    1.83 +	CMarks iMarks;
    1.84 +};
    1.85 +
    1.86 +#include <cmarkedstack.inl>
    1.87 +
    1.88 +#endif // __CMARKEDSTACK_H__