epoc32/include/cmarkedstack.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 cmarkedstack.h
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // 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
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Template class to implement a marked stack. Conatins a stack itself of marks 
       
    15 // providing basic marking functionality.
       
    16 // 
       
    17 //
       
    18 
       
    19 #ifndef __CMARKEDSTACK_H__
       
    20 #define __CMARKEDSTACK_H__
       
    21 
       
    22 // includes
       
    23 #include <e32base.h>
       
    24 #include <cstack.h>
       
    25 
       
    26 //##ModelId=3B666BCD0001
       
    27 
       
    28 template <class T, TBool Owner>
       
    29 class CMarkedStack : public CStack<T, Owner>
       
    30 /** Provides a templated stack that allows items in the stack to be marked.
       
    31 
       
    32 The class allows each mark to have an associated TInt value, which allows different 
       
    33 types of mark to be used on the same stack.
       
    34 
       
    35 Template parameter T specifies the type of object on the stack. Owner should be set to 
       
    36 ETrue if the object's destructor should delete the objects on the stack.
       
    37     @publishedAll
       
    38     @released
       
    39  
       
    40 */
       
    41 {
       
    42 protected:
       
    43 class TMarkPoint
       
    44 /** Represents a mark.
       
    45  */
       
    46 {
       
    47 public:
       
    48 	/** Represents a mark. */	
       
    49 	TMarkPoint(TInt aMarkType
       
    50 		   , TInt aIndex)
       
    51 	  : iMarkType(aMarkType)
       
    52 	  , iStackIndex(aIndex)
       
    53 	{}
       
    54 	/** Mark type. */
       
    55 	TInt iMarkType;
       
    56 	/** Index of the marked stack item. */
       
    57 	TInt iStackIndex;
       
    58 };
       
    59 /** Defines a stack of marks. */
       
    60 typedef CStack<TMarkPoint, ETrue> CMarks;
       
    61 public:
       
    62 	//##ModelId=3B666BCD0048
       
    63 	inline virtual ~CMarkedStack();
       
    64 
       
    65 	//##ModelId=3B666BCD0041
       
    66 	inline void MarkL(TInt aMarkType);
       
    67 	//##ModelId=3B666BCD003F
       
    68 	inline TInt RemoveMark(TInt aMarkType);
       
    69 	//##ModelId=3B666BCD003D
       
    70 	inline void DeleteToMark(TInt aMarkType);
       
    71 	//##ModelId=3B666BCD0033
       
    72 	inline void ResetToMark(TInt aMarkType);
       
    73 protected:
       
    74 	/** A stack of marks.
       
    75 
       
    76 	Items are added and removed from this stack by MarkL(), RemoveMark() etc.
       
    77 	*/
       
    78 	//##ModelId=3B666BCD002D
       
    79 	CMarks iMarks;
       
    80 };
       
    81 
       
    82 #include <cmarkedstack.inl>
       
    83 
       
    84 #endif // __CMARKEDSTACK_H__