|
1 /* |
|
2 * Copyright (c) 2002-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: TInt array that can be streamed |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef RVPBKSTREAMEDINTARRAY_H |
|
21 #define RVPBKSTREAMEDINTARRAY_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include "VPbkSimCntFieldTypes.hrh" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class RWriteStream; |
|
29 class RReadStream; |
|
30 class RVPbkStreamedIntArray; |
|
31 |
|
32 // FUNCTION PROTOTYPES |
|
33 |
|
34 /// Returns a buffer containg the content of the array |
|
35 IMPORT_C HBufC8* ExternalizeArrayLC( |
|
36 const RVPbkStreamedIntArray& aFieldTypes ); |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * Serializable TInt array |
|
42 * |
|
43 * @lib VPbkSimStoreImpl.lib |
|
44 */ |
|
45 class RVPbkStreamedIntArray |
|
46 { |
|
47 public: // Constructors |
|
48 |
|
49 /** |
|
50 * C++ default constructor. |
|
51 */ |
|
52 inline RVPbkStreamedIntArray(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Externalizes the instance |
|
58 * @param aWriteStream the stream to write to. |
|
59 */ |
|
60 IMPORT_C void ExternalizeL( RWriteStream& aWriteStream ) const; |
|
61 |
|
62 /** |
|
63 * Returns the size of the data in the instance |
|
64 * @return the size of the data in the instance |
|
65 */ |
|
66 IMPORT_C TInt ExternalizedSize() const; |
|
67 |
|
68 /** |
|
69 * Initializes the instance from the stream |
|
70 * @param aReadStream the stream to read from. |
|
71 */ |
|
72 IMPORT_C void InternalizeL( RReadStream& aReadStream ); |
|
73 |
|
74 /** |
|
75 * Deletes all the items from the array but doesn't free the memory |
|
76 */ |
|
77 IMPORT_C void RemoveAll(); |
|
78 |
|
79 /** |
|
80 * Closes this array |
|
81 */ |
|
82 inline void Close(); |
|
83 |
|
84 /** |
|
85 * Returns the amount of the types in the array |
|
86 * @return the amount of the types in the array |
|
87 */ |
|
88 inline TInt Count() const; |
|
89 |
|
90 /** |
|
91 * Resets the sort order |
|
92 */ |
|
93 inline void Reset(); |
|
94 |
|
95 /** |
|
96 * Appends a value to the array |
|
97 * @param aField the field type |
|
98 */ |
|
99 inline void AppendIntL( TInt aInt ); |
|
100 |
|
101 /** |
|
102 * Finds the given value from the array |
|
103 * @return index or KErrNotFound |
|
104 */ |
|
105 inline TInt Find( TInt aInt ); |
|
106 |
|
107 /** |
|
108 * Returns the type in the specfied index |
|
109 * @return the type in the specfied index. |
|
110 */ |
|
111 inline TInt operator[]( TInt aIndex ) const; |
|
112 |
|
113 private: // New functions |
|
114 |
|
115 // Prohibit copy constructor if not deriving from CBase. |
|
116 RVPbkStreamedIntArray( const RVPbkStreamedIntArray& ); |
|
117 // Prohibit assigment operator if not deriving from CBase. |
|
118 RVPbkStreamedIntArray& operator=( |
|
119 const RVPbkStreamedIntArray& ); |
|
120 |
|
121 private: // Data |
|
122 RArray<TInt> iIntArray; |
|
123 }; |
|
124 |
|
125 /** |
|
126 * Streamed array for types that have a conversion to TInt |
|
127 * |
|
128 * @lib VPbkSimStoreImpl.lib |
|
129 */ |
|
130 template<class T> |
|
131 class RVPbkStreamedEnumArray : public RVPbkStreamedIntArray |
|
132 { |
|
133 public: // Constructors |
|
134 |
|
135 /** |
|
136 * C++ default constructor. |
|
137 */ |
|
138 inline RVPbkStreamedEnumArray(); |
|
139 |
|
140 public: // New functions |
|
141 |
|
142 /** |
|
143 * Returns the type in the specfied index |
|
144 * @return the type in the specfied index. |
|
145 */ |
|
146 inline T operator[]( TInt aIndex ) const; |
|
147 |
|
148 /** |
|
149 * Appends an new value to the array |
|
150 * @param aEnum the new value |
|
151 */ |
|
152 inline void AppendL( T aEnum ); |
|
153 }; |
|
154 |
|
155 |
|
156 /** |
|
157 * Streamed sort order array for SIM field types |
|
158 * |
|
159 * @lib VPbkSimStoreImpl.lib |
|
160 */ |
|
161 class RVPbkSimFieldTypeArray : |
|
162 public RVPbkStreamedEnumArray<TVPbkSimCntFieldType> |
|
163 { |
|
164 public: // Constructors |
|
165 |
|
166 /** |
|
167 * C++ default constructor. |
|
168 */ |
|
169 inline RVPbkSimFieldTypeArray(); |
|
170 }; |
|
171 |
|
172 #include "RVPbkStreamedIntArray.inl" |
|
173 #endif // RVPBKSTREAMEDINTARRAY_H |
|
174 |
|
175 // End of File |