|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: vector implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef ALFPTRVECTORIMPL_H |
|
21 #define ALFPTRVECTORIMPL_H |
|
22 |
|
23 #include <osn/osndefines.h> |
|
24 #include <osn/osntypes.h> |
|
25 |
|
26 namespace osncore |
|
27 { |
|
28 |
|
29 class IDeleter |
|
30 { |
|
31 private: |
|
32 friend class AlfPtrVectorImpl; |
|
33 virtual void deleteItem(void* aItem)=0; |
|
34 }; |
|
35 |
|
36 |
|
37 /** |
|
38 * @deprecated Use STL vector |
|
39 * @class AlfPtrVectorImpl alfptrvectorimpl.h "osn/alfptrvectorimpl.h" |
|
40 * Implementation class for AlfPtrVector |
|
41 * |
|
42 * @lib osncore.lib |
|
43 * @since S60 5.0 |
|
44 * @status Draft |
|
45 */ |
|
46 class AlfPtrVectorImpl |
|
47 { |
|
48 public: // constructors / destructor |
|
49 |
|
50 /** |
|
51 * @deprecated Use STL vector |
|
52 * Constructor |
|
53 * |
|
54 * @since S60 5.0 |
|
55 * @param aDeleter |
|
56 */ |
|
57 OSN_IMPORT AlfPtrVectorImpl( IDeleter& aDeleter ); |
|
58 |
|
59 /** |
|
60 * @deprecated Use STL vector |
|
61 * Constructor |
|
62 * |
|
63 * @since S60 5.0 |
|
64 * @param aSize |
|
65 * @param aDeleter |
|
66 */ |
|
67 OSN_IMPORT AlfPtrVectorImpl(uint aSize, IDeleter& aDeleter); |
|
68 |
|
69 /** |
|
70 * @deprecated Use STL vector |
|
71 * Destructor |
|
72 */ |
|
73 OSN_IMPORT ~AlfPtrVectorImpl(); |
|
74 |
|
75 /** |
|
76 * @deprecated Use STL vector |
|
77 * Clears the vector |
|
78 * |
|
79 * @since S60 5.0 |
|
80 * @param aDelItems determines whether the items are deleted |
|
81 */ |
|
82 OSN_IMPORT void clear(bool aDelItems); |
|
83 |
|
84 /** |
|
85 * @deprecated Use STL vector |
|
86 * Removes an item from the vector |
|
87 * |
|
88 * @since S60 5.0 |
|
89 * @param aCount the item to be deleted |
|
90 * @param aDelItems determines whether the item is deleted |
|
91 * @return true/false to indicate if item has been removed. |
|
92 */ |
|
93 OSN_IMPORT bool remove(uint aCount, bool aDelItems); |
|
94 |
|
95 /** |
|
96 * @deprecated Use STL vector |
|
97 * Resizes the vector to new size. Existing items in |
|
98 * the vector will be restored if auto delete property is false. |
|
99 * |
|
100 * @since S60 5.0 |
|
101 * @param aSize New size in bytes. |
|
102 * @param aDelItems determines whether the items are deleted |
|
103 * @return true/false to indicate if item has been resized. |
|
104 */ |
|
105 OSN_IMPORT bool resize(uint aSize, bool aDelItems); |
|
106 |
|
107 /** |
|
108 * @deprecated Use STL vector |
|
109 * Inserts a new item at given position in the vector. |
|
110 * |
|
111 * @since S60 5.0 |
|
112 * @param aCount Position at which item has to be inserted. |
|
113 * @param aItem Pointer to the item to be inserted. |
|
114 * @param aDelItems determines whether the item is deleted, not used! |
|
115 * @return true/false to indicate if the item has been inserted. |
|
116 */ |
|
117 OSN_IMPORT bool insert(uint aCount, void *aItem, bool aDelItems); |
|
118 |
|
119 /** |
|
120 * @deprecated Use STL vector |
|
121 * Returns the position of the item in the vector. |
|
122 * |
|
123 * @since S60 5.0 |
|
124 * @param aItem Pointer to the item being searched in the vector. |
|
125 * @return Position of item in the vector.-1 is returned if item is not found. |
|
126 */ |
|
127 OSN_IMPORT int findRef(void *aItem); |
|
128 |
|
129 public: // inliners |
|
130 bool isEmpty() const { return mcount == 0; } |
|
131 uint count() const { return mcount; } |
|
132 uint size() const { return msize; } |
|
133 void* at(uint aCount) const { return mdata[aCount]; } |
|
134 void** data() { return mdata; } |
|
135 |
|
136 |
|
137 private: |
|
138 AlfPtrVectorImpl& operator=(const AlfPtrVectorImpl&); |
|
139 |
|
140 void** mdata; |
|
141 uint msize; |
|
142 uint mcount; |
|
143 IDeleter& mDeleter; |
|
144 }; |
|
145 |
|
146 } // namespace core |
|
147 #endif |