|
1 // Copyright (c) 1997-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <apaid.h> |
|
17 #include <s32strm.h> |
|
18 #include "APASTD.H" |
|
19 |
|
20 |
|
21 ///////////////////////////// |
|
22 // TApaAppIdentifier |
|
23 ///////////////////////////// |
|
24 |
|
25 EXPORT_C TApaAppIdentifier::TApaAppIdentifier() |
|
26 /** Constructs an empty application identifier. |
|
27 |
|
28 The data is not initialised. */ |
|
29 {} |
|
30 |
|
31 EXPORT_C TApaAppIdentifier::TApaAppIdentifier(TUid aAppUid,const TFileName& aDllName) |
|
32 : iAppUid(aAppUid), |
|
33 iFullName(aDllName) |
|
34 /** Constructs an application identifier from the specified application |
|
35 DLL file name and extension, and the specified application UID. |
|
36 @param aAppUid The application specific UID. |
|
37 @param aDllName The filename and extension of the application DLL. */ |
|
38 {} |
|
39 |
|
40 EXPORT_C void TApaAppIdentifier::ExternalizeL(RWriteStream& aStream)const |
|
41 /** Externalises the application identifier to a write stream. |
|
42 |
|
43 @param aStream The write stream. */ |
|
44 { |
|
45 aStream<< iAppUid; |
|
46 aStream<< iFullName; |
|
47 } |
|
48 |
|
49 EXPORT_C void TApaAppIdentifier::InternalizeL(RReadStream& aStream) |
|
50 /** Internalises the application identifier from a read stream. |
|
51 |
|
52 @param aStream The read stream. */ |
|
53 { |
|
54 aStream>> iAppUid; |
|
55 aStream>> iFullName; |
|
56 } |
|
57 |
|
58 ///////////////////////////// |
|
59 // TApaAppEntry |
|
60 ///////////////////////////// |
|
61 |
|
62 EXPORT_C TApaAppEntry::TApaAppEntry() |
|
63 : iUidType(TUidType()), |
|
64 iFullName(KNullDesC) |
|
65 /** Constructs an empty application entry object. |
|
66 |
|
67 The full path name is empty, and the triplet of UIDs forming the UID type |
|
68 are set to null UIDs. */ |
|
69 {} |
|
70 |
|
71 |
|
72 EXPORT_C TApaAppEntry::TApaAppEntry(const TUidType& aAppUidType,const TFileName& aDllName) |
|
73 : iUidType(aAppUidType), |
|
74 iFullName(aDllName) |
|
75 /** Constructs an application entry object from the specified application |
|
76 DLL full path name and UID type. |
|
77 @param aAppUidType UID type. |
|
78 @param aDllName Application DLL full path name. */ |
|
79 {} |
|
80 |
|
81 |
|
82 EXPORT_C void TApaAppEntry::ExternalizeL(RWriteStream& aStream)const |
|
83 /** Externalises the application entry to a write stream. |
|
84 |
|
85 @param aStream The write stream. */ |
|
86 { |
|
87 aStream<< iUidType[0]; |
|
88 aStream<< iUidType[1]; |
|
89 aStream<< iUidType[2]; |
|
90 aStream<< iFullName; |
|
91 } |
|
92 |
|
93 |
|
94 EXPORT_C void TApaAppEntry::InternalizeL(RReadStream& aStream) |
|
95 /** Internalises the application entry from a read stream. |
|
96 |
|
97 @param aStream The read stream. */ |
|
98 { |
|
99 TUid uid1; |
|
100 TUid uid2; |
|
101 TUid uid3; |
|
102 aStream>> uid1; |
|
103 aStream>> uid2; |
|
104 aStream>> uid3; |
|
105 iUidType = TUidType(uid1,uid2,uid3); |
|
106 aStream>> iFullName; |
|
107 } |
|
108 |
|
109 |
|
110 ///////////////////////////// |
|
111 // TApaAppInfo |
|
112 ///////////////////////////// |
|
113 |
|
114 EXPORT_C TApaAppInfo::TApaAppInfo() |
|
115 : iUid(TUid()), |
|
116 iFullName(KNullDesC), |
|
117 iCaption(KNullDesC), |
|
118 iShortCaption(KNullDesC) |
|
119 /** Constructs an empty application information object. |
|
120 |
|
121 The full path name is empty, the captions are empty and the application specific |
|
122 UID is set to the null UID. */ |
|
123 {} |
|
124 |
|
125 |
|
126 EXPORT_C TApaAppInfo::TApaAppInfo(TUid aAppUid,const TFileName& aDllName,const TApaAppCaption& aCaption) |
|
127 : iUid(aAppUid), |
|
128 iFullName(aDllName), |
|
129 iCaption(aCaption), |
|
130 iShortCaption(aCaption) |
|
131 /** Constructs an application information object from the specified full DLL path |
|
132 name, UID and full length caption. |
|
133 |
|
134 @param aAppUid The application specific UID. |
|
135 @param aDllName The full path name of the application DLL. |
|
136 @param aCaption The application caption. */ |
|
137 {} |
|
138 |
|
139 EXPORT_C TApaAppInfo::TApaAppInfo(TUid aAppUid,const TFileName& aDllName,const TApaAppCaption& aCaption,const TApaAppCaption& aShortCaption) |
|
140 : iUid(aAppUid), |
|
141 iFullName(aDllName), |
|
142 iCaption(aCaption), |
|
143 iShortCaption(aShortCaption) |
|
144 /** Constructs an application information object from the specified full DLL path |
|
145 name, UID, caption and short caption. |
|
146 |
|
147 @param aAppUid The application specific UID. |
|
148 @param aDllName The full path name of the application DLL. |
|
149 @param aCaption The application caption. |
|
150 @param aShortCaption The application short caption. */ |
|
151 {} |
|
152 |
|
153 EXPORT_C void TApaAppInfo::ExternalizeL(RWriteStream& aStream)const |
|
154 /** Externalises the application information to a write stream. |
|
155 |
|
156 @param aStream The write stream. */ |
|
157 { |
|
158 aStream<< iUid; |
|
159 aStream<< iFullName; |
|
160 aStream<< iCaption; |
|
161 aStream<< iShortCaption; |
|
162 } |
|
163 |
|
164 EXPORT_C void TApaAppInfo::InternalizeL(RReadStream& aStream) |
|
165 /** Internalises the application information from a read stream. |
|
166 |
|
167 @param aStream The read stream. */ |
|
168 { |
|
169 aStream>> iUid; |
|
170 aStream>> iFullName; |
|
171 aStream>> iCaption; |
|
172 aStream>> iShortCaption; |
|
173 } |
|
174 |
|
175 |
|
176 ///////////////////////////// |
|
177 // TApaAppViewInfo |
|
178 ///////////////////////////// |
|
179 |
|
180 EXPORT_C TApaAppViewInfo::TApaAppViewInfo() |
|
181 : iUid(KNullUid), |
|
182 iViewCaption(KNullDesC) |
|
183 /** Constructs an empty object. |
|
184 |
|
185 Specifically, it sets the view UID to KNullUid and empties the application |
|
186 caption, i.e. sets it to KNullDesC. */ |
|
187 {} |
|
188 |
|
189 |
|
190 EXPORT_C TApaAppViewInfo::TApaAppViewInfo(TUid aAppUid,const TApaAppCaption& aViewCaption, TInt aScreenMode) |
|
191 : iUid(aAppUid), |
|
192 iViewCaption(aViewCaption), |
|
193 iScreenMode(aScreenMode) |
|
194 {} |
|
195 |
|
196 |
|
197 EXPORT_C void TApaAppViewInfo::ExternalizeL(RWriteStream& aStream)const |
|
198 /** Externalises the application view information to a write stream. |
|
199 |
|
200 @param aStream The write stream. */ |
|
201 { |
|
202 aStream<< iUid; |
|
203 aStream<< iViewCaption; |
|
204 aStream.WriteInt32L(iScreenMode); |
|
205 } |
|
206 |
|
207 |
|
208 EXPORT_C void TApaAppViewInfo::InternalizeL(RReadStream& aStream) |
|
209 /** Internalises the application view information from a read stream. |
|
210 |
|
211 @param aStream The read stream. */ |
|
212 { |
|
213 aStream>> iUid; |
|
214 aStream>> iViewCaption; |
|
215 iScreenMode=aStream.ReadInt32L(); |
|
216 } |
|
217 |
|
218 |
|
219 /////////////////////////////////////// |
|
220 // class TApaAppCapability |
|
221 /////////////////////////////////////// |
|
222 |
|
223 EXPORT_C void TApaAppCapability::InternalizeL(RReadStream& aStream) |
|
224 { |
|
225 DoInternalizeL(aStream, iLaunchInBackground, iGroupName); |
|
226 } |
|
227 |
|
228 EXPORT_C void TApaAppCapability::Internalize7_0L(RReadStream& aStream) |
|
229 /** |
|
230 @deprecated |
|
231 */ |
|
232 { |
|
233 TBool dummyBool; |
|
234 TApaAppGroupName dummyGroupName; |
|
235 DoInternalizeL(aStream,dummyBool,dummyGroupName); |
|
236 } |
|
237 |
|
238 void TApaAppCapability::DoInternalizeL(RReadStream& aStream, TBool& aLaunchInBackground, TApaAppGroupName& aGroupName) |
|
239 /** Internalises the application capabilities from a read stream. |
|
240 |
|
241 @param aStream The read stream. */ |
|
242 { |
|
243 TInt version = aStream.ReadInt32L(); |
|
244 iEmbeddability = TEmbeddability(aStream.ReadInt32L()); |
|
245 iSupportsNewFile = aStream.ReadInt32L(); |
|
246 iAppIsHidden = aStream.ReadInt32L(); |
|
247 |
|
248 // initialise values of members which may not be in the stream |
|
249 aLaunchInBackground = EFalse; |
|
250 aGroupName.Zero(); |
|
251 |
|
252 if (version==1) |
|
253 return; |
|
254 |
|
255 // Calypso extension to allow apps to be launched in the background |
|
256 aLaunchInBackground = aStream.ReadInt32L(); |
|
257 if (version==2) |
|
258 return; |
|
259 |
|
260 aStream >> aGroupName; |
|
261 if (version == 3) |
|
262 return; |
|
263 |
|
264 iAttributes = aStream.ReadUint32L(); |
|
265 if (version == 4) |
|
266 return; |
|
267 |
|
268 Panic(EDPanicInvalidVersionNumber); |
|
269 } |
|
270 |
|
271 EXPORT_C void TApaAppCapability::ExternalizeL(RWriteStream& aStream) const |
|
272 /** Externalises the application capabilities to a write stream. |
|
273 |
|
274 @param aStream The write stream. */ |
|
275 { |
|
276 aStream.WriteInt32L(EVersion); |
|
277 aStream.WriteInt32L(iEmbeddability); |
|
278 aStream.WriteInt32L(iSupportsNewFile); |
|
279 aStream.WriteInt32L(iAppIsHidden); |
|
280 aStream.WriteInt32L(iLaunchInBackground); |
|
281 aStream << iGroupName; |
|
282 aStream.WriteUint32L(iAttributes); |
|
283 } |
|
284 |
|
285 const TInt KOldVersion=1; |
|
286 |
|
287 EXPORT_C void TApaAppCapability::Externalize7_0L(RWriteStream& aStream) const |
|
288 /** Externalises the application capabilities to a write stream. |
|
289 |
|
290 @param aStream The write stream. |
|
291 @deprecated*/ |
|
292 { |
|
293 aStream.WriteInt32L(KOldVersion); |
|
294 aStream.WriteInt32L(iEmbeddability); |
|
295 aStream.WriteInt32L(iSupportsNewFile); |
|
296 aStream.WriteInt32L(iAppIsHidden); |
|
297 } |
|
298 |
|
299 EXPORT_C void TApaAppCapability::CopyCapability(TDes8& aDest,const TDesC8& aSource) |
|
300 /** A utility function that can copy capability information from one descriptor |
|
301 to another. |
|
302 |
|
303 @param aDest Target descriptor. |
|
304 @param aSource Source descriptor. */ |
|
305 { |
|
306 TInt maxLen=aDest.MaxLength(); |
|
307 aDest.FillZ(maxLen); // zero fill in case aSource is shorter |
|
308 aDest.Copy(aSource.Left(Min(aSource.Length(),maxLen))); |
|
309 aDest.SetLength(maxLen); |
|
310 } |
|
311 |
|
312 |
|
313 /////////////////////////////////////// |
|
314 // class TApaEmbeddabilityFilter |
|
315 /////////////////////////////////////// |
|
316 EXPORT_C TApaEmbeddabilityFilter::TApaEmbeddabilityFilter() |
|
317 : iEmbeddabilityFlags(0) |
|
318 /** Constructs an empty embeddability filter. */ |
|
319 { |
|
320 } |
|
321 |
|
322 EXPORT_C void TApaEmbeddabilityFilter::AddEmbeddability(TApaAppCapability::TEmbeddability aEmbeddability) |
|
323 /** Adds aEmbeddability to the filter. |
|
324 |
|
325 @param aEmbeddability TEmbeddability value to add to the filter. */ |
|
326 { |
|
327 __ASSERT_ALWAYS(aEmbeddability >= 0 && static_cast<TUint>(aEmbeddability) < (sizeof(TUint)*8), Panic(EPanicEmbeddabilityOutOfRange)); |
|
328 iEmbeddabilityFlags |= (1 << aEmbeddability); |
|
329 } |
|
330 |
|
331 EXPORT_C TBool TApaEmbeddabilityFilter::MatchesEmbeddability(TApaAppCapability::TEmbeddability aEmbeddability) const |
|
332 /** Compares aEmbeddability with the filter. |
|
333 |
|
334 @param aEmbeddability TEmbeddability value to compare. |
|
335 @return True, if aEmbeddability is included in the filter; false, otherwise. */ |
|
336 { |
|
337 __ASSERT_ALWAYS(aEmbeddability >= 0 && static_cast<TUint>(aEmbeddability) < (sizeof(TUint)*8), Panic(EPanicEmbeddabilityOutOfRange)); |
|
338 TUint embeddabilityFlag = (1 << aEmbeddability); |
|
339 if (embeddabilityFlag & iEmbeddabilityFlags) |
|
340 { |
|
341 return ETrue; |
|
342 } |
|
343 return EFalse; |
|
344 } |
|
345 |
|
346 // |
|
347 // CApaAppFinder |
|
348 // |
|
349 |
|
350 /** Constructor for CApaAppFinder */ |
|
351 EXPORT_C CApaAppFinder::CApaAppFinder() |
|
352 { |
|
353 } |
|
354 |
|
355 /* Reserved for future use */ |
|
356 EXPORT_C void CApaAppFinder::CApaAppFinder_Reserved1() |
|
357 { |
|
358 } |
|
359 |
|
360 /* Reserved for future use */ |
|
361 EXPORT_C void CApaAppFinder::CApaAppFinder_Reserved2() |
|
362 { |
|
363 } |
|
364 |
|
365 // |
|
366 // CApaAppServiceInfoArray |
|
367 // |
|
368 |
|
369 EXPORT_C CApaAppServiceInfoArray::CApaAppServiceInfoArray() |
|
370 { |
|
371 } |
|
372 |
|
373 EXPORT_C void CApaAppServiceInfoArray::CApaAppServiceInfoArray_Reserved1() |
|
374 { |
|
375 } |
|
376 |
|
377 EXPORT_C void CApaAppServiceInfoArray::CApaAppServiceInfoArray_Reserved2() |
|
378 { |
|
379 } |