|
1 /* |
|
2 * Copyright (c) 2005 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: Container of one reactive authorization item |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CPENGAUTHORIZATIONITEM_H__ |
|
19 #define __CPENGAUTHORIZATIONITEM_H__ |
|
20 |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "MPEngAuthorizationRequest.h" |
|
25 |
|
26 |
|
27 // FORWARD DECLARATION |
|
28 class RWriteStream; |
|
29 class RReadStream; |
|
30 |
|
31 |
|
32 // CLASS DECLARATION |
|
33 /** |
|
34 * Container of the one reactive authorization item |
|
35 * |
|
36 * @lib PEngListLib2 |
|
37 * @since 3.0 |
|
38 */ |
|
39 class CPEngAuthorizationItem : public CBase |
|
40 { |
|
41 public: // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CPEngAuthorizationItem(); |
|
47 |
|
48 |
|
49 public: // New public functions |
|
50 |
|
51 /** |
|
52 * User id of the user who requested authorization |
|
53 * |
|
54 * @since 3.0 |
|
55 * @return User id |
|
56 */ |
|
57 const TDesC& Id() const; |
|
58 |
|
59 |
|
60 /** |
|
61 * Get local flag value |
|
62 * @since 3.0 |
|
63 * @return Local flag value |
|
64 */ |
|
65 TInt LocalFlags() const; |
|
66 |
|
67 |
|
68 /** |
|
69 * Set local flag value |
|
70 * @since 3.0 |
|
71 * @param Local flag value |
|
72 */ |
|
73 void SetLocalFlags( TInt aLocalFlag ); |
|
74 |
|
75 |
|
76 /** |
|
77 * Template function for derived classes to |
|
78 * update local flags |
|
79 * |
|
80 * @since 3.0 |
|
81 * @param aSource source item |
|
82 */ |
|
83 virtual void DoUpdateLocalFlags( |
|
84 const CPEngAuthorizationItem& aSource ) = 0; |
|
85 |
|
86 |
|
87 protected: // Streaming Support |
|
88 |
|
89 /** |
|
90 * Externalizes to the given stream |
|
91 * @since 3.0 |
|
92 * @param aStream write stream |
|
93 */ |
|
94 void ExternalizeL( RWriteStream& aStream ) const ; |
|
95 |
|
96 /** |
|
97 * Internalizes from the given stream |
|
98 * @since 3.0 |
|
99 * @param aStream read stream |
|
100 */ |
|
101 void InternalizeL( RReadStream& aStream ); |
|
102 |
|
103 |
|
104 /** |
|
105 * Externalize TUint array |
|
106 * |
|
107 * @since 3.0 |
|
108 * @param aStream write stream |
|
109 * @param aArray array |
|
110 */ |
|
111 static void ExternalizeArrayL( RWriteStream& aStream, |
|
112 const RArray<TUint32>& aArray ); |
|
113 |
|
114 /** |
|
115 * Internalize TUint array |
|
116 * |
|
117 * @since 3.0 |
|
118 * @param aStream read stream |
|
119 * @param aArray array |
|
120 */ |
|
121 static void InternalizeArrayL( RReadStream& aStream, |
|
122 RArray<TUint32>& aArray, |
|
123 TInt& aSize ); |
|
124 |
|
125 /** |
|
126 * Size of TUint aArray for stream. |
|
127 * |
|
128 * @since 3.0 |
|
129 * @param aArray array |
|
130 * @return size of array |
|
131 */ |
|
132 static TInt SizeOfArray( const RArray<TUint32>& aArray ); |
|
133 |
|
134 |
|
135 /** |
|
136 * Add Attribute to the array |
|
137 * |
|
138 * @since 3.0 |
|
139 * @param aArray array of attributes to add atribute |
|
140 * @param aAttribute attribute to add to requested attributes |
|
141 * @rturn size of which array size was increased |
|
142 */ |
|
143 static TInt AddAttributeToArrayL( RArray<TUint32>& aArray, |
|
144 TUint32 aAttribute ); |
|
145 |
|
146 |
|
147 /** |
|
148 * Copy TUint array. |
|
149 * |
|
150 * @since 3.0 |
|
151 * @param aSource source array |
|
152 * @param aTarget target array |
|
153 * @return difference in the size of array |
|
154 */ |
|
155 static TInt CopyArrayContentL( RArray<TUint32>& aTarget, |
|
156 const TArray<TUint32>& aSource ); |
|
157 |
|
158 |
|
159 protected: // constructors |
|
160 |
|
161 /** |
|
162 * C++ constructor. |
|
163 */ |
|
164 CPEngAuthorizationItem( TInt& aSize ); |
|
165 |
|
166 /** |
|
167 * Symbian constructor |
|
168 */ |
|
169 void ConstructL( const TDesC& aUserId ); |
|
170 |
|
171 |
|
172 protected: // data, used by derived classes |
|
173 |
|
174 /// REF: Size of the item |
|
175 TInt& iSize; |
|
176 |
|
177 /// OWN: TInt local cached flag |
|
178 TUint32 iLocalFlags; |
|
179 |
|
180 private: // Data |
|
181 |
|
182 /// OWN: Requesting contact Id |
|
183 HBufC* iUserId; |
|
184 }; |
|
185 |
|
186 #endif // __CPENGAUTHORIZATIONITEM_H__ |
|
187 |
|
188 // End of File |
|
189 |