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