|
1 // Copyright (c) 2005-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Utility class for indexing instances of CWsGraphicDrawer |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __WSGRAPHICDRAWERARRAY_H__ |
|
19 #define __WSGRAPHICDRAWERARRAY_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <graphics/wsgraphicdrawer.h> |
|
23 |
|
24 class CWsGraphicDrawerArray: public CBase |
|
25 /** An index of CWsGraphicDrawer instances |
|
26 A CWsGraphicDrawer can be in many such indexes, as an index does not imply ownership |
|
27 @publishedPartner |
|
28 @released |
|
29 */ { |
|
30 public: |
|
31 //Placeholder for transacion record |
|
32 class XRollBackBase; |
|
33 |
|
34 //transactional manipulation methods that are deprecated because they leak |
|
35 IMPORT_C void AddLC(CWsGraphicDrawer* aDrawer); |
|
36 IMPORT_C TInt SwapLC(CWsGraphicDrawer* aDrawer); |
|
37 |
|
38 //non-transactional manipulation |
|
39 IMPORT_C TInt Remove(const TGraphicDrawerId& aId); |
|
40 IMPORT_C TInt Add(CWsGraphicDrawer* aDrawer); |
|
41 IMPORT_C TInt Swap(CWsGraphicDrawer* aDrawer); |
|
42 |
|
43 //safe transactional methods |
|
44 //The array should not be Compressed() during the transaction period to ensure that the Remove RollBack operation will always succeed. |
|
45 IMPORT_C XRollBackBase* AddTLC(CWsGraphicDrawer* aDrawer); |
|
46 IMPORT_C XRollBackBase* SwapTLC(CWsGraphicDrawer* aDrawer); |
|
47 IMPORT_C XRollBackBase* RemoveTLC(const TGraphicDrawerId& aId); |
|
48 IMPORT_C void CommitP(XRollBackBase*); |
|
49 |
|
50 //Query |
|
51 IMPORT_C const CWsGraphicDrawer* ResolveGraphic(const TGraphicDrawerId& aId) const; |
|
52 IMPORT_C TBool IsEmpty() const; |
|
53 |
|
54 //Other non-transactional methods |
|
55 IMPORT_C TInt RemoveAndDestroy(const TGraphicDrawerId& aId); |
|
56 IMPORT_C TInt RemoveAll(const MWsClient& aOwner); |
|
57 IMPORT_C TInt RemoveAndDestroyAll(const MWsClient& aOwner); |
|
58 IMPORT_C void Close(); |
|
59 IMPORT_C void ResetAndDestroy(); |
|
60 private: |
|
61 NONSHARABLE_STRUCT(TGraphic) |
|
62 { |
|
63 TGraphicDrawerId iId; |
|
64 CWsGraphicDrawer* iDrawer; |
|
65 }; |
|
66 RArray<TGraphic> iArray; |
|
67 CWsGraphicDrawer* SwapIn(CWsGraphicDrawer* aDrawer); |
|
68 TInt IndexOf(const TGraphicDrawerId& aId) const; |
|
69 static TInt GraphicDrawerCompare(const TGraphic& aFirst,const TGraphic& aSecond); |
|
70 private: |
|
71 //Transactional unwinding support classes |
|
72 class XAddRollBack; |
|
73 friend class XAddRollBack; |
|
74 class XSwapRollBack; |
|
75 friend class XSwapRollBack; |
|
76 class XRemoveRollBack; |
|
77 friend class XRemoveRollBack; |
|
78 class testArrayValidator; |
|
79 friend class testArrayValidator; |
|
80 }; |
|
81 |
|
82 #endif //#ifndef __WSGRAPHICDRAWERARRAY_H__ |