0
|
1 |
// Copyright (c) 1994-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 "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 |
// e32\include\e32cmn.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef __E32CMN_H__
|
|
19 |
#define __E32CMN_H__
|
|
20 |
#include <e32const.h>
|
|
21 |
|
|
22 |
extern "C" {
|
|
23 |
/**
|
|
24 |
@publishedAll
|
|
25 |
@released
|
|
26 |
|
|
27 |
A Nanokernel utility function that compares two memory buffers for equality.
|
|
28 |
|
|
29 |
The two buffers are considered equal only if:
|
|
30 |
|
|
31 |
1. the buffers have the same length
|
|
32 |
|
|
33 |
and
|
|
34 |
|
|
35 |
2. the binary content of both buffers is the same.
|
|
36 |
|
|
37 |
@param aLeft The start address of the first buffer in the comparison.
|
|
38 |
@param aLeftLen The length of the first buffer in the comparison.
|
|
39 |
@param aRight The start address of the second buffer in the comparison.
|
|
40 |
@param aRightLen The length of the second buffer in the comparison.
|
|
41 |
|
|
42 |
@return Zero if both buffers are equal; non-zero, otherwise.
|
|
43 |
|
|
44 |
@panic USER 88 In debug mode only, if aLeftL is negative,
|
|
45 |
and the function is called on the user side.
|
|
46 |
@panic KERN-COMMON 88 In debug mode only, if aLeftL is negative,
|
|
47 |
and the function is called on the kernel side.
|
|
48 |
@panic USER 89 In debug mode only, if aRightL is negative,
|
|
49 |
and the function is called on the user side.
|
|
50 |
@panic KERN-COMMON 89 In debug mode only, if aRightL is negative,
|
|
51 |
and the function is called on the kernel side.
|
|
52 |
*/
|
|
53 |
IMPORT_C TInt memcompare(const TUint8* aLeft, TInt aLeftLen, const TUint8* aRight, TInt aRightLen);
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
/**
|
|
59 |
@publishedAll
|
|
60 |
@released
|
|
61 |
|
|
62 |
A Nanokernel utility function that moves (copies) bytes in memory.
|
|
63 |
|
|
64 |
The function assumes that the addresses are aligned on word boundaries,
|
|
65 |
and that the length value is a multiple of 4.
|
|
66 |
|
|
67 |
@param aTrg The target address.
|
|
68 |
@param aSrc The source address.
|
|
69 |
@param aLength The number of bytes to be moved.
|
|
70 |
|
|
71 |
@return The target address.
|
|
72 |
|
|
73 |
@panic USER 91 In debug mode only, if aLength is not a multiple of 4,
|
|
74 |
and the function is called on the user side.
|
|
75 |
@panic KERN-COMMON 91 In debug mode only, if aLength is not a multiple of 4,
|
|
76 |
and the function is called on the kernel side.
|
|
77 |
@panic USER 92 In debug mode only, if aSrc is not aligned on a word boundary,
|
|
78 |
and the function is called on the user side.
|
|
79 |
@panic KERN-COMMON 92 In debug mode only, if aSrc is not aligned on a word boundary,
|
|
80 |
and the function is called on the kernel side.
|
|
81 |
@panic USER 93 In debug mode only, if aTrg is not aligned on a word boundary,
|
|
82 |
and the function is called on the user side.
|
|
83 |
@panic KERN-COMMON 93 In debug mode only, if aTrg is not aligned on a word boundary,
|
|
84 |
and the function is called on the kernel side.
|
|
85 |
*/
|
|
86 |
IMPORT_C TAny* wordmove(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
/**
|
|
92 |
@publishedAll
|
|
93 |
@released
|
|
94 |
|
|
95 |
A Nanokernel utility function that sets the specified number of bytes
|
|
96 |
to binary zero.
|
|
97 |
|
|
98 |
@param aTrg The start address.
|
|
99 |
@param aLength The number of bytes to be set.
|
|
100 |
|
|
101 |
@return The target address.
|
|
102 |
*/
|
|
103 |
IMPORT_C TAny* memclr(TAny* aTrg, unsigned int aLength);
|
|
104 |
}
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
#ifndef __TOOLS__
|
|
110 |
extern "C" {
|
|
111 |
/**
|
|
112 |
@publishedAll
|
|
113 |
@released
|
|
114 |
|
|
115 |
A Nanokernel utility function that sets all of the specified number of bytes to
|
|
116 |
the specified fill value.
|
|
117 |
|
|
118 |
@param aTrg The start address.
|
|
119 |
@param aValue The fill value (the first or junior byte).
|
|
120 |
@param aLength The number of bytes to be set.
|
|
121 |
|
|
122 |
@return The target address.
|
|
123 |
*/
|
|
124 |
IMPORT_C TAny* memset(TAny* aTrg, TInt aValue, unsigned int aLength);
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
/**
|
|
130 |
@publishedAll
|
|
131 |
@released
|
|
132 |
|
|
133 |
A Nanokernel utility function that copies bytes in memory.
|
|
134 |
|
|
135 |
@param aTrg The target address.
|
|
136 |
@param aSrc The source address.
|
|
137 |
@param aLength The number of bytes to be moved.
|
|
138 |
|
|
139 |
@return The target address.
|
|
140 |
*/
|
|
141 |
IMPORT_C TAny* memcpy(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
/**
|
|
147 |
@publishedAll
|
|
148 |
@released
|
|
149 |
|
|
150 |
A Nanokernel utility function that moves (copies) bytes in memory.
|
|
151 |
|
|
152 |
@param aTrg The target address.
|
|
153 |
@param aSrc The source address.
|
|
154 |
@param aLength The number of bytes to be moved.
|
|
155 |
|
|
156 |
@return The target address.
|
|
157 |
*/
|
|
158 |
IMPORT_C TAny* memmove(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
|
|
159 |
}
|
|
160 |
#else
|
|
161 |
#include <string.h>
|
|
162 |
#endif
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
/**
|
|
168 |
@publishedAll
|
|
169 |
@released
|
|
170 |
|
|
171 |
Tests whether the specified value is less than or equal to the
|
|
172 |
specified upper limit.
|
|
173 |
|
|
174 |
@param aVal The value to be tested.
|
|
175 |
@param aLimit The upper limit.
|
|
176 |
|
|
177 |
@return True, if the value is less than or equal to the specified upper limit;
|
|
178 |
false, otherwise.
|
|
179 |
*/
|
|
180 |
inline TInt Lim(TInt aVal,TUint aLimit)
|
|
181 |
{return(((TUint)aVal)<=aLimit);}
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
/**
|
|
187 |
@publishedAll
|
|
188 |
@released
|
|
189 |
|
|
190 |
Tests whether the specified value is strictly less than the
|
|
191 |
specified upper limit.
|
|
192 |
|
|
193 |
@param aVal The value to be tested.
|
|
194 |
@param aLimit The upper limit.
|
|
195 |
|
|
196 |
@return True, if the value is strictly less than the specified upper limit;
|
|
197 |
false, otherwise.
|
|
198 |
*/
|
|
199 |
inline TInt LimX(TInt aVal,TUint aLimit)
|
|
200 |
{return(((TUint)aVal)<aLimit);}
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
/**
|
|
206 |
@publishedAll
|
|
207 |
@released
|
|
208 |
|
|
209 |
Returns the smaller of two values.
|
|
210 |
|
|
211 |
@param aLeft The first value to be compared.
|
|
212 |
@param aRight The second value to be compared.
|
|
213 |
|
|
214 |
@return The smaller value.
|
|
215 |
*/
|
|
216 |
template <class T>
|
|
217 |
inline T Min(T aLeft,T aRight)
|
|
218 |
{return(aLeft<aRight ? aLeft : aRight);}
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
/**
|
|
224 |
@publishedAll
|
|
225 |
@released
|
|
226 |
|
|
227 |
Returns the smaller of two objects, where the right hand object is a treated
|
|
228 |
as a TInt for the purpose of comparison.
|
|
229 |
|
|
230 |
@param aLeft The first value to be compared.
|
|
231 |
@param aRight The second value to be compared.
|
|
232 |
|
|
233 |
@return The smaller value.
|
|
234 |
*/
|
|
235 |
template <class T>
|
|
236 |
inline T Min(T aLeft,TUint aRight)
|
|
237 |
{return(aLeft<(TInt)aRight ? aLeft : (T)aRight);}
|
|
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
|
242 |
/**
|
|
243 |
@publishedAll
|
|
244 |
@released
|
|
245 |
|
|
246 |
Returns the larger of two values.
|
|
247 |
|
|
248 |
@param aLeft The first value to be compared.
|
|
249 |
@param aRight The second value to be compared.
|
|
250 |
|
|
251 |
@return The larger value.
|
|
252 |
*/
|
|
253 |
template <class T>
|
|
254 |
inline T Max(T aLeft,T aRight)
|
|
255 |
{return(aLeft<aRight ? aRight : aLeft);}
|
|
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
/**
|
|
261 |
@publishedAll
|
|
262 |
@released
|
|
263 |
|
|
264 |
Returns the larger of two objects, where the right hand object is a treated
|
|
265 |
as a TInt for the purpose of comparison.
|
|
266 |
|
|
267 |
@param aLeft The first value to be compared.
|
|
268 |
@param aRight The second value to be compared.
|
|
269 |
|
|
270 |
@return The larger value.
|
|
271 |
*/
|
|
272 |
template <class T>
|
|
273 |
inline T Max(T aLeft,TUint aRight)
|
|
274 |
{return(aLeft<(TInt)aRight ? (TInt)aRight : aLeft);}
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
/**
|
|
280 |
@publishedAll
|
|
281 |
@released
|
|
282 |
|
|
283 |
Returns an absolute value.
|
|
284 |
|
|
285 |
@param aVal The source value.
|
|
286 |
|
|
287 |
@return The absolute value
|
|
288 |
*/
|
|
289 |
template <class T>
|
|
290 |
inline T Abs(T aVal)
|
|
291 |
{return(aVal<0 ? -aVal : aVal);}
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
/**
|
|
297 |
@publishedAll
|
|
298 |
@released
|
|
299 |
|
|
300 |
Determines whether a specified value lies within a defined range of values.
|
|
301 |
|
|
302 |
@param aMin The lower value of the range.
|
|
303 |
@param aVal The value to be compared.
|
|
304 |
@param aMax The higher value of the range.
|
|
305 |
|
|
306 |
@return True, if the specified value lies within the range; false, otherwise.
|
|
307 |
*/
|
|
308 |
template <class T>
|
|
309 |
inline TBool Rng(T aMin,T aVal,T aMax)
|
|
310 |
{return(aVal>=aMin && aVal<=aMax);}
|
|
311 |
|
|
312 |
|
|
313 |
|
|
314 |
|
|
315 |
/**
|
|
316 |
@publishedAll
|
|
317 |
@released
|
|
318 |
|
|
319 |
Adds a value to a pointer.
|
|
320 |
|
|
321 |
@param aPtr Pointer to an object of type T.
|
|
322 |
@param aVal The value to be added.
|
|
323 |
|
|
324 |
@return The resulting pointer value, as a pointer to a type T.
|
|
325 |
*/
|
|
326 |
template <class T,class S>
|
|
327 |
inline T* PtrAdd(T* aPtr,S aVal)
|
|
328 |
{return((T*)(((TUint8*)aPtr)+aVal));}
|
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
|
333 |
/**
|
|
334 |
@publishedAll
|
|
335 |
@released
|
|
336 |
|
|
337 |
Subtracts a value from a pointer.
|
|
338 |
|
|
339 |
@param aPtr Pointer to an object of type T.
|
|
340 |
@param aVal The value to be added.
|
|
341 |
|
|
342 |
@return The resulting pointer value, as a pointer to a type T.
|
|
343 |
*/
|
|
344 |
template <class T,class S>
|
|
345 |
inline T* PtrSub(T* aPtr,S aVal)
|
|
346 |
{return((T*)(((TUint8*)aPtr)-aVal));}
|
|
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
/**
|
|
352 |
@publishedAll
|
|
353 |
@released
|
|
354 |
|
|
355 |
Aligns the specified value onto a 2-byte boundary.
|
|
356 |
|
|
357 |
@param aValue The value to be aligned.
|
|
358 |
|
|
359 |
@return The aligned value.
|
|
360 |
*/
|
|
361 |
template <class T>
|
|
362 |
inline T Align2(T aValue)
|
|
363 |
{return((T)((((TUint)aValue)+sizeof(TUint16)-1)&~(sizeof(TUint16)-1)));}
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
/**
|
|
369 |
@publishedAll
|
|
370 |
@released
|
|
371 |
|
|
372 |
Aligns the specified value onto a 4-byte boundary.
|
|
373 |
|
|
374 |
@param aValue The value to be aligned.
|
|
375 |
|
|
376 |
@return The aligned value.
|
|
377 |
*/
|
|
378 |
template <class T>
|
|
379 |
inline T Align4(T aValue)
|
|
380 |
{return((T)((((TUint)aValue)+sizeof(TUint32)-1)&~(sizeof(TUint32)-1)));}
|
|
381 |
|
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
/**
|
|
386 |
@publishedAll
|
|
387 |
@released
|
|
388 |
|
|
389 |
A templated class which encapsulates a reference to an object within a wrapper.
|
|
390 |
|
|
391 |
The wrapper object can be passed to a function as a value type. This allows
|
|
392 |
a reference to be passed to a function as a value type.
|
|
393 |
|
|
394 |
This wrapper object is commonly termed a value reference.
|
|
395 |
*/
|
|
396 |
template <class T>
|
|
397 |
class TRefByValue
|
|
398 |
{
|
|
399 |
public:
|
|
400 |
inline TRefByValue(T& aRef);
|
|
401 |
inline operator T&();
|
|
402 |
private:
|
|
403 |
TRefByValue& operator=(TRefByValue aRef);
|
|
404 |
private:
|
|
405 |
T &iRef;
|
|
406 |
};
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
#if !defined (__KERNEL_MODE__)
|
|
412 |
class TDesC16; // forward declaration for TChar member functions
|
|
413 |
class TPtrC16; // forward declaration for TChar member functions
|
|
414 |
#endif
|
|
415 |
|
|
416 |
|
|
417 |
|
|
418 |
|
|
419 |
/**
|
|
420 |
@publishedAll
|
|
421 |
@released
|
|
422 |
|
|
423 |
Holds a character value and provides a number of utility functions to
|
|
424 |
manipulate it and test its properties.
|
|
425 |
|
|
426 |
For example, there are functions to convert the character
|
|
427 |
to uppercase and test whether or not it is a control character.
|
|
428 |
|
|
429 |
The character value is stored as a 32-bit unsigned integer. The shorthand
|
|
430 |
"TChar value" is used to describe the character value wrapped by a TChar
|
|
431 |
object.
|
|
432 |
|
|
433 |
TChar can be used to represent Unicode values outside plane 0 (that is, the
|
|
434 |
extended Unicode range from 0x10000 to 0xFFFFF). This differentiates it from
|
|
435 |
TText which can only be used for 16-bit Unicode character values.
|
|
436 |
|
|
437 |
@see TText
|
|
438 |
*/
|
|
439 |
class TChar
|
|
440 |
{
|
|
441 |
public:
|
|
442 |
|
|
443 |
|
|
444 |
/**
|
|
445 |
General Unicode character category.
|
|
446 |
|
|
447 |
The high nibble encodes the major category (Mark, Number, etc.) and a low
|
|
448 |
nibble encodes the subdivisions of that category.
|
|
449 |
|
|
450 |
The category codes can be used in three ways:
|
|
451 |
|
|
452 |
(i) as unique constants: there is one for each Unicode category, with a
|
|
453 |
name of the form
|
|
454 |
@code
|
|
455 |
E<XX>Category
|
|
456 |
@endcode
|
|
457 |
where
|
|
458 |
@code
|
|
459 |
<XX>
|
|
460 |
@endcode
|
|
461 |
is the category name given by
|
|
462 |
the Unicode database (e.g., the constant ELuCategory is used for lowercase
|
|
463 |
letters, category Lu);
|
|
464 |
|
|
465 |
(ii) as numbers in certain ranges: letter categories are all <= EMaxLetterCategory;
|
|
466 |
|
|
467 |
(iii) as codes in which the upper nibble gives the category group
|
|
468 |
(e.g., punctuation categories all yield TRUE for
|
|
469 |
the test (category & 0xF0) ==EPunctuationGroup).
|
|
470 |
*/
|
|
471 |
enum TCategory
|
|
472 |
{
|
|
473 |
/**
|
|
474 |
Alphabetic letters.
|
|
475 |
|
|
476 |
Includes ELuCategory, ELlCategory and ELtCategory.
|
|
477 |
*/
|
|
478 |
EAlphaGroup = 0x00,
|
|
479 |
|
|
480 |
|
|
481 |
/**
|
|
482 |
Other letters.
|
|
483 |
|
|
484 |
Includes ELoCategory.
|
|
485 |
*/
|
|
486 |
ELetterOtherGroup = 0x10,
|
|
487 |
|
|
488 |
|
|
489 |
/**
|
|
490 |
Letter modifiers.
|
|
491 |
|
|
492 |
Includes ELmCategory.
|
|
493 |
*/
|
|
494 |
ELetterModifierGroup = 0x20,
|
|
495 |
|
|
496 |
|
|
497 |
/**
|
|
498 |
Marks group.
|
|
499 |
|
|
500 |
Includes EMnCategory, EMcCategory and EMeCategory.
|
|
501 |
*/
|
|
502 |
EMarkGroup = 0x30,
|
|
503 |
|
|
504 |
|
|
505 |
/**
|
|
506 |
Numbers group.
|
|
507 |
|
|
508 |
Includes ENdCategory, ENlCategory and ENoCategory.
|
|
509 |
*/
|
|
510 |
ENumberGroup = 0x40,
|
|
511 |
|
|
512 |
|
|
513 |
/**
|
|
514 |
Punctuation group.
|
|
515 |
|
|
516 |
IncludesEPcCategory, PdCategory, EpeCategory, EPsCategory and EPoCategory.
|
|
517 |
*/
|
|
518 |
EPunctuationGroup = 0x50,
|
|
519 |
|
|
520 |
|
|
521 |
/**
|
|
522 |
Symbols group.
|
|
523 |
|
|
524 |
Includes ESmCategory, EScCategory, ESkCategory and ESoCategory.
|
|
525 |
*/
|
|
526 |
ESymbolGroup = 0x60,
|
|
527 |
|
|
528 |
|
|
529 |
/**
|
|
530 |
Separators group.
|
|
531 |
|
|
532 |
Includes EZsCategory, EZlCategory and EZlpCategory.
|
|
533 |
*/
|
|
534 |
ESeparatorGroup = 0x70,
|
|
535 |
|
|
536 |
|
|
537 |
/**
|
|
538 |
Control, format, private use, unassigned.
|
|
539 |
|
|
540 |
Includes ECcCategory, ECtCategory, ECsCategory,
|
|
541 |
ECoCategory and ECnCategory.
|
|
542 |
*/
|
|
543 |
EControlGroup = 0x80,
|
|
544 |
|
|
545 |
|
|
546 |
/**
|
|
547 |
The highest possible groups category.
|
|
548 |
*/
|
|
549 |
EMaxAssignedGroup = 0xE0,
|
|
550 |
|
|
551 |
|
|
552 |
/**
|
|
553 |
Unassigned to any other group.
|
|
554 |
*/
|
|
555 |
EUnassignedGroup = 0xF0,
|
|
556 |
|
|
557 |
|
|
558 |
/**
|
|
559 |
Letter, Uppercase.
|
|
560 |
*/
|
|
561 |
ELuCategory = EAlphaGroup | 0,
|
|
562 |
|
|
563 |
|
|
564 |
/**
|
|
565 |
Letter, Lowercase.
|
|
566 |
*/
|
|
567 |
ELlCategory = EAlphaGroup | 1,
|
|
568 |
|
|
569 |
|
|
570 |
/**
|
|
571 |
Letter, Titlecase.
|
|
572 |
*/
|
|
573 |
ELtCategory = EAlphaGroup | 2,
|
|
574 |
|
|
575 |
|
|
576 |
/**
|
|
577 |
Letter, Other.
|
|
578 |
*/
|
|
579 |
ELoCategory = ELetterOtherGroup | 0,
|
|
580 |
|
|
581 |
|
|
582 |
/**
|
|
583 |
The highest possible (non-modifier) letter category.
|
|
584 |
*/
|
|
585 |
EMaxLetterCategory = ELetterOtherGroup | 0x0F,
|
|
586 |
|
|
587 |
/**
|
|
588 |
Letter, Modifier.
|
|
589 |
*/
|
|
590 |
ELmCategory = ELetterModifierGroup | 0,
|
|
591 |
|
|
592 |
|
|
593 |
/**
|
|
594 |
The highest possible letter category.
|
|
595 |
*/
|
|
596 |
EMaxLetterOrLetterModifierCategory = ELetterModifierGroup | 0x0F,
|
|
597 |
|
|
598 |
/**
|
|
599 |
Mark, Non-Spacing
|
|
600 |
*/
|
|
601 |
EMnCategory = EMarkGroup | 0,
|
|
602 |
|
|
603 |
|
|
604 |
/**
|
|
605 |
Mark, Combining.
|
|
606 |
*/
|
|
607 |
EMcCategory = EMarkGroup | 1,
|
|
608 |
|
|
609 |
|
|
610 |
/**
|
|
611 |
Mark, Enclosing.
|
|
612 |
*/
|
|
613 |
EMeCategory = EMarkGroup | 2,
|
|
614 |
|
|
615 |
|
|
616 |
/**
|
|
617 |
Number, Decimal Digit.
|
|
618 |
*/
|
|
619 |
ENdCategory = ENumberGroup | 0,
|
|
620 |
|
|
621 |
|
|
622 |
/**
|
|
623 |
Number, Letter.
|
|
624 |
*/
|
|
625 |
ENlCategory = ENumberGroup | 1,
|
|
626 |
|
|
627 |
|
|
628 |
/**
|
|
629 |
Number, Other.
|
|
630 |
*/
|
|
631 |
ENoCategory = ENumberGroup | 2,
|
|
632 |
|
|
633 |
|
|
634 |
/**
|
|
635 |
Punctuation, Connector.
|
|
636 |
*/
|
|
637 |
EPcCategory = EPunctuationGroup | 0,
|
|
638 |
|
|
639 |
|
|
640 |
/**
|
|
641 |
Punctuation, Dash.
|
|
642 |
*/
|
|
643 |
EPdCategory = EPunctuationGroup | 1,
|
|
644 |
|
|
645 |
|
|
646 |
/**
|
|
647 |
Punctuation, Open.
|
|
648 |
*/
|
|
649 |
EPsCategory = EPunctuationGroup | 2,
|
|
650 |
|
|
651 |
|
|
652 |
/**
|
|
653 |
Punctuation, Close.
|
|
654 |
*/
|
|
655 |
EPeCategory = EPunctuationGroup | 3,
|
|
656 |
|
|
657 |
|
|
658 |
/**
|
|
659 |
Punctuation, Initial Quote
|
|
660 |
*/
|
|
661 |
EPiCategory = EPunctuationGroup | 4,
|
|
662 |
|
|
663 |
|
|
664 |
/**
|
|
665 |
Punctuation, Final Quote
|
|
666 |
*/
|
|
667 |
EPfCategory = EPunctuationGroup | 5,
|
|
668 |
|
|
669 |
|
|
670 |
/**
|
|
671 |
Punctuation, Other.
|
|
672 |
*/
|
|
673 |
EPoCategory = EPunctuationGroup | 6,
|
|
674 |
|
|
675 |
|
|
676 |
/**
|
|
677 |
Symbol, Math.
|
|
678 |
*/
|
|
679 |
ESmCategory = ESymbolGroup | 0,
|
|
680 |
|
|
681 |
|
|
682 |
/**
|
|
683 |
Symbol, Currency.
|
|
684 |
*/
|
|
685 |
EScCategory = ESymbolGroup | 1,
|
|
686 |
|
|
687 |
|
|
688 |
/**
|
|
689 |
Symbol, Modifier.
|
|
690 |
*/
|
|
691 |
ESkCategory = ESymbolGroup | 2,
|
|
692 |
|
|
693 |
|
|
694 |
/**
|
|
695 |
Symbol, Other.
|
|
696 |
*/
|
|
697 |
ESoCategory = ESymbolGroup | 3,
|
|
698 |
|
|
699 |
|
|
700 |
/**
|
|
701 |
The highest possible graphic character category.
|
|
702 |
*/
|
|
703 |
EMaxGraphicCategory = ESymbolGroup | 0x0F,
|
|
704 |
|
|
705 |
|
|
706 |
/**
|
|
707 |
Separator, Space.
|
|
708 |
*/
|
|
709 |
EZsCategory = ESeparatorGroup | 0,
|
|
710 |
|
|
711 |
|
|
712 |
/**
|
|
713 |
The highest possible printable character category.
|
|
714 |
*/
|
|
715 |
EMaxPrintableCategory = EZsCategory,
|
|
716 |
|
|
717 |
|
|
718 |
/**
|
|
719 |
Separator, Line.
|
|
720 |
*/
|
|
721 |
EZlCategory = ESeparatorGroup | 1,
|
|
722 |
|
|
723 |
|
|
724 |
/**
|
|
725 |
Separator, Paragraph.
|
|
726 |
*/
|
|
727 |
EZpCategory = ESeparatorGroup | 2,
|
|
728 |
|
|
729 |
|
|
730 |
/**
|
|
731 |
Other, Control.
|
|
732 |
*/
|
|
733 |
ECcCategory = EControlGroup | 0,
|
|
734 |
|
|
735 |
|
|
736 |
/**
|
|
737 |
Other, Format.
|
|
738 |
*/
|
|
739 |
ECfCategory = EControlGroup | 1,
|
|
740 |
|
|
741 |
|
|
742 |
/**
|
|
743 |
The highest possible category for assigned 16-bit characters; does not
|
|
744 |
include surrogates, which are interpreted as pairs and have no meaning
|
|
745 |
on their own.
|
|
746 |
*/
|
|
747 |
EMaxAssignedCategory = EMaxAssignedGroup | 0x0F,
|
|
748 |
|
|
749 |
|
|
750 |
/**
|
|
751 |
Other, Surrogate.
|
|
752 |
*/
|
|
753 |
ECsCategory = EUnassignedGroup | 0,
|
|
754 |
|
|
755 |
|
|
756 |
/**
|
|
757 |
Other, Private Use.
|
|
758 |
*/
|
|
759 |
ECoCategory = EUnassignedGroup | 1,
|
|
760 |
|
|
761 |
|
|
762 |
/**
|
|
763 |
Other, Not Assigned.
|
|
764 |
*/
|
|
765 |
ECnCategory = EUnassignedGroup | 2
|
|
766 |
};
|
|
767 |
|
|
768 |
|
|
769 |
/**
|
|
770 |
The bi-directional Unicode character category.
|
|
771 |
|
|
772 |
For more information on the bi-directional algorithm, see Unicode Technical
|
|
773 |
Report No. 9 available at: http://www.unicode.org/unicode/reports/tr9.
|
|
774 |
*/
|
|
775 |
enum TBdCategory
|
|
776 |
{
|
|
777 |
/**
|
|
778 |
Left to right.
|
|
779 |
*/
|
|
780 |
ELeftToRight, // L Left-to-Right
|
|
781 |
|
|
782 |
|
|
783 |
/**
|
|
784 |
Left to right embedding.
|
|
785 |
*/
|
|
786 |
ELeftToRightEmbedding, // LRE Left-to-Right Embedding
|
|
787 |
|
|
788 |
|
|
789 |
/**
|
|
790 |
Left-to-Right Override.
|
|
791 |
*/
|
|
792 |
ELeftToRightOverride, // LRO Left-to-Right Override
|
|
793 |
|
|
794 |
|
|
795 |
/**
|
|
796 |
Right to left.
|
|
797 |
*/
|
|
798 |
ERightToLeft, // R Right-to-Left
|
|
799 |
|
|
800 |
|
|
801 |
/**
|
|
802 |
Right to left Arabic.
|
|
803 |
*/
|
|
804 |
ERightToLeftArabic, // AL Right-to-Left Arabic
|
|
805 |
|
|
806 |
|
|
807 |
/**
|
|
808 |
Right to left embedding.
|
|
809 |
*/
|
|
810 |
ERightToLeftEmbedding, // RLE Right-to-Left Embedding
|
|
811 |
|
|
812 |
|
|
813 |
/**
|
|
814 |
Right-to-Left Override.
|
|
815 |
*/
|
|
816 |
ERightToLeftOverride, // RLO Right-to-Left Override
|
|
817 |
|
|
818 |
|
|
819 |
/**
|
|
820 |
Pop Directional Format.
|
|
821 |
*/
|
|
822 |
EPopDirectionalFormat, // PDF Pop Directional Format
|
|
823 |
|
|
824 |
|
|
825 |
/**
|
|
826 |
European number.
|
|
827 |
*/
|
|
828 |
EEuropeanNumber, // EN European Number
|
|
829 |
|
|
830 |
|
|
831 |
/**
|
|
832 |
European number separator.
|
|
833 |
*/
|
|
834 |
EEuropeanNumberSeparator, // ES European Number Separator
|
|
835 |
|
|
836 |
|
|
837 |
/**
|
|
838 |
European number terminator.
|
|
839 |
*/
|
|
840 |
EEuropeanNumberTerminator, // ET European Number Terminator
|
|
841 |
|
|
842 |
|
|
843 |
/**
|
|
844 |
Arabic number.
|
|
845 |
*/
|
|
846 |
EArabicNumber, // AN Arabic Number
|
|
847 |
|
|
848 |
|
|
849 |
/**
|
|
850 |
Common number separator.
|
|
851 |
*/
|
|
852 |
ECommonNumberSeparator, // CS Common Number Separator
|
|
853 |
|
|
854 |
|
|
855 |
/**
|
|
856 |
Non Spacing Mark.
|
|
857 |
*/
|
|
858 |
ENonSpacingMark, // NSM Non-Spacing Mark
|
|
859 |
|
|
860 |
|
|
861 |
/**
|
|
862 |
Boundary Neutral.
|
|
863 |
*/
|
|
864 |
EBoundaryNeutral, // BN Boundary Neutral
|
|
865 |
|
|
866 |
|
|
867 |
/**
|
|
868 |
Paragraph Separator.
|
|
869 |
*/
|
|
870 |
EParagraphSeparator, // B Paragraph Separator
|
|
871 |
|
|
872 |
|
|
873 |
/**
|
|
874 |
Segment separator.
|
|
875 |
*/
|
|
876 |
ESegmentSeparator, // S Segment Separator
|
|
877 |
|
|
878 |
|
|
879 |
/**
|
|
880 |
Whitespace
|
|
881 |
*/
|
|
882 |
EWhitespace, // WS Whitespace
|
|
883 |
|
|
884 |
|
|
885 |
/**
|
|
886 |
Other neutrals; all other characters: punctuation, symbols.
|
|
887 |
*/
|
|
888 |
EOtherNeutral // ON Other Neutrals
|
|
889 |
};
|
|
890 |
|
|
891 |
|
|
892 |
/**
|
|
893 |
Notional character width as known to East Asian (Chinese, Japanese,
|
|
894 |
Korean (CJK)) coding systems.
|
|
895 |
*/
|
|
896 |
enum TCjkWidth
|
|
897 |
{
|
|
898 |
/**
|
|
899 |
Includes 'ambiguous width' defined in Unicode Technical Report 11: East Asian Width
|
|
900 |
*/
|
|
901 |
ENeutralWidth,
|
|
902 |
|
|
903 |
|
|
904 |
/**
|
|
905 |
Character which occupies a single cell.
|
|
906 |
*/
|
|
907 |
EHalfWidth, // other categories are as defined in the report
|
|
908 |
|
|
909 |
|
|
910 |
/**
|
|
911 |
Character which occupies 2 cells.
|
|
912 |
*/
|
|
913 |
EFullWidth,
|
|
914 |
|
|
915 |
|
|
916 |
/**
|
|
917 |
Characters that are always narrow and have explicit full-width
|
|
918 |
counterparts. All of ASCII is an example of East Asian Narrow
|
|
919 |
characters.
|
|
920 |
*/
|
|
921 |
ENarrow,
|
|
922 |
|
|
923 |
/**
|
|
924 |
Characters that are always wide. This category includes characters that
|
|
925 |
have explicit half-width counterparts.
|
|
926 |
*/
|
|
927 |
EWide
|
|
928 |
};
|
|
929 |
|
|
930 |
|
|
931 |
/**
|
|
932 |
@deprecated
|
|
933 |
|
|
934 |
Encoding systems used by the translation functions.
|
|
935 |
*/
|
|
936 |
enum TEncoding
|
|
937 |
{
|
|
938 |
/**
|
|
939 |
The Unicode encoding.
|
|
940 |
*/
|
|
941 |
EUnicode,
|
|
942 |
|
|
943 |
|
|
944 |
/**
|
|
945 |
The shift-JIS encoding (used in Japan).
|
|
946 |
*/
|
|
947 |
EShiftJIS
|
|
948 |
};
|
|
949 |
|
|
950 |
|
|
951 |
/**
|
|
952 |
Flags defining operations to be performed using TChar::Fold().
|
|
953 |
|
|
954 |
The flag values are passed to the Fold() funtion.
|
|
955 |
|
|
956 |
@see TChar::Fold
|
|
957 |
*/
|
|
958 |
enum
|
|
959 |
{
|
|
960 |
/**
|
|
961 |
Convert characters to their lower case form if any.
|
|
962 |
*/
|
|
963 |
EFoldCase = 1,
|
|
964 |
|
|
965 |
|
|
966 |
/**
|
|
967 |
Strip accents
|
|
968 |
*/
|
|
969 |
EFoldAccents = 2,
|
|
970 |
|
|
971 |
|
|
972 |
/**
|
|
973 |
Convert digits representing values 0..9 to characters '0'..'9'
|
|
974 |
*/
|
|
975 |
EFoldDigits = 4,
|
|
976 |
|
|
977 |
|
|
978 |
/**
|
|
979 |
Convert all spaces (ordinary, fixed-width, ideographic, etc.) to ' '
|
|
980 |
*/
|
|
981 |
EFoldSpaces = 8,
|
|
982 |
|
|
983 |
|
|
984 |
/**
|
|
985 |
Convert hiragana to katakana.
|
|
986 |
*/
|
|
987 |
EFoldKana = 16,
|
|
988 |
|
|
989 |
|
|
990 |
/**
|
|
991 |
Fold fullwidth and halfwidth variants to their standard forms
|
|
992 |
*/
|
|
993 |
EFoldWidth = 32,
|
|
994 |
|
|
995 |
|
|
996 |
/**
|
|
997 |
Perform standard folding operations, i.e.those done by Fold() with no argument
|
|
998 |
*/
|
|
999 |
EFoldStandard = EFoldCase | EFoldAccents | EFoldDigits | EFoldSpaces,
|
|
1000 |
|
|
1001 |
|
|
1002 |
/**
|
|
1003 |
Perform all possible folding operations
|
|
1004 |
*/
|
|
1005 |
EFoldAll = -1
|
|
1006 |
};
|
|
1007 |
|
|
1008 |
|
|
1009 |
struct TCharInfo
|
|
1010 |
/**
|
|
1011 |
A structure to hold information about a Unicode character.
|
|
1012 |
|
|
1013 |
An object of this type is passed to TChar::GetInfo().
|
|
1014 |
|
|
1015 |
@see TChar::GetInfo
|
|
1016 |
*/
|
|
1017 |
{
|
|
1018 |
/**
|
|
1019 |
General category.
|
|
1020 |
*/
|
|
1021 |
TCategory iCategory;
|
|
1022 |
|
|
1023 |
|
|
1024 |
/**
|
|
1025 |
Bi-directional category.
|
|
1026 |
*/
|
|
1027 |
TBdCategory iBdCategory;
|
|
1028 |
|
|
1029 |
|
|
1030 |
/**
|
|
1031 |
Combining class: number (currently) in the range 0..234
|
|
1032 |
*/
|
|
1033 |
TInt iCombiningClass;
|
|
1034 |
|
|
1035 |
|
|
1036 |
/**
|
|
1037 |
Lower case form.
|
|
1038 |
*/
|
|
1039 |
TUint iLowerCase;
|
|
1040 |
|
|
1041 |
|
|
1042 |
/**
|
|
1043 |
Upper case form.
|
|
1044 |
*/
|
|
1045 |
TUint iUpperCase;
|
|
1046 |
|
|
1047 |
|
|
1048 |
/**
|
|
1049 |
Title case form.
|
|
1050 |
*/
|
|
1051 |
TUint iTitleCase;
|
|
1052 |
|
|
1053 |
|
|
1054 |
/**
|
|
1055 |
True, if the character is mirrored.
|
|
1056 |
*/
|
|
1057 |
TBool iMirrored;
|
|
1058 |
|
|
1059 |
|
|
1060 |
/**
|
|
1061 |
Integer numeric value: -1 if none, -2 if a fraction.
|
|
1062 |
*/
|
|
1063 |
TInt iNumericValue;
|
|
1064 |
};
|
|
1065 |
|
|
1066 |
inline TChar();
|
|
1067 |
inline TChar(TUint aChar);
|
|
1068 |
inline TChar& operator-=(TUint aChar);
|
|
1069 |
inline TChar& operator+=(TUint aChar);
|
|
1070 |
inline TChar operator-(TUint aChar);
|
|
1071 |
inline TChar operator+(TUint aChar);
|
|
1072 |
inline operator TUint() const;
|
|
1073 |
#ifndef __KERNEL_MODE__
|
|
1074 |
inline void Fold();
|
|
1075 |
inline void LowerCase();
|
|
1076 |
inline void UpperCase();
|
|
1077 |
inline TBool Eos() const;
|
|
1078 |
IMPORT_C TUint GetUpperCase() const;
|
|
1079 |
IMPORT_C TUint GetLowerCase() const;
|
|
1080 |
IMPORT_C TBool IsLower() const;
|
|
1081 |
IMPORT_C TBool IsUpper() const;
|
|
1082 |
IMPORT_C TBool IsAlpha() const;
|
|
1083 |
IMPORT_C TBool IsDigit() const;
|
|
1084 |
IMPORT_C TBool IsAlphaDigit() const;
|
|
1085 |
IMPORT_C TBool IsHexDigit() const;
|
|
1086 |
IMPORT_C TBool IsSpace() const;
|
|
1087 |
IMPORT_C TBool IsPunctuation() const;
|
|
1088 |
IMPORT_C TBool IsGraph() const;
|
|
1089 |
IMPORT_C TBool IsPrint() const;
|
|
1090 |
IMPORT_C TBool IsControl() const;
|
|
1091 |
inline void Fold(TInt aFlags);
|
|
1092 |
inline void TitleCase();
|
|
1093 |
IMPORT_C TUint GetTitleCase() const;
|
|
1094 |
IMPORT_C TBool IsTitle() const;
|
|
1095 |
IMPORT_C TBool IsAssigned() const;
|
|
1096 |
IMPORT_C void GetInfo(TCharInfo& aInfo) const;
|
|
1097 |
IMPORT_C TCategory GetCategory() const;
|
|
1098 |
IMPORT_C TBdCategory GetBdCategory() const;
|
|
1099 |
IMPORT_C TInt GetCombiningClass() const;
|
|
1100 |
IMPORT_C TBool IsMirrored() const;
|
|
1101 |
IMPORT_C TInt GetNumericValue() const;
|
|
1102 |
IMPORT_C TCjkWidth GetCjkWidth() const;
|
|
1103 |
IMPORT_C static TBool Compose(TUint& aResult,const TDesC16& aSource);
|
|
1104 |
IMPORT_C TBool Decompose(TPtrC16& aResult) const;
|
|
1105 |
|
|
1106 |
protected:
|
|
1107 |
inline void SetChar(TUint aChar);
|
|
1108 |
#endif
|
|
1109 |
private:
|
|
1110 |
TUint iChar;
|
|
1111 |
__DECLARE_TEST;
|
|
1112 |
};
|
|
1113 |
|
|
1114 |
#include <e32des8.h>
|
|
1115 |
#ifndef __KERNEL_MODE__
|
|
1116 |
#include <e32des16.h>
|
|
1117 |
#endif
|
|
1118 |
|
|
1119 |
|
|
1120 |
|
|
1121 |
|
|
1122 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
|
|
1123 |
#define __Size (sizeof(TUint)/sizeof(TUint16))
|
|
1124 |
/**
|
|
1125 |
@publishedAll
|
|
1126 |
@released
|
|
1127 |
|
|
1128 |
Defines a build-independent non-modifiable descriptor.
|
|
1129 |
|
|
1130 |
A 16-bit build variant is generated for a Unicode, non-kernel
|
|
1131 |
mode build.
|
|
1132 |
|
|
1133 |
A build-independent type should always be used unless an explicit 8-bit
|
|
1134 |
or 16-bit type is required.
|
|
1135 |
|
|
1136 |
@see TDesC8
|
|
1137 |
@see TDesC16
|
|
1138 |
*/
|
|
1139 |
typedef TDesC16 TDesC;
|
|
1140 |
|
|
1141 |
|
|
1142 |
|
|
1143 |
|
|
1144 |
/**
|
|
1145 |
@publishedAll
|
|
1146 |
@released
|
|
1147 |
|
|
1148 |
Defines a build-independent non-modifiable pointer descriptor.
|
|
1149 |
|
|
1150 |
A 16-bit build variant is generated for a Unicode, non-kernel
|
|
1151 |
mode build.
|
|
1152 |
|
|
1153 |
A build-independent type should always be used unless an explicit 8-bit
|
|
1154 |
or 16-bit type is required.
|
|
1155 |
|
|
1156 |
@see TPtrC8
|
|
1157 |
@see TPtrC16
|
|
1158 |
*/
|
|
1159 |
typedef TPtrC16 TPtrC;
|
|
1160 |
|
|
1161 |
|
|
1162 |
|
|
1163 |
|
|
1164 |
/**
|
|
1165 |
@publishedAll
|
|
1166 |
@released
|
|
1167 |
|
|
1168 |
Defines a build-independent modifiable descriptor.
|
|
1169 |
|
|
1170 |
A 16-bit build variant is generated for a Unicode, non-kernel
|
|
1171 |
mode build.
|
|
1172 |
|
|
1173 |
A build-independent type should always be used unless an explicit 8-bit
|
|
1174 |
or 16-bit type is required.
|
|
1175 |
|
|
1176 |
@see TDes8
|
|
1177 |
@see TDes16
|
|
1178 |
*/
|
|
1179 |
typedef TDes16 TDes;
|
|
1180 |
|
|
1181 |
|
|
1182 |
|
|
1183 |
|
|
1184 |
/**
|
|
1185 |
@publishedAll
|
|
1186 |
@released
|
|
1187 |
|
|
1188 |
Defines a build-independent modifiable pointer descriptor.
|
|
1189 |
|
|
1190 |
A 16-bit build variant is generated for a Unicode, non-kernel
|
|
1191 |
mode build.
|
|
1192 |
|
|
1193 |
A build-independent type should always be used unless an explicit 8-bit
|
|
1194 |
or 16-bit type is required.
|
|
1195 |
|
|
1196 |
@see TPtr8
|
|
1197 |
@see TPtr16
|
|
1198 |
*/
|
|
1199 |
typedef TPtr16 TPtr;
|
|
1200 |
|
|
1201 |
|
|
1202 |
|
|
1203 |
|
|
1204 |
#ifndef __KERNEL_MODE__
|
|
1205 |
/**
|
|
1206 |
@publishedAll
|
|
1207 |
@released
|
|
1208 |
|
|
1209 |
Defines a build-independent heap descriptor.
|
|
1210 |
|
|
1211 |
A 16-bit build variant is generated for a Unicode, non-kernel
|
|
1212 |
mode build.
|
|
1213 |
|
|
1214 |
A build-independent type should always be used unless an explicit 8-bit
|
|
1215 |
or 16-bit type is required.
|
|
1216 |
|
|
1217 |
@see HBufC8
|
|
1218 |
@see HBufC16
|
|
1219 |
*/
|
|
1220 |
typedef HBufC16 HBufC;
|
|
1221 |
|
|
1222 |
|
|
1223 |
|
|
1224 |
|
|
1225 |
/**
|
|
1226 |
@publishedAll
|
|
1227 |
@released
|
|
1228 |
|
|
1229 |
Defines a build-independent descriptor overflow handler.
|
|
1230 |
|
|
1231 |
A 16-bit build variant is generated for a Unicode, non-kernel
|
|
1232 |
mode build.
|
|
1233 |
|
|
1234 |
A build-independent type should always be used unless an explicit 8-bit
|
|
1235 |
or 16-bit type is required.
|
|
1236 |
|
|
1237 |
@see TDes8Overflow
|
|
1238 |
@see TDes16Overflow
|
|
1239 |
*/
|
|
1240 |
typedef TDes16Overflow TDesOverflow;
|
|
1241 |
|
|
1242 |
|
|
1243 |
/**
|
|
1244 |
@publishedAll
|
|
1245 |
@released
|
|
1246 |
|
|
1247 |
Defines a build-independent resizable buffer descriptor.
|
|
1248 |
|
|
1249 |
A 16-bit build variant is generated for a Unicode, non-kernel mode build.
|
|
1250 |
|
|
1251 |
A build-independent type should always be used unless an explicit 8-bit
|
|
1252 |
or 16-bit type is required.
|
|
1253 |
|
|
1254 |
@see RBuf8
|
|
1255 |
@see RBuf16
|
|
1256 |
*/
|
|
1257 |
typedef RBuf16 RBuf;
|
|
1258 |
|
|
1259 |
#endif
|
|
1260 |
#else
|
|
1261 |
#define __Size (sizeof(TUint)/sizeof(TUint8))
|
|
1262 |
|
|
1263 |
|
|
1264 |
|
|
1265 |
|
|
1266 |
/**
|
|
1267 |
@publishedAll
|
|
1268 |
@released
|
|
1269 |
|
|
1270 |
Defines a build-independent non-modifiable descriptor.
|
|
1271 |
|
|
1272 |
An 8-bit build variant is generated for a non-Unicode build.
|
|
1273 |
|
|
1274 |
This build-independent type should always be used unless an explicit 8-bit
|
|
1275 |
or 16-bit build variant is required.
|
|
1276 |
|
|
1277 |
@see TDesC8
|
|
1278 |
@see TDesC16
|
|
1279 |
*/
|
|
1280 |
typedef TDesC8 TDesC;
|
|
1281 |
|
|
1282 |
|
|
1283 |
|
|
1284 |
|
|
1285 |
/**
|
|
1286 |
@publishedAll
|
|
1287 |
@released
|
|
1288 |
|
|
1289 |
Defines a build-independent non-modifiable pointer descriptor.
|
|
1290 |
|
|
1291 |
An 8-bit build variant is generated for a non-Unicode build.
|
|
1292 |
|
|
1293 |
This build-independent type should always be used unless an explicit 8-bit
|
|
1294 |
or 16-bit build variant is required.
|
|
1295 |
|
|
1296 |
@see TPtrC8
|
|
1297 |
@see TPtrC16
|
|
1298 |
*/
|
|
1299 |
typedef TPtrC8 TPtrC;
|
|
1300 |
|
|
1301 |
|
|
1302 |
|
|
1303 |
|
|
1304 |
/**
|
|
1305 |
@publishedAll
|
|
1306 |
@released
|
|
1307 |
|
|
1308 |
Defines a build-independent modifiable descriptor.
|
|
1309 |
|
|
1310 |
An 8-bit build variant is generated for a non-Unicode build.
|
|
1311 |
|
|
1312 |
This build-independent type should always be used unless an explicit 8-bit
|
|
1313 |
or 16-bit build variant is required.
|
|
1314 |
|
|
1315 |
@see TDes8
|
|
1316 |
@see TDes16
|
|
1317 |
*/
|
|
1318 |
typedef TDes8 TDes;
|
|
1319 |
|
|
1320 |
|
|
1321 |
|
|
1322 |
|
|
1323 |
/**
|
|
1324 |
@publishedAll
|
|
1325 |
@released
|
|
1326 |
|
|
1327 |
Defines a build-independent modifiable pointer descriptor.
|
|
1328 |
|
|
1329 |
An 8-bit build variant is generated for a non-Unicode build.
|
|
1330 |
|
|
1331 |
This build-independent type should always be used unless an explicit 8-bit
|
|
1332 |
or 16-bit build variant is required.
|
|
1333 |
|
|
1334 |
@see TPtr8
|
|
1335 |
@see TPtr16
|
|
1336 |
*/
|
|
1337 |
typedef TPtr8 TPtr;
|
|
1338 |
#ifndef __KERNEL_MODE__
|
|
1339 |
|
|
1340 |
|
|
1341 |
|
|
1342 |
|
|
1343 |
/**
|
|
1344 |
@publishedAll
|
|
1345 |
@released
|
|
1346 |
|
|
1347 |
Defines a build-independent heap descriptor.
|
|
1348 |
|
|
1349 |
An 8-bit build variant is generated for a non-Unicode, non-kernel
|
|
1350 |
mode build.
|
|
1351 |
|
|
1352 |
This build-independent type should always be used unless an explicit 8-bit
|
|
1353 |
or 16-bit build variant is required.
|
|
1354 |
|
|
1355 |
@see HBufC8
|
|
1356 |
@see HBufC16
|
|
1357 |
*/
|
|
1358 |
typedef HBufC8 HBufC;
|
|
1359 |
|
|
1360 |
|
|
1361 |
|
|
1362 |
|
|
1363 |
/**
|
|
1364 |
@publishedAll
|
|
1365 |
@released
|
|
1366 |
|
|
1367 |
Defines a build-independent descriptor overflow handler.
|
|
1368 |
|
|
1369 |
An 8-bit build variant is generated for a non-Unicode, non-kernel
|
|
1370 |
mode build.
|
|
1371 |
|
|
1372 |
This build-independent type should always be used unless an explicit 8-bit
|
|
1373 |
or 16-bit build variant is required.
|
|
1374 |
|
|
1375 |
@see TDes8Overflow
|
|
1376 |
@see TDes16Overflow
|
|
1377 |
*/
|
|
1378 |
typedef TDes8Overflow TDesOverflow;
|
|
1379 |
|
|
1380 |
|
|
1381 |
/**
|
|
1382 |
@publishedAll
|
|
1383 |
@released
|
|
1384 |
|
|
1385 |
Defines a build-independent resizable buffer descriptor.
|
|
1386 |
|
|
1387 |
An 8-bit build variant is generated for a non-Unicode, non-kernel mode build.
|
|
1388 |
|
|
1389 |
This build-independent type should always be used unless an explicit 8-bit
|
|
1390 |
or 16-bit build variant is required.
|
|
1391 |
|
|
1392 |
@see RBuf8
|
|
1393 |
@see RBuf16
|
|
1394 |
*/
|
|
1395 |
typedef RBuf8 RBuf;
|
|
1396 |
|
|
1397 |
#endif
|
|
1398 |
#endif
|
|
1399 |
|
|
1400 |
|
|
1401 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
|
|
1402 |
typedef TBufCBase16 TBufCBase;
|
|
1403 |
#else
|
|
1404 |
typedef TBufCBase8 TBufCBase;
|
|
1405 |
#endif
|
|
1406 |
|
|
1407 |
/**
|
|
1408 |
@publishedAll
|
|
1409 |
@released
|
|
1410 |
|
|
1411 |
A build-independent non-modifiable buffer descriptor.
|
|
1412 |
|
|
1413 |
This is a descriptor class which provides a buffer of fixed length for
|
|
1414 |
containing and accessing TUint16 or TUint8 data, depending on the build.
|
|
1415 |
|
|
1416 |
The class intended for instantiation. The data that the descriptor represents
|
|
1417 |
is part of the descriptor object itself.
|
|
1418 |
|
|
1419 |
The class is templated, based on an integer value which defines the size of
|
|
1420 |
the descriptor's data area.
|
|
1421 |
|
|
1422 |
The data is intended to be accessed, but not modified; however, it can be
|
|
1423 |
completely replaced using the assignment operators of this class. The base
|
|
1424 |
class provides the functions through which the data is accessed.
|
|
1425 |
|
|
1426 |
This class derives from TBufCBase16 for a Unicode, non-kernel build, but
|
|
1427 |
derives from TBufCBase8 for a non-Unicode build.
|
|
1428 |
|
|
1429 |
@see TDesC
|
|
1430 |
@see TDesC8
|
|
1431 |
@see TDesC16
|
|
1432 |
@see TPtr
|
|
1433 |
@see TPtr8
|
|
1434 |
@see TPtr16
|
|
1435 |
@see TBufC8
|
|
1436 |
@see TBufC16
|
|
1437 |
*/
|
|
1438 |
template <TInt S>
|
|
1439 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
|
|
1440 |
class TBufC : public TBufCBase16
|
|
1441 |
#else
|
|
1442 |
class TBufC : public TBufCBase8
|
|
1443 |
#endif
|
|
1444 |
{
|
|
1445 |
public:
|
|
1446 |
inline TBufC();
|
|
1447 |
inline TBufC(const TText* aString);
|
|
1448 |
inline TBufC(const TDesC& aDes);
|
|
1449 |
inline TBufC<S>& operator=(const TText* aString);
|
|
1450 |
inline TBufC<S>& operator=(const TDesC& aDes);
|
|
1451 |
inline TPtr Des();
|
|
1452 |
private:
|
|
1453 |
TText iBuf[__Align(S)];
|
|
1454 |
};
|
|
1455 |
|
|
1456 |
|
|
1457 |
|
|
1458 |
/**
|
|
1459 |
@publishedAll
|
|
1460 |
@released
|
|
1461 |
|
|
1462 |
A build-independent modifiable buffer descriptor.
|
|
1463 |
|
|
1464 |
This is a descriptor class which provides a buffer of fixed length for
|
|
1465 |
containing, accessing and manipulating TUint16 or TUint8 data, depending
|
|
1466 |
on the build.
|
|
1467 |
|
|
1468 |
The class is intended for instantiation. The data that the descriptor represents
|
|
1469 |
is part of the descriptor object itself.
|
|
1470 |
|
|
1471 |
The class is templated, based on an integer value which determines the size
|
|
1472 |
of the data area created as part of the buffer descriptor object; this is
|
|
1473 |
also the maximum length of the descriptor.
|
|
1474 |
|
|
1475 |
The data is intended to be both accessed and modified. The base classes provide
|
|
1476 |
the functions through which the data is accessed.
|
|
1477 |
|
|
1478 |
This class derives from TBufCBase16 for a Unicode, non-kernel build, but
|
|
1479 |
derives from TBufCBase8 for a non-Unicode build.
|
|
1480 |
|
|
1481 |
@see TDesC
|
|
1482 |
@see TDesC8
|
|
1483 |
@see TDesC16
|
|
1484 |
@see TDes
|
|
1485 |
@see TDes8
|
|
1486 |
@see TDes16
|
|
1487 |
@see TPtr
|
|
1488 |
@see TPtr8
|
|
1489 |
@see TPtr16
|
|
1490 |
*/
|
|
1491 |
template <TInt S>
|
|
1492 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
|
|
1493 |
class TBuf : public TBufBase16
|
|
1494 |
#else
|
|
1495 |
class TBuf : public TBufBase8
|
|
1496 |
#endif
|
|
1497 |
{
|
|
1498 |
public:
|
|
1499 |
inline TBuf();
|
|
1500 |
inline explicit TBuf(TInt aLength);
|
|
1501 |
inline TBuf(const TText* aString);
|
|
1502 |
inline TBuf(const TDesC& aDes);
|
|
1503 |
inline TBuf<S>& operator=(const TText* aString);
|
|
1504 |
inline TBuf<S>& operator=(const TDesC& aDes);
|
|
1505 |
inline TBuf<S>& operator=(const TBuf<S>& aBuf);
|
|
1506 |
private:
|
|
1507 |
TText iBuf[__Align(S)];
|
|
1508 |
};
|
|
1509 |
|
|
1510 |
|
|
1511 |
|
|
1512 |
|
|
1513 |
/**
|
|
1514 |
@publishedAll
|
|
1515 |
@released
|
|
1516 |
|
|
1517 |
Value reference used in operator TLitC::__TRefDesC().
|
|
1518 |
|
|
1519 |
@see TRefByValue
|
|
1520 |
*/
|
|
1521 |
typedef TRefByValue<const TDesC> __TRefDesC;
|
|
1522 |
|
|
1523 |
|
|
1524 |
|
|
1525 |
|
|
1526 |
/**
|
|
1527 |
@publishedAll
|
|
1528 |
@released
|
|
1529 |
|
|
1530 |
Encapsulates literal text.
|
|
1531 |
|
|
1532 |
This is always constructed using an _LIT macro.
|
|
1533 |
|
|
1534 |
This class is build independent; i.e. for a non-Unicode build, an 8-bit build
|
|
1535 |
variant is generated; for a Unicode build, a 16 bit build variant is generated.
|
|
1536 |
|
|
1537 |
The class has no explicit constructors. See the _LIT macro definition.
|
|
1538 |
*/
|
|
1539 |
template <TInt S>
|
|
1540 |
class TLitC
|
|
1541 |
{
|
|
1542 |
public:
|
|
1543 |
/**
|
|
1544 |
@internalComponent
|
|
1545 |
*/
|
|
1546 |
enum {BufferSize=S-1};
|
|
1547 |
inline const TDesC* operator&() const;
|
|
1548 |
inline operator const TDesC&() const;
|
|
1549 |
inline const TDesC& operator()() const;
|
|
1550 |
inline operator const __TRefDesC() const;
|
|
1551 |
public:
|
|
1552 |
#if !defined(_UNICODE) || defined(__KERNEL_MODE__)
|
|
1553 |
|
|
1554 |
/**
|
|
1555 |
@internalComponent
|
|
1556 |
*/
|
|
1557 |
typedef TUint8 __TText;
|
|
1558 |
#elif defined(__GCC32__)
|
|
1559 |
|
|
1560 |
/**
|
|
1561 |
@internalComponent
|
|
1562 |
*/
|
|
1563 |
typedef wchar_t __TText;
|
|
1564 |
#elif defined(__VC32__)
|
|
1565 |
|
|
1566 |
/**
|
|
1567 |
@internalComponent
|
|
1568 |
*/
|
|
1569 |
typedef TUint16 __TText;
|
|
1570 |
|
|
1571 |
#elif defined(__CW32__)
|
|
1572 |
|
|
1573 |
/**
|
|
1574 |
@internalComponent
|
|
1575 |
*/
|
|
1576 |
typedef TUint16 __TText;
|
|
1577 |
#elif !defined(__TText_defined)
|
|
1578 |
#error no typedef for __TText
|
|
1579 |
#endif
|
|
1580 |
public:
|
|
1581 |
/**
|
|
1582 |
@internalComponent
|
|
1583 |
*/
|
|
1584 |
TUint iTypeLength;
|
|
1585 |
|
|
1586 |
/**
|
|
1587 |
@internalComponent
|
|
1588 |
*/
|
|
1589 |
__TText iBuf[__Align(S)];
|
|
1590 |
};
|
|
1591 |
|
|
1592 |
|
|
1593 |
/**
|
|
1594 |
@publishedAll
|
|
1595 |
@released
|
|
1596 |
|
|
1597 |
Defines an empty or null literal descriptor.
|
|
1598 |
|
|
1599 |
This is the build independent form.
|
|
1600 |
An 8 bit build variant is generated for a non-Unicode build;
|
|
1601 |
a 16 bit build variant is generated for a Unicode build.
|
|
1602 |
*/
|
|
1603 |
_LIT(KNullDesC,"");
|
|
1604 |
|
|
1605 |
|
|
1606 |
|
|
1607 |
/**
|
|
1608 |
@publishedAll
|
|
1609 |
@released
|
|
1610 |
|
|
1611 |
Defines an empty or null literal descriptor for use with 8-bit descriptors.
|
|
1612 |
*/
|
|
1613 |
_LIT8(KNullDesC8,"");
|
|
1614 |
#ifndef __KERNEL_MODE__
|
|
1615 |
|
|
1616 |
|
|
1617 |
|
|
1618 |
/**
|
|
1619 |
@publishedAll
|
|
1620 |
@released
|
|
1621 |
|
|
1622 |
Defines an empty or null literal descriptor for use with 16-bit descriptors
|
|
1623 |
*/
|
|
1624 |
_LIT16(KNullDesC16,"");
|
|
1625 |
#endif
|
|
1626 |
|
|
1627 |
|
|
1628 |
|
|
1629 |
|
|
1630 |
/**
|
|
1631 |
@publishedAll
|
|
1632 |
@released
|
|
1633 |
|
|
1634 |
Packages a non-modifiable pointer descriptor which represents an object of
|
|
1635 |
specific type.
|
|
1636 |
|
|
1637 |
The template parameter defines the type of object.
|
|
1638 |
|
|
1639 |
The object represented by the packaged pointer descriptor is accessible through
|
|
1640 |
the package but cannot be changed. */
|
|
1641 |
template <class T>
|
|
1642 |
class TPckgC : public TPtrC8
|
|
1643 |
{
|
|
1644 |
public:
|
|
1645 |
inline TPckgC(const T& aRef);
|
|
1646 |
inline const T& operator()() const;
|
|
1647 |
private:
|
|
1648 |
TPckgC<T>& operator=(const TPckgC<T>& aRef);
|
|
1649 |
};
|
|
1650 |
|
|
1651 |
|
|
1652 |
|
|
1653 |
|
|
1654 |
/**
|
|
1655 |
@publishedAll
|
|
1656 |
@released
|
|
1657 |
|
|
1658 |
Packages a modifiable pointer descriptor which represents an object of specific
|
|
1659 |
type.
|
|
1660 |
|
|
1661 |
The template parameter defines the type of object.
|
|
1662 |
|
|
1663 |
The object represented by the packaged pointer descriptor is accessible through
|
|
1664 |
the package.
|
|
1665 |
*/
|
|
1666 |
template <class T>
|
|
1667 |
class TPckg : public TPtr8
|
|
1668 |
{
|
|
1669 |
public:
|
|
1670 |
inline TPckg(const T& aRef);
|
|
1671 |
inline T& operator()();
|
|
1672 |
private:
|
|
1673 |
TPckg<T>& operator=(const TPckg<T>& aRef);
|
|
1674 |
};
|
|
1675 |
|
|
1676 |
|
|
1677 |
|
|
1678 |
|
|
1679 |
/**
|
|
1680 |
@publishedAll
|
|
1681 |
@released
|
|
1682 |
|
|
1683 |
Packages an object into a modifiable buffer descriptor.
|
|
1684 |
|
|
1685 |
The template parameter defines the type of object to be packaged.
|
|
1686 |
|
|
1687 |
The package provides a type safe way of transferring an object or data structure
|
|
1688 |
which is contained within a modifiable buffer descriptor. Typically, a package
|
|
1689 |
is used for passing data via inter thread communication.
|
|
1690 |
|
|
1691 |
The contained object is accessible through the package.
|
|
1692 |
*/
|
|
1693 |
template <class T>
|
|
1694 |
class TPckgBuf : public TAlignedBuf8<sizeof(T)>
|
|
1695 |
{
|
|
1696 |
public:
|
|
1697 |
inline TPckgBuf();
|
|
1698 |
inline TPckgBuf(const T& aRef);
|
|
1699 |
inline TPckgBuf& operator=(const TPckgBuf<T>& aRef);
|
|
1700 |
inline T& operator=(const T& aRef);
|
|
1701 |
inline T& operator()();
|
|
1702 |
inline const T& operator()() const;
|
|
1703 |
};
|
|
1704 |
|
|
1705 |
|
|
1706 |
|
|
1707 |
|
|
1708 |
/**
|
|
1709 |
@publishedAll
|
|
1710 |
@released
|
|
1711 |
|
|
1712 |
Defines a modifiable buffer descriptor that can contain the name of a reference
|
|
1713 |
counting object.
|
|
1714 |
|
|
1715 |
@see TBuf
|
|
1716 |
@see CObject
|
|
1717 |
*/
|
|
1718 |
typedef TBuf<KMaxName> TName;
|
|
1719 |
|
|
1720 |
|
|
1721 |
/**
|
|
1722 |
@publishedAll
|
|
1723 |
@released
|
|
1724 |
|
|
1725 |
Defines a modifiable buffer descriptor that can contain the full name of a
|
|
1726 |
reference counting object.
|
|
1727 |
|
|
1728 |
@see TBuf
|
|
1729 |
@see CObject
|
|
1730 |
*/
|
|
1731 |
typedef TBuf<KMaxFullName> TFullName;
|
|
1732 |
|
|
1733 |
|
|
1734 |
|
|
1735 |
/**
|
|
1736 |
@publishedAll
|
|
1737 |
@released
|
|
1738 |
|
|
1739 |
Defines a modifiable buffer descriptor to contain the category name identifying
|
|
1740 |
the cause of thread or process termination. The buffer takes a maximum length
|
|
1741 |
of KMaxExitCategoryName.
|
|
1742 |
|
|
1743 |
@see RThread::ExitCategory
|
|
1744 |
@see RThread::ExitCategory
|
|
1745 |
*/
|
|
1746 |
typedef TBuf<KMaxExitCategoryName> TExitCategoryName;
|
|
1747 |
|
|
1748 |
|
|
1749 |
|
|
1750 |
/**
|
|
1751 |
@publishedAll
|
|
1752 |
@released
|
|
1753 |
|
|
1754 |
A buffer that can contain the name of a file.
|
|
1755 |
The name can have a maximum length of KMaxFileName
|
|
1756 |
(currently 256 but check the definition of KMaxFileName).
|
|
1757 |
|
|
1758 |
@see KMaxFileName
|
|
1759 |
*/
|
|
1760 |
typedef TBuf<KMaxFileName> TFileName;
|
|
1761 |
|
|
1762 |
|
|
1763 |
|
|
1764 |
/**
|
|
1765 |
@publishedAll
|
|
1766 |
@released
|
|
1767 |
|
|
1768 |
A buffer that can contain the name of a path.
|
|
1769 |
The name can have a maximum length of KMaxPath
|
|
1770 |
(currently 256 but check the definition of KMaxPath).
|
|
1771 |
|
|
1772 |
@see KMaxPath
|
|
1773 |
*/
|
|
1774 |
typedef TBuf<KMaxPath> TPath;
|
|
1775 |
|
|
1776 |
|
|
1777 |
|
|
1778 |
|
|
1779 |
/**
|
|
1780 |
@publishedAll
|
|
1781 |
@released
|
|
1782 |
|
|
1783 |
Version name type.
|
|
1784 |
|
|
1785 |
This is a buffer descriptor with a maximum length of KMaxVersionName.
|
|
1786 |
A TVersion object returns the formatted character representation of its version
|
|
1787 |
information in a descriptor of this type.
|
|
1788 |
|
|
1789 |
@see TVersion
|
|
1790 |
*/
|
|
1791 |
typedef TBuf<KMaxVersionName> TVersionName;
|
|
1792 |
|
|
1793 |
|
|
1794 |
|
|
1795 |
|
|
1796 |
/**
|
|
1797 |
@publishedAll
|
|
1798 |
@released
|
|
1799 |
|
|
1800 |
Defines a modifiable buffer descriptor for the text form of the UID.
|
|
1801 |
The descriptor has a maximum length of KMaxUidName and is used to contain
|
|
1802 |
the standard text format returned by the function TUid::Name().
|
|
1803 |
|
|
1804 |
@see TUid::Name
|
|
1805 |
*/
|
|
1806 |
typedef TBuf<KMaxUidName> TUidName;
|
|
1807 |
|
|
1808 |
|
|
1809 |
|
|
1810 |
|
|
1811 |
/**
|
|
1812 |
@publishedAll
|
|
1813 |
@released
|
|
1814 |
|
|
1815 |
Defines a null UID
|
|
1816 |
*/
|
|
1817 |
#define KNullUid TUid::Null()
|
|
1818 |
|
|
1819 |
|
|
1820 |
|
|
1821 |
|
|
1822 |
/**
|
|
1823 |
@publishedAll
|
|
1824 |
@released
|
|
1825 |
|
|
1826 |
A globally unique 32-bit number.
|
|
1827 |
*/
|
|
1828 |
class TUid
|
|
1829 |
{
|
|
1830 |
public:
|
|
1831 |
#ifndef __KERNEL_MODE__
|
|
1832 |
IMPORT_C TBool operator==(const TUid& aUid) const;
|
|
1833 |
IMPORT_C TBool operator!=(const TUid& aUid) const;
|
|
1834 |
IMPORT_C TUidName Name() const;
|
|
1835 |
#endif
|
|
1836 |
static inline TUid Uid(TInt aUid);
|
|
1837 |
static inline TUid Null();
|
|
1838 |
public:
|
|
1839 |
/**
|
|
1840 |
The 32-bit integer UID value.
|
|
1841 |
*/
|
|
1842 |
TInt32 iUid;
|
|
1843 |
};
|
|
1844 |
|
|
1845 |
|
|
1846 |
|
|
1847 |
|
|
1848 |
/**
|
|
1849 |
@publishedAll
|
|
1850 |
@released
|
|
1851 |
|
|
1852 |
Encapsulates a set of three unique identifiers (UIDs) which, in combination,
|
|
1853 |
identify a system object such as a GUI application or a DLL. The three
|
|
1854 |
component UIDs are referred to as UID1, UID2 and UID3.
|
|
1855 |
|
|
1856 |
An object of this type is referred to as a compound identifier or a UID type.
|
|
1857 |
*/
|
|
1858 |
class TUidType
|
|
1859 |
{
|
|
1860 |
public:
|
|
1861 |
#ifndef __KERNEL_MODE__
|
|
1862 |
IMPORT_C TUidType();
|
|
1863 |
IMPORT_C TUidType(TUid aUid1);
|
|
1864 |
IMPORT_C TUidType(TUid aUid1,TUid aUid2);
|
|
1865 |
IMPORT_C TUidType(TUid aUid1,TUid aUid2,TUid aUid3);
|
|
1866 |
IMPORT_C TBool operator==(const TUidType& aUidType) const;
|
|
1867 |
IMPORT_C TBool operator!=(const TUidType& aUidType) const;
|
|
1868 |
IMPORT_C const TUid& operator[](TInt anIndex) const;
|
|
1869 |
IMPORT_C TUid MostDerived() const;
|
|
1870 |
IMPORT_C TBool IsPresent(TUid aUid) const;
|
|
1871 |
IMPORT_C TBool IsValid() const;
|
|
1872 |
private:
|
|
1873 |
#endif
|
|
1874 |
TUid iUid[KMaxCheckedUid];
|
|
1875 |
};
|
|
1876 |
|
|
1877 |
|
|
1878 |
|
|
1879 |
|
|
1880 |
/**
|
|
1881 |
A class used to represent the Secure ID of a process or executable image.
|
|
1882 |
|
|
1883 |
Constructors and conversion operators are provided to enable conversion
|
|
1884 |
of this class to and from both TUint32 and TUid objects.
|
|
1885 |
|
|
1886 |
Because this class has non-default constructors, compilers will not initialise
|
|
1887 |
this objects at compile time, instead code will be generated to construct the object
|
|
1888 |
at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
|
|
1889 |
such uninitialised data. To overcome these problems a macro is provided to construct
|
|
1890 |
a const object which behaves like a TSecureId. This is _LIT_SECURE_ID.
|
|
1891 |
This macro should be used where it is desirable to define const TSecureId objects,
|
|
1892 |
like in header files. E.g. Instead of writing:
|
|
1893 |
@code
|
|
1894 |
const TSecureId MyId=0x1234567
|
|
1895 |
@endcode
|
|
1896 |
use
|
|
1897 |
@code
|
|
1898 |
_LIT_SECURE_ID(MyId,0x1234567)
|
|
1899 |
@endcode
|
|
1900 |
|
|
1901 |
@publishedAll
|
|
1902 |
@released
|
|
1903 |
|
|
1904 |
@see _LIT_SECURE_ID
|
|
1905 |
*/
|
|
1906 |
class TSecureId
|
|
1907 |
{
|
|
1908 |
public:
|
|
1909 |
inline TSecureId();
|
|
1910 |
inline TSecureId(TUint32 aId);
|
|
1911 |
inline operator TUint32() const;
|
|
1912 |
inline TSecureId(TUid aId);
|
|
1913 |
inline operator TUid() const;
|
|
1914 |
public:
|
|
1915 |
TUint32 iId;
|
|
1916 |
};
|
|
1917 |
|
|
1918 |
|
|
1919 |
|
|
1920 |
|
|
1921 |
/**
|
|
1922 |
A class used to represent the Vendor ID of a process or executable image
|
|
1923 |
|
|
1924 |
Constructors and conversion operators are provided to enable conversion
|
|
1925 |
of this class to and from both TUint32 and TUid objects.
|
|
1926 |
|
|
1927 |
Because this class has non-default constructors, compilers will not initialise
|
|
1928 |
this objects at compile time, instead code will be generated to construct the object
|
|
1929 |
at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
|
|
1930 |
such uninitialised data. To overcome these problems a macro is provided to construct
|
|
1931 |
a const object which behaves like a TSecureId. This is _LIT_VENDOR_ID.
|
|
1932 |
This macro should be used where it is desirable to define const TSecureId objects,
|
|
1933 |
like in header files. E.g. Instead of writing:
|
|
1934 |
@code
|
|
1935 |
const TVendorId MyId=0x1234567
|
|
1936 |
@endcode
|
|
1937 |
use
|
|
1938 |
@code
|
|
1939 |
_LIT_VENDOR_ID(MyId,0x1234567)
|
|
1940 |
@endcode
|
|
1941 |
|
|
1942 |
@publishedAll
|
|
1943 |
@released
|
|
1944 |
|
|
1945 |
@see _LIT_VENDOR_ID
|
|
1946 |
*/
|
|
1947 |
class TVendorId
|
|
1948 |
{
|
|
1949 |
public:
|
|
1950 |
inline TVendorId();
|
|
1951 |
inline TVendorId(TUint32 aId);
|
|
1952 |
inline operator TUint32() const;
|
|
1953 |
inline TVendorId(TUid aId);
|
|
1954 |
inline operator TUid() const;
|
|
1955 |
public:
|
|
1956 |
TUint32 iId;
|
|
1957 |
};
|
|
1958 |
|
|
1959 |
|
|
1960 |
|
|
1961 |
/**
|
|
1962 |
Structure for compile-time definition of a secure ID
|
|
1963 |
@internalComponent
|
|
1964 |
*/
|
|
1965 |
class SSecureId
|
|
1966 |
{
|
|
1967 |
public:
|
|
1968 |
inline const TSecureId* operator&() const;
|
|
1969 |
inline operator const TSecureId&() const;
|
|
1970 |
inline operator TUint32() const;
|
|
1971 |
inline operator TUid() const;
|
|
1972 |
public:
|
|
1973 |
TUint32 iId;
|
|
1974 |
};
|
|
1975 |
|
|
1976 |
|
|
1977 |
|
|
1978 |
|
|
1979 |
/**
|
|
1980 |
Structure for compile-time definition of a vendor ID
|
|
1981 |
@internalComponent
|
|
1982 |
*/
|
|
1983 |
class SVendorId
|
|
1984 |
{
|
|
1985 |
public:
|
|
1986 |
inline const TVendorId* operator&() const;
|
|
1987 |
inline operator const TVendorId&() const;
|
|
1988 |
inline operator TUint32() const;
|
|
1989 |
inline operator TUid() const;
|
|
1990 |
public:
|
|
1991 |
TUint32 iId;
|
|
1992 |
};
|
|
1993 |
|
|
1994 |
|
|
1995 |
|
|
1996 |
|
|
1997 |
/**
|
|
1998 |
Macro for compile-time definition of a secure ID
|
|
1999 |
@param name Name to use for secure ID
|
|
2000 |
@param value Value of secure ID
|
|
2001 |
@publishedAll
|
|
2002 |
@released
|
|
2003 |
*/
|
|
2004 |
#define _LIT_SECURE_ID(name,value) const SSecureId name={value}
|
|
2005 |
|
|
2006 |
|
|
2007 |
|
|
2008 |
|
|
2009 |
/**
|
|
2010 |
Macro for compile-time definition of a vendor ID
|
|
2011 |
@param name Name to use for vendor ID
|
|
2012 |
@param value Value of vendor ID
|
|
2013 |
@publishedAll
|
|
2014 |
@released
|
|
2015 |
*/
|
|
2016 |
#define _LIT_VENDOR_ID(name,value) const SVendorId name={value}
|
|
2017 |
|
|
2018 |
|
|
2019 |
|
|
2020 |
|
|
2021 |
/**
|
|
2022 |
@publishedAll
|
|
2023 |
@released
|
|
2024 |
|
|
2025 |
Contains version information.
|
|
2026 |
|
|
2027 |
A version is defined by a set of three numbers:
|
|
2028 |
|
|
2029 |
1. the major version number, ranging from 0 to 127, inclusive
|
|
2030 |
|
|
2031 |
2. the minor version number, ranging from 0 to 99 inclusive
|
|
2032 |
|
|
2033 |
3. the build number, ranging from 0 to 32767 inclusive.
|
|
2034 |
|
|
2035 |
The class provides a constructor for setting all three numbers.
|
|
2036 |
It also provides a member function to build a character representation of
|
|
2037 |
this information in a TVersionName descriptor.
|
|
2038 |
|
|
2039 |
@see TVersionName
|
|
2040 |
*/
|
|
2041 |
class TVersion
|
|
2042 |
{
|
|
2043 |
public:
|
|
2044 |
IMPORT_C TVersion();
|
|
2045 |
IMPORT_C TVersion(TInt aMajor,TInt aMinor,TInt aBuild);
|
|
2046 |
IMPORT_C TVersionName Name() const;
|
|
2047 |
public:
|
|
2048 |
/**
|
|
2049 |
The major version number.
|
|
2050 |
*/
|
|
2051 |
TInt8 iMajor;
|
|
2052 |
|
|
2053 |
|
|
2054 |
/**
|
|
2055 |
The minor version number.
|
|
2056 |
*/
|
|
2057 |
TInt8 iMinor;
|
|
2058 |
|
|
2059 |
|
|
2060 |
/**
|
|
2061 |
The build number.
|
|
2062 |
*/
|
|
2063 |
TInt16 iBuild;
|
|
2064 |
};
|
|
2065 |
|
|
2066 |
|
|
2067 |
|
|
2068 |
|
|
2069 |
/**
|
|
2070 |
@publishedAll
|
|
2071 |
@released
|
|
2072 |
|
|
2073 |
Indicates the completion status of a request made to a service provider.
|
|
2074 |
|
|
2075 |
When a thread makes a request, it passes a request status as a parameter.
|
|
2076 |
On completion, the provider signals the requesting thread's request semaphore
|
|
2077 |
and stores a completion code in the request status. Typically, this is KErrNone
|
|
2078 |
or one of the other system-wide error codes.
|
|
2079 |
|
|
2080 |
This class is not intended for user derivation.
|
|
2081 |
*/
|
|
2082 |
class TRequestStatus
|
|
2083 |
{
|
|
2084 |
public:
|
|
2085 |
inline TRequestStatus();
|
|
2086 |
inline TRequestStatus(TInt aVal);
|
|
2087 |
inline TInt operator=(TInt aVal);
|
|
2088 |
inline TBool operator==(TInt aVal) const;
|
|
2089 |
inline TBool operator!=(TInt aVal) const;
|
|
2090 |
inline TBool operator>=(TInt aVal) const;
|
|
2091 |
inline TBool operator<=(TInt aVal) const;
|
|
2092 |
inline TBool operator>(TInt aVal) const;
|
|
2093 |
inline TBool operator<(TInt aVal) const;
|
|
2094 |
inline TInt Int() const;
|
|
2095 |
private:
|
|
2096 |
enum
|
|
2097 |
{
|
|
2098 |
EActive = 1, //bit0
|
|
2099 |
ERequestPending = 2, //bit1
|
|
2100 |
};
|
|
2101 |
TInt iStatus;
|
|
2102 |
TUint iFlags;
|
|
2103 |
friend class CActive;
|
|
2104 |
friend class CActiveScheduler;
|
|
2105 |
friend class CServer2;
|
|
2106 |
};
|
|
2107 |
|
|
2108 |
|
|
2109 |
|
|
2110 |
|
|
2111 |
class TSize;
|
|
2112 |
/**
|
|
2113 |
@publishedAll
|
|
2114 |
@released
|
|
2115 |
|
|
2116 |
Stores a two-dimensional point in Cartesian co-ordinates.
|
|
2117 |
|
|
2118 |
Its data members (iX and iY) are public and can be manipulated directly, or
|
|
2119 |
by means of the functions provided. Functions are provided to set and manipulate
|
|
2120 |
the point, and to compare points for equality.
|
|
2121 |
*/
|
|
2122 |
class TPoint
|
|
2123 |
{
|
|
2124 |
public:
|
|
2125 |
#ifndef __KERNEL_MODE__
|
|
2126 |
enum TUninitialized { EUninitialized };
|
|
2127 |
/**
|
|
2128 |
Constructs default point, initialising its iX and iY members to zero.
|
|
2129 |
*/
|
|
2130 |
TPoint(TUninitialized) {}
|
|
2131 |
inline TPoint();
|
|
2132 |
inline TPoint(TInt aX,TInt aY);
|
|
2133 |
IMPORT_C TBool operator==(const TPoint& aPoint) const;
|
|
2134 |
IMPORT_C TBool operator!=(const TPoint& aPoint) const;
|
|
2135 |
IMPORT_C TPoint& operator-=(const TPoint& aPoint);
|
|
2136 |
IMPORT_C TPoint& operator+=(const TPoint& aPoint);
|
|
2137 |
IMPORT_C TPoint& operator-=(const TSize& aSize);
|
|
2138 |
IMPORT_C TPoint& operator+=(const TSize& aSize);
|
|
2139 |
IMPORT_C TPoint operator-(const TPoint& aPoint) const;
|
|
2140 |
IMPORT_C TPoint operator+(const TPoint& aPoint) const;
|
|
2141 |
IMPORT_C TPoint operator-(const TSize& aSize) const;
|
|
2142 |
IMPORT_C TPoint operator+(const TSize& aSize) const;
|
|
2143 |
IMPORT_C TPoint operator-() const;
|
|
2144 |
IMPORT_C void SetXY(TInt aX,TInt aY);
|
|
2145 |
IMPORT_C TSize AsSize() const;
|
|
2146 |
#endif
|
|
2147 |
public:
|
|
2148 |
/**
|
|
2149 |
The x co-ordinate.
|
|
2150 |
*/
|
|
2151 |
TInt iX;
|
|
2152 |
/**
|
|
2153 |
The y co-ordinate.
|
|
2154 |
*/
|
|
2155 |
TInt iY;
|
|
2156 |
};
|
|
2157 |
|
|
2158 |
|
|
2159 |
|
|
2160 |
|
|
2161 |
/**
|
|
2162 |
@publishedAll
|
|
2163 |
@prototype
|
|
2164 |
|
|
2165 |
Stores a three-dimensional point in Cartesian or polar co-ordinates.
|
|
2166 |
Its data members (iX, iY and iZ) are public and can be manipulated directly.
|
|
2167 |
|
|
2168 |
*/
|
|
2169 |
class TPoint3D
|
|
2170 |
{
|
|
2171 |
public:
|
|
2172 |
#ifndef __KERNEL_MODE__
|
|
2173 |
enum TUninitialized { EUninitialized };
|
|
2174 |
|
|
2175 |
/**
|
|
2176 |
TUninitialized Constructor
|
|
2177 |
*/
|
|
2178 |
TPoint3D(TUninitialized) {}
|
|
2179 |
/**
|
|
2180 |
Constructs default TPoint3D, initialising its iX , iY and iZ members to zero.
|
|
2181 |
*/
|
|
2182 |
inline TPoint3D();
|
|
2183 |
/**
|
|
2184 |
Constructs TPoint3D with the specified x,y and z co-ordinates.
|
|
2185 |
*/
|
|
2186 |
inline TPoint3D(TInt aX,TInt aY,TInt aZ);
|
|
2187 |
/**
|
|
2188 |
Copy Construct from TPoint , initialises Z co-ordinate to Zero
|
|
2189 |
*/
|
|
2190 |
inline TPoint3D(const TPoint& aPoint);
|
|
2191 |
|
|
2192 |
IMPORT_C TBool operator==(const TPoint3D& aPoint3D) const;
|
|
2193 |
IMPORT_C TBool operator!=(const TPoint3D& aPoint3D) const;
|
|
2194 |
|
|
2195 |
IMPORT_C TPoint3D& operator-=(const TPoint3D& aPoint3D);
|
|
2196 |
IMPORT_C TPoint3D& operator-=(const TPoint& aPoint);
|
|
2197 |
|
|
2198 |
IMPORT_C TPoint3D& operator+=(const TPoint3D& aPoint3D);
|
|
2199 |
IMPORT_C TPoint3D& operator+=(const TPoint& aPoint);
|
|
2200 |
|
|
2201 |
IMPORT_C TPoint3D operator-(const TPoint3D& aPoint3D) const;
|
|
2202 |
IMPORT_C TPoint3D operator-(const TPoint& aPoint) const;
|
|
2203 |
|
|
2204 |
IMPORT_C TPoint3D operator+(const TPoint3D& aPoint3D) const;
|
|
2205 |
IMPORT_C TPoint3D operator+(const TPoint& aPoint) const;
|
|
2206 |
/**
|
|
2207 |
Unary minus operator. The operator returns the negation of this Point3D
|
|
2208 |
*/
|
|
2209 |
IMPORT_C TPoint3D operator-() const;
|
|
2210 |
|
|
2211 |
/**
|
|
2212 |
Set Method to set the xyz co-ordinates of TPoint3D
|
|
2213 |
*/
|
|
2214 |
IMPORT_C void SetXYZ(TInt aX,TInt aY,TInt aZ);
|
|
2215 |
|
|
2216 |
/**
|
|
2217 |
TPoint3D from TPoint, sets the Z co-ordinate to Zero
|
|
2218 |
*/
|
|
2219 |
IMPORT_C void SetPoint(const TPoint& aPoint);
|
|
2220 |
|
|
2221 |
/**
|
|
2222 |
Returns TPoint from TPoint3D
|
|
2223 |
*/
|
|
2224 |
IMPORT_C TPoint AsPoint() const;
|
|
2225 |
#endif
|
|
2226 |
public:
|
|
2227 |
/**
|
|
2228 |
The x co-ordinate.
|
|
2229 |
*/
|
|
2230 |
TInt iX;
|
|
2231 |
/**
|
|
2232 |
The y co-ordinate.
|
|
2233 |
*/
|
|
2234 |
TInt iY;
|
|
2235 |
/**
|
|
2236 |
The z co-ordinate.
|
|
2237 |
*/
|
|
2238 |
TInt iZ;
|
|
2239 |
};
|
|
2240 |
|
|
2241 |
|
|
2242 |
|
|
2243 |
/**
|
|
2244 |
@internalTechnology
|
|
2245 |
@prototype For now, only intended to be used by TRwEvent and the Windows Server
|
|
2246 |
|
|
2247 |
Stores the angular spherical coordinates (Phi,Theta) of a three-dimensional point.
|
|
2248 |
|
|
2249 |
Its data members (iPhi, iTheta) are public and can be manipulated directly.
|
|
2250 |
*/
|
|
2251 |
class TAngle3D
|
|
2252 |
{
|
|
2253 |
public:
|
|
2254 |
/**
|
|
2255 |
The Phi co-ordinate (angle between X-axis and the line that links the projection of the point on the X-Y plane and the origin).
|
|
2256 |
*/
|
|
2257 |
TInt iPhi;
|
|
2258 |
/**
|
|
2259 |
The Theta co-ordinate (angle between the Z-axis and the line that links the point and the origin).
|
|
2260 |
*/
|
|
2261 |
TInt iTheta;
|
|
2262 |
};
|
|
2263 |
|
|
2264 |
|
|
2265 |
/**
|
|
2266 |
@publishedAll
|
|
2267 |
@released
|
|
2268 |
|
|
2269 |
Stores a two-dimensional size as a width and a height value.
|
|
2270 |
|
|
2271 |
Its data members are public and can be manipulated directly, or by means of
|
|
2272 |
the functions provided.
|
|
2273 |
*/
|
|
2274 |
class TSize
|
|
2275 |
{
|
|
2276 |
public:
|
|
2277 |
#ifndef __KERNEL_MODE__
|
|
2278 |
enum TUninitialized { EUninitialized };
|
|
2279 |
/**
|
|
2280 |
Constructs the size object with its iWidth and iHeight members set to zero.
|
|
2281 |
*/
|
|
2282 |
TSize(TUninitialized) {}
|
|
2283 |
inline TSize();
|
|
2284 |
inline TSize(TInt aWidth,TInt aHeight);
|
|
2285 |
IMPORT_C TBool operator==(const TSize& aSize) const;
|
|
2286 |
IMPORT_C TBool operator!=(const TSize& aSize) const;
|
|
2287 |
IMPORT_C TSize& operator-=(const TSize& aSize);
|
|
2288 |
IMPORT_C TSize& operator-=(const TPoint& aPoint);
|
|
2289 |
IMPORT_C TSize& operator+=(const TSize& aSize);
|
|
2290 |
IMPORT_C TSize& operator+=(const TPoint& aPoint);
|
|
2291 |
IMPORT_C TSize operator-(const TSize& aSize) const;
|
|
2292 |
IMPORT_C TSize operator-(const TPoint& aPoint) const;
|
|
2293 |
IMPORT_C TSize operator+(const TSize& aSize) const;
|
|
2294 |
IMPORT_C TSize operator+(const TPoint& aPoint) const;
|
|
2295 |
IMPORT_C TSize operator-() const;
|
|
2296 |
IMPORT_C void SetSize(TInt aWidth,TInt aHeight);
|
|
2297 |
IMPORT_C TPoint AsPoint() const;
|
|
2298 |
#endif
|
|
2299 |
public:
|
|
2300 |
/**
|
|
2301 |
The width of this TSize object.
|
|
2302 |
*/
|
|
2303 |
TInt iWidth;
|
|
2304 |
/**
|
|
2305 |
The height of this TSize object.
|
|
2306 |
*/
|
|
2307 |
TInt iHeight;
|
|
2308 |
};
|
|
2309 |
|
|
2310 |
|
|
2311 |
|
|
2312 |
|
|
2313 |
/**
|
|
2314 |
@publishedAll
|
|
2315 |
@released
|
|
2316 |
|
|
2317 |
Information about a kernel object.
|
|
2318 |
|
|
2319 |
This type of object is passed to RHandleBase::HandleInfo(). The function
|
|
2320 |
fetches information on the usage of the kernel object associated with that
|
|
2321 |
handle and stores the information in the THandleInfo object.
|
|
2322 |
|
|
2323 |
The class contains four data members and no explicitly defined function
|
|
2324 |
members.
|
|
2325 |
*/
|
|
2326 |
class THandleInfo
|
|
2327 |
{
|
|
2328 |
public:
|
|
2329 |
/**
|
|
2330 |
The number of times that the kernel object is open in the current process.
|
|
2331 |
*/
|
|
2332 |
TInt iNumOpenInProcess;
|
|
2333 |
|
|
2334 |
/**
|
|
2335 |
The number of times that the kernel object is open in the current thread.
|
|
2336 |
*/
|
|
2337 |
TInt iNumOpenInThread;
|
|
2338 |
|
|
2339 |
/**
|
|
2340 |
The number of processes which have a handle on the kernel object.
|
|
2341 |
*/
|
|
2342 |
TInt iNumProcesses;
|
|
2343 |
|
|
2344 |
/**
|
|
2345 |
The number of threads which have a handle on the kernel object.
|
|
2346 |
*/
|
|
2347 |
TInt iNumThreads;
|
|
2348 |
};
|
|
2349 |
|
|
2350 |
|
|
2351 |
|
|
2352 |
|
|
2353 |
/**
|
|
2354 |
@internalComponent
|
|
2355 |
*/
|
|
2356 |
class TFindHandle
|
|
2357 |
{
|
|
2358 |
public:
|
|
2359 |
inline TFindHandle();
|
|
2360 |
inline TInt Handle() const;
|
|
2361 |
#ifdef __KERNEL_MODE__
|
|
2362 |
inline TInt Index() const;
|
|
2363 |
inline TInt UniqueID() const;
|
|
2364 |
inline TUint64 ObjectID() const;
|
|
2365 |
inline void Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId);
|
|
2366 |
#else
|
|
2367 |
protected:
|
|
2368 |
inline void Reset();
|
|
2369 |
#endif
|
|
2370 |
private:
|
|
2371 |
TInt iHandle;
|
|
2372 |
TInt iSpare1;
|
|
2373 |
TInt iObjectIdLow;
|
|
2374 |
TInt iObjectIdHigh;
|
|
2375 |
};
|
|
2376 |
|
|
2377 |
|
|
2378 |
|
|
2379 |
class RThread;
|
|
2380 |
class TFindHandleBase;
|
|
2381 |
class TFindSemaphore;
|
|
2382 |
/**
|
|
2383 |
@publishedAll
|
|
2384 |
@released
|
|
2385 |
|
|
2386 |
A handle to an object.
|
|
2387 |
|
|
2388 |
The class encapsulates the basic behaviour of a handle, hiding the
|
|
2389 |
handle-number which identifies the object which the handle represents.
|
|
2390 |
|
|
2391 |
The class is abstract in the sense that a RHandleBase object is never
|
|
2392 |
explicitly instantiated. It is always a base class to a concrete handle class;
|
|
2393 |
for example, RSemaphore, RThread, RProcess, RCriticalSection etc.
|
|
2394 |
*/
|
|
2395 |
class RHandleBase
|
|
2396 |
{
|
|
2397 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
2398 |
public:
|
|
2399 |
/**
|
|
2400 |
@internalComponent
|
|
2401 |
*/
|
|
2402 |
#else
|
|
2403 |
protected:
|
|
2404 |
#endif
|
|
2405 |
enum
|
|
2406 |
{
|
|
2407 |
EReadAccess=0x1,
|
|
2408 |
EWriteAccess=0x2,
|
|
2409 |
EDirectReadAccess=0x4,
|
|
2410 |
EDirectWriteAccess=0x8,
|
|
2411 |
};
|
|
2412 |
public:
|
|
2413 |
inline RHandleBase();
|
|
2414 |
inline TInt Handle() const;
|
|
2415 |
inline void SetHandle(TInt aHandle);
|
|
2416 |
inline TInt SetReturnedHandle(TInt aHandleOrError);
|
|
2417 |
static void DoExtendedClose();
|
|
2418 |
#ifndef __KERNEL_MODE__
|
|
2419 |
IMPORT_C void Close();
|
|
2420 |
IMPORT_C TName Name() const;
|
|
2421 |
IMPORT_C TFullName FullName() const;
|
|
2422 |
IMPORT_C void FullName(TDes& aName) const;
|
|
2423 |
IMPORT_C void SetHandleNC(TInt aHandle);
|
|
2424 |
IMPORT_C TInt Duplicate(const RThread& aSrc,TOwnerType aType=EOwnerProcess);
|
|
2425 |
IMPORT_C void HandleInfo(THandleInfo* anInfo);
|
|
2426 |
IMPORT_C TUint Attributes() const;
|
|
2427 |
IMPORT_C TInt BTraceId() const;
|
|
2428 |
IMPORT_C void NotifyDestruction(TRequestStatus& aStatus); /**< @internalTechnology */
|
|
2429 |
protected:
|
|
2430 |
inline RHandleBase(TInt aHandle);
|
|
2431 |
IMPORT_C TInt Open(const TFindHandleBase& aHandle,TOwnerType aType);
|
|
2432 |
static TInt SetReturnedHandle(TInt aHandleOrError,RHandleBase& aHandle);
|
|
2433 |
TInt OpenByName(const TDesC &aName,TOwnerType aOwnerType,TInt aObjectType);
|
|
2434 |
#endif
|
|
2435 |
private:
|
|
2436 |
static void DoExtendedCloseL();
|
|
2437 |
protected:
|
|
2438 |
TInt iHandle;
|
|
2439 |
};
|
|
2440 |
|
|
2441 |
|
|
2442 |
|
|
2443 |
|
|
2444 |
class RMessagePtr2;
|
|
2445 |
/**
|
|
2446 |
@publishedAll
|
|
2447 |
@released
|
|
2448 |
|
|
2449 |
A handle to a semaphore.
|
|
2450 |
|
|
2451 |
The semaphore itself is a Kernel side object.
|
|
2452 |
|
|
2453 |
As with all handles, they should be closed after use. RHandleBase provides
|
|
2454 |
the necessary Close() function, which should be called when the handle is
|
|
2455 |
no longer required.
|
|
2456 |
|
|
2457 |
@see RHandleBase::Close
|
|
2458 |
*/
|
|
2459 |
class RSemaphore : public RHandleBase
|
|
2460 |
{
|
|
2461 |
public:
|
|
2462 |
#ifndef __KERNEL_MODE__
|
|
2463 |
inline TInt Open(const TFindSemaphore& aFind,TOwnerType aType=EOwnerProcess);
|
|
2464 |
IMPORT_C TInt CreateLocal(TInt aCount,TOwnerType aType=EOwnerProcess);
|
|
2465 |
IMPORT_C TInt CreateGlobal(const TDesC& aName,TInt aCount,TOwnerType aType=EOwnerProcess);
|
|
2466 |
IMPORT_C TInt OpenGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess);
|
|
2467 |
IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
|
|
2468 |
IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
|
|
2469 |
IMPORT_C void Wait();
|
|
2470 |
IMPORT_C TInt Wait(TInt aTimeout); // timeout in microseconds
|
|
2471 |
IMPORT_C void Signal();
|
|
2472 |
IMPORT_C void Signal(TInt aCount);
|
|
2473 |
#endif
|
|
2474 |
};
|
|
2475 |
|
|
2476 |
|
|
2477 |
|
|
2478 |
|
|
2479 |
/**
|
|
2480 |
@publishedAll
|
|
2481 |
@released
|
|
2482 |
|
|
2483 |
A fast semaphore.
|
|
2484 |
|
|
2485 |
This is a layer over a standard semaphore, and only calls into the kernel side
|
|
2486 |
if there is contention.
|
|
2487 |
*/
|
|
2488 |
class RFastLock : public RSemaphore
|
|
2489 |
{
|
|
2490 |
public:
|
|
2491 |
inline RFastLock();
|
|
2492 |
IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess);
|
|
2493 |
IMPORT_C void Wait();
|
|
2494 |
IMPORT_C void Signal();
|
|
2495 |
private:
|
|
2496 |
TInt iCount;
|
|
2497 |
};
|
|
2498 |
|
|
2499 |
|
|
2500 |
|
|
2501 |
|
|
2502 |
/**
|
|
2503 |
@publishedAll
|
|
2504 |
@released
|
|
2505 |
|
|
2506 |
A read-write lock.
|
|
2507 |
|
|
2508 |
This is a lock for co-ordinating readers and writers to shared resources.
|
|
2509 |
It is designed to allow multiple concurrent readers.
|
|
2510 |
It is not a kernel side object and so does not inherit from RHandleBase.
|
|
2511 |
*/
|
|
2512 |
class RReadWriteLock
|
|
2513 |
{
|
|
2514 |
public:
|
|
2515 |
enum TReadWriteLockPriority
|
|
2516 |
{
|
|
2517 |
/** Pending writers always get the lock before pending readers */
|
|
2518 |
EWriterPriority,
|
|
2519 |
/** Lock is given alternately to pending readers and writers */
|
|
2520 |
EAlternatePriority,
|
|
2521 |
/** Pending readers always get the lock before pending writers - beware writer starvation! */
|
|
2522 |
EReaderPriority,
|
|
2523 |
};
|
|
2524 |
enum TReadWriteLockClientCategoryLimit
|
|
2525 |
{
|
|
2526 |
/** Maximum number of clients in each category: read locked, read lock pending, write lock pending */
|
|
2527 |
EReadWriteLockClientCategoryLimit = KMaxTUint16
|
|
2528 |
};
|
|
2529 |
|
|
2530 |
public:
|
|
2531 |
inline RReadWriteLock();
|
|
2532 |
IMPORT_C TInt CreateLocal(TReadWriteLockPriority aPriority = EWriterPriority);
|
|
2533 |
IMPORT_C void Close();
|
|
2534 |
|
|
2535 |
IMPORT_C void ReadLock();
|
|
2536 |
IMPORT_C void WriteLock();
|
|
2537 |
IMPORT_C TBool TryReadLock();
|
|
2538 |
IMPORT_C TBool TryWriteLock();
|
|
2539 |
IMPORT_C TBool TryUpgradeReadLock();
|
|
2540 |
IMPORT_C void DowngradeWriteLock();
|
|
2541 |
IMPORT_C void Unlock();
|
|
2542 |
|
|
2543 |
private:
|
|
2544 |
RReadWriteLock(const RReadWriteLock& aLock);
|
|
2545 |
RReadWriteLock& operator=(const RReadWriteLock& aLock);
|
|
2546 |
|
|
2547 |
TInt UnlockWriter();
|
|
2548 |
TInt UnlockAlternate();
|
|
2549 |
TInt UnlockReader();
|
|
2550 |
|
|
2551 |
private:
|
|
2552 |
volatile TUint64 iValues; // Bits 0-15: readers; bit 16: writer; bits 32-47: readersPending; bits 48-63: writersPending
|
|
2553 |
TReadWriteLockPriority iPriority;
|
|
2554 |
RSemaphore iReaderSem;
|
|
2555 |
RSemaphore iWriterSem;
|
|
2556 |
TUint32 iSpare[4]; // Reserved for future development
|
|
2557 |
};
|
|
2558 |
|
|
2559 |
|
|
2560 |
|
|
2561 |
|
|
2562 |
/**
|
|
2563 |
@publishedAll
|
|
2564 |
@released
|
|
2565 |
|
|
2566 |
The user-side handle to a logical channel.
|
|
2567 |
|
|
2568 |
The class provides functions that are used to open a channel
|
|
2569 |
to a device driver, and to make requests. A device driver provides
|
|
2570 |
a derived class to give the user-side a tailored interface to the driver.
|
|
2571 |
*/
|
|
2572 |
class RBusLogicalChannel : public RHandleBase
|
|
2573 |
{
|
|
2574 |
public:
|
|
2575 |
IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
|
|
2576 |
IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
|
|
2577 |
protected:
|
|
2578 |
inline TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* anInfo, TOwnerType aType=EOwnerProcess, TBool aProtected=EFalse);
|
|
2579 |
IMPORT_C void DoCancel(TUint aReqMask);
|
|
2580 |
IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus);
|
|
2581 |
IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1);
|
|
2582 |
IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1,TAny* a2);
|
|
2583 |
IMPORT_C TInt DoControl(TInt aFunction);
|
|
2584 |
IMPORT_C TInt DoControl(TInt aFunction,TAny* a1);
|
|
2585 |
IMPORT_C TInt DoControl(TInt aFunction,TAny* a1,TAny* a2);
|
|
2586 |
inline TInt DoSvControl(TInt aFunction) { return DoControl(aFunction); }
|
|
2587 |
inline TInt DoSvControl(TInt aFunction,TAny* a1) { return DoControl(aFunction, a1); }
|
|
2588 |
inline TInt DoSvControl(TInt aFunction,TAny* a1,TAny* a2) { return DoControl(aFunction, a1, a2); }
|
|
2589 |
private:
|
|
2590 |
IMPORT_C TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* aInfo, TInt aType);
|
|
2591 |
private:
|
|
2592 |
// Padding for Binary Compatibility purposes
|
|
2593 |
TInt iPadding1;
|
|
2594 |
TInt iPadding2;
|
|
2595 |
};
|
|
2596 |
|
|
2597 |
|
|
2598 |
|
|
2599 |
|
|
2600 |
/**
|
|
2601 |
@internalComponent
|
|
2602 |
|
|
2603 |
Base class for memory allocators.
|
|
2604 |
*/
|
|
2605 |
// Put pure virtual functions into a separate base class so that vptr is at same
|
|
2606 |
// place in both GCC98r2 and EABI builds.
|
|
2607 |
class MAllocator
|
|
2608 |
{
|
|
2609 |
public:
|
|
2610 |
virtual TAny* Alloc(TInt aSize)=0;
|
|
2611 |
virtual void Free(TAny* aPtr)=0;
|
|
2612 |
virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0)=0;
|
|
2613 |
virtual TInt AllocLen(const TAny* aCell) const =0;
|
|
2614 |
virtual TInt Compress()=0;
|
|
2615 |
virtual void Reset()=0;
|
|
2616 |
virtual TInt AllocSize(TInt& aTotalAllocSize) const =0;
|
|
2617 |
virtual TInt Available(TInt& aBiggestBlock) const =0;
|
|
2618 |
virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL)=0;
|
|
2619 |
virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)=0;
|
|
2620 |
};
|
|
2621 |
|
|
2622 |
|
|
2623 |
|
|
2624 |
|
|
2625 |
/**
|
|
2626 |
@publishedAll
|
|
2627 |
@released
|
|
2628 |
|
|
2629 |
Base class for heaps.
|
|
2630 |
*/
|
|
2631 |
class RAllocator : public MAllocator
|
|
2632 |
{
|
|
2633 |
public:
|
|
2634 |
|
|
2635 |
|
|
2636 |
/**
|
|
2637 |
A set of heap allocation failure flags.
|
|
2638 |
|
|
2639 |
This enumeration indicates how to simulate heap allocation failure.
|
|
2640 |
|
|
2641 |
@see RAllocator::__DbgSetAllocFail()
|
|
2642 |
*/
|
|
2643 |
enum TAllocFail {
|
|
2644 |
/**
|
|
2645 |
Attempts to allocate from this heap fail at a random rate;
|
|
2646 |
however, the interval pattern between failures is the same
|
|
2647 |
every time simulation is started.
|
|
2648 |
*/
|
|
2649 |
ERandom,
|
|
2650 |
|
|
2651 |
|
|
2652 |
/**
|
|
2653 |
Attempts to allocate from this heap fail at a random rate.
|
|
2654 |
The interval pattern between failures may be different every
|
|
2655 |
time the simulation is started.
|
|
2656 |
*/
|
|
2657 |
ETrueRandom,
|
|
2658 |
|
|
2659 |
|
|
2660 |
/**
|
|
2661 |
Attempts to allocate from this heap fail at a rate aRate;
|
|
2662 |
for example, if aRate is 3, allocation fails at every
|
|
2663 |
third attempt.
|
|
2664 |
*/
|
|
2665 |
EDeterministic,
|
|
2666 |
|
|
2667 |
|
|
2668 |
/**
|
|
2669 |
Cancels simulated heap allocation failure.
|
|
2670 |
*/
|
|
2671 |
ENone,
|
|
2672 |
|
|
2673 |
|
|
2674 |
/**
|
|
2675 |
An allocation from this heap will fail after the next aRate - 1
|
|
2676 |
allocation attempts. For example, if aRate = 1 then the next
|
|
2677 |
attempt to allocate from this heap will fail.
|
|
2678 |
*/
|
|
2679 |
EFailNext,
|
|
2680 |
|
|
2681 |
/**
|
|
2682 |
Cancels simulated heap allocation failure, and sets
|
|
2683 |
the nesting level for all allocated cells to zero.
|
|
2684 |
*/
|
|
2685 |
EReset,
|
|
2686 |
|
|
2687 |
/**
|
|
2688 |
aBurst allocations from this heap fail at a random rate;
|
|
2689 |
however, the interval pattern between failures is the same
|
|
2690 |
every time the simulation is started.
|
|
2691 |
*/
|
|
2692 |
EBurstRandom,
|
|
2693 |
|
|
2694 |
|
|
2695 |
/**
|
|
2696 |
aBurst allocations from this heap fail at a random rate.
|
|
2697 |
The interval pattern between failures may be different every
|
|
2698 |
time the simulation is started.
|
|
2699 |
*/
|
|
2700 |
EBurstTrueRandom,
|
|
2701 |
|
|
2702 |
|
|
2703 |
/**
|
|
2704 |
aBurst allocations from this heap fail at a rate aRate.
|
|
2705 |
For example, if aRate is 10 and aBurst is 2, then 2 allocations
|
|
2706 |
will fail at every tenth attempt.
|
|
2707 |
*/
|
|
2708 |
EBurstDeterministic,
|
|
2709 |
|
|
2710 |
/**
|
|
2711 |
aBurst allocations from this heap will fail after the next aRate - 1
|
|
2712 |
allocation attempts have occurred. For example, if aRate = 1 and
|
|
2713 |
aBurst = 3 then the next 3 attempts to allocate from this heap will fail.
|
|
2714 |
*/
|
|
2715 |
EBurstFailNext,
|
|
2716 |
|
|
2717 |
/**
|
|
2718 |
Use this to determine how many times the current debug
|
|
2719 |
failure mode has failed so far.
|
|
2720 |
@see RAllocator::__DbgCheckFailure()
|
|
2721 |
*/
|
|
2722 |
ECheckFailure,
|
|
2723 |
};
|
|
2724 |
|
|
2725 |
|
|
2726 |
/**
|
|
2727 |
Heap debug checking type flag.
|
|
2728 |
*/
|
|
2729 |
enum TDbgHeapType {
|
|
2730 |
/**
|
|
2731 |
The heap is a user heap.
|
|
2732 |
*/
|
|
2733 |
EUser,
|
|
2734 |
|
|
2735 |
/**
|
|
2736 |
The heap is the Kernel heap.
|
|
2737 |
*/
|
|
2738 |
EKernel
|
|
2739 |
};
|
|
2740 |
|
|
2741 |
|
|
2742 |
enum TAllocDebugOp {ECount, EMarkStart, EMarkEnd, ECheck, ESetFail, ECopyDebugInfo, ESetBurstFail};
|
|
2743 |
|
|
2744 |
|
|
2745 |
/**
|
|
2746 |
Flags controlling reallocation.
|
|
2747 |
*/
|
|
2748 |
enum TReAllocMode {
|
|
2749 |
/**
|
|
2750 |
A reallocation of a cell must not change
|
|
2751 |
the start address of the cell.
|
|
2752 |
*/
|
|
2753 |
ENeverMove=1,
|
|
2754 |
|
|
2755 |
/**
|
|
2756 |
Allows the start address of the cell to change
|
|
2757 |
if the cell shrinks in size.
|
|
2758 |
*/
|
|
2759 |
EAllowMoveOnShrink=2
|
|
2760 |
};
|
|
2761 |
|
|
2762 |
|
|
2763 |
enum TFlags {ESingleThreaded=1, EFixedSize=2, ETraceAllocs=4, EMonitorMemory=8,};
|
|
2764 |
struct SCheckInfo {TBool iAll; TInt iCount; const TDesC8* iFileName; TInt iLineNum;};
|
|
2765 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
2766 |
struct SRAllocatorBurstFail {TInt iBurst; TInt iRate; TInt iUnused[2];};
|
|
2767 |
#endif
|
|
2768 |
enum {EMaxHandles=32};
|
|
2769 |
|
|
2770 |
public:
|
|
2771 |
inline RAllocator();
|
|
2772 |
#ifndef __KERNEL_MODE__
|
|
2773 |
IMPORT_C TInt Open();
|
|
2774 |
IMPORT_C void Close();
|
|
2775 |
IMPORT_C TAny* AllocZ(TInt aSize);
|
|
2776 |
IMPORT_C TAny* AllocZL(TInt aSize);
|
|
2777 |
IMPORT_C TAny* AllocL(TInt aSize);
|
|
2778 |
IMPORT_C TAny* AllocLC(TInt aSize);
|
|
2779 |
IMPORT_C void FreeZ(TAny*& aCell);
|
|
2780 |
IMPORT_C TAny* ReAllocL(TAny* aCell, TInt aSize, TInt aMode=0);
|
|
2781 |
IMPORT_C TInt Count() const;
|
|
2782 |
IMPORT_C TInt Count(TInt& aFreeCount) const;
|
|
2783 |
#endif
|
|
2784 |
UIMPORT_C void Check() const;
|
|
2785 |
UIMPORT_C void __DbgMarkStart();
|
|
2786 |
UIMPORT_C TUint32 __DbgMarkEnd(TInt aCount);
|
|
2787 |
UIMPORT_C TInt __DbgMarkCheck(TBool aCountAll, TInt aCount, const TDesC8& aFileName, TInt aLineNum);
|
|
2788 |
inline void __DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum);
|
|
2789 |
UIMPORT_C void __DbgSetAllocFail(TAllocFail aType, TInt aRate);
|
|
2790 |
UIMPORT_C void __DbgSetBurstAllocFail(TAllocFail aType, TUint aRate, TUint aBurst);
|
|
2791 |
UIMPORT_C TUint __DbgCheckFailure();
|
|
2792 |
protected:
|
|
2793 |
UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
|
|
2794 |
#ifndef __KERNEL_MODE__
|
|
2795 |
IMPORT_C virtual void DoClose();
|
|
2796 |
#endif
|
|
2797 |
protected:
|
|
2798 |
TInt iAccessCount;
|
|
2799 |
TInt iHandleCount;
|
|
2800 |
TInt* iHandles;
|
|
2801 |
TUint32 iFlags;
|
|
2802 |
TInt iCellCount;
|
|
2803 |
TInt iTotalAllocSize;
|
|
2804 |
};
|
|
2805 |
|
|
2806 |
|
|
2807 |
|
|
2808 |
|
|
2809 |
class UserHeap;
|
|
2810 |
/**
|
|
2811 |
@publishedAll
|
|
2812 |
@released
|
|
2813 |
|
|
2814 |
Represents the default implementation for a heap.
|
|
2815 |
|
|
2816 |
The default implementation uses an address-ordered first fit type algorithm.
|
|
2817 |
|
|
2818 |
The heap itself is contained in a chunk and may be the only occupant of the
|
|
2819 |
chunk or may share the chunk with the program stack.
|
|
2820 |
|
|
2821 |
The class contains member functions for allocating, adjusting, freeing individual
|
|
2822 |
cells and generally managing the heap.
|
|
2823 |
|
|
2824 |
The class is not a handle in the same sense that RChunk is a handle; i.e.
|
|
2825 |
there is no Kernel object which corresponds to the heap.
|
|
2826 |
*/
|
|
2827 |
class RHeap : public RAllocator
|
|
2828 |
{
|
|
2829 |
public:
|
|
2830 |
/**
|
|
2831 |
The structure of a heap cell header for a heap cell on the free list.
|
|
2832 |
*/
|
|
2833 |
struct SCell {
|
|
2834 |
/**
|
|
2835 |
The length of the cell, which includes the length of
|
|
2836 |
this header.
|
|
2837 |
*/
|
|
2838 |
TInt len;
|
|
2839 |
|
|
2840 |
|
|
2841 |
/**
|
|
2842 |
A pointer to the next cell in the free list.
|
|
2843 |
*/
|
|
2844 |
SCell* next;
|
|
2845 |
};
|
|
2846 |
|
|
2847 |
|
|
2848 |
/**
|
|
2849 |
The structure of a heap cell header for an allocated heap cell in a debug build.
|
|
2850 |
*/
|
|
2851 |
struct SDebugCell {
|
|
2852 |
/**
|
|
2853 |
The length of the cell, which includes the length of
|
|
2854 |
this header.
|
|
2855 |
*/
|
|
2856 |
TInt len;
|
|
2857 |
|
|
2858 |
|
|
2859 |
/**
|
|
2860 |
The nested level.
|
|
2861 |
*/
|
|
2862 |
TInt nestingLevel;
|
|
2863 |
|
|
2864 |
|
|
2865 |
/**
|
|
2866 |
The cumulative number of allocated cells
|
|
2867 |
*/
|
|
2868 |
TInt allocCount;
|
|
2869 |
};
|
|
2870 |
|
|
2871 |
/**
|
|
2872 |
@internalComponent
|
|
2873 |
*/
|
|
2874 |
struct SHeapCellInfo { RHeap* iHeap; TInt iTotalAlloc; TInt iTotalAllocSize; TInt iTotalFree; TInt iLevelAlloc; SDebugCell* iStranded; };
|
|
2875 |
|
|
2876 |
/**
|
|
2877 |
@internalComponent
|
|
2878 |
*/
|
|
2879 |
struct _s_align {char c; double d;};
|
|
2880 |
|
|
2881 |
/**
|
|
2882 |
The default cell alignment.
|
|
2883 |
*/
|
|
2884 |
enum {ECellAlignment = sizeof(_s_align)-sizeof(double)};
|
|
2885 |
|
|
2886 |
/**
|
|
2887 |
Size of a free cell header.
|
|
2888 |
*/
|
|
2889 |
enum {EFreeCellSize = sizeof(SCell)};
|
|
2890 |
|
|
2891 |
|
|
2892 |
#ifdef _DEBUG
|
|
2893 |
/**
|
|
2894 |
Size of an allocated cell header in a debug build.
|
|
2895 |
*/
|
|
2896 |
enum {EAllocCellSize = sizeof(SDebugCell)};
|
|
2897 |
#else
|
|
2898 |
/**
|
|
2899 |
Size of an allocated cell header in a release build.
|
|
2900 |
*/
|
|
2901 |
enum {EAllocCellSize = sizeof(SCell*)};
|
|
2902 |
#endif
|
|
2903 |
|
|
2904 |
|
|
2905 |
/**
|
|
2906 |
@internalComponent
|
|
2907 |
*/
|
|
2908 |
enum TDebugOp {EWalk=128};
|
|
2909 |
|
|
2910 |
|
|
2911 |
/**
|
|
2912 |
@internalComponent
|
|
2913 |
*/
|
|
2914 |
enum TCellType
|
|
2915 |
{EGoodAllocatedCell, EGoodFreeCell, EBadAllocatedCellSize, EBadAllocatedCellAddress,
|
|
2916 |
EBadFreeCellAddress, EBadFreeCellSize};
|
|
2917 |
|
|
2918 |
|
|
2919 |
/**
|
|
2920 |
@internalComponent
|
|
2921 |
*/
|
|
2922 |
enum TDebugHeapId {EUser=0, EKernel=1};
|
|
2923 |
|
|
2924 |
/**
|
|
2925 |
@internalComponent
|
|
2926 |
*/
|
|
2927 |
enum TDefaultShrinkRatios {EShrinkRatio1=256, EShrinkRatioDflt=512};
|
|
2928 |
|
|
2929 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
2930 |
/**
|
|
2931 |
@internalComponent
|
|
2932 |
*/
|
|
2933 |
#else
|
|
2934 |
private:
|
|
2935 |
#endif
|
|
2936 |
typedef void (*TWalkFunc)(TAny*, TCellType, TAny*, TInt);
|
|
2937 |
|
|
2938 |
public:
|
|
2939 |
UIMPORT_C virtual TAny* Alloc(TInt aSize);
|
|
2940 |
UIMPORT_C virtual void Free(TAny* aPtr);
|
|
2941 |
UIMPORT_C virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
|
|
2942 |
UIMPORT_C virtual TInt AllocLen(const TAny* aCell) const;
|
|
2943 |
#ifndef __KERNEL_MODE__
|
|
2944 |
UIMPORT_C virtual TInt Compress();
|
|
2945 |
UIMPORT_C virtual void Reset();
|
|
2946 |
UIMPORT_C virtual TInt AllocSize(TInt& aTotalAllocSize) const;
|
|
2947 |
UIMPORT_C virtual TInt Available(TInt& aBiggestBlock) const;
|
|
2948 |
#endif
|
|
2949 |
UIMPORT_C virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
|
|
2950 |
protected:
|
|
2951 |
UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
|
|
2952 |
public:
|
|
2953 |
UIMPORT_C RHeap(TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue);
|
|
2954 |
UIMPORT_C RHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign=0, TBool aSingleThread=EFalse);
|
|
2955 |
UIMPORT_C TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
|
|
2956 |
inline void operator delete(TAny* aPtr, TAny* aBase);
|
|
2957 |
inline TUint8* Base() const;
|
|
2958 |
inline TInt Size() const;
|
|
2959 |
inline TInt MaxLength() const;
|
|
2960 |
inline TInt Align(TInt a) const;
|
|
2961 |
inline const TAny* Align(const TAny* a) const;
|
|
2962 |
inline TBool IsLastCell(const SCell* aCell) const;
|
|
2963 |
inline void Lock() const;
|
|
2964 |
inline void Unlock() const;
|
|
2965 |
inline TInt ChunkHandle() const;
|
|
2966 |
protected:
|
|
2967 |
inline RHeap();
|
|
2968 |
void Initialise();
|
|
2969 |
SCell* DoAlloc(TInt aSize, SCell*& aLastFree);
|
|
2970 |
void DoFree(SCell* pC);
|
|
2971 |
TInt TryToGrowHeap(TInt aSize, SCell* aLastFree);
|
|
2972 |
inline void FindFollowingFreeCell(SCell* aCell, SCell*& pPrev, SCell*& aNext);
|
|
2973 |
TInt TryToGrowCell(SCell* pC, SCell* pP, SCell* pE, TInt aSize);
|
|
2974 |
TInt Reduce(SCell* aCell);
|
|
2975 |
UIMPORT_C SCell* GetAddress(const TAny* aCell) const;
|
|
2976 |
void CheckCell(const SCell* aCell) const;
|
|
2977 |
void Walk(TWalkFunc aFunc, TAny* aPtr);
|
|
2978 |
static void WalkCheckCell(TAny* aPtr, TCellType aType, TAny* aCell, TInt aLen);
|
|
2979 |
TInt DoCountAllocFree(TInt& aFree);
|
|
2980 |
TInt DoCheckHeap(SCheckInfo* aInfo);
|
|
2981 |
void DoMarkStart();
|
|
2982 |
TUint32 DoMarkEnd(TInt aExpected);
|
|
2983 |
void DoSetAllocFail(TAllocFail aType, TInt aRate);
|
|
2984 |
TBool CheckForSimulatedAllocFail();
|
|
2985 |
inline TInt SetBrk(TInt aBrk);
|
|
2986 |
inline TAny* ReAllocImpl(TAny* aPtr, TInt aSize, TInt aMode);
|
|
2987 |
void DoSetAllocFail(TAllocFail aType, TInt aRate, TUint aBurst);
|
|
2988 |
protected:
|
|
2989 |
TInt iMinLength;
|
|
2990 |
TInt iMaxLength;
|
|
2991 |
TInt iOffset;
|
|
2992 |
TInt iGrowBy;
|
|
2993 |
TInt iChunkHandle;
|
|
2994 |
RFastLock iLock;
|
|
2995 |
TUint8* iBase;
|
|
2996 |
TUint8* iTop;
|
|
2997 |
TInt iAlign;
|
|
2998 |
TInt iMinCell;
|
|
2999 |
TInt iPageSize;
|
|
3000 |
SCell iFree;
|
|
3001 |
protected:
|
|
3002 |
TInt iNestingLevel;
|
|
3003 |
TInt iAllocCount;
|
|
3004 |
TAllocFail iFailType;
|
|
3005 |
TInt iFailRate;
|
|
3006 |
TBool iFailed;
|
|
3007 |
TInt iFailAllocCount;
|
|
3008 |
TInt iRand;
|
|
3009 |
TAny* iTestData;
|
|
3010 |
|
|
3011 |
friend class UserHeap;
|
|
3012 |
};
|
|
3013 |
|
|
3014 |
|
|
3015 |
|
|
3016 |
|
|
3017 |
|
|
3018 |
class OnlyCreateWithNull;
|
|
3019 |
|
|
3020 |
/** @internalTechnology */
|
|
3021 |
typedef void (OnlyCreateWithNull::* __NullPMF)();
|
|
3022 |
|
|
3023 |
/** @internalTechnology */
|
|
3024 |
class OnlyCreateWithNull
|
|
3025 |
{
|
|
3026 |
public:
|
|
3027 |
inline OnlyCreateWithNull(__NullPMF /*aPointerToNull*/) {}
|
|
3028 |
};
|
|
3029 |
|
|
3030 |
/**
|
|
3031 |
@publishedAll
|
|
3032 |
@released
|
|
3033 |
|
|
3034 |
A handle to a message sent by the client to the server.
|
|
3035 |
|
|
3036 |
A server's interaction with its clients is channelled through an RMessagePtr2
|
|
3037 |
object, which acts as a handle to a message sent by the client.
|
|
3038 |
The details of the original message are kept by the kernel allowing it enforce
|
|
3039 |
correct usage of the member functions of this class.
|
|
3040 |
|
|
3041 |
@see RMessage2
|
|
3042 |
*/
|
|
3043 |
class RMessagePtr2
|
|
3044 |
{
|
|
3045 |
public:
|
|
3046 |
inline RMessagePtr2();
|
|
3047 |
inline TBool IsNull() const;
|
|
3048 |
inline TInt Handle() const;
|
|
3049 |
#ifndef __KERNEL_MODE__
|
|
3050 |
IMPORT_C void Complete(TInt aReason) const;
|
|
3051 |
IMPORT_C void Complete(RHandleBase aHandle) const;
|
|
3052 |
IMPORT_C TInt GetDesLength(TInt aParam) const;
|
|
3053 |
IMPORT_C TInt GetDesLengthL(TInt aParam) const;
|
|
3054 |
IMPORT_C TInt GetDesMaxLength(TInt aParam) const;
|
|
3055 |
IMPORT_C TInt GetDesMaxLengthL(TInt aParam) const;
|
|
3056 |
IMPORT_C void ReadL(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
|
|
3057 |
IMPORT_C void ReadL(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
|
|
3058 |
IMPORT_C void WriteL(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
|
|
3059 |
IMPORT_C void WriteL(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
|
|
3060 |
IMPORT_C TInt Read(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
|
|
3061 |
IMPORT_C TInt Read(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
|
|
3062 |
IMPORT_C TInt Write(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
|
|
3063 |
IMPORT_C TInt Write(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
|
|
3064 |
IMPORT_C void Panic(const TDesC& aCategory,TInt aReason) const;
|
|
3065 |
IMPORT_C void Kill(TInt aReason) const;
|
|
3066 |
IMPORT_C void Terminate(TInt aReason) const;
|
|
3067 |
IMPORT_C TInt SetProcessPriority(TProcessPriority aPriority) const;
|
|
3068 |
inline void SetProcessPriorityL(TProcessPriority aPriority) const;
|
|
3069 |
IMPORT_C TInt Client(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
|
|
3070 |
inline void ClientL(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
|
|
3071 |
IMPORT_C TUint ClientProcessFlags() const;
|
|
3072 |
IMPORT_C const TRequestStatus* ClientStatus() const;
|
|
3073 |
IMPORT_C TBool ClientIsRealtime() const;
|
|
3074 |
|
|
3075 |
/**
|
|
3076 |
Return the Secure ID of the process which sent this message.
|
|
3077 |
|
|
3078 |
If an intended use of this method is to check that the Secure ID is
|
|
3079 |
a given value, then the use of a TSecurityPolicy object should be
|
|
3080 |
considered. E.g. Instead of something like:
|
|
3081 |
|
|
3082 |
@code
|
|
3083 |
RMessagePtr2& message;
|
|
3084 |
TInt error = message.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied;
|
|
3085 |
@endcode
|
|
3086 |
|
|
3087 |
this could be used;
|
|
3088 |
|
|
3089 |
@code
|
|
3090 |
RMessagePtr2& message;
|
|
3091 |
static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId);
|
|
3092 |
TBool pass = mySidPolicy().CheckPolicy(message);
|
|
3093 |
@endcode
|
|
3094 |
|
|
3095 |
This has the benefit that the TSecurityPolicy::CheckPolicy methods are
|
|
3096 |
configured by the system wide Platform Security configuration. I.e. are
|
|
3097 |
capable of emitting diagnostic messages when a check fails and/or the
|
|
3098 |
check can be forced to always pass.
|
|
3099 |
|
|
3100 |
@see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
|
|
3101 |
@see _LIT_SECURITY_POLICY_S0
|
|
3102 |
|
|
3103 |
@return The Secure ID.
|
|
3104 |
|
|
3105 |
@publishedAll
|
|
3106 |
@released
|
|
3107 |
*/
|
|
3108 |
IMPORT_C TSecureId SecureId() const;
|
|
3109 |
|
|
3110 |
/**
|
|
3111 |
Return the Vendor ID of the process which sent this message.
|
|
3112 |
|
|
3113 |
If an intended use of this method is to check that the Vendor ID is
|
|
3114 |
a given value, then the use of a TSecurityPolicy object should be
|
|
3115 |
considered. E.g. Instead of something like:
|
|
3116 |
|
|
3117 |
@code
|
|
3118 |
RMessagePtr2& message;
|
|
3119 |
TInt error = message.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied;
|
|
3120 |
@endcode
|
|
3121 |
|
|
3122 |
this could be used;
|
|
3123 |
|
|
3124 |
@code
|
|
3125 |
RMessagePtr2& message;
|
|
3126 |
static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId);
|
|
3127 |
TBool pass = myVidPolicy().CheckPolicy(message);
|
|
3128 |
@endcode
|
|
3129 |
|
|
3130 |
This has the benefit that the TSecurityPolicy::CheckPolicy methods are
|
|
3131 |
configured by the system wide Platform Security configuration. I.e. are
|
|
3132 |
capable of emitting diagnostic messages when a check fails and/or the
|
|
3133 |
check can be forced to always pass.
|
|
3134 |
|
|
3135 |
@see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
|
|
3136 |
@see _LIT_SECURITY_POLICY_V0
|
|
3137 |
|
|
3138 |
@return The Vendor ID.
|
|
3139 |
@publishedAll
|
|
3140 |
@released
|
|
3141 |
*/
|
|
3142 |
IMPORT_C TVendorId VendorId() const;
|
|
3143 |
|
|
3144 |
/**
|
|
3145 |
Check if the process which sent this message has a given capability.
|
|
3146 |
|
|
3147 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
3148 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
3149 |
If PlatSecEnforcement is OFF, then this function will return ETrue even though the
|
|
3150 |
check failed.
|
|
3151 |
|
|
3152 |
@param aCapability The capability to test.
|
|
3153 |
@param aDiagnostic A string that will be emitted along with any diagnostic message
|
|
3154 |
that may be issued if the test finds the capability is not present.
|
|
3155 |
This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
3156 |
which enables it to be easily removed from the system.
|
|
3157 |
@return ETrue if process which sent this message has the capability, EFalse otherwise.
|
|
3158 |
@publishedAll
|
|
3159 |
@released
|
|
3160 |
*/
|
|
3161 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3162 |
inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const;
|
|
3163 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3164 |
// Only available to NULL arguments
|
|
3165 |
inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3166 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3167 |
// For things using KSuppressPlatSecDiagnostic
|
|
3168 |
inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3169 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3170 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3171 |
|
|
3172 |
/**
|
|
3173 |
Check if the process which sent this message has a given capability.
|
|
3174 |
|
|
3175 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
3176 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
3177 |
If PlatSecEnforcement is OFF, then this function will not leave even though the
|
|
3178 |
check failed.
|
|
3179 |
|
|
3180 |
@param aCapability The capability to test.
|
|
3181 |
@param aDiagnosticMessage A string that will be emitted along with any diagnostic message
|
|
3182 |
that may be issued if the test finds the capability is not present.
|
|
3183 |
This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
3184 |
which enables it to be easily removed from the system.
|
|
3185 |
@leave KErrPermissionDenied, if the process does not have the capability.
|
|
3186 |
@publishedAll
|
|
3187 |
@released
|
|
3188 |
*/
|
|
3189 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3190 |
inline void HasCapabilityL(TCapability aCapability, const char* aDiagnosticMessage=0) const;
|
|
3191 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3192 |
// Only available to NULL arguments
|
|
3193 |
inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
|
|
3194 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3195 |
// For things using KSuppressPlatSecDiagnostic
|
|
3196 |
inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3197 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3198 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3199 |
|
|
3200 |
/**
|
|
3201 |
Check if the process which sent this message has both of the given capabilities.
|
|
3202 |
|
|
3203 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
3204 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
3205 |
If PlatSecEnforcement is OFF, then this function will return ETrue even though the
|
|
3206 |
check failed.
|
|
3207 |
|
|
3208 |
@param aCapability1 The first capability to test.
|
|
3209 |
@param aCapability2 The second capability to test.
|
|
3210 |
@param aDiagnostic A string that will be emitted along with any diagnostic message
|
|
3211 |
that may be issued if the test finds a capability is not present.
|
|
3212 |
This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
3213 |
which enables it to be easily removed from the system.
|
|
3214 |
@return ETrue if the process which sent this message has both the capabilities, EFalse otherwise.
|
|
3215 |
@publishedAll
|
|
3216 |
@released
|
|
3217 |
*/
|
|
3218 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3219 |
inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const;
|
|
3220 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3221 |
// Only available to NULL arguments
|
|
3222 |
inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3223 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3224 |
// For things using KSuppressPlatSecDiagnostic
|
|
3225 |
inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3226 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3227 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3228 |
|
|
3229 |
/**
|
|
3230 |
Check if the process which sent this message has both of the given capabilities.
|
|
3231 |
|
|
3232 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
3233 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
3234 |
If PlatSecEnforcement is OFF, then this function will not leave even though the
|
|
3235 |
check failed.
|
|
3236 |
|
|
3237 |
@param aCapability1 The first capability to test.
|
|
3238 |
@param aCapability2 The second capability to test.
|
|
3239 |
@param aDiagnosticMessage A string that will be emitted along with any diagnostic message
|
|
3240 |
that may be issued if the test finds a capability is not present.
|
|
3241 |
This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
3242 |
which enables it to be easily removed from the system.
|
|
3243 |
@leave KErrPermissionDenied, if the process does not have the capabilities.
|
|
3244 |
@publishedAll
|
|
3245 |
@released
|
|
3246 |
*/
|
|
3247 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3248 |
inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, const char* aDiagnosticMessage=0) const;
|
|
3249 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3250 |
// Only available to NULL arguments
|
|
3251 |
inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
|
|
3252 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3253 |
// For things using KSuppressPlatSecDiagnostic
|
|
3254 |
inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3255 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3256 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3257 |
|
|
3258 |
/**
|
|
3259 |
@deprecated Use SecureId()
|
|
3260 |
*/
|
|
3261 |
inline TUid Identity() const { return SecureId(); }
|
|
3262 |
#endif
|
|
3263 |
|
|
3264 |
private:
|
|
3265 |
// Implementations of functions with diagnostics
|
|
3266 |
IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const;
|
|
3267 |
IMPORT_C TBool DoHasCapability(TCapability aCapability) const;
|
|
3268 |
IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2, const char* aDiagnostic) const;
|
|
3269 |
IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2) const;
|
|
3270 |
|
|
3271 |
protected:
|
|
3272 |
TInt iHandle;
|
|
3273 |
};
|
|
3274 |
inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight);
|
|
3275 |
inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight);
|
|
3276 |
|
|
3277 |
class CSession2;
|
|
3278 |
|
|
3279 |
#define __IPC_V2_PRESENT__
|
|
3280 |
|
|
3281 |
/**
|
|
3282 |
@publishedAll
|
|
3283 |
@released
|
|
3284 |
|
|
3285 |
An object that encapsulates the details of a client request.
|
|
3286 |
*/
|
|
3287 |
class RMessage2 : public RMessagePtr2
|
|
3288 |
{
|
|
3289 |
friend class CServer2;
|
|
3290 |
public:
|
|
3291 |
|
|
3292 |
/**
|
|
3293 |
Defines internal message types.
|
|
3294 |
*/
|
|
3295 |
enum TSessionMessages {
|
|
3296 |
/**
|
|
3297 |
A message type used internally that means connect.
|
|
3298 |
*/
|
|
3299 |
EConnect=-1,
|
|
3300 |
|
|
3301 |
/**
|
|
3302 |
A message type used internally that means disconnect.
|
|
3303 |
*/
|
|
3304 |
EDisConnect=-2
|
|
3305 |
};
|
|
3306 |
public:
|
|
3307 |
inline RMessage2();
|
|
3308 |
#ifndef __KERNEL_MODE__
|
|
3309 |
IMPORT_C explicit RMessage2(const RMessagePtr2& aPtr);
|
|
3310 |
void SetAuthorised() const;
|
|
3311 |
void ClearAuthorised() const;
|
|
3312 |
TBool Authorised() const;
|
|
3313 |
#endif
|
|
3314 |
inline TInt Function() const;
|
|
3315 |
inline TInt Int0() const;
|
|
3316 |
inline TInt Int1() const;
|
|
3317 |
inline TInt Int2() const;
|
|
3318 |
inline TInt Int3() const;
|
|
3319 |
inline const TAny* Ptr0() const;
|
|
3320 |
inline const TAny* Ptr1() const;
|
|
3321 |
inline const TAny* Ptr2() const;
|
|
3322 |
inline const TAny* Ptr3() const;
|
|
3323 |
inline CSession2* Session() const;
|
|
3324 |
protected:
|
|
3325 |
|
|
3326 |
/**
|
|
3327 |
The request type.
|
|
3328 |
*/
|
|
3329 |
TInt iFunction;
|
|
3330 |
|
|
3331 |
/**
|
|
3332 |
A copy of the message arguments.
|
|
3333 |
*/
|
|
3334 |
TInt iArgs[KMaxMessageArguments];
|
|
3335 |
private:
|
|
3336 |
TInt iSpare1;
|
|
3337 |
protected:
|
|
3338 |
/**
|
|
3339 |
@internalComponent
|
|
3340 |
*/
|
|
3341 |
const TAny* iSessionPtr;
|
|
3342 |
private:
|
|
3343 |
mutable TInt iFlags;// Currently only used for *Authorised above
|
|
3344 |
TInt iSpare3; // Reserved for future use
|
|
3345 |
|
|
3346 |
friend class RMessage;
|
|
3347 |
};
|
|
3348 |
|
|
3349 |
|
|
3350 |
|
|
3351 |
|
|
3352 |
/**
|
|
3353 |
@publishedAll
|
|
3354 |
@released
|
|
3355 |
|
|
3356 |
Defines an 8-bit modifiable buffer descriptor to contain passwords when dealing
|
|
3357 |
with password security support in a file server session.
|
|
3358 |
|
|
3359 |
The descriptor takes a maximum length of KMaxMediaPassword.
|
|
3360 |
|
|
3361 |
@see KMaxMediaPassword
|
|
3362 |
*/
|
|
3363 |
typedef TBuf8<KMaxMediaPassword> TMediaPassword; // 128 bit
|
|
3364 |
|
|
3365 |
|
|
3366 |
|
|
3367 |
/**
|
|
3368 |
@publishedPartner
|
|
3369 |
@prototype
|
|
3370 |
A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
|
|
3371 |
set signifies that a buffer offset list follows the buffer configuration class. This list holds the offset of each buffer.
|
|
3372 |
*/
|
|
3373 |
const TUint KScFlagBufOffsetListInUse=0x00000001;
|
|
3374 |
|
|
3375 |
/**
|
|
3376 |
@publishedPartner
|
|
3377 |
@prototype
|
|
3378 |
A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
|
|
3379 |
set is a suggestion that the shared chunk should be configured leaving guard pages around each buffers.
|
|
3380 |
*/
|
|
3381 |
const TUint KScFlagUseGuardPages=0x00000002;
|
|
3382 |
|
|
3383 |
/**
|
|
3384 |
@publishedPartner
|
|
3385 |
@prototype
|
|
3386 |
The shared chunk buffer configuration class (used by the multimedia device drivers). This is used to hold information
|
|
3387 |
on the current buffer configuration within a shared chunk.
|
|
3388 |
*/
|
|
3389 |
class TSharedChunkBufConfigBase
|
|
3390 |
{
|
|
3391 |
public:
|
|
3392 |
inline TSharedChunkBufConfigBase();
|
|
3393 |
public:
|
|
3394 |
/** The number of buffers. */
|
|
3395 |
TInt iNumBuffers;
|
|
3396 |
/** The size of each buffer in bytes. */
|
|
3397 |
TInt iBufferSizeInBytes;
|
|
3398 |
/** Reserved field. */
|
|
3399 |
TInt iReserved1;
|
|
3400 |
/** Shared chunk buffer flag settings. */
|
|
3401 |
TUint iFlags;
|
|
3402 |
};
|
|
3403 |
|
|
3404 |
|
|
3405 |
/** Maximum size of capability set
|
|
3406 |
|
|
3407 |
@internalTechnology
|
|
3408 |
*/
|
|
3409 |
const TInt KCapabilitySetMaxSize = (((TInt)ECapability_HardLimit + 7)>>3);
|
|
3410 |
|
|
3411 |
/** Maximum size of any future extension to TSecurityPolicy
|
|
3412 |
|
|
3413 |
@internalTechnology
|
|
3414 |
*/
|
|
3415 |
const TInt KMaxSecurityPolicySize = KCapabilitySetMaxSize + 3*sizeof(TUint32);
|
|
3416 |
|
|
3417 |
|
|
3418 |
/** Class representing an arbitrary set of capabilities.
|
|
3419 |
|
|
3420 |
This class can only contain capabilities supported by the current OS version.
|
|
3421 |
|
|
3422 |
@publishedAll
|
|
3423 |
@released
|
|
3424 |
*/
|
|
3425 |
class TCapabilitySet
|
|
3426 |
{
|
|
3427 |
public:
|
|
3428 |
inline TCapabilitySet();
|
|
3429 |
inline TCapabilitySet(TCapability aCapability);
|
|
3430 |
IMPORT_C TCapabilitySet(TCapability aCapability1, TCapability aCapability2);
|
|
3431 |
IMPORT_C void SetEmpty();
|
|
3432 |
inline void Set(TCapability aCapability);
|
|
3433 |
inline void Set(TCapability aCapability1, TCapability aCapability2);
|
|
3434 |
IMPORT_C void SetAllSupported();
|
|
3435 |
IMPORT_C void AddCapability(TCapability aCapability);
|
|
3436 |
IMPORT_C void RemoveCapability(TCapability aCapability);
|
|
3437 |
IMPORT_C void Union(const TCapabilitySet& aCapabilities);
|
|
3438 |
IMPORT_C void Intersection(const TCapabilitySet& aCapabilities);
|
|
3439 |
IMPORT_C void Remove(const TCapabilitySet& aCapabilities);
|
|
3440 |
IMPORT_C TBool HasCapability(TCapability aCapability) const;
|
|
3441 |
IMPORT_C TBool HasCapabilities(const TCapabilitySet& aCapabilities) const;
|
|
3442 |
|
|
3443 |
/**
|
|
3444 |
Make this set consist of the capabilities which are disabled on this platform.
|
|
3445 |
@internalTechnology
|
|
3446 |
*/
|
|
3447 |
IMPORT_C void SetDisabled();
|
|
3448 |
/**
|
|
3449 |
@internalComponent
|
|
3450 |
*/
|
|
3451 |
TBool NotEmpty() const;
|
|
3452 |
|
|
3453 |
private:
|
|
3454 |
TUint32 iCaps[KCapabilitySetMaxSize / sizeof(TUint32)];
|
|
3455 |
};
|
|
3456 |
|
|
3457 |
#ifndef __SECURITY_INFO_DEFINED__
|
|
3458 |
#define __SECURITY_INFO_DEFINED__
|
|
3459 |
/**
|
|
3460 |
@internalTechnology
|
|
3461 |
*/
|
|
3462 |
struct SCapabilitySet
|
|
3463 |
{
|
|
3464 |
enum {ENCapW=2};
|
|
3465 |
|
|
3466 |
inline void AddCapability(TCapability aCap1) {((TCapabilitySet*)this)->AddCapability(aCap1);}
|
|
3467 |
inline void Remove(const SCapabilitySet& aCaps) {((TCapabilitySet*)this)->Remove(*((TCapabilitySet*)&aCaps));}
|
|
3468 |
inline TBool NotEmpty() const {return ((TCapabilitySet*)this)->NotEmpty();}
|
|
3469 |
|
|
3470 |
inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; }
|
|
3471 |
inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; }
|
|
3472 |
|
|
3473 |
TUint32 iCaps[ENCapW];
|
|
3474 |
};
|
|
3475 |
|
|
3476 |
/**
|
|
3477 |
@internalTechnology
|
|
3478 |
*/
|
|
3479 |
struct SSecurityInfo
|
|
3480 |
{
|
|
3481 |
TUint32 iSecureId;
|
|
3482 |
TUint32 iVendorId;
|
|
3483 |
SCapabilitySet iCaps; // Capabilities re. platform security
|
|
3484 |
};
|
|
3485 |
|
|
3486 |
#endif
|
|
3487 |
|
|
3488 |
/** Define this macro to reference the set of all capabilities.
|
|
3489 |
@internalTechnology
|
|
3490 |
*/
|
|
3491 |
#ifdef __REFERENCE_ALL_SUPPORTED_CAPABILITIES__
|
|
3492 |
|
|
3493 |
extern const SCapabilitySet AllSupportedCapabilities;
|
|
3494 |
|
|
3495 |
#endif //__REFERENCE_ALL_SUPPORTED_CAPABILITIES__
|
|
3496 |
|
|
3497 |
/** Define this macro to include the set of all capabilities.
|
|
3498 |
@internalTechnology
|
|
3499 |
*/
|
|
3500 |
#ifdef __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
|
|
3501 |
|
|
3502 |
/** The set of all capabilities.
|
|
3503 |
@internalTechnology
|
|
3504 |
*/
|
|
3505 |
const SCapabilitySet AllSupportedCapabilities = {
|
|
3506 |
{
|
|
3507 |
ECapability_Limit<32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0xffffffffu
|
|
3508 |
,
|
|
3509 |
ECapability_Limit>=32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0u
|
|
3510 |
}
|
|
3511 |
};
|
|
3512 |
|
|
3513 |
#endif // __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
|
|
3514 |
|
|
3515 |
#ifndef __KERNEL_MODE__
|
|
3516 |
class RProcess;
|
|
3517 |
class RThread;
|
|
3518 |
class RMessagePtr2;
|
|
3519 |
class RSessionBase;
|
|
3520 |
#else
|
|
3521 |
class DProcess;
|
|
3522 |
class DThread;
|
|
3523 |
#endif
|
|
3524 |
|
|
3525 |
/** Class representing all security attributes of a process or DLL.
|
|
3526 |
These comprise a set of capabilities, a Secure ID and a Vendor ID.
|
|
3527 |
|
|
3528 |
@publishedAll
|
|
3529 |
@released
|
|
3530 |
*/
|
|
3531 |
class TSecurityInfo
|
|
3532 |
{
|
|
3533 |
public:
|
|
3534 |
inline TSecurityInfo();
|
|
3535 |
#ifdef __KERNEL_MODE__
|
|
3536 |
IMPORT_C TSecurityInfo(DProcess* aProcess);
|
|
3537 |
IMPORT_C TSecurityInfo(DThread* aThread);
|
|
3538 |
#else
|
|
3539 |
IMPORT_C TSecurityInfo(RProcess aProcess);
|
|
3540 |
IMPORT_C TSecurityInfo(RThread aThread);
|
|
3541 |
IMPORT_C TSecurityInfo(RMessagePtr2 aMesPtr);
|
|
3542 |
inline void Set(RProcess aProcess);
|
|
3543 |
inline void Set(RThread aThread);
|
|
3544 |
inline void Set(RMessagePtr2 aMsgPtr);
|
|
3545 |
TInt Set(RSessionBase aSession); /**< @internalComponent */
|
|
3546 |
inline void SetToCurrentInfo();
|
|
3547 |
IMPORT_C void SetToCreatorInfo();
|
|
3548 |
#endif //__KERNEL_MODE__
|
|
3549 |
public:
|
|
3550 |
TSecureId iSecureId; /**< Secure ID */
|
|
3551 |
TVendorId iVendorId; /**< Vendor ID */
|
|
3552 |
TCapabilitySet iCaps; /**< Capability Set */
|
|
3553 |
};
|
|
3554 |
|
|
3555 |
|
|
3556 |
/** Class representing a generic security policy
|
|
3557 |
|
|
3558 |
This class can specify a security policy consisting of either:
|
|
3559 |
|
|
3560 |
-# A check for between 0 and 7 capabilities
|
|
3561 |
-# A check for a given Secure ID along with 0-3 capabilities
|
|
3562 |
-# A check for a given Vendor ID along with 0-3 capabilities
|
|
3563 |
|
|
3564 |
If multiple capabilities are specified, all of them must be present for the
|
|
3565 |
security check to succeed ('AND' relation).
|
|
3566 |
|
|
3567 |
The envisaged use case for this class is to specify access rights to an object
|
|
3568 |
managed either by the kernel or by a server but in principle owned by a client
|
|
3569 |
and usable in a limited way by other clients. For example
|
|
3570 |
- Publish and Subscribe properties
|
|
3571 |
- DBMS databases
|
|
3572 |
|
|
3573 |
In these cases the owning client would pass one (or more) of these objects to
|
|
3574 |
the server to specify which security checks should be done on other clients
|
|
3575 |
before allowing access to the object.
|
|
3576 |
|
|
3577 |
To pass a TSecurityPolicy object via IPC, a client should obtain a descriptor
|
|
3578 |
for the object using Package() and send this. When a server receives this descriptor
|
|
3579 |
it should read the descriptor contents into a TSecurityPolicyBuf and then
|
|
3580 |
Set() should be used to create a policy object from this.
|
|
3581 |
|
|
3582 |
Because this class has non-default constructors, compilers will not initialise
|
|
3583 |
this object at compile time, instead code will be generated to construct the object
|
|
3584 |
at run-time. This is wasteful - and Symbian OS DLLs are not permitted to have
|
|
3585 |
such uninitialised data. To overcome these problems a set of macros are provided to
|
|
3586 |
construct a const object which behaves like a TSecurityPolicy. These are:
|
|
3587 |
|
|
3588 |
_LIT_SECURITY_POLICY_C1 through _LIT_SECURITY_POLICY_C7,
|
|
3589 |
_LIT_SECURITY_POLICY_S0 through _LIT_SECURITY_POLICY_S3 and
|
|
3590 |
_LIT_SECURITY_POLICY_V0 through _LIT_SECURITY_POLICY_V3.
|
|
3591 |
|
|
3592 |
Also, the macros _LIT_SECURITY_POLICY_PASS and _LIT_SECURITY_POLICY_FAIL are provided
|
|
3593 |
in order to allow easy construction of a const object which can be used as a
|
|
3594 |
TSecuityPolicy which always passes or always fails, respectively.
|
|
3595 |
|
|
3596 |
If a security policy object is needed to be embedded in another class then the
|
|
3597 |
TStaticSecurityPolicy structure can be used. This behaves in the same way as a
|
|
3598 |
TSecurityPolicy object but may be initialised at compile time.
|
|
3599 |
|
|
3600 |
@see TStaticSecurityPolicy
|
|
3601 |
@see TSecurityPolicyBuf
|
|
3602 |
@see _LIT_SECURITY_POLICY_PASS
|
|
3603 |
@see _LIT_SECURITY_POLICY_FAIL
|
|
3604 |
@see _LIT_SECURITY_POLICY_C1
|
|
3605 |
@see _LIT_SECURITY_POLICY_C2
|
|
3606 |
@see _LIT_SECURITY_POLICY_C3
|
|
3607 |
@see _LIT_SECURITY_POLICY_C4
|
|
3608 |
@see _LIT_SECURITY_POLICY_C5
|
|
3609 |
@see _LIT_SECURITY_POLICY_C6
|
|
3610 |
@see _LIT_SECURITY_POLICY_C7
|
|
3611 |
@see _LIT_SECURITY_POLICY_S0
|
|
3612 |
@see _LIT_SECURITY_POLICY_S1
|
|
3613 |
@see _LIT_SECURITY_POLICY_S2
|
|
3614 |
@see _LIT_SECURITY_POLICY_S3
|
|
3615 |
@see _LIT_SECURITY_POLICY_V0
|
|
3616 |
@see _LIT_SECURITY_POLICY_V1
|
|
3617 |
@see _LIT_SECURITY_POLICY_V2
|
|
3618 |
@see _LIT_SECURITY_POLICY_V3
|
|
3619 |
|
|
3620 |
@publishedAll
|
|
3621 |
@released
|
|
3622 |
*/
|
|
3623 |
class TSecurityPolicy
|
|
3624 |
{
|
|
3625 |
public:
|
|
3626 |
enum TSecPolicyType
|
|
3627 |
{
|
|
3628 |
EAlwaysFail=0,
|
|
3629 |
EAlwaysPass=1,
|
|
3630 |
};
|
|
3631 |
|
|
3632 |
public:
|
|
3633 |
inline TSecurityPolicy();
|
|
3634 |
IMPORT_C TSecurityPolicy(TSecPolicyType aType);
|
|
3635 |
IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
|
|
3636 |
IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2, TCapability aCap3, TCapability aCap4, TCapability aCap5 = ECapability_None, TCapability aCap6 = ECapability_None, TCapability aCap7 = ECapability_None);
|
|
3637 |
IMPORT_C TSecurityPolicy(TSecureId aSecureId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
|
|
3638 |
IMPORT_C TSecurityPolicy(TVendorId aVendorId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
|
|
3639 |
IMPORT_C TInt Set(const TDesC8& aDes);
|
|
3640 |
IMPORT_C TPtrC8 Package() const;
|
|
3641 |
|
|
3642 |
#ifdef __KERNEL_MODE__
|
|
3643 |
|
|
3644 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3645 |
inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const;
|
|
3646 |
inline TBool CheckPolicy(DThread* aThread, const char* aDiagnostic=0) const;
|
|
3647 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3648 |
// Only available to NULL arguments
|
|
3649 |
inline TBool CheckPolicy(DProcess* aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3650 |
inline TBool CheckPolicy(DThread* aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3651 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3652 |
|
|
3653 |
#else // !__KERNEL_MODE__
|
|
3654 |
|
|
3655 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3656 |
inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
|
|
3657 |
inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
|
|
3658 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
|
|
3659 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
|
|
3660 |
inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
|
|
3661 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3662 |
// Only available to NULL arguments
|
|
3663 |
inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3664 |
inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3665 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3666 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3667 |
inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3668 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3669 |
// For things using KSuppressPlatSecDiagnostic
|
|
3670 |
inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3671 |
inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3672 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3673 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3674 |
inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3675 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3676 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3677 |
TInt CheckPolicy(RSessionBase aSession) const; /**< @internalComponent */
|
|
3678 |
|
|
3679 |
#endif //__KERNEL_MODE__
|
|
3680 |
|
|
3681 |
TBool Validate() const;
|
|
3682 |
|
|
3683 |
private:
|
|
3684 |
#ifdef __KERNEL_MODE__
|
|
3685 |
IMPORT_C TBool DoCheckPolicy(DProcess* aProcess, const char* aDiagnostic) const;
|
|
3686 |
IMPORT_C TBool DoCheckPolicy(DProcess* aProcess) const;
|
|
3687 |
IMPORT_C TBool DoCheckPolicy(DThread* aThread, const char* aDiagnostic) const;
|
|
3688 |
IMPORT_C TBool DoCheckPolicy(DThread* aThread) const;
|
|
3689 |
#else // !__KERNEL_MODE__
|
|
3690 |
IMPORT_C TBool DoCheckPolicy(RProcess aProcess, const char* aDiagnostic) const;
|
|
3691 |
IMPORT_C TBool DoCheckPolicy(RProcess aProcess) const;
|
|
3692 |
IMPORT_C TBool DoCheckPolicy(RThread aThread, const char* aDiagnostic) const;
|
|
3693 |
IMPORT_C TBool DoCheckPolicy(RThread aThread) const;
|
|
3694 |
IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const;
|
|
3695 |
IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr) const;
|
|
3696 |
IMPORT_C TBool DoCheckPolicyCreator(const char* aDiagnostic) const;
|
|
3697 |
IMPORT_C TBool DoCheckPolicyCreator() const;
|
|
3698 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3699 |
TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) const;
|
|
3700 |
#endif //__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3701 |
TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing) const;
|
|
3702 |
#endif //__KERNEL_MODE__
|
|
3703 |
|
|
3704 |
public:
|
|
3705 |
/** Constants to specify the type of TSecurityPolicy objects.
|
|
3706 |
*/
|
|
3707 |
enum TType
|
|
3708 |
{
|
|
3709 |
ETypeFail=0, /**< Always fail*/
|
|
3710 |
ETypePass=1, /**< Always pass*/
|
|
3711 |
ETypeC3=2, /**< Up to 3 capabilities*/
|
|
3712 |
ETypeC7=3, /**< Up to 7 capabilities*/
|
|
3713 |
ETypeS3=4, /**< Secure ID and up to 3 capabilities*/
|
|
3714 |
ETypeV3=5, /**< Vendor ID and up to 3 capabilities*/
|
|
3715 |
|
|
3716 |
/** The number of possible TSecurityPolicy types
|
|
3717 |
This is intended for internal Symbian use only.
|
|
3718 |
@internalTechnology
|
|
3719 |
*/
|
|
3720 |
ETypeLimit
|
|
3721 |
|
|
3722 |
// other values may be added to indicate expanded policy objects (future extensions)
|
|
3723 |
};
|
|
3724 |
protected:
|
|
3725 |
TBool CheckPolicy(const SSecurityInfo& aSecInfo, SSecurityInfo& aMissing) const;
|
|
3726 |
private:
|
|
3727 |
void ConstructAndCheck3(TCapability aCap1, TCapability aCap2, TCapability aCap3);
|
|
3728 |
private:
|
|
3729 |
TUint8 iType;
|
|
3730 |
TUint8 iCaps[3]; // missing capabilities are set to 0xff
|
|
3731 |
union
|
|
3732 |
{
|
|
3733 |
TUint32 iSecureId;
|
|
3734 |
TUint32 iVendorId;
|
|
3735 |
TUint8 iExtraCaps[4]; // missing capabilities are set to 0xff
|
|
3736 |
};
|
|
3737 |
friend class TCompiledSecurityPolicy;
|
|
3738 |
};
|
|
3739 |
|
|
3740 |
/** Provides a TPkcgBuf wrapper for a descriptorised TSecurityPolicy. This a
|
|
3741 |
suitable container for passing a security policy across IPC.
|
|
3742 |
@publishedAll
|
|
3743 |
@released
|
|
3744 |
*/
|
|
3745 |
typedef TPckgBuf<TSecurityPolicy> TSecurityPolicyBuf;
|
|
3746 |
|
|
3747 |
|
|
3748 |
/** Structure for compile-time initialisation of a security policy.
|
|
3749 |
|
|
3750 |
This structure behaves in the same way as a TSecurityPolicy object but has
|
|
3751 |
the advantage that it may be initialised at compile time. E.g.
|
|
3752 |
the following line defines a security policy 'KSecurityPolictReadUserData'
|
|
3753 |
which checks ReadUserData capability.
|
|
3754 |
|
|
3755 |
@code
|
|
3756 |
_LIT_SECURITY_POLICY_C1(KSecurityPolictReadUserData,ECapabilityReadUserData)
|
|
3757 |
@endcode
|
|
3758 |
|
|
3759 |
Or, an array of security policies may be created like this:
|
|
3760 |
@code
|
|
3761 |
static const TStaticSecurityPolicy MyPolicies[] =
|
|
3762 |
{
|
|
3763 |
_INIT_SECURITY_POLICY_C1(ECapabilityReadUserData),
|
|
3764 |
_INIT_SECURITY_POLICY_PASS(),
|
|
3765 |
_INIT_SECURITY_POLICY_S0(0x1234567)
|
|
3766 |
}
|
|
3767 |
@endcode
|
|
3768 |
|
|
3769 |
This class should not be initialised directly, instead one of the following
|
|
3770 |
macros should be used:
|
|
3771 |
|
|
3772 |
- _INIT_SECURITY_POLICY_PASS
|
|
3773 |
- _INIT_SECURITY_POLICY_FAIL
|
|
3774 |
- _INIT_SECURITY_POLICY_C1
|
|
3775 |
- _INIT_SECURITY_POLICY_C2
|
|
3776 |
- _INIT_SECURITY_POLICY_C3
|
|
3777 |
- _INIT_SECURITY_POLICY_C4
|
|
3778 |
- _INIT_SECURITY_POLICY_C5
|
|
3779 |
- _INIT_SECURITY_POLICY_C6
|
|
3780 |
- _INIT_SECURITY_POLICY_C7
|
|
3781 |
- _INIT_SECURITY_POLICY_S0
|
|
3782 |
- _INIT_SECURITY_POLICY_S1
|
|
3783 |
- _INIT_SECURITY_POLICY_S2
|
|
3784 |
- _INIT_SECURITY_POLICY_S3
|
|
3785 |
- _INIT_SECURITY_POLICY_V0
|
|
3786 |
- _INIT_SECURITY_POLICY_V1
|
|
3787 |
- _INIT_SECURITY_POLICY_V2
|
|
3788 |
- _INIT_SECURITY_POLICY_V3
|
|
3789 |
- _LIT_SECURITY_POLICY_PASS
|
|
3790 |
- _LIT_SECURITY_POLICY_FAIL
|
|
3791 |
- _LIT_SECURITY_POLICY_C1
|
|
3792 |
- _LIT_SECURITY_POLICY_C2
|
|
3793 |
- _LIT_SECURITY_POLICY_C3
|
|
3794 |
- _LIT_SECURITY_POLICY_C4
|
|
3795 |
- _LIT_SECURITY_POLICY_C5
|
|
3796 |
- _LIT_SECURITY_POLICY_C6
|
|
3797 |
- _LIT_SECURITY_POLICY_C7
|
|
3798 |
- _LIT_SECURITY_POLICY_S0
|
|
3799 |
- _LIT_SECURITY_POLICY_S1
|
|
3800 |
- _LIT_SECURITY_POLICY_S2
|
|
3801 |
- _LIT_SECURITY_POLICY_S3
|
|
3802 |
- _LIT_SECURITY_POLICY_V0
|
|
3803 |
- _LIT_SECURITY_POLICY_V1
|
|
3804 |
- _LIT_SECURITY_POLICY_V2
|
|
3805 |
- _LIT_SECURITY_POLICY_V3
|
|
3806 |
|
|
3807 |
@see TSecurityPolicy
|
|
3808 |
@publishedAll
|
|
3809 |
@released
|
|
3810 |
*/
|
|
3811 |
struct TStaticSecurityPolicy
|
|
3812 |
{
|
|
3813 |
inline const TSecurityPolicy* operator&() const;
|
|
3814 |
inline operator const TSecurityPolicy&() const;
|
|
3815 |
inline const TSecurityPolicy& operator()() const;
|
|
3816 |
|
|
3817 |
#ifndef __KERNEL_MODE__
|
|
3818 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3819 |
inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
|
|
3820 |
inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
|
|
3821 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
|
|
3822 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
|
|
3823 |
inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
|
|
3824 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3825 |
// Only available to NULL arguments
|
|
3826 |
inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3827 |
inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3828 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3829 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3830 |
inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
|
|
3831 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3832 |
// For things using KSuppressPlatSecDiagnostic
|
|
3833 |
inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3834 |
inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3835 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3836 |
inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3837 |
inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
|
|
3838 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
3839 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
3840 |
#endif // !__KERNEL_MODE__
|
|
3841 |
|
|
3842 |
TUint32 iA; /**< @internalComponent */
|
|
3843 |
TUint32 iB; /**< @internalComponent */
|
|
3844 |
};
|
|
3845 |
|
|
3846 |
|
|
3847 |
/**
|
|
3848 |
A dummy enum for use by the CAPABILITY_AS_TUINT8 macro
|
|
3849 |
@internalComponent
|
|
3850 |
*/
|
|
3851 |
enum __invalid_capability_value {};
|
|
3852 |
|
|
3853 |
/**
|
|
3854 |
A macro to cast a TCapability to a TUint8.
|
|
3855 |
|
|
3856 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
3857 |
a compile time error or warning will be produced which includes the label
|
|
3858 |
"__invalid_capability_value"
|
|
3859 |
|
|
3860 |
@param cap The capability value
|
|
3861 |
@internalComponent
|
|
3862 |
*/
|
|
3863 |
#define CAPABILITY_AS_TUINT8(cap) \
|
|
3864 |
((TUint8)(int)( \
|
|
3865 |
(cap)==ECapability_None \
|
|
3866 |
? (__invalid_capability_value(*)[1])(ECapability_None) \
|
|
3867 |
: (__invalid_capability_value(*)[((TUint)(cap+1)<=(TUint)ECapability_Limit)?1:2])(cap) \
|
|
3868 |
))
|
|
3869 |
|
|
3870 |
|
|
3871 |
/**
|
|
3872 |
A macro to construct a TUint32 from four TUint8s. The TUint32 is in BigEndian
|
|
3873 |
ordering useful for class layout rather than number generation.
|
|
3874 |
|
|
3875 |
@param i1 The first TUint8
|
|
3876 |
@param i2 The second TUint8
|
|
3877 |
@param i3 The third TUint8
|
|
3878 |
@param i4 The fourth TUint8
|
|
3879 |
@internalComponent
|
|
3880 |
*/
|
|
3881 |
#define FOUR_TUINT8(i1,i2,i3,i4) \
|
|
3882 |
(TUint32)( \
|
|
3883 |
(TUint8)i1 | \
|
|
3884 |
(TUint8)i2 << 8 | \
|
|
3885 |
(TUint8)i3 << 16 | \
|
|
3886 |
(TUint8)i4 << 24 \
|
|
3887 |
)
|
|
3888 |
|
|
3889 |
|
|
3890 |
/** Macro for compile-time initialisation of a security policy object that
|
|
3891 |
always fails. That is, checks against this policy will always fail,
|
|
3892 |
irrespective of the security attributes of the item being checked.
|
|
3893 |
|
|
3894 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
3895 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
3896 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
3897 |
function call operator n().
|
|
3898 |
@publishedAll
|
|
3899 |
@released
|
|
3900 |
*/
|
|
3901 |
#define _INIT_SECURITY_POLICY_FAIL \
|
|
3902 |
{ \
|
|
3903 |
FOUR_TUINT8( \
|
|
3904 |
(TUint8)TSecurityPolicy::ETypeFail, \
|
|
3905 |
(TUint8)0xff, \
|
|
3906 |
(TUint8)0xff, \
|
|
3907 |
(TUint8)0xff \
|
|
3908 |
), \
|
|
3909 |
(TUint32)0xffffffff \
|
|
3910 |
}
|
|
3911 |
|
|
3912 |
|
|
3913 |
/** Macro for compile-time definition of a security policy object that always
|
|
3914 |
fails. That is, checks against this policy will always fail, irrespective of
|
|
3915 |
the security attributes of the item being checked.
|
|
3916 |
|
|
3917 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
3918 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
3919 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
3920 |
function call operator n().
|
|
3921 |
@param n Name to use for policy object
|
|
3922 |
@publishedAll
|
|
3923 |
@released
|
|
3924 |
*/
|
|
3925 |
#define _LIT_SECURITY_POLICY_FAIL(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_FAIL
|
|
3926 |
|
|
3927 |
|
|
3928 |
/** Macro for compile-time initialisation of a security policy object that
|
|
3929 |
always passes. That is, checks against this policy will always pass,
|
|
3930 |
irrespective of the security attributes of the item being checked.
|
|
3931 |
|
|
3932 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
3933 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
3934 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
3935 |
function call operator n().
|
|
3936 |
@publishedAll
|
|
3937 |
@released
|
|
3938 |
*/
|
|
3939 |
#define _INIT_SECURITY_POLICY_PASS \
|
|
3940 |
{ \
|
|
3941 |
FOUR_TUINT8( \
|
|
3942 |
(TUint8)TSecurityPolicy::ETypePass, \
|
|
3943 |
(TUint8)0xff, \
|
|
3944 |
(TUint8)0xff, \
|
|
3945 |
(TUint8)0xff \
|
|
3946 |
), \
|
|
3947 |
(TUint32)0xffffffff \
|
|
3948 |
}
|
|
3949 |
|
|
3950 |
|
|
3951 |
/** Macro for compile-time definition of a security policy object that always
|
|
3952 |
passes. That is, checks against this policy will always pass, irrespective of
|
|
3953 |
the security attributes of the item being checked.
|
|
3954 |
|
|
3955 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
3956 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
3957 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
3958 |
function call operator n().
|
|
3959 |
@param n Name to use for policy object
|
|
3960 |
@publishedAll
|
|
3961 |
@released
|
|
3962 |
*/
|
|
3963 |
#define _LIT_SECURITY_POLICY_PASS(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_PASS
|
|
3964 |
|
|
3965 |
|
|
3966 |
/** Macro for compile-time initialisation of a security policy object
|
|
3967 |
The policy will check for seven capabilities.
|
|
3968 |
|
|
3969 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
3970 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
3971 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
3972 |
function call operator n().
|
|
3973 |
|
|
3974 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
3975 |
a compile time error or warning will be produced which includes the label
|
|
3976 |
"__invalid_capability_value"
|
|
3977 |
|
|
3978 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
3979 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
3980 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
3981 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
3982 |
@param c5 The fifth capability to check (enumerator of TCapability)
|
|
3983 |
@param c6 The sixth capability to check (enumerator of TCapability)
|
|
3984 |
@param c7 The seventh capability to check (enumerator of TCapability)
|
|
3985 |
|
|
3986 |
@publishedAll
|
|
3987 |
@released
|
|
3988 |
*/
|
|
3989 |
#define _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7) \
|
|
3990 |
{ \
|
|
3991 |
FOUR_TUINT8( \
|
|
3992 |
(TUint8)TSecurityPolicy::ETypeC7, \
|
|
3993 |
CAPABILITY_AS_TUINT8(c1), \
|
|
3994 |
CAPABILITY_AS_TUINT8(c2), \
|
|
3995 |
CAPABILITY_AS_TUINT8(c3) \
|
|
3996 |
), \
|
|
3997 |
FOUR_TUINT8( \
|
|
3998 |
CAPABILITY_AS_TUINT8(c4), \
|
|
3999 |
CAPABILITY_AS_TUINT8(c5), \
|
|
4000 |
CAPABILITY_AS_TUINT8(c6), \
|
|
4001 |
CAPABILITY_AS_TUINT8(c7) \
|
|
4002 |
) \
|
|
4003 |
}
|
|
4004 |
|
|
4005 |
|
|
4006 |
/** Macro for compile-time definition of a security policy object
|
|
4007 |
The policy will check for seven capabilities.
|
|
4008 |
|
|
4009 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4010 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4011 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4012 |
function call operator n().
|
|
4013 |
|
|
4014 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4015 |
a compile time error or warning will be produced which includes the label
|
|
4016 |
"__invalid_capability_value"
|
|
4017 |
|
|
4018 |
@param n Name to use for policy object
|
|
4019 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4020 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4021 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4022 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
4023 |
@param c5 The fifth capability to check (enumerator of TCapability)
|
|
4024 |
@param c6 The sixth capability to check (enumerator of TCapability)
|
|
4025 |
@param c7 The seventh capability to check (enumerator of TCapability)
|
|
4026 |
|
|
4027 |
@publishedAll
|
|
4028 |
@released
|
|
4029 |
*/
|
|
4030 |
#define _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,c7) \
|
|
4031 |
const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7)
|
|
4032 |
|
|
4033 |
|
|
4034 |
/** Macro for compile-time initialisation of a security policy object
|
|
4035 |
The policy will check for six capabilities.
|
|
4036 |
|
|
4037 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4038 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4039 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4040 |
function call operator n().
|
|
4041 |
|
|
4042 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4043 |
a compile time error or warning will be produced which includes the label
|
|
4044 |
"__invalid_capability_value"
|
|
4045 |
|
|
4046 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4047 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4048 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4049 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
4050 |
@param c5 The fifth capability to check (enumerator of TCapability)
|
|
4051 |
@param c6 The sixth capability to check (enumerator of TCapability)
|
|
4052 |
|
|
4053 |
@publishedAll
|
|
4054 |
@released
|
|
4055 |
*/
|
|
4056 |
#define _INIT_SECURITY_POLICY_C6(c1,c2,c3,c4,c5,c6) \
|
|
4057 |
_INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,ECapability_None)
|
|
4058 |
|
|
4059 |
|
|
4060 |
/** Macro for compile-time definition of a security policy object
|
|
4061 |
The policy will check for six capabilities.
|
|
4062 |
|
|
4063 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4064 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4065 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4066 |
function call operator n().
|
|
4067 |
|
|
4068 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4069 |
a compile time error or warning will be produced which includes the label
|
|
4070 |
"__invalid_capability_value"
|
|
4071 |
|
|
4072 |
@param n Name to use for policy object
|
|
4073 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4074 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4075 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4076 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
4077 |
@param c5 The fifth capability to check (enumerator of TCapability)
|
|
4078 |
@param c6 The sixth capability to check (enumerator of TCapability)
|
|
4079 |
|
|
4080 |
@publishedAll
|
|
4081 |
@released
|
|
4082 |
*/
|
|
4083 |
#define _LIT_SECURITY_POLICY_C6(n,c1,c2,c3,c4,c5,c6) \
|
|
4084 |
_LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,ECapability_None)
|
|
4085 |
|
|
4086 |
|
|
4087 |
/** Macro for compile-time initialisation of a security policy object
|
|
4088 |
The policy will check for five capabilities.
|
|
4089 |
|
|
4090 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4091 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4092 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4093 |
function call operator n().
|
|
4094 |
|
|
4095 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4096 |
a compile time error or warning will be produced which includes the label
|
|
4097 |
"__invalid_capability_value"
|
|
4098 |
|
|
4099 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4100 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4101 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4102 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
4103 |
@param c5 The fifth capability to check (enumerator of TCapability)
|
|
4104 |
|
|
4105 |
@publishedAll
|
|
4106 |
@released
|
|
4107 |
*/
|
|
4108 |
#define _INIT_SECURITY_POLICY_C5(c1,c2,c3,c4,c5) \
|
|
4109 |
_INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
|
|
4110 |
|
|
4111 |
|
|
4112 |
/** Macro for compile-time definition of a security policy object
|
|
4113 |
The policy will check for five capabilities.
|
|
4114 |
|
|
4115 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4116 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4117 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4118 |
function call operator n().
|
|
4119 |
|
|
4120 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4121 |
a compile time error or warning will be produced which includes the label
|
|
4122 |
"__invalid_capability_value"
|
|
4123 |
|
|
4124 |
@param n Name to use for policy object
|
|
4125 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4126 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4127 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4128 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
4129 |
@param c5 The fifth capability to check (enumerator of TCapability)
|
|
4130 |
|
|
4131 |
@publishedAll
|
|
4132 |
@released
|
|
4133 |
*/
|
|
4134 |
#define _LIT_SECURITY_POLICY_C5(n,c1,c2,c3,c4,c5) \
|
|
4135 |
_LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
|
|
4136 |
|
|
4137 |
|
|
4138 |
/** Macro for compile-time initialisation of a security policy object
|
|
4139 |
The policy will check for four capabilities.
|
|
4140 |
|
|
4141 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4142 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4143 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4144 |
function call operator n().
|
|
4145 |
|
|
4146 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4147 |
a compile time error or warning will be produced which includes the label
|
|
4148 |
"__invalid_capability_value"
|
|
4149 |
|
|
4150 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4151 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4152 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4153 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
4154 |
|
|
4155 |
@publishedAll
|
|
4156 |
@released
|
|
4157 |
*/
|
|
4158 |
#define _INIT_SECURITY_POLICY_C4(c1,c2,c3,c4) \
|
|
4159 |
_INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
|
|
4160 |
|
|
4161 |
|
|
4162 |
/** Macro for compile-time definition of a security policy object
|
|
4163 |
The policy will check for four capabilities.
|
|
4164 |
|
|
4165 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4166 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4167 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4168 |
function call operator n().
|
|
4169 |
|
|
4170 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4171 |
a compile time error or warning will be produced which includes the label
|
|
4172 |
"__invalid_capability_value"
|
|
4173 |
|
|
4174 |
@param n Name to use for policy object
|
|
4175 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4176 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4177 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4178 |
@param c4 The fourth capability to check (enumerator of TCapability)
|
|
4179 |
|
|
4180 |
@publishedAll
|
|
4181 |
@released
|
|
4182 |
*/
|
|
4183 |
#define _LIT_SECURITY_POLICY_C4(n,c1,c2,c3,c4) \
|
|
4184 |
_LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
|
|
4185 |
|
|
4186 |
|
|
4187 |
/** Macro for compile-time initialisation of a security policy object
|
|
4188 |
The policy will check for three capabilities.
|
|
4189 |
|
|
4190 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4191 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4192 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4193 |
function call operator n().
|
|
4194 |
|
|
4195 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4196 |
a compile time error or warning will be produced which includes the label
|
|
4197 |
"__invalid_capability_value"
|
|
4198 |
|
|
4199 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4200 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4201 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4202 |
|
|
4203 |
@publishedAll
|
|
4204 |
@released
|
|
4205 |
*/
|
|
4206 |
#define _INIT_SECURITY_POLICY_C3(c1,c2,c3) \
|
|
4207 |
{ \
|
|
4208 |
FOUR_TUINT8( \
|
|
4209 |
(TUint8)TSecurityPolicy::ETypeC3, \
|
|
4210 |
CAPABILITY_AS_TUINT8(c1), \
|
|
4211 |
CAPABILITY_AS_TUINT8(c2), \
|
|
4212 |
CAPABILITY_AS_TUINT8(c3) \
|
|
4213 |
), \
|
|
4214 |
(TUint32)0xffffffff \
|
|
4215 |
}
|
|
4216 |
|
|
4217 |
|
|
4218 |
/** Macro for compile-time definition of a security policy object
|
|
4219 |
The policy will check for three capabilities.
|
|
4220 |
|
|
4221 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4222 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4223 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4224 |
function call operator n().
|
|
4225 |
|
|
4226 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4227 |
a compile time error or warning will be produced which includes the label
|
|
4228 |
"__invalid_capability_value"
|
|
4229 |
|
|
4230 |
@param n Name to use for policy object
|
|
4231 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4232 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4233 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4234 |
|
|
4235 |
@publishedAll
|
|
4236 |
@released
|
|
4237 |
*/
|
|
4238 |
#define _LIT_SECURITY_POLICY_C3(n,c1,c2,c3) \
|
|
4239 |
const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C3(c1,c2,c3)
|
|
4240 |
|
|
4241 |
|
|
4242 |
/** Macro for compile-time initialisation of a security policy object
|
|
4243 |
The policy will check for two capabilities.
|
|
4244 |
|
|
4245 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4246 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4247 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4248 |
function call operator n().
|
|
4249 |
|
|
4250 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4251 |
a compile time error or warning will be produced which includes the label
|
|
4252 |
"__invalid_capability_value"
|
|
4253 |
|
|
4254 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4255 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4256 |
|
|
4257 |
@publishedAll
|
|
4258 |
@released
|
|
4259 |
*/
|
|
4260 |
#define _INIT_SECURITY_POLICY_C2(c1,c2) \
|
|
4261 |
_INIT_SECURITY_POLICY_C3(c1,c2,ECapability_None)
|
|
4262 |
|
|
4263 |
|
|
4264 |
/** Macro for compile-time definition of a security policy object
|
|
4265 |
The policy will check for two capabilities.
|
|
4266 |
|
|
4267 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4268 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4269 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4270 |
function call operator n().
|
|
4271 |
|
|
4272 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4273 |
a compile time error or warning will be produced which includes the label
|
|
4274 |
"__invalid_capability_value"
|
|
4275 |
|
|
4276 |
@param n Name to use for policy object
|
|
4277 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4278 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4279 |
|
|
4280 |
@publishedAll
|
|
4281 |
@released
|
|
4282 |
*/
|
|
4283 |
#define _LIT_SECURITY_POLICY_C2(n,c1,c2) \
|
|
4284 |
_LIT_SECURITY_POLICY_C3(n,c1,c2,ECapability_None)
|
|
4285 |
|
|
4286 |
|
|
4287 |
/** Macro for compile-time initialisation of a security policy object
|
|
4288 |
The policy will check for one capability.
|
|
4289 |
|
|
4290 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4291 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4292 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4293 |
function call operator n().
|
|
4294 |
|
|
4295 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4296 |
a compile time error or warning will be produced which includes the label
|
|
4297 |
"__invalid_capability_value"
|
|
4298 |
|
|
4299 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4300 |
|
|
4301 |
|
|
4302 |
@publishedAll
|
|
4303 |
@released
|
|
4304 |
*/
|
|
4305 |
#define _INIT_SECURITY_POLICY_C1(c1) \
|
|
4306 |
_INIT_SECURITY_POLICY_C3(c1,ECapability_None,ECapability_None)
|
|
4307 |
|
|
4308 |
|
|
4309 |
/** Macro for compile-time definition of a security policy object
|
|
4310 |
The policy will check for one capability.
|
|
4311 |
|
|
4312 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4313 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4314 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4315 |
function call operator n().
|
|
4316 |
|
|
4317 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4318 |
a compile time error or warning will be produced which includes the label
|
|
4319 |
"__invalid_capability_value"
|
|
4320 |
|
|
4321 |
@param n Name to use for policy object
|
|
4322 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4323 |
|
|
4324 |
@publishedAll
|
|
4325 |
@released
|
|
4326 |
*/
|
|
4327 |
#define _LIT_SECURITY_POLICY_C1(n,c1) \
|
|
4328 |
_LIT_SECURITY_POLICY_C3(n,c1,ECapability_None,ECapability_None)
|
|
4329 |
|
|
4330 |
|
|
4331 |
/** Macro for compile-time initialisation of a security policy object
|
|
4332 |
The policy will check for a secure ID and three capabilities.
|
|
4333 |
|
|
4334 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4335 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4336 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4337 |
function call operator n().
|
|
4338 |
|
|
4339 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4340 |
a compile time error or warning be produced which includes the label
|
|
4341 |
"__invalid_capability_value"
|
|
4342 |
|
|
4343 |
@param sid The SID value to check for
|
|
4344 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4345 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4346 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4347 |
|
|
4348 |
@publishedAll
|
|
4349 |
@released
|
|
4350 |
*/
|
|
4351 |
#define _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3) \
|
|
4352 |
{ \
|
|
4353 |
FOUR_TUINT8( \
|
|
4354 |
(TUint8)TSecurityPolicy::ETypeS3, \
|
|
4355 |
CAPABILITY_AS_TUINT8(c1), \
|
|
4356 |
CAPABILITY_AS_TUINT8(c2), \
|
|
4357 |
CAPABILITY_AS_TUINT8(c3) \
|
|
4358 |
), \
|
|
4359 |
(TUint32)(sid) \
|
|
4360 |
}
|
|
4361 |
|
|
4362 |
|
|
4363 |
/** Macro for compile-time definition of a security policy object
|
|
4364 |
The policy will check for a secure ID and three capabilities.
|
|
4365 |
|
|
4366 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4367 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4368 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4369 |
function call operator n().
|
|
4370 |
|
|
4371 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4372 |
a compile time error or warning be produced which includes the label
|
|
4373 |
"__invalid_capability_value"
|
|
4374 |
|
|
4375 |
@param n Name to use for policy object
|
|
4376 |
@param sid The SID value to check for
|
|
4377 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4378 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4379 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4380 |
|
|
4381 |
@publishedAll
|
|
4382 |
@released
|
|
4383 |
*/
|
|
4384 |
#define _LIT_SECURITY_POLICY_S3(n,sid,c1,c2,c3) \
|
|
4385 |
const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3)
|
|
4386 |
|
|
4387 |
|
|
4388 |
/** Macro for compile-time initialisation of a security policy object
|
|
4389 |
The policy will check for a secure ID and two capabilities.
|
|
4390 |
|
|
4391 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4392 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4393 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4394 |
function call operator n().
|
|
4395 |
|
|
4396 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4397 |
a compile time error or warning be produced which includes the label
|
|
4398 |
"__invalid_capability_value"
|
|
4399 |
|
|
4400 |
@param sid The SID value to check for
|
|
4401 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4402 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4403 |
|
|
4404 |
@publishedAll
|
|
4405 |
@released
|
|
4406 |
*/
|
|
4407 |
#define _INIT_SECURITY_POLICY_S2(sid,c1,c2) \
|
|
4408 |
_INIT_SECURITY_POLICY_S3(sid,c1,c2,ECapability_None)
|
|
4409 |
|
|
4410 |
|
|
4411 |
/** Macro for compile-time definition of a security policy object
|
|
4412 |
The policy will check for a secure ID and two capabilities.
|
|
4413 |
|
|
4414 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4415 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4416 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4417 |
function call operator n().
|
|
4418 |
|
|
4419 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4420 |
a compile time error or warning be produced which includes the label
|
|
4421 |
"__invalid_capability_value"
|
|
4422 |
|
|
4423 |
@param n Name to use for policy object
|
|
4424 |
@param sid The SID value to check for
|
|
4425 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4426 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4427 |
|
|
4428 |
@publishedAll
|
|
4429 |
@released
|
|
4430 |
*/
|
|
4431 |
#define _LIT_SECURITY_POLICY_S2(n,sid,c1,c2) \
|
|
4432 |
_LIT_SECURITY_POLICY_S3(n,sid,c1,c2,ECapability_None)
|
|
4433 |
|
|
4434 |
|
|
4435 |
/** Macro for compile-time initialisation of a security policy object
|
|
4436 |
The policy will check for a secure ID and one capability.
|
|
4437 |
|
|
4438 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4439 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4440 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4441 |
function call operator n().
|
|
4442 |
|
|
4443 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4444 |
a compile time error or warning be produced which includes the label
|
|
4445 |
"__invalid_capability_value"
|
|
4446 |
|
|
4447 |
@param sid The SID value to check for
|
|
4448 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4449 |
|
|
4450 |
@publishedAll
|
|
4451 |
@released
|
|
4452 |
*/
|
|
4453 |
#define _INIT_SECURITY_POLICY_S1(sid,c1) \
|
|
4454 |
_INIT_SECURITY_POLICY_S3(sid,c1,ECapability_None,ECapability_None)
|
|
4455 |
|
|
4456 |
|
|
4457 |
/** Macro for compile-time definition of a security policy object
|
|
4458 |
The policy will check for a secure ID and one capability.
|
|
4459 |
|
|
4460 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4461 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4462 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4463 |
function call operator n().
|
|
4464 |
|
|
4465 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4466 |
a compile time error or warning be produced which includes the label
|
|
4467 |
"__invalid_capability_value"
|
|
4468 |
|
|
4469 |
@param n Name to use for policy object
|
|
4470 |
@param sid The SID value to check for
|
|
4471 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4472 |
|
|
4473 |
@publishedAll
|
|
4474 |
@released
|
|
4475 |
*/
|
|
4476 |
#define _LIT_SECURITY_POLICY_S1(n,sid,c1) \
|
|
4477 |
_LIT_SECURITY_POLICY_S3(n,sid,c1,ECapability_None,ECapability_None)
|
|
4478 |
|
|
4479 |
|
|
4480 |
/** Macro for compile-time initialisation of a security policy object
|
|
4481 |
The policy will check for a secure ID.
|
|
4482 |
|
|
4483 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4484 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4485 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4486 |
function call operator n().
|
|
4487 |
|
|
4488 |
@param sid The SID value to check for
|
|
4489 |
|
|
4490 |
@publishedAll
|
|
4491 |
@released
|
|
4492 |
*/
|
|
4493 |
#define _INIT_SECURITY_POLICY_S0(sid) \
|
|
4494 |
_INIT_SECURITY_POLICY_S3(sid,ECapability_None,ECapability_None,ECapability_None)
|
|
4495 |
|
|
4496 |
|
|
4497 |
/** Macro for compile-time definition of a security policy object
|
|
4498 |
The policy will check for a secure ID.
|
|
4499 |
|
|
4500 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4501 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4502 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4503 |
function call operator n().
|
|
4504 |
|
|
4505 |
@param n Name to use for policy object
|
|
4506 |
@param sid The SID value to check for
|
|
4507 |
|
|
4508 |
@publishedAll
|
|
4509 |
@released
|
|
4510 |
*/
|
|
4511 |
#define _LIT_SECURITY_POLICY_S0(n,sid) \
|
|
4512 |
_LIT_SECURITY_POLICY_S3(n,sid,ECapability_None,ECapability_None,ECapability_None)
|
|
4513 |
|
|
4514 |
|
|
4515 |
/** Macro for compile-time initialisation of a security policy object
|
|
4516 |
The policy will check for a vendor ID and three capabilities.
|
|
4517 |
|
|
4518 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4519 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4520 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4521 |
function call operator n().
|
|
4522 |
|
|
4523 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4524 |
a compile time error or warning be produced which includes the label
|
|
4525 |
"__invalid_capability_value"
|
|
4526 |
|
|
4527 |
@param vid The VID value to check for
|
|
4528 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4529 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4530 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4531 |
|
|
4532 |
@publishedAll
|
|
4533 |
@released
|
|
4534 |
*/
|
|
4535 |
#define _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3) \
|
|
4536 |
{ \
|
|
4537 |
FOUR_TUINT8( \
|
|
4538 |
(TUint8)TSecurityPolicy::ETypeV3, \
|
|
4539 |
CAPABILITY_AS_TUINT8(c1), \
|
|
4540 |
CAPABILITY_AS_TUINT8(c2), \
|
|
4541 |
CAPABILITY_AS_TUINT8(c3) \
|
|
4542 |
), \
|
|
4543 |
(TUint32)(vid) \
|
|
4544 |
}
|
|
4545 |
|
|
4546 |
|
|
4547 |
/** Macro for compile-time definition of a security policy object
|
|
4548 |
The policy will check for a vendor ID and three capabilities.
|
|
4549 |
|
|
4550 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4551 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4552 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4553 |
function call operator n().
|
|
4554 |
|
|
4555 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4556 |
a compile time error or warning be produced which includes the label
|
|
4557 |
"__invalid_capability_value"
|
|
4558 |
|
|
4559 |
@param n Name to use for policy object
|
|
4560 |
@param vid The VID value to check for
|
|
4561 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4562 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4563 |
@param c3 The third capability to check (enumerator of TCapability)
|
|
4564 |
|
|
4565 |
@publishedAll
|
|
4566 |
@released
|
|
4567 |
*/
|
|
4568 |
#define _LIT_SECURITY_POLICY_V3(n,vid,c1,c2,c3) \
|
|
4569 |
const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3)
|
|
4570 |
|
|
4571 |
|
|
4572 |
/** Macro for compile-time initialisation of a security policy object
|
|
4573 |
The policy will check for a vendor ID and two capabilities.
|
|
4574 |
|
|
4575 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4576 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4577 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4578 |
function call operator n().
|
|
4579 |
|
|
4580 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4581 |
a compile time error or warning be produced which includes the label
|
|
4582 |
"__invalid_capability_value"
|
|
4583 |
|
|
4584 |
@param vid The VID value to check for
|
|
4585 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4586 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4587 |
|
|
4588 |
@publishedAll
|
|
4589 |
@released
|
|
4590 |
*/
|
|
4591 |
#define _INIT_SECURITY_POLICY_V2(vid,c1,c2) \
|
|
4592 |
_INIT_SECURITY_POLICY_V3(vid,c1,c2,ECapability_None)
|
|
4593 |
|
|
4594 |
|
|
4595 |
/** Macro for compile-time definition of a security policy object
|
|
4596 |
The policy will check for a vendor ID and two capabilities.
|
|
4597 |
|
|
4598 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4599 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4600 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4601 |
function call operator n().
|
|
4602 |
|
|
4603 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4604 |
a compile time error or warning be produced which includes the label
|
|
4605 |
"__invalid_capability_value"
|
|
4606 |
|
|
4607 |
@param n Name to use for policy object
|
|
4608 |
@param vid The VID value to check for
|
|
4609 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4610 |
@param c2 The second capability to check (enumerator of TCapability)
|
|
4611 |
|
|
4612 |
@publishedAll
|
|
4613 |
@released
|
|
4614 |
*/
|
|
4615 |
#define _LIT_SECURITY_POLICY_V2(n,vid,c1,c2) \
|
|
4616 |
_LIT_SECURITY_POLICY_V3(n,vid,c1,c2,ECapability_None)
|
|
4617 |
|
|
4618 |
|
|
4619 |
/** Macro for compile-time initialisation of a security policy object
|
|
4620 |
The policy will check for a vendor ID and one capability.
|
|
4621 |
|
|
4622 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4623 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4624 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4625 |
function call operator n().
|
|
4626 |
|
|
4627 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4628 |
a compile time error or warning be produced which includes the label
|
|
4629 |
"__invalid_capability_value"
|
|
4630 |
|
|
4631 |
@param vid The VID value to check for
|
|
4632 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4633 |
|
|
4634 |
@publishedAll
|
|
4635 |
@released
|
|
4636 |
*/
|
|
4637 |
#define _INIT_SECURITY_POLICY_V1(vid,c1) \
|
|
4638 |
_INIT_SECURITY_POLICY_V3(vid,c1,ECapability_None,ECapability_None)
|
|
4639 |
|
|
4640 |
|
|
4641 |
/** Macro for compile-time definition of a security policy object
|
|
4642 |
The policy will check for a vendor ID and one capability.
|
|
4643 |
|
|
4644 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4645 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4646 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4647 |
function call operator n().
|
|
4648 |
|
|
4649 |
If an invlid capability value is specified then, dependant on the compiler,
|
|
4650 |
a compile time error or warning be produced which includes the label
|
|
4651 |
"__invalid_capability_value"
|
|
4652 |
|
|
4653 |
@param n Name to use for policy object
|
|
4654 |
@param vid The VID value to check for
|
|
4655 |
@param c1 The first capability to check (enumerator of TCapability)
|
|
4656 |
|
|
4657 |
@publishedAll
|
|
4658 |
@released
|
|
4659 |
*/
|
|
4660 |
#define _LIT_SECURITY_POLICY_V1(n,vid,c1) \
|
|
4661 |
_LIT_SECURITY_POLICY_V3(n,vid,c1,ECapability_None,ECapability_None)
|
|
4662 |
|
|
4663 |
|
|
4664 |
/** Macro for compile-time initialisation of a security policy object
|
|
4665 |
The policy will check for a vendor ID.
|
|
4666 |
|
|
4667 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4668 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4669 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4670 |
function call operator n().
|
|
4671 |
|
|
4672 |
@param vid The VID value to check for
|
|
4673 |
|
|
4674 |
@publishedAll
|
|
4675 |
@released
|
|
4676 |
*/
|
|
4677 |
#define _INIT_SECURITY_POLICY_V0(vid) \
|
|
4678 |
_INIT_SECURITY_POLICY_V3(vid,ECapability_None,ECapability_None,ECapability_None)
|
|
4679 |
|
|
4680 |
|
|
4681 |
/** Macro for compile-time definition of a security policy object
|
|
4682 |
The policy will check for a vendor ID.
|
|
4683 |
|
|
4684 |
The object declared has an implicit conversion to const TSecurityPolicy&.
|
|
4685 |
Taking the address of the object will return a const TSecurityPolicy*.
|
|
4686 |
Explicit conversion to const TSecurityPolicy& may be effected by using the
|
|
4687 |
function call operator n().
|
|
4688 |
|
|
4689 |
@param n Name to use for policy object
|
|
4690 |
@param vid The VID value to check for
|
|
4691 |
|
|
4692 |
@publishedAll
|
|
4693 |
@released
|
|
4694 |
*/
|
|
4695 |
#define _LIT_SECURITY_POLICY_V0(n,vid) \
|
|
4696 |
_LIT_SECURITY_POLICY_V3(n,vid,ECapability_None,ECapability_None,ECapability_None)
|
|
4697 |
|
|
4698 |
|
|
4699 |
|
|
4700 |
#ifdef __KERNEL_MODE__
|
|
4701 |
class DThread;
|
|
4702 |
class RMessageK;
|
|
4703 |
#endif
|
|
4704 |
class TPlatSecDiagnostic;
|
|
4705 |
|
|
4706 |
/**
|
|
4707 |
Class containing Platform Security related methods
|
|
4708 |
@internalTechnology
|
|
4709 |
*/
|
|
4710 |
class PlatSec
|
|
4711 |
{
|
|
4712 |
#ifndef __KERNEL_MODE__
|
|
4713 |
public:
|
|
4714 |
/**
|
|
4715 |
Tests whether a given Platform Security capability is enforced by the system.
|
|
4716 |
|
|
4717 |
Capabilities may not be enforced for several reasons:
|
|
4718 |
-# The capability has been explicitly disabled on this system
|
|
4719 |
by use of the PlatSecDisabledCaps configuration parameter
|
|
4720 |
-# Platform Security checks have been globally disabled
|
|
4721 |
by use of the EPlatSecEnforcement configuration parameter
|
|
4722 |
-# The capability value is unknown. I.e. Is not part of the set of supported
|
|
4723 |
capabilities. See TCapabilitySet::SetAllSupported().
|
|
4724 |
|
|
4725 |
@param aCapability The capability to test
|
|
4726 |
@return A non-zero value if the capability is enforced, zero if it is not.
|
|
4727 |
|
|
4728 |
@publishedAll
|
|
4729 |
@released
|
|
4730 |
*/
|
|
4731 |
IMPORT_C static TBool IsCapabilityEnforced(TCapability aCapability);
|
|
4732 |
|
|
4733 |
/**
|
|
4734 |
An enumeration used with PlatSecSetting()
|
|
4735 |
@see PlatSecSetting()
|
|
4736 |
@publishedAll
|
|
4737 |
@test
|
|
4738 |
*/
|
|
4739 |
enum TConfigSetting
|
|
4740 |
{
|
|
4741 |
EPlatSecEnforcement, /**< Used to request the value of the PlatSecEnforcement setting */
|
|
4742 |
EPlatSecDiagnotics, /**< Used to request the value of the PlatSecDiagnotics setting */
|
|
4743 |
EPlatSecProcessIsolation, /**< Used to request the value of the PlatSecProcessIsolation setting */
|
|
4744 |
EPlatSecEnforceSysBin, /**< Used to request the value of the PlatSecEnforceSysBin setting */
|
|
4745 |
EPlatSecLocked, /**< Used to request the value of the PlatSecLocked setting */
|
|
4746 |
};
|
|
4747 |
|
|
4748 |
/**
|
|
4749 |
A test function to return the state of a given Platform Security configuration setting.
|
|
4750 |
@param aSetting An enumerated value representing the required setting
|
|
4751 |
@return A value representing the setting. 0 represents 'OFF', 1 represents 'ON'
|
|
4752 |
Other values may be returned for some settings, these exceptions are documented
|
|
4753 |
in the description for individual enumerations of TConfigSetting.
|
|
4754 |
@see TConfigSetting
|
|
4755 |
@publishedAll
|
|
4756 |
@test
|
|
4757 |
*/
|
|
4758 |
IMPORT_C static TInt ConfigSetting(TConfigSetting aSetting);
|
|
4759 |
|
|
4760 |
#endif // Not __KERNEL_MODE__
|
|
4761 |
|
|
4762 |
//
|
|
4763 |
// All methods below here are internalTechnology
|
|
4764 |
//
|
|
4765 |
|
|
4766 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
|
|
4767 |
public:
|
|
4768 |
/** @internalTechnology */
|
|
4769 |
static inline TInt LoaderCapabilityViolation(const TDesC8& aImporterName, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
|
|
4770 |
#ifdef __KERNEL_MODE__
|
|
4771 |
/** @internalTechnology */
|
|
4772 |
static inline TInt CapabilityCheckFail(const DProcess* aViolatingProcess, TCapability aCapability, const char* aContextText);
|
|
4773 |
/** @internalTechnology */
|
|
4774 |
static inline TInt CapabilityCheckFail(const DThread* aViolatingThread, TCapability aCapability, const char* aContextText);
|
|
4775 |
/** @internalTechnology */
|
|
4776 |
static inline TInt SecureIdCheckFail(const DProcess* aViolatingProcess, TSecureId aSid, const char* aContextText);
|
|
4777 |
/** @internalTechnology */
|
|
4778 |
static inline TInt PolicyCheckFail(const DProcess* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
|
|
4779 |
/** @internalTechnology */
|
|
4780 |
static inline TInt PolicyCheckFail(const DThread* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
|
|
4781 |
/** @internalTechnology */
|
|
4782 |
static inline TInt ProcessIsolationFail(const char* aContextText);
|
|
4783 |
/** @internalTechnology */
|
|
4784 |
static inline TInt ProcessIsolationIPCFail(RMessageK* aMessage, const char* aContextText);
|
|
4785 |
#else // !__KERNEL_MODE__
|
|
4786 |
/** @internalTechnology */
|
|
4787 |
static inline TInt LoaderCapabilityViolation(RProcess aLoadingProcess, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
|
|
4788 |
/** @internalTechnology */
|
|
4789 |
static inline TInt CreatorCapabilityCheckFail(TCapability aCapability, const char* aContextText);
|
|
4790 |
/** @internalTechnology */
|
|
4791 |
static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps, const char* aContextText);
|
|
4792 |
/** @internalTechnology */
|
|
4793 |
static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability, const char* aContextText);
|
|
4794 |
/** @internalTechnology */
|
|
4795 |
static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps, const char* aContextText);
|
|
4796 |
/** @internalTechnology */
|
|
4797 |
static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing, const char* aContextText);
|
|
4798 |
/** @internalTechnology */
|
|
4799 |
static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability, const char* aContextText);
|
|
4800 |
/** @internalTechnology */
|
|
4801 |
static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps, const char* aContextText);
|
|
4802 |
/** @internalTechnology */
|
|
4803 |
static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps, const char* aContextText);
|
|
4804 |
/** @internalTechnology */
|
|
4805 |
static inline TInt PolicyCheckFail(RSessionBase aSession, const SSecurityInfo& aMissingCaps, const char* aContextText);
|
|
4806 |
/** @internalTechnology */
|
|
4807 |
static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps, const char* aContextText);
|
|
4808 |
/** @internalTechnology */
|
|
4809 |
static inline TInt CreatorCapabilityCheckFail(TCapability aCapability);
|
|
4810 |
/** @internalTechnology */
|
|
4811 |
static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps);
|
|
4812 |
/** @internalTechnology */
|
|
4813 |
static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability);
|
|
4814 |
/** @internalTechnology */
|
|
4815 |
static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps);
|
|
4816 |
/** @internalTechnology */
|
|
4817 |
static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing);
|
|
4818 |
/** @internalTechnology */
|
|
4819 |
static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability);
|
|
4820 |
/** @internalTechnology */
|
|
4821 |
static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps);
|
|
4822 |
/** @internalTechnology */
|
|
4823 |
static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps);
|
|
4824 |
/** @internalTechnology */
|
|
4825 |
static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps);
|
|
4826 |
#endif //__KERNEL_MODE__
|
|
4827 |
|
|
4828 |
private:
|
|
4829 |
UIMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
|
|
4830 |
#else //__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
4831 |
#ifndef __KERNEL_MODE__
|
|
4832 |
private:
|
|
4833 |
IMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
|
|
4834 |
#endif // !__KERNEL_MODE__
|
|
4835 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
|
|
4836 |
|
|
4837 |
public:
|
|
4838 |
/** @internalTechnology */
|
|
4839 |
UIMPORT_C static TInt EmitDiagnostic();
|
|
4840 |
};
|
|
4841 |
|
|
4842 |
|
|
4843 |
|
|
4844 |
/**
|
|
4845 |
@publishedAll
|
|
4846 |
@released
|
|
4847 |
|
|
4848 |
Contains information about the code and data sections belonging to a process.
|
|
4849 |
|
|
4850 |
@see RProcess::GetMemoryInfo
|
|
4851 |
*/
|
|
4852 |
class TProcessMemoryInfo
|
|
4853 |
{
|
|
4854 |
public:
|
|
4855 |
/**
|
|
4856 |
The code base address (.text).
|
|
4857 |
*/
|
|
4858 |
TUint32 iCodeBase;
|
|
4859 |
|
|
4860 |
|
|
4861 |
/**
|
|
4862 |
The size of the code section (.text).
|
|
4863 |
*/
|
|
4864 |
TUint32 iCodeSize;
|
|
4865 |
|
|
4866 |
|
|
4867 |
/**
|
|
4868 |
The base address of the constant data section (.radata).
|
|
4869 |
*/
|
|
4870 |
TUint32 iConstDataBase;
|
|
4871 |
|
|
4872 |
|
|
4873 |
/**
|
|
4874 |
The size of the constant data section (.radata).
|
|
4875 |
*/
|
|
4876 |
|
|
4877 |
TUint32 iConstDataSize;
|
|
4878 |
|
|
4879 |
|
|
4880 |
/**
|
|
4881 |
The base address of the initialised data section (.data).
|
|
4882 |
*/
|
|
4883 |
TUint32 iInitialisedDataBase;
|
|
4884 |
|
|
4885 |
|
|
4886 |
/**
|
|
4887 |
The size of the initialised data section (.data).
|
|
4888 |
*/
|
|
4889 |
TUint32 iInitialisedDataSize;
|
|
4890 |
|
|
4891 |
|
|
4892 |
/**
|
|
4893 |
The base address of the uninitialised data section (.bss).
|
|
4894 |
*/
|
|
4895 |
TUint32 iUninitialisedDataBase;
|
|
4896 |
|
|
4897 |
|
|
4898 |
/**
|
|
4899 |
The size of the uninitialised data section (.bss).
|
|
4900 |
*/
|
|
4901 |
TUint32 iUninitialisedDataSize;
|
|
4902 |
};
|
|
4903 |
|
|
4904 |
|
|
4905 |
|
|
4906 |
|
|
4907 |
/**
|
|
4908 |
@publishedAll
|
|
4909 |
@released
|
|
4910 |
|
|
4911 |
Defines a more useful synonym for TProcessMemoryInfo.
|
|
4912 |
*/
|
|
4913 |
typedef TProcessMemoryInfo TModuleMemoryInfo; // more accurate name - remove old one later
|
|
4914 |
|
|
4915 |
|
|
4916 |
|
|
4917 |
|
|
4918 |
#ifndef __KERNEL_MODE__
|
|
4919 |
class CBase;
|
|
4920 |
/**
|
|
4921 |
@publishedAll
|
|
4922 |
@released
|
|
4923 |
|
|
4924 |
Generic array.
|
|
4925 |
|
|
4926 |
This class defines a generic array which can be constructed by any of the
|
|
4927 |
following templated concrete arrays:
|
|
4928 |
|
|
4929 |
1. CArrayFixFlat<class T>
|
|
4930 |
|
|
4931 |
2. CArrayFixSeg<class T>
|
|
4932 |
|
|
4933 |
3. CArrayVarFlat<class T>
|
|
4934 |
|
|
4935 |
4. CArrayVarSeg<class T>
|
|
4936 |
|
|
4937 |
5. CArrayPakFlat<class T>
|
|
4938 |
|
|
4939 |
6. RArray<class T>
|
|
4940 |
|
|
4941 |
7. RPointerArray<class T>
|
|
4942 |
|
|
4943 |
and also by the following template specialisation classes:
|
|
4944 |
|
|
4945 |
1. RArray<TInt>
|
|
4946 |
|
|
4947 |
2. RArray<TUint>
|
|
4948 |
|
|
4949 |
It allows a degree of polymorphism amongst the array classes. It permits the
|
|
4950 |
operator[] and the Count() member functions of an array to be invoked without
|
|
4951 |
knowing which array class has been used to construct that array.
|
|
4952 |
|
|
4953 |
TArray allows access to elements of an array but does not permit changes to
|
|
4954 |
those elements.
|
|
4955 |
|
|
4956 |
Use the Array() member function of an array to construct and return
|
|
4957 |
a TArray<class T> object for that array.
|
|
4958 |
|
|
4959 |
A TArray<class T> type object is not intended to be constructed explicitly
|
|
4960 |
by user code.
|
|
4961 |
|
|
4962 |
@see CArrayFixFlat
|
|
4963 |
@see CArrayFixSeg
|
|
4964 |
@see CArrayVarFlat
|
|
4965 |
@see CArrayVarSeg
|
|
4966 |
@see CArrayPakFlat
|
|
4967 |
@see RArray
|
|
4968 |
@see RPointerArray
|
|
4969 |
@see RArray<TInt>
|
|
4970 |
@see RArray<TUint>
|
|
4971 |
*/
|
|
4972 |
template <class T>
|
|
4973 |
class TArray
|
|
4974 |
{
|
|
4975 |
public:
|
|
4976 |
inline TArray(TInt (*aCount)(const CBase* aPtr),const TAny*(*anAt)(const CBase* aPtr,TInt anIndex),const CBase* aPtr);
|
|
4977 |
inline TInt Count() const;
|
|
4978 |
inline const T& operator[](TInt anIndex) const;
|
|
4979 |
private:
|
|
4980 |
const CBase* iPtr;
|
|
4981 |
TInt (*iCount)(const CBase* aPtr);
|
|
4982 |
const TAny*(*iAt)(const CBase* aPtr,TInt anIndex);
|
|
4983 |
};
|
|
4984 |
#endif
|
|
4985 |
|
|
4986 |
|
|
4987 |
|
|
4988 |
|
|
4989 |
/**
|
|
4990 |
@publishedAll
|
|
4991 |
@released
|
|
4992 |
|
|
4993 |
Defines a function type used by a TIdentityRelation object.
|
|
4994 |
|
|
4995 |
A function of this type implements an algorithm for determining whether
|
|
4996 |
two objects match.
|
|
4997 |
|
|
4998 |
@see TIdentityRelation
|
|
4999 |
*/
|
|
5000 |
typedef TBool (*TGeneralIdentityRelation)(const TAny*, const TAny*);
|
|
5001 |
|
|
5002 |
|
|
5003 |
|
|
5004 |
|
|
5005 |
/**
|
|
5006 |
@publishedAll
|
|
5007 |
@released
|
|
5008 |
|
|
5009 |
Defines a function type used by a TLinearOrder object
|
|
5010 |
|
|
5011 |
A function of this type implements an algorithm that determines
|
|
5012 |
the order of two objects.
|
|
5013 |
|
|
5014 |
@see TLinearOrder
|
|
5015 |
*/
|
|
5016 |
typedef TInt (*TGeneralLinearOrder)(const TAny*, const TAny*);
|
|
5017 |
|
|
5018 |
|
|
5019 |
|
|
5020 |
|
|
5021 |
/**
|
|
5022 |
@publishedAll
|
|
5023 |
@released
|
|
5024 |
|
|
5025 |
A templated class which packages a function that determines whether two
|
|
5026 |
objects of a given class type match. During linear search operations the search
|
|
5027 |
term is always passed as the first argument and the second argument is an
|
|
5028 |
element of the array being searched.
|
|
5029 |
|
|
5030 |
A TIdentityRelation<T> object is constructed and passed as a parameter to
|
|
5031 |
member functions of the array classes RArray<T> and RPointerArray<T>.
|
|
5032 |
|
|
5033 |
@see RArray
|
|
5034 |
@see RPointerArray
|
|
5035 |
*/
|
|
5036 |
template <class T>
|
|
5037 |
class TIdentityRelation
|
|
5038 |
{
|
|
5039 |
public:
|
|
5040 |
inline TIdentityRelation();
|
|
5041 |
inline TIdentityRelation( TBool (*anIdentity)(const T&, const T&) );
|
|
5042 |
inline operator TGeneralIdentityRelation() const;
|
|
5043 |
private:
|
|
5044 |
inline static TBool EqualityOperatorCompare(const T& aLeft, const T& aRight);
|
|
5045 |
private:
|
|
5046 |
TGeneralIdentityRelation iIdentity;
|
|
5047 |
};
|
|
5048 |
|
|
5049 |
|
|
5050 |
|
|
5051 |
/**
|
|
5052 |
@publishedAll
|
|
5053 |
@released
|
|
5054 |
|
|
5055 |
A set of common identity relations for frequently occurring types.
|
|
5056 |
|
|
5057 |
@see RArray
|
|
5058 |
@see RPointerArray
|
|
5059 |
@see RHashSet
|
|
5060 |
@see RPtrHashSet
|
|
5061 |
@see RHashMap
|
|
5062 |
@see RPtrHashMap
|
|
5063 |
*/
|
|
5064 |
class DefaultIdentity
|
|
5065 |
{
|
|
5066 |
public:
|
|
5067 |
IMPORT_C static TBool Integer(const TInt&, const TInt&);
|
|
5068 |
IMPORT_C static TBool Des8(const TDesC8&, const TDesC8&);
|
|
5069 |
IMPORT_C static TBool Des16(const TDesC16&, const TDesC16&);
|
|
5070 |
IMPORT_C static TBool IntegerPtr(TInt* const&, TInt* const&);
|
|
5071 |
IMPORT_C static TBool Des8Ptr(TDesC8* const&, TDesC8* const&);
|
|
5072 |
IMPORT_C static TBool Des16Ptr(TDesC16* const&, TDesC16* const&);
|
|
5073 |
};
|
|
5074 |
|
|
5075 |
|
|
5076 |
|
|
5077 |
|
|
5078 |
/**
|
|
5079 |
@publishedAll
|
|
5080 |
@released
|
|
5081 |
|
|
5082 |
A templated class which packages a function that determines the order of two
|
|
5083 |
objects of a given class type. During binary search operations the search term
|
|
5084 |
is always passed as the first argument and the second argument is an element
|
|
5085 |
of the array being searched.
|
|
5086 |
|
|
5087 |
A TLinearOrder<T> object is constructed and passed as a parameter to member
|
|
5088 |
functions of the array classes RArray<T> and RPointerArray<T>.
|
|
5089 |
|
|
5090 |
@see RArray
|
|
5091 |
@see RPointerArray
|
|
5092 |
*/
|
|
5093 |
template <class T>
|
|
5094 |
class TLinearOrder
|
|
5095 |
{
|
|
5096 |
public:
|
|
5097 |
inline TLinearOrder( TInt(*anOrder)(const T&, const T&) );
|
|
5098 |
inline operator TGeneralLinearOrder() const;
|
|
5099 |
private:
|
|
5100 |
TGeneralLinearOrder iOrder;
|
|
5101 |
};
|
|
5102 |
|
|
5103 |
|
|
5104 |
/*
|
|
5105 |
@publishedAll
|
|
5106 |
@released
|
|
5107 |
|
|
5108 |
A set of values that tell array search functions which array element is to be
|
|
5109 |
returned when there are duplicate elements in the array.
|
|
5110 |
|
|
5111 |
These values are used by RArray, RPointerArray, RArray<TInt>,
|
|
5112 |
and RArray<TUint> search functions.
|
|
5113 |
|
|
5114 |
Examples of functions that take
|
|
5115 |
these enum values are: RPointerArray::SpecificFindInOrderL(),
|
|
5116 |
and RArray::SpecificFindInSignedKeyOrder().
|
|
5117 |
|
|
5118 |
@see RArray
|
|
5119 |
@see RPointerArray
|
|
5120 |
@see RArray<TInt>
|
|
5121 |
@see RArray<TUint>
|
|
5122 |
*/
|
|
5123 |
enum TArrayFindMode
|
|
5124 |
{
|
|
5125 |
/**
|
|
5126 |
Indicates that any element in a block of duplicate elements can be
|
|
5127 |
returned by a search function.
|
|
5128 |
|
|
5129 |
Note that using this mode, there can be no guarantee that the element
|
|
5130 |
returned by the search functions will be the same if the size of the array
|
|
5131 |
changes between successive calls to those functions.
|
|
5132 |
*/
|
|
5133 |
EArrayFindMode_Any = 0,
|
|
5134 |
|
|
5135 |
/**
|
|
5136 |
Indicates that the first element in a block of duplicate elements
|
|
5137 |
is returned.
|
|
5138 |
*/
|
|
5139 |
EArrayFindMode_First = 1,
|
|
5140 |
|
|
5141 |
/**
|
|
5142 |
Indicates that the first element after the last element in a block
|
|
5143 |
of duplicate elements is returned.
|
|
5144 |
*/
|
|
5145 |
EArrayFindMode_Last = 2,
|
|
5146 |
|
|
5147 |
/**
|
|
5148 |
@internalTechnology
|
|
5149 |
*/
|
|
5150 |
EArrayFindMode_Limit = 3
|
|
5151 |
};
|
|
5152 |
|
|
5153 |
|
|
5154 |
/**
|
|
5155 |
@internalComponent
|
|
5156 |
|
|
5157 |
Base class used in the derivation of RPointerArray, RArray<TInt>,
|
|
5158 |
and RArray<TUint>.
|
|
5159 |
|
|
5160 |
The base class is inherited privately.
|
|
5161 |
|
|
5162 |
The class is internal and is not intended for use.
|
|
5163 |
*/
|
|
5164 |
class RPointerArrayBase
|
|
5165 |
{
|
|
5166 |
protected:
|
|
5167 |
IMPORT_C RPointerArrayBase();
|
|
5168 |
IMPORT_C RPointerArrayBase(TInt aGranularity);
|
|
5169 |
IMPORT_C RPointerArrayBase(TInt aMinGrowBy, TInt aFactor);
|
|
5170 |
IMPORT_C void Close();
|
|
5171 |
IMPORT_C TInt Count() const;
|
|
5172 |
inline void ZeroCount() {iCount=0;}
|
|
5173 |
inline TAny** Entries() {return iEntries;}
|
|
5174 |
IMPORT_C TAny*& At(TInt anIndex) const;
|
|
5175 |
IMPORT_C TInt Append(const TAny* anEntry);
|
|
5176 |
IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
|
|
5177 |
IMPORT_C void Remove(TInt anIndex);
|
|
5178 |
IMPORT_C void Compress();
|
|
5179 |
IMPORT_C void Reset();
|
|
5180 |
IMPORT_C TInt Find(const TAny* anEntry) const;
|
|
5181 |
IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
|
|
5182 |
IMPORT_C TInt FindReverse(const TAny* aEntry) const;
|
|
5183 |
IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
|
|
5184 |
IMPORT_C TInt FindIsqSigned(TInt anEntry) const;
|
|
5185 |
IMPORT_C TInt FindIsqUnsigned(TUint anEntry) const;
|
|
5186 |
IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
|
|
5187 |
IMPORT_C TInt FindIsqSigned(TInt anEntry, TInt aMode) const;
|
|
5188 |
IMPORT_C TInt FindIsqUnsigned(TUint anEntry, TInt aMode) const;
|
|
5189 |
IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
|
|
5190 |
IMPORT_C TInt InsertIsqSigned(TInt anEntry, TBool aAllowRepeats);
|
|
5191 |
IMPORT_C TInt InsertIsqUnsigned(TUint anEntry, TBool aAllowRepeats);
|
|
5192 |
IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
|
|
5193 |
IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex) const;
|
|
5194 |
IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex) const;
|
|
5195 |
IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
|
|
5196 |
IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex, TInt aMode) const;
|
|
5197 |
IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex, TInt aMode) const;
|
|
5198 |
IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
|
|
5199 |
#ifndef __KERNEL_MODE__
|
|
5200 |
IMPORT_C RPointerArrayBase(TAny** aEntries, TInt aCount);
|
|
5201 |
IMPORT_C void GranularCompress();
|
|
5202 |
IMPORT_C TInt DoReserve(TInt aCount);
|
|
5203 |
IMPORT_C void HeapSortSigned();
|
|
5204 |
IMPORT_C void HeapSortUnsigned();
|
|
5205 |
IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
|
|
5206 |
IMPORT_C static TInt GetCount(const CBase* aPtr);
|
|
5207 |
IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
|
|
5208 |
#endif
|
|
5209 |
private:
|
|
5210 |
TInt Grow();
|
|
5211 |
private:
|
|
5212 |
TInt iCount;
|
|
5213 |
TAny** iEntries;
|
|
5214 |
TInt iAllocated;
|
|
5215 |
TInt iGranularity; // positive means linear, negative means exponential growth
|
|
5216 |
TInt iSpare1;
|
|
5217 |
TInt iSpare2;
|
|
5218 |
};
|
|
5219 |
|
|
5220 |
|
|
5221 |
|
|
5222 |
|
|
5223 |
/**
|
|
5224 |
@publishedAll
|
|
5225 |
@released
|
|
5226 |
|
|
5227 |
A simple and efficient array of pointers to objects.
|
|
5228 |
|
|
5229 |
The elements of the array are pointers to instances of a class; this class
|
|
5230 |
is specified as the template parameter T.
|
|
5231 |
|
|
5232 |
The class offers standard array behaviour which includes insertion, appending
|
|
5233 |
and sorting of pointers.
|
|
5234 |
|
|
5235 |
Derivation from RPointerArrayBase is private.
|
|
5236 |
*/
|
|
5237 |
template <class T>
|
|
5238 |
class RPointerArray : private RPointerArrayBase
|
|
5239 |
{
|
|
5240 |
public:
|
|
5241 |
inline RPointerArray();
|
|
5242 |
inline explicit RPointerArray(TInt aGranularity);
|
|
5243 |
inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
|
|
5244 |
inline void Close();
|
|
5245 |
inline TInt Count() const;
|
|
5246 |
inline T* const& operator[](TInt anIndex) const;
|
|
5247 |
inline T*& operator[](TInt anIndex);
|
|
5248 |
inline TInt Append(const T* anEntry);
|
|
5249 |
inline TInt Insert(const T* anEntry, TInt aPos);
|
|
5250 |
inline void Remove(TInt anIndex);
|
|
5251 |
inline void Compress();
|
|
5252 |
inline void Reset();
|
|
5253 |
void ResetAndDestroy();
|
|
5254 |
inline TInt Find(const T* anEntry) const;
|
|
5255 |
inline TInt Find(const T* anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5256 |
template <class K>
|
|
5257 |
inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
|
|
5258 |
/**
|
|
5259 |
Finds the first object pointer in the array which matches aKey using
|
|
5260 |
the comparison algorithm provided by apfnCompare.
|
|
5261 |
|
|
5262 |
The find operation always starts at the low index end of the array. There
|
|
5263 |
is no assumption about the order of objects in the array.
|
|
5264 |
|
|
5265 |
@param aKey The key of type K to be compared with the elements of the array using apfnCompare.
|
|
5266 |
@param apfnCompare A function defining the identity relation between the
|
|
5267 |
object pointers in the array, and their keys of type K. The
|
|
5268 |
function returns true if k and t match based on this relationship.
|
|
5269 |
|
|
5270 |
@return The index of the first matching object pointer within the array.
|
|
5271 |
KErrNotFound, if no suitable object pointer can be found.
|
|
5272 |
*/
|
|
5273 |
{ return RPointerArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
|
|
5274 |
inline TInt FindReverse(const T* anEntry) const;
|
|
5275 |
inline TInt FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5276 |
template <class K>
|
|
5277 |
inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
|
|
5278 |
/**
|
|
5279 |
Finds the first object pointer in the array which matches aKey using
|
|
5280 |
the comparison algorithm provided by apfnCompare.
|
|
5281 |
|
|
5282 |
The find operation always starts at the high index end of the array. There
|
|
5283 |
is no assumption about the order of objects in the array.
|
|
5284 |
|
|
5285 |
@param aKey The key of type K to be compared with the elements of the array using apfnMatch.
|
|
5286 |
@param apfnMatch A function defining the identity relation between the
|
|
5287 |
object pointers in the array, and their keys of type K. The
|
|
5288 |
function returns true if k and t match based on this relationship.
|
|
5289 |
|
|
5290 |
@return The index of the first matching object pointer within the array.
|
|
5291 |
KErrNotFound, if no suitable object pointer can be found.
|
|
5292 |
*/
|
|
5293 |
|
|
5294 |
{ return RPointerArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
|
|
5295 |
inline TInt FindInAddressOrder(const T* anEntry) const;
|
|
5296 |
inline TInt FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const;
|
|
5297 |
inline TInt FindInAddressOrder(const T* anEntry, TInt& anIndex) const;
|
|
5298 |
inline TInt FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
|
|
5299 |
template <class K>
|
|
5300 |
inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
|
|
5301 |
/**
|
|
5302 |
Finds the object pointer in the array whose object matches the specified
|
|
5303 |
key, (Using the relationship defined within apfnCompare) using a binary search
|
|
5304 |
technique and an ordering algorithm.
|
|
5305 |
|
|
5306 |
The function assumes that existing object pointers in the array are ordered
|
|
5307 |
so that the objects themselves are in object order as determined by an algorithm
|
|
5308 |
supplied by the caller and packaged as a TLinearOrder<T>.
|
|
5309 |
|
|
5310 |
@param aKey The key of type K to be compared with the elements of the array using apfnCompare.
|
|
5311 |
@param apfnCompare A function which defines the order that the array was sorted,
|
|
5312 |
where in it aKey (via the defined relationship) should fit, and if the key is present.
|
|
5313 |
|
|
5314 |
@return The index of the matching object pointer within the array.
|
|
5315 |
KErrNotFound, if no suitable object pointer can be found.
|
|
5316 |
*/
|
|
5317 |
{ return RPointerArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
|
|
5318 |
inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const;
|
|
5319 |
inline TInt SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5320 |
inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const;
|
|
5321 |
inline TInt SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5322 |
inline TInt InsertInAddressOrder(const T* anEntry);
|
|
5323 |
inline TInt InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder);
|
|
5324 |
inline TInt InsertInAddressOrderAllowRepeats(const T* anEntry);
|
|
5325 |
inline TInt InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder);
|
|
5326 |
#ifndef __KERNEL_MODE__
|
|
5327 |
inline void AppendL(const T* anEntry);
|
|
5328 |
inline void InsertL(const T* anEntry, TInt aPos);
|
|
5329 |
inline TInt FindL(const T* anEntry) const;
|
|
5330 |
inline TInt FindL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5331 |
inline TInt FindReverseL(const T* anEntry) const;
|
|
5332 |
inline TInt FindReverseL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5333 |
inline TInt FindInAddressOrderL(const T* anEntry) const;
|
|
5334 |
inline TInt FindInOrderL(const T* anEntry, TLinearOrder<T> anOrder) const;
|
|
5335 |
inline void FindInAddressOrderL(const T* anEntry, TInt& anIndex) const;
|
|
5336 |
inline void FindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
|
|
5337 |
inline TInt SpecificFindInAddressOrderL(const T* anEntry, TInt aMode) const;
|
|
5338 |
inline TInt SpecificFindInOrderL(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5339 |
inline void SpecificFindInAddressOrderL(const T* anEntry, TInt& anIndex, TInt aMode) const;
|
|
5340 |
inline void SpecificFindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5341 |
inline void InsertInAddressOrderL(const T* anEntry);
|
|
5342 |
inline void InsertInOrderL(const T* anEntry, TLinearOrder<T> anOrder);
|
|
5343 |
inline void InsertInAddressOrderAllowRepeatsL(const T* anEntry);
|
|
5344 |
inline void InsertInOrderAllowRepeatsL(const T* anEntry, TLinearOrder<T> anOrder);
|
|
5345 |
|
|
5346 |
inline RPointerArray(T** aEntries, TInt aCount);
|
|
5347 |
inline void GranularCompress();
|
|
5348 |
inline TInt Reserve(TInt aCount);
|
|
5349 |
inline void ReserveL(TInt aCount);
|
|
5350 |
inline void SortIntoAddressOrder();
|
|
5351 |
inline void Sort(TLinearOrder<T> anOrder);
|
|
5352 |
inline TArray<T*> Array() const;
|
|
5353 |
#endif
|
|
5354 |
};
|
|
5355 |
|
|
5356 |
|
|
5357 |
|
|
5358 |
/**
|
|
5359 |
@publishedAll
|
|
5360 |
@released
|
|
5361 |
|
|
5362 |
Array of raw pointers.
|
|
5363 |
|
|
5364 |
The array is a simple and efficient specialized array of TAny pointers offering
|
|
5365 |
standard array behaviour.
|
|
5366 |
|
|
5367 |
The derivation from RPointerArrayBase is private.
|
|
5368 |
*/
|
|
5369 |
TEMPLATE_SPECIALIZATION class RPointerArray<TAny> : private RPointerArrayBase
|
|
5370 |
{
|
|
5371 |
public:
|
|
5372 |
inline RPointerArray();
|
|
5373 |
inline explicit RPointerArray(TInt aGranularity);
|
|
5374 |
inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
|
|
5375 |
inline void Close();
|
|
5376 |
inline TInt Count() const;
|
|
5377 |
inline TAny* const& operator[](TInt anIndex) const;
|
|
5378 |
inline TAny*& operator[](TInt anIndex);
|
|
5379 |
inline TInt Append(const TAny* anEntry);
|
|
5380 |
inline TInt Insert(const TAny* anEntry, TInt aPos);
|
|
5381 |
inline void Remove(TInt anIndex);
|
|
5382 |
inline void Compress();
|
|
5383 |
inline void Reset();
|
|
5384 |
inline TInt Find(const TAny* anEntry) const;
|
|
5385 |
inline TInt FindReverse(const TAny* anEntry) const;
|
|
5386 |
inline TInt FindInAddressOrder(const TAny* anEntry) const;
|
|
5387 |
inline TInt FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const;
|
|
5388 |
inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const;
|
|
5389 |
inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
|
|
5390 |
inline TInt InsertInAddressOrder(const TAny* anEntry);
|
|
5391 |
inline TInt InsertInAddressOrderAllowRepeats(const TAny* anEntry);
|
|
5392 |
#ifndef __KERNEL_MODE__
|
|
5393 |
inline void AppendL(const TAny* anEntry);
|
|
5394 |
inline void InsertL(const TAny* anEntry, TInt aPos);
|
|
5395 |
inline TInt FindL(const TAny* anEntry) const;
|
|
5396 |
inline TInt FindReverseL(const TAny* anEntry) const;
|
|
5397 |
inline TInt FindInAddressOrderL(const TAny* anEntry) const;
|
|
5398 |
inline void FindInAddressOrderL(const TAny* anEntry, TInt& anIndex) const;
|
|
5399 |
inline TInt SpecificFindInAddressOrderL(const TAny* anEntry, TInt aMode) const;
|
|
5400 |
inline void SpecificFindInAddressOrderL(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
|
|
5401 |
inline void InsertInAddressOrderL(const TAny* anEntry);
|
|
5402 |
inline void InsertInAddressOrderAllowRepeatsL(const TAny* anEntry);
|
|
5403 |
|
|
5404 |
inline RPointerArray(TAny** aEntries, TInt aCount);
|
|
5405 |
inline void GranularCompress();
|
|
5406 |
inline void SortIntoAddressOrder();
|
|
5407 |
inline TArray<TAny*> Array() const;
|
|
5408 |
#endif
|
|
5409 |
};
|
|
5410 |
|
|
5411 |
|
|
5412 |
|
|
5413 |
/**
|
|
5414 |
@internalComponent
|
|
5415 |
|
|
5416 |
Base class used in the derivation of RArray.
|
|
5417 |
|
|
5418 |
The base class is inherited privately.
|
|
5419 |
|
|
5420 |
The class is internal and is not intended for use.
|
|
5421 |
*/
|
|
5422 |
class RArrayBase
|
|
5423 |
{
|
|
5424 |
protected:
|
|
5425 |
IMPORT_C RArrayBase(TInt anEntrySize);
|
|
5426 |
IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity);
|
|
5427 |
IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity, TInt aKeyOffset);
|
|
5428 |
IMPORT_C RArrayBase(TInt anEntrySize, TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
|
|
5429 |
IMPORT_C RArrayBase(TInt aEntrySize,TAny* aEntries, TInt aCount);
|
|
5430 |
IMPORT_C void Close();
|
|
5431 |
IMPORT_C TInt Count() const;
|
|
5432 |
IMPORT_C TAny* At(TInt anIndex) const;
|
|
5433 |
IMPORT_C TInt Append(const TAny* anEntry);
|
|
5434 |
IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
|
|
5435 |
IMPORT_C void Remove(TInt anIndex);
|
|
5436 |
IMPORT_C void Compress();
|
|
5437 |
IMPORT_C void Reset();
|
|
5438 |
IMPORT_C TInt Find(const TAny* anEntry) const;
|
|
5439 |
IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
|
|
5440 |
IMPORT_C TInt FindReverse(const TAny* aEntry) const;
|
|
5441 |
IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
|
|
5442 |
IMPORT_C TInt FindIsqSigned(const TAny* anEntry) const;
|
|
5443 |
IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry) const;
|
|
5444 |
IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
|
|
5445 |
IMPORT_C TInt FindIsqSigned(const TAny* anEntry, TInt aMode) const;
|
|
5446 |
IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry, TInt aMode) const;
|
|
5447 |
IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
|
|
5448 |
IMPORT_C TInt InsertIsqSigned(const TAny* anEntry, TBool aAllowRepeats);
|
|
5449 |
IMPORT_C TInt InsertIsqUnsigned(const TAny* anEntry, TBool aAllowRepeats);
|
|
5450 |
IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
|
|
5451 |
IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex) const;
|
|
5452 |
IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex) const;
|
|
5453 |
IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
|
|
5454 |
IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
|
|
5455 |
IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
|
|
5456 |
IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
|
|
5457 |
#ifndef __KERNEL_MODE__
|
|
5458 |
IMPORT_C void GranularCompress();
|
|
5459 |
IMPORT_C TInt DoReserve(TInt aCount);
|
|
5460 |
IMPORT_C void HeapSortSigned();
|
|
5461 |
IMPORT_C void HeapSortUnsigned();
|
|
5462 |
IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
|
|
5463 |
IMPORT_C static TInt GetCount(const CBase* aPtr);
|
|
5464 |
IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
|
|
5465 |
#endif
|
|
5466 |
private:
|
|
5467 |
TInt Grow();
|
|
5468 |
private:
|
|
5469 |
TInt iCount;
|
|
5470 |
TAny* iEntries;
|
|
5471 |
TInt iEntrySize;
|
|
5472 |
TInt iKeyOffset;
|
|
5473 |
TInt iAllocated;
|
|
5474 |
TInt iGranularity; // positive means linear, negative means exponential growth
|
|
5475 |
TInt iSpare1;
|
|
5476 |
TInt iSpare2;
|
|
5477 |
};
|
|
5478 |
|
|
5479 |
|
|
5480 |
|
|
5481 |
|
|
5482 |
/**
|
|
5483 |
@publishedAll
|
|
5484 |
@released
|
|
5485 |
|
|
5486 |
A simple and efficient array of fixed length objects.
|
|
5487 |
|
|
5488 |
The elements of the array are instances of a class; this class is specified
|
|
5489 |
as the template parameter T.
|
|
5490 |
|
|
5491 |
The array offers standard array behaviour which includes insertion, appending
|
|
5492 |
and sorting of elements.
|
|
5493 |
|
|
5494 |
Note:
|
|
5495 |
|
|
5496 |
1. where possible, this class should be used in preference to
|
|
5497 |
CArrayFixFlat<classT>.
|
|
5498 |
|
|
5499 |
2. the derivation from RArrayBase is private.
|
|
5500 |
|
|
5501 |
3. for performance reasons, RArray stores objects in the array as
|
|
5502 |
word (4 byte) aligned quantities. This means that some member functions
|
|
5503 |
do not work when RArray is instantiated for classes of less than 4 bytes
|
|
5504 |
in size, or when the class's alignment requirement is not 4.
|
|
5505 |
Be aware that it is possible to get an unhandled exception on hardware
|
|
5506 |
that enforces strict alignment.
|
|
5507 |
|
|
5508 |
The affected functions are:
|
|
5509 |
|
|
5510 |
3.1 the constructor: RArray(TInt, T*, TInt)
|
|
5511 |
|
|
5512 |
3.2 Append(const T&)
|
|
5513 |
|
|
5514 |
3.3 Insert(const T&, TInt)
|
|
5515 |
|
|
5516 |
3.4 the [] operator, and then using the pointer to iterate through
|
|
5517 |
the array as you would with a C array.
|
|
5518 |
*/
|
|
5519 |
template <class T>
|
|
5520 |
class RArray : private RArrayBase
|
|
5521 |
{
|
|
5522 |
public:
|
|
5523 |
inline RArray();
|
|
5524 |
inline explicit RArray(TInt aGranularity);
|
|
5525 |
inline RArray(TInt aGranularity, TInt aKeyOffset);
|
|
5526 |
inline RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
|
|
5527 |
inline RArray(TInt aEntrySize,T* aEntries, TInt aCount);
|
|
5528 |
inline void Close();
|
|
5529 |
inline TInt Count() const;
|
|
5530 |
inline const T& operator[](TInt anIndex) const;
|
|
5531 |
inline T& operator[](TInt anIndex);
|
|
5532 |
inline TInt Append(const T& anEntry);
|
|
5533 |
inline TInt Insert(const T& anEntry, TInt aPos);
|
|
5534 |
inline void Remove(TInt anIndex);
|
|
5535 |
inline void Compress();
|
|
5536 |
inline void Reset();
|
|
5537 |
inline TInt Find(const T& anEntry) const;
|
|
5538 |
inline TInt Find(const T& anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5539 |
template <class K>
|
|
5540 |
inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
|
|
5541 |
/**
|
|
5542 |
Finds the first object in the array which matches aKey using
|
|
5543 |
the comparison algorithm provided by apfnCompare.
|
|
5544 |
|
|
5545 |
The find operation always starts at the low index end of the array. There
|
|
5546 |
is no assumption about the order of objects in the array.
|
|
5547 |
|
|
5548 |
@param aKey The key of type K to be compared with the elements of the array using apfnCompare.
|
|
5549 |
@param apfnCompare A function defining the identity relation between the
|
|
5550 |
object in the array, and their keys of type K. The function
|
|
5551 |
returns true if k and t match based on this relationship.
|
|
5552 |
|
|
5553 |
@return The index of the first matching object within the array.
|
|
5554 |
KErrNotFound, if no suitable object can be found.
|
|
5555 |
*/
|
|
5556 |
{ return RArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
|
|
5557 |
inline TInt FindReverse(const T& anEntry) const;
|
|
5558 |
inline TInt FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5559 |
template <class K>
|
|
5560 |
inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
|
|
5561 |
/**
|
|
5562 |
Finds the first object in the array which matches aKey using the comparison
|
|
5563 |
algorithm provided by apfnCompare.
|
|
5564 |
|
|
5565 |
The find operation always starts at the high index end of the array. There
|
|
5566 |
is no assumption about the order of objects in the array.
|
|
5567 |
|
|
5568 |
@param aKey The key of type K to be compared with the elements of the array using apfnMatch.
|
|
5569 |
@param apfnMatch A function defining the identity relation between the
|
|
5570 |
object in the array, and their keys of type K. The function
|
|
5571 |
returns true if k and t match based on this relationship.
|
|
5572 |
|
|
5573 |
@return The index of the first matching object within the array.
|
|
5574 |
KErrNotFound, if no suitable object can be found.
|
|
5575 |
*/
|
|
5576 |
{ return RArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
|
|
5577 |
inline TInt FindInSignedKeyOrder(const T& anEntry) const;
|
|
5578 |
inline TInt FindInUnsignedKeyOrder(const T& anEntry) const;
|
|
5579 |
inline TInt FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const;
|
|
5580 |
inline TInt FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const;
|
|
5581 |
inline TInt FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const;
|
|
5582 |
inline TInt FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
|
|
5583 |
template <class K>
|
|
5584 |
inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
|
|
5585 |
/**
|
|
5586 |
Finds the object in the array whose object matches the specified
|
|
5587 |
key, (Using the relationship defined within apfnCompare) using a binary search
|
|
5588 |
technique and an ordering algorithm.
|
|
5589 |
|
|
5590 |
The function assumes that existing objects in the array are ordered so
|
|
5591 |
that the objects themselves are in object order as determined by an algorithm
|
|
5592 |
supplied by the caller and packaged as a TLinearOrder<T>.
|
|
5593 |
|
|
5594 |
@param aKey The key of type K to be compared with the elements of the array using apfnCompare.
|
|
5595 |
@param apfnCompare A function which defines the order that the array was sorted,
|
|
5596 |
where in it aKey (via the defined relationship) should fit, and if the key is present.
|
|
5597 |
|
|
5598 |
@return The index of the matching object within the array.
|
|
5599 |
KErrNotFound, if no suitable object can be found.
|
|
5600 |
*/
|
|
5601 |
|
|
5602 |
{ return RArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
|
|
5603 |
inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const;
|
|
5604 |
inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const;
|
|
5605 |
inline TInt SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5606 |
inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
|
|
5607 |
inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
|
|
5608 |
inline TInt SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5609 |
inline TInt InsertInSignedKeyOrder(const T& anEntry);
|
|
5610 |
inline TInt InsertInUnsignedKeyOrder(const T& anEntry);
|
|
5611 |
inline TInt InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder);
|
|
5612 |
inline TInt InsertInSignedKeyOrderAllowRepeats(const T& anEntry);
|
|
5613 |
inline TInt InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry);
|
|
5614 |
inline TInt InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder);
|
|
5615 |
#ifndef __KERNEL_MODE__
|
|
5616 |
inline void AppendL(const T& anEntry);
|
|
5617 |
inline void InsertL(const T& anEntry, TInt aPos);
|
|
5618 |
inline TInt FindL(const T& anEntry) const;
|
|
5619 |
inline TInt FindL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5620 |
inline TInt FindReverseL(const T& anEntry) const;
|
|
5621 |
inline TInt FindReverseL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
|
|
5622 |
inline TInt FindInSignedKeyOrderL(const T& anEntry) const;
|
|
5623 |
inline TInt FindInUnsignedKeyOrderL(const T& anEntry) const;
|
|
5624 |
inline TInt FindInOrderL(const T& anEntry, TLinearOrder<T> anOrder) const;
|
|
5625 |
inline void FindInSignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
|
|
5626 |
inline void FindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
|
|
5627 |
inline void FindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
|
|
5628 |
inline TInt SpecificFindInSignedKeyOrderL(const T& anEntry, TInt aMode) const;
|
|
5629 |
inline TInt SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt aMode) const;
|
|
5630 |
inline TInt SpecificFindInOrderL(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5631 |
inline void SpecificFindInSignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
|
|
5632 |
inline void SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
|
|
5633 |
inline void SpecificFindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
|
|
5634 |
inline void InsertInSignedKeyOrderL(const T& anEntry);
|
|
5635 |
inline void InsertInUnsignedKeyOrderL(const T& anEntry);
|
|
5636 |
inline void InsertInOrderL(const T& anEntry, TLinearOrder<T> anOrder);
|
|
5637 |
inline void InsertInSignedKeyOrderAllowRepeatsL(const T& anEntry);
|
|
5638 |
inline void InsertInUnsignedKeyOrderAllowRepeatsL(const T& anEntry);
|
|
5639 |
inline void InsertInOrderAllowRepeatsL(const T& anEntry, TLinearOrder<T> anOrder);
|
|
5640 |
|
|
5641 |
inline void GranularCompress();
|
|
5642 |
inline TInt Reserve(TInt aCount);
|
|
5643 |
inline void ReserveL(TInt aCount);
|
|
5644 |
inline void SortSigned();
|
|
5645 |
inline void SortUnsigned();
|
|
5646 |
inline void Sort(TLinearOrder<T> anOrder);
|
|
5647 |
inline TArray<T> Array() const;
|
|
5648 |
#endif
|
|
5649 |
};
|
|
5650 |
|
|
5651 |
|
|
5652 |
|
|
5653 |
|
|
5654 |
/**
|
|
5655 |
@publishedAll
|
|
5656 |
@released
|
|
5657 |
|
|
5658 |
A simple and efficient specialized array of signed integers offering standard
|
|
5659 |
array behaviour.
|
|
5660 |
|
|
5661 |
Note that derivation from RPointerArrayBase is private.
|
|
5662 |
*/
|
|
5663 |
TEMPLATE_SPECIALIZATION class RArray<TInt> : private RPointerArrayBase
|
|
5664 |
{
|
|
5665 |
public:
|
|
5666 |
inline RArray();
|
|
5667 |
inline explicit RArray(TInt aGranularity);
|
|
5668 |
inline RArray(TInt aMinGrowBy, TInt aFactor);
|
|
5669 |
inline void Close();
|
|
5670 |
inline TInt Count() const;
|
|
5671 |
inline const TInt& operator[](TInt anIndex) const;
|
|
5672 |
inline TInt& operator[](TInt anIndex);
|
|
5673 |
inline TInt Append(TInt anEntry);
|
|
5674 |
inline TInt Insert(TInt anEntry, TInt aPos);
|
|
5675 |
inline void Remove(TInt anIndex);
|
|
5676 |
inline void Compress();
|
|
5677 |
inline void Reset();
|
|
5678 |
inline TInt Find(TInt anEntry) const;
|
|
5679 |
inline TInt FindReverse(TInt anEntry) const;
|
|
5680 |
inline TInt FindInOrder(TInt anEntry) const;
|
|
5681 |
inline TInt FindInOrder(TInt anEntry, TInt& anIndex) const;
|
|
5682 |
inline TInt SpecificFindInOrder(TInt anEntry, TInt aMode) const;
|
|
5683 |
inline TInt SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const;
|
|
5684 |
inline TInt InsertInOrder(TInt anEntry);
|
|
5685 |
inline TInt InsertInOrderAllowRepeats(TInt anEntry);
|
|
5686 |
#ifndef __KERNEL_MODE__
|
|
5687 |
inline void AppendL(TInt anEntry);
|
|
5688 |
inline void InsertL(TInt anEntry, TInt aPos);
|
|
5689 |
inline TInt FindL(TInt anEntry) const;
|
|
5690 |
inline TInt FindReverseL(TInt anEntry) const;
|
|
5691 |
inline TInt FindInOrderL(TInt anEntry) const;
|
|
5692 |
inline void FindInOrderL(TInt anEntry, TInt& anIndex) const;
|
|
5693 |
inline TInt SpecificFindInOrderL(TInt anEntry, TInt aMode) const;
|
|
5694 |
inline void SpecificFindInOrderL(TInt anEntry, TInt& anIndex, TInt aMode) const;
|
|
5695 |
inline void InsertInOrderL(TInt anEntry);
|
|
5696 |
inline void InsertInOrderAllowRepeatsL(TInt anEntry);
|
|
5697 |
|
|
5698 |
inline RArray(TInt* aEntries, TInt aCount);
|
|
5699 |
inline void GranularCompress();
|
|
5700 |
inline TInt Reserve(TInt aCount);
|
|
5701 |
inline void ReserveL(TInt aCount);
|
|
5702 |
inline void Sort();
|
|
5703 |
inline TArray<TInt> Array() const;
|
|
5704 |
#endif
|
|
5705 |
};
|
|
5706 |
|
|
5707 |
|
|
5708 |
|
|
5709 |
|
|
5710 |
/**
|
|
5711 |
@publishedAll
|
|
5712 |
@released
|
|
5713 |
|
|
5714 |
Array of unsigned integers.
|
|
5715 |
|
|
5716 |
The array is a simple and efficient specialized array of unsigned integers
|
|
5717 |
offering standard array behaviour.
|
|
5718 |
|
|
5719 |
The derivation from RPointerArrayBase is private.
|
|
5720 |
*/
|
|
5721 |
TEMPLATE_SPECIALIZATION class RArray<TUint> : private RPointerArrayBase
|
|
5722 |
{
|
|
5723 |
public:
|
|
5724 |
inline RArray();
|
|
5725 |
inline explicit RArray(TInt aGranularity);
|
|
5726 |
inline RArray(TInt aMinGrowBy, TInt aFactor);
|
|
5727 |
inline void Close();
|
|
5728 |
inline TInt Count() const;
|
|
5729 |
inline const TUint& operator[](TInt anIndex) const;
|
|
5730 |
inline TUint& operator[](TInt anIndex);
|
|
5731 |
inline TInt Append(TUint anEntry);
|
|
5732 |
inline TInt Insert(TUint anEntry, TInt aPos);
|
|
5733 |
inline void Remove(TInt anIndex);
|
|
5734 |
inline void Compress();
|
|
5735 |
inline void Reset();
|
|
5736 |
inline TInt Find(TUint anEntry) const;
|
|
5737 |
inline TInt FindReverse(TUint anEntry) const;
|
|
5738 |
inline TInt FindInOrder(TUint anEntry) const;
|
|
5739 |
inline TInt FindInOrder(TUint anEntry, TInt& anIndex) const;
|
|
5740 |
inline TInt SpecificFindInOrder(TUint anEntry, TInt aMode) const;
|
|
5741 |
inline TInt SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const;
|
|
5742 |
inline TInt InsertInOrder(TUint anEntry);
|
|
5743 |
inline TInt InsertInOrderAllowRepeats(TUint anEntry);
|
|
5744 |
#ifndef __KERNEL_MODE__
|
|
5745 |
inline void AppendL(TUint anEntry);
|
|
5746 |
inline void InsertL(TUint anEntry, TInt aPos);
|
|
5747 |
inline TInt FindL(TUint anEntry) const;
|
|
5748 |
inline TInt FindReverseL(TUint anEntry) const;
|
|
5749 |
inline TInt FindInOrderL(TUint anEntry) const;
|
|
5750 |
inline void FindInOrderL(TUint anEntry, TInt& anIndex) const;
|
|
5751 |
inline TInt SpecificFindInOrderL(TUint anEntry, TInt aMode) const;
|
|
5752 |
inline void SpecificFindInOrderL(TUint anEntry, TInt& anIndex, TInt aMode) const;
|
|
5753 |
inline void InsertInOrderL(TUint anEntry);
|
|
5754 |
inline void InsertInOrderAllowRepeatsL(TUint anEntry);
|
|
5755 |
|
|
5756 |
inline RArray(TUint* aEntries, TInt aCount);
|
|
5757 |
inline void GranularCompress();
|
|
5758 |
inline TInt Reserve(TInt aCount);
|
|
5759 |
inline void ReserveL(TInt aCount);
|
|
5760 |
inline void Sort();
|
|
5761 |
inline TArray<TUint> Array() const;
|
|
5762 |
#endif
|
|
5763 |
};
|
|
5764 |
|
|
5765 |
#ifndef __LEAVE_EQUALS_THROW__
|
|
5766 |
|
|
5767 |
class TTrapHandler;
|
|
5768 |
|
|
5769 |
/**
|
|
5770 |
@internalComponent
|
|
5771 |
*/
|
|
5772 |
class TTrap
|
|
5773 |
{
|
|
5774 |
public:
|
|
5775 |
#ifndef __KERNEL_MODE__
|
|
5776 |
IMPORT_C TInt Trap(TInt& aResult);
|
|
5777 |
IMPORT_C static void UnTrap();
|
|
5778 |
#endif
|
|
5779 |
public:
|
|
5780 |
enum {EMaxState=0x10};
|
|
5781 |
public:
|
|
5782 |
TInt iState[EMaxState];
|
|
5783 |
TTrap* iNext;
|
|
5784 |
TInt* iResult;
|
|
5785 |
TTrapHandler* iHandler;
|
|
5786 |
};
|
|
5787 |
|
|
5788 |
|
|
5789 |
|
|
5790 |
/**
|
|
5791 |
@publishedAll
|
|
5792 |
@released
|
|
5793 |
|
|
5794 |
Executes the set of C++ statements _s under a trap harness.
|
|
5795 |
|
|
5796 |
Use this macro as a C++ statement.
|
|
5797 |
|
|
5798 |
_r must be a TInt which has already been declared; if any of the
|
|
5799 |
C++ statements _s leaves, then the leave code is returned in _r,
|
|
5800 |
otherwise _r is set to KErrNone.
|
|
5801 |
|
|
5802 |
_s can consist of multiple C++ statements; in theory, _s can consist
|
|
5803 |
of any legal C++ code but in practice, such statements consist of simple
|
|
5804 |
function calls, e.g. Foo() or an assignment of some value to the result of
|
|
5805 |
a function call, e.g. functionValue=GetFoo().
|
|
5806 |
|
|
5807 |
A cleanup stack is constructed for the set of C++ statements _s.
|
|
5808 |
If any function in _s leaves, objects pushed to the cleanup stack are
|
|
5809 |
cleaned-up. In addition, if any of the C++ statements in _s leaves,
|
|
5810 |
then remaining C++ code in _s is not executed and any variables which
|
|
5811 |
are assigned within that remaining code are not defined.
|
|
5812 |
|
|
5813 |
@param _r An lvalue, convertible to TInt&, which will receive the result of
|
|
5814 |
any User::Leave() executed within _s or, if no leave occurred,
|
|
5815 |
it will be set to KErrNone. The value of _r on entry is not used.
|
|
5816 |
|
|
5817 |
@param _s C++ statements which will be executed under a trap harness.
|
|
5818 |
|
|
5819 |
@see TRAPD
|
|
5820 |
*/
|
|
5821 |
#define TRAP(_r,_s) {TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
|
|
5822 |
|
|
5823 |
/**
|
|
5824 |
@publishedAll
|
|
5825 |
@released
|
|
5826 |
|
|
5827 |
Executes the set of C++ statements _s under a trap harness.
|
|
5828 |
|
|
5829 |
Use this macro in the same way as you would TRAP, except that the
|
|
5830 |
variable _r is defined as part of the macro (and is therefore valid for the
|
|
5831 |
rest of the block in which the macro occurs). Often, this saves a line of code.
|
|
5832 |
|
|
5833 |
@param _r A name, which will be declared as a TInt, and will receive the result
|
|
5834 |
of any User::Leave() executed within _s or, if no leave occurred, it
|
|
5835 |
will be set to KErrNone. After the macro, _r remains in scope until
|
|
5836 |
the end of its enclosing block.
|
|
5837 |
|
|
5838 |
@param _s C++ statements which will be executed under a trap harness.
|
|
5839 |
|
|
5840 |
@see TRAP
|
|
5841 |
*/
|
|
5842 |
#define TRAPD(_r,_s) TInt _r;{TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
|
|
5843 |
|
|
5844 |
/**
|
|
5845 |
@publishedAll
|
|
5846 |
@released
|
|
5847 |
|
|
5848 |
Executes the set of C++ statements _s under a trap harness.
|
|
5849 |
Any leave code generated is ignored.
|
|
5850 |
|
|
5851 |
Use this macro as a C++ statement.
|
|
5852 |
|
|
5853 |
This macro is functionally equivalent to:
|
|
5854 |
@code
|
|
5855 |
TInt x;
|
|
5856 |
TRAP(x,_s)
|
|
5857 |
@endcode
|
|
5858 |
or
|
|
5859 |
@code
|
|
5860 |
TRAPD(x,_s)
|
|
5861 |
@endcode
|
|
5862 |
where the value in 'x' is not used by any subsequent code.
|
|
5863 |
|
|
5864 |
_s can consist of multiple C++ statements; in theory, _s can consist
|
|
5865 |
of any legal C++ code but in practice, such statements consist of simple
|
|
5866 |
function calls, e.g. Foo() or an assignment of some value to the result of
|
|
5867 |
a function call, e.g. functionValue=GetFoo().
|
|
5868 |
|
|
5869 |
A cleanup stack is constructed for the set of C++ statements _s.
|
|
5870 |
If any function in _s leaves, objects pushed to the cleanup stack are
|
|
5871 |
cleaned-up. In addition, if any of the C++ statements in _s leaves,
|
|
5872 |
then remaining C++ code in _s is not executed and any variables which
|
|
5873 |
are assigned within that remaining code are not defined.
|
|
5874 |
|
|
5875 |
@param _s C++ statements which will be executed under a trap harness.
|
|
5876 |
|
|
5877 |
@see TRAPD
|
|
5878 |
@see TRAP
|
|
5879 |
*/
|
|
5880 |
#define TRAP_IGNORE(_s) {TInt _ignore;TTrap __t;if (__t.Trap(_ignore)==0){_s;TTrap::UnTrap();}}
|
|
5881 |
|
|
5882 |
|
|
5883 |
#else //__LEAVE_EQUALS_THROW__
|
|
5884 |
|
|
5885 |
#ifdef __WINS__
|
|
5886 |
/** @internalComponent */
|
|
5887 |
#define __WIN32SEHTRAP TWin32SEHTrap __trap; __trap.Trap();
|
|
5888 |
/** @internalComponent */
|
|
5889 |
#define __WIN32SEHUNTRAP __trap.UnTrap();
|
|
5890 |
IMPORT_C void EmptyFunction();
|
|
5891 |
#define __CALL_EMPTY_FUNCTION EmptyFunction();
|
|
5892 |
#else // !__WINS__
|
|
5893 |
#define __WIN32SEHTRAP
|
|
5894 |
#define __WIN32SEHUNTRAP
|
|
5895 |
#define __CALL_EMPTY_FUNCTION
|
|
5896 |
#endif //__WINS__
|
|
5897 |
|
|
5898 |
/**
|
|
5899 |
This macro is used by the TRAP and TRAPD macros and provides a means
|
|
5900 |
of inserting code into uses of these.
|
|
5901 |
|
|
5902 |
This macro is invoked before any 'trapped' code is called, and it should be
|
|
5903 |
redefined to do whatever task is required. E.g. this code:
|
|
5904 |
|
|
5905 |
@code
|
|
5906 |
#undef TRAP_INSTRUMENTATION_START
|
|
5907 |
#define TRAP_INSTRUMENTATION_START DoMyLoging(__LINE__)
|
|
5908 |
@endcode
|
|
5909 |
|
|
5910 |
Will cause all subsequent uses of the TRAP macros to behave in an
|
|
5911 |
equivalent way to:
|
|
5912 |
|
|
5913 |
@code
|
|
5914 |
DoMyLoging(__LINE__)
|
|
5915 |
TRAP(r,SomeCodeL());
|
|
5916 |
@endcode
|
|
5917 |
|
|
5918 |
|
|
5919 |
@publishedPartner
|
|
5920 |
@released
|
|
5921 |
|
|
5922 |
@see TRAP
|
|
5923 |
@see TRAPD
|
|
5924 |
*/
|
|
5925 |
#define TRAP_INSTRUMENTATION_START
|
|
5926 |
|
|
5927 |
|
|
5928 |
|
|
5929 |
/**
|
|
5930 |
This macro is used by the TRAP and TRAPD macros and provides a means
|
|
5931 |
of inserting code into uses of these.
|
|
5932 |
|
|
5933 |
This macro is invoked if the 'trapped' code did not Leave.
|
|
5934 |
E.g. this code:
|
|
5935 |
|
|
5936 |
@code
|
|
5937 |
#undef TRAP_INSTRUMENTATION_NOLEAVE
|
|
5938 |
#define TRAP_INSTRUMENTATION_NOLEAVE DoMyLoging(__LINE__)
|
|
5939 |
@endcode
|
|
5940 |
|
|
5941 |
Will cause all subsequent uses of the TRAP macros to behave in an
|
|
5942 |
equivalent way to:
|
|
5943 |
|
|
5944 |
@code
|
|
5945 |
TRAP(r,SomeCodeL());
|
|
5946 |
if(r==KErrNone) DoMyLoging(__LINE__);
|
|
5947 |
@endcode
|
|
5948 |
|
|
5949 |
|
|
5950 |
@param aLine The line number in the C++ source file where the TRAP or TRAPD
|
|
5951 |
macro was used.
|
|
5952 |
|
|
5953 |
@publishedPartner
|
|
5954 |
@released
|
|
5955 |
|
|
5956 |
@see TRAP
|
|
5957 |
@see TRAPD
|
|
5958 |
*/
|
|
5959 |
#define TRAP_INSTRUMENTATION_NOLEAVE
|
|
5960 |
|
|
5961 |
|
|
5962 |
/**
|
|
5963 |
This macro is used by the TRAP and TRAPD macros and provides a means
|
|
5964 |
of inserting code into uses of these.
|
|
5965 |
|
|
5966 |
This macro is invoked if the 'trapped' code did Leave. E.g. this code:
|
|
5967 |
|
|
5968 |
@code
|
|
5969 |
#undef TRAP_INSTRUMENTATION_LEAVE
|
|
5970 |
#define TRAP_INSTRUMENTATION_LEAVE(aResult) DoMyLoging(aResult,__LINE__)
|
|
5971 |
@endcode
|
|
5972 |
|
|
5973 |
Will cause all subsequent uses of the TRAP macros to behave in an
|
|
5974 |
equivalent way to:
|
|
5975 |
|
|
5976 |
@code
|
|
5977 |
TRAP(r,SomeCodeL());
|
|
5978 |
if(r!=KErrNone) DoMyLoging(r,__LINE__);
|
|
5979 |
@endcode
|
|
5980 |
|
|
5981 |
|
|
5982 |
@param aResult A reference to the result value used in the TRAP macro.
|
|
5983 |
|
|
5984 |
|
|
5985 |
@publishedPartner
|
|
5986 |
@released
|
|
5987 |
|
|
5988 |
@see TRAP
|
|
5989 |
@see TRAPD
|
|
5990 |
*/
|
|
5991 |
#define TRAP_INSTRUMENTATION_LEAVE(aResult)
|
|
5992 |
|
|
5993 |
|
|
5994 |
|
|
5995 |
/**
|
|
5996 |
This macro is used by the TRAP and TRAPD macros and provides a means
|
|
5997 |
of inserting code into uses of these.
|
|
5998 |
|
|
5999 |
This macro is invoked after the 'trapped' code is called, regardless of whether
|
|
6000 |
or not it did Leave. It should be redefined to do whatever task is
|
|
6001 |
required. E.g. this code:
|
|
6002 |
|
|
6003 |
@code
|
|
6004 |
#undef TRAP_INSTRUMENTATION_END
|
|
6005 |
#define TRAP_INSTRUMENTATION_END DoMyLoging(__LINE__)
|
|
6006 |
@endcode
|
|
6007 |
|
|
6008 |
Will cause all subsequent uses of the TRAP macros to behave in an
|
|
6009 |
equivalent way to:
|
|
6010 |
|
|
6011 |
@code
|
|
6012 |
TRAP(r,SomeCodeL());
|
|
6013 |
DoMyLoging(__LINE__)
|
|
6014 |
@endcode
|
|
6015 |
|
|
6016 |
|
|
6017 |
@publishedPartner
|
|
6018 |
@released
|
|
6019 |
|
|
6020 |
@see TRAP
|
|
6021 |
@see TRAPD
|
|
6022 |
*/
|
|
6023 |
#define TRAP_INSTRUMENTATION_END
|
|
6024 |
|
|
6025 |
|
|
6026 |
|
|
6027 |
/**
|
|
6028 |
@publishedAll
|
|
6029 |
@released
|
|
6030 |
|
|
6031 |
Executes the set of C++ statements _s under a trap harness.
|
|
6032 |
|
|
6033 |
Use this macro as a C++ statement.
|
|
6034 |
|
|
6035 |
_r must be a TInt which has already been declared; if any of the
|
|
6036 |
C++ statements _s leaves, then the leave code is returned in _r,
|
|
6037 |
otherwise _r is set to KErrNone.
|
|
6038 |
|
|
6039 |
_s can consist of multiple C++ statements; in theory, _s can consist
|
|
6040 |
of any legal C++ code but in practice, such statements consist of simple
|
|
6041 |
function calls, e.g. Foo() or an assignment of some value to the result of
|
|
6042 |
a function call, e.g. functionValue=GetFoo().
|
|
6043 |
|
|
6044 |
A cleanup stack is constructed for the set of C++ statements _s.
|
|
6045 |
If any function in _s leaves, objects pushed to the cleanup stack are
|
|
6046 |
cleaned-up. In addition, if any of the C++ statements in _s leaves,
|
|
6047 |
then remaining C++ code in _s is not executed and any variables which
|
|
6048 |
are assigned within that remaining code are not defined.
|
|
6049 |
|
|
6050 |
@param _r An lvalue, convertible to TInt&, which will receive the result of
|
|
6051 |
any User::Leave() executed within _s or, if no leave occurred,
|
|
6052 |
it will be set to KErrNone. The value of _r on entry is not used.
|
|
6053 |
|
|
6054 |
@param _s C++ statements which will be executed under a trap harness.
|
|
6055 |
|
|
6056 |
@see TRAPD
|
|
6057 |
*/
|
|
6058 |
|
|
6059 |
/*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
|
|
6060 |
workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
|
|
6061 |
trap handler to be invoked when multiple nested TRAP's were present and
|
|
6062 |
User::Leave(..) was called. */
|
|
6063 |
|
|
6064 |
#define TRAP(_r, _s) \
|
|
6065 |
{ \
|
|
6066 |
TInt& __rref = _r; \
|
|
6067 |
__rref = 0; \
|
|
6068 |
{ TRAP_INSTRUMENTATION_START; } \
|
|
6069 |
try { \
|
|
6070 |
__WIN32SEHTRAP \
|
|
6071 |
TTrapHandler* ____t = User::MarkCleanupStack(); \
|
|
6072 |
_s; \
|
|
6073 |
User::UnMarkCleanupStack(____t); \
|
|
6074 |
{ TRAP_INSTRUMENTATION_NOLEAVE; } \
|
|
6075 |
__WIN32SEHUNTRAP \
|
|
6076 |
} \
|
|
6077 |
catch (XLeaveException& l) \
|
|
6078 |
{ \
|
|
6079 |
__rref = l.GetReason(); \
|
|
6080 |
{ TRAP_INSTRUMENTATION_LEAVE(__rref); } \
|
|
6081 |
} \
|
|
6082 |
catch (...) \
|
|
6083 |
{ \
|
|
6084 |
User::Invariant(); \
|
|
6085 |
} \
|
|
6086 |
__CALL_EMPTY_FUNCTION \
|
|
6087 |
{ TRAP_INSTRUMENTATION_END; } \
|
|
6088 |
}
|
|
6089 |
|
|
6090 |
|
|
6091 |
/**
|
|
6092 |
@publishedAll
|
|
6093 |
@released
|
|
6094 |
|
|
6095 |
Executes the set of C++ statements _s under a trap harness.
|
|
6096 |
|
|
6097 |
Use this macro in the same way as you would TRAP, except that the
|
|
6098 |
variable _r is defined as part of the macro (and is therefore valid for the
|
|
6099 |
rest of the block in which the macro occurs). Often, this saves a line of code.
|
|
6100 |
|
|
6101 |
@param _r A name, which will be declared as a TInt, and will receive the result
|
|
6102 |
of any User::Leave() executed within _s or, if no leave occurred, it
|
|
6103 |
will be set to KErrNone. After the macro, _r remains in scope until
|
|
6104 |
the end of its enclosing block.
|
|
6105 |
|
|
6106 |
@param _s C++ statements which will be executed under a trap harness.
|
|
6107 |
|
|
6108 |
@see TRAP
|
|
6109 |
*/
|
|
6110 |
|
|
6111 |
/*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
|
|
6112 |
workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
|
|
6113 |
trap handler to be invoked when multiple nested TRAP's were present and
|
|
6114 |
User::Leave(..) was called. */
|
|
6115 |
|
|
6116 |
|
|
6117 |
#define TRAPD(_r, _s) \
|
|
6118 |
TInt _r; \
|
|
6119 |
{ \
|
|
6120 |
_r = 0; \
|
|
6121 |
{ TRAP_INSTRUMENTATION_START; } \
|
|
6122 |
try { \
|
|
6123 |
__WIN32SEHTRAP \
|
|
6124 |
TTrapHandler* ____t = User::MarkCleanupStack(); \
|
|
6125 |
_s; \
|
|
6126 |
User::UnMarkCleanupStack(____t); \
|
|
6127 |
{ TRAP_INSTRUMENTATION_NOLEAVE; } \
|
|
6128 |
__WIN32SEHUNTRAP \
|
|
6129 |
} \
|
|
6130 |
catch (XLeaveException& l) \
|
|
6131 |
{ \
|
|
6132 |
_r = l.GetReason(); \
|
|
6133 |
{ TRAP_INSTRUMENTATION_LEAVE(_r); } \
|
|
6134 |
} \
|
|
6135 |
catch (...) \
|
|
6136 |
{ \
|
|
6137 |
User::Invariant(); \
|
|
6138 |
} \
|
|
6139 |
__CALL_EMPTY_FUNCTION \
|
|
6140 |
{ TRAP_INSTRUMENTATION_END; } \
|
|
6141 |
}
|
|
6142 |
|
|
6143 |
/**
|
|
6144 |
@publishedAll
|
|
6145 |
@released
|
|
6146 |
|
|
6147 |
Executes the set of C++ statements _s under a trap harness.
|
|
6148 |
Any leave code generated is ignored.
|
|
6149 |
|
|
6150 |
Use this macro as a C++ statement.
|
|
6151 |
|
|
6152 |
This macro is functionally equivalent to:
|
|
6153 |
@code
|
|
6154 |
TInt x;
|
|
6155 |
TRAP(x,_s)
|
|
6156 |
@endcode
|
|
6157 |
or
|
|
6158 |
@code
|
|
6159 |
TRAPD(x,_s)
|
|
6160 |
@endcode
|
|
6161 |
where the value in 'x' is not used by any subsequent code.
|
|
6162 |
|
|
6163 |
Use this macro as a C++ statement.
|
|
6164 |
|
|
6165 |
_s can consist of multiple C++ statements; in theory, _s can consist
|
|
6166 |
of any legal C++ code but in practice, such statements consist of simple
|
|
6167 |
function calls, e.g. Foo() or an assignment of some value to the result of
|
|
6168 |
a function call, e.g. functionValue=GetFoo().
|
|
6169 |
|
|
6170 |
A cleanup stack is constructed for the set of C++ statements _s.
|
|
6171 |
If any function in _s leaves, objects pushed to the cleanup stack are
|
|
6172 |
cleaned-up. In addition, if any of the C++ statements in _s leaves,
|
|
6173 |
then remaining C++ code in _s is not executed and any variables which
|
|
6174 |
are assigned within that remaining code are not defined.
|
|
6175 |
|
|
6176 |
@param _s C++ statements which will be executed under a trap harness.
|
|
6177 |
|
|
6178 |
@see TRAPD
|
|
6179 |
@see TRAP
|
|
6180 |
*/
|
|
6181 |
|
|
6182 |
/*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
|
|
6183 |
workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
|
|
6184 |
trap handler to be invoked when multiple nested TRAP's were present and
|
|
6185 |
User::Leave(..) was called. */
|
|
6186 |
|
|
6187 |
#define TRAP_IGNORE(_s) \
|
|
6188 |
{ \
|
|
6189 |
{ TRAP_INSTRUMENTATION_START; } \
|
|
6190 |
try { \
|
|
6191 |
__WIN32SEHTRAP \
|
|
6192 |
TTrapHandler* ____t = User::MarkCleanupStack(); \
|
|
6193 |
_s; \
|
|
6194 |
User::UnMarkCleanupStack(____t); \
|
|
6195 |
{ TRAP_INSTRUMENTATION_NOLEAVE; } \
|
|
6196 |
__WIN32SEHUNTRAP \
|
|
6197 |
} \
|
|
6198 |
catch (XLeaveException& l) \
|
|
6199 |
{ \
|
|
6200 |
l.GetReason(); \
|
|
6201 |
{ TRAP_INSTRUMENTATION_LEAVE(l.Reason()); } \
|
|
6202 |
} \
|
|
6203 |
catch (...) \
|
|
6204 |
{ \
|
|
6205 |
User::Invariant(); \
|
|
6206 |
} \
|
|
6207 |
__CALL_EMPTY_FUNCTION \
|
|
6208 |
{ TRAP_INSTRUMENTATION_END; } \
|
|
6209 |
}
|
|
6210 |
|
|
6211 |
|
|
6212 |
#endif //__LEAVE_EQUALS_THROW__
|
|
6213 |
|
|
6214 |
/* The macro __SYMBIAN_STDCPP_SUPPORT__ is defined when building a StdC++ target.
|
|
6215 |
* In this case, operator new and operator delete below should not be declared
|
|
6216 |
* to avoid clashing with StdC++ declarations.
|
|
6217 |
*/
|
|
6218 |
|
|
6219 |
#ifndef __SYMBIAN_STDCPP_SUPPORT__
|
|
6220 |
|
|
6221 |
#ifndef __OPERATOR_NEW_DECLARED__
|
|
6222 |
|
|
6223 |
/* Some operator new and operator delete overloads may be declared in compiler
|
|
6224 |
* pre-include files.
|
|
6225 |
*
|
|
6226 |
* __OPERATOR_NEW_DECLARED__ is #defined if they are, so that we can avoid
|
|
6227 |
* re-declaring them here.
|
|
6228 |
*/
|
|
6229 |
|
|
6230 |
#define __OPERATOR_NEW_DECLARED__
|
|
6231 |
|
|
6232 |
/**
|
|
6233 |
@publishedAll
|
|
6234 |
@released
|
|
6235 |
*/
|
|
6236 |
GLREF_C TAny* operator new(TUint aSize) __NO_THROW;
|
|
6237 |
|
|
6238 |
/**
|
|
6239 |
@publishedAll
|
|
6240 |
@released
|
|
6241 |
*/
|
|
6242 |
GLREF_C TAny* operator new(TUint aSize,TUint anExtraSize) __NO_THROW;
|
|
6243 |
|
|
6244 |
/**
|
|
6245 |
@publishedAll
|
|
6246 |
@released
|
|
6247 |
*/
|
|
6248 |
GLREF_C void operator delete(TAny* aPtr) __NO_THROW;
|
|
6249 |
|
|
6250 |
#ifndef __OMIT_VEC_OPERATOR_NEW_DECL__
|
|
6251 |
/**
|
|
6252 |
@publishedAll
|
|
6253 |
@released
|
|
6254 |
*/
|
|
6255 |
GLREF_C TAny* operator new[](TUint aSize) __NO_THROW;
|
|
6256 |
|
|
6257 |
/**
|
|
6258 |
@publishedAll
|
|
6259 |
@released
|
|
6260 |
*/
|
|
6261 |
GLREF_C void operator delete[](TAny* aPtr) __NO_THROW;
|
|
6262 |
#endif // !__OMIT_VEC_OPERATOR_NEW_DECL__
|
|
6263 |
|
|
6264 |
#endif // !__OPERATOR_NEW_DECLARED__
|
|
6265 |
|
|
6266 |
#endif // !__SYMBIAN_STDCPP_SUPPORT__
|
|
6267 |
|
|
6268 |
/**
|
|
6269 |
@publishedAll
|
|
6270 |
@released
|
|
6271 |
*/
|
|
6272 |
inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
|
|
6273 |
|
|
6274 |
/**
|
|
6275 |
@publishedAll
|
|
6276 |
@released
|
|
6277 |
*/
|
|
6278 |
inline void operator delete(TAny* aPtr, TAny* aBase) __NO_THROW;
|
|
6279 |
|
|
6280 |
#ifndef __PLACEMENT_VEC_NEW_INLINE
|
|
6281 |
/**
|
|
6282 |
@publishedAll
|
|
6283 |
@released
|
|
6284 |
*/
|
|
6285 |
inline TAny* operator new[](TUint aSize, TAny* aBase) __NO_THROW;
|
|
6286 |
|
|
6287 |
/**
|
|
6288 |
@publishedAll
|
|
6289 |
@released
|
|
6290 |
*/
|
|
6291 |
inline void operator delete[](TAny* aPtr, TAny* aBase) __NO_THROW;
|
|
6292 |
|
|
6293 |
#endif // !__PLACEMENT_VEC_NEW_INLINE
|
|
6294 |
|
|
6295 |
#if !defined(__BOOL_NO_TRUE_TRAP__)
|
|
6296 |
|
|
6297 |
/**
|
|
6298 |
@publishedAll
|
|
6299 |
@released
|
|
6300 |
*/
|
|
6301 |
TBool operator==(TTrue,volatile const TBool);
|
|
6302 |
|
|
6303 |
/**
|
|
6304 |
@publishedAll
|
|
6305 |
@released
|
|
6306 |
*/
|
|
6307 |
TBool operator==(volatile const TBool,TTrue);
|
|
6308 |
|
|
6309 |
/**
|
|
6310 |
@publishedAll
|
|
6311 |
@released
|
|
6312 |
*/
|
|
6313 |
TBool operator!=(TTrue,volatile const TBool);
|
|
6314 |
|
|
6315 |
/**
|
|
6316 |
@publishedAll
|
|
6317 |
@released
|
|
6318 |
*/
|
|
6319 |
TBool operator!=(volatile const TBool,TTrue);
|
|
6320 |
#endif
|
|
6321 |
|
|
6322 |
|
|
6323 |
|
|
6324 |
|
|
6325 |
/**
|
|
6326 |
@publishedAll
|
|
6327 |
@released
|
|
6328 |
|
|
6329 |
A Version 2 client/server class that clients use to package
|
|
6330 |
the arguments to be sent to a server.
|
|
6331 |
|
|
6332 |
The object can package up to 4 arguments together with information about each
|
|
6333 |
argument's type, width and accessibility; it is also possible for
|
|
6334 |
the package to contain zero arguments. In addition to the default constructor,
|
|
6335 |
the class has four templated constructors, allowing an object of this type to
|
|
6336 |
be constructed for 0, 1, 2, 3 or 4 arguments.
|
|
6337 |
|
|
6338 |
Internally, the arguments are stored in a simple TInt array.
|
|
6339 |
Consecutive arguments in a constructor's parameter list are put into
|
|
6340 |
consecutive slots in the array. The Set() overloaded functions can be used
|
|
6341 |
to set argument values into specific slots within this array.
|
|
6342 |
*/
|
|
6343 |
class TIpcArgs
|
|
6344 |
{
|
|
6345 |
public:
|
|
6346 |
/**
|
|
6347 |
@internalComponent
|
|
6348 |
|
|
6349 |
Argument types; some of these may be ORed together to specify
|
|
6350 |
type, accessibility, and width.
|
|
6351 |
*/
|
|
6352 |
enum TArgType
|
|
6353 |
{
|
|
6354 |
EUnspecified = 0, /**< Type not specified.*/
|
|
6355 |
EHandle = 1, /**< Handle type.*/
|
|
6356 |
EFlagDes = 4, /**< Descriptor type.*/
|
|
6357 |
EFlagConst = 2, /**< Read only type.*/
|
|
6358 |
EFlag16Bit = 1, /**< 16 bit rather than 8 bit.*/
|
|
6359 |
EDes8 = EFlagDes, /**< 8 bit read/write descriptor.*/
|
|
6360 |
EDes16 = EFlagDes|EFlag16Bit, /**< 16 bit read/write descriptor.*/
|
|
6361 |
EDesC8 = EFlagDes|EFlagConst, /**< 8 bit read only descriptor.*/
|
|
6362 |
EDesC16 = EFlagDes|EFlagConst|EFlag16Bit, /**< 16 bit read only descriptor.*/
|
|
6363 |
};
|
|
6364 |
|
|
6365 |
|
|
6366 |
/**
|
|
6367 |
@internalComponent
|
|
6368 |
*/
|
|
6369 |
enum
|
|
6370 |
{
|
|
6371 |
KBitsPerType = 3, /**< Number of bits of type information used for each of the 4 arguments.*/
|
|
6372 |
KPinArgShift = KBitsPerType*KMaxMessageArguments, /**< Bit number of the start of the pin flags. */
|
|
6373 |
KPinArg0 = 1<<(KPinArgShift+0), /**< Set to pin argument at index 0.*/
|
|
6374 |
KPinArg1 = 1<<(KPinArgShift+1), /**< Set to pin argument at index 1.*/
|
|
6375 |
KPinArg2 = 1<<(KPinArgShift+2), /**< Set to pin argument at index 2.*/
|
|
6376 |
KPinArg3 = 1<<(KPinArgShift+3), /**< Set to pin argument at index 3.*/
|
|
6377 |
KPinMask = 0xf<<KPinArgShift, /**< The bits used for the pinning attributes of each argument.*/
|
|
6378 |
};
|
|
6379 |
|
|
6380 |
|
|
6381 |
/**
|
|
6382 |
Indicates a Null argument.
|
|
6383 |
*/
|
|
6384 |
enum TNothing {
|
|
6385 |
/**
|
|
6386 |
An enum value that can be used to indicate an empty or
|
|
6387 |
unused argument to a server. For example:
|
|
6388 |
|
|
6389 |
@code
|
|
6390 |
TIpcArgs args(arg1, TIpcArgs::ENothing, arg2);
|
|
6391 |
@endcode
|
|
6392 |
|
|
6393 |
This argument will have an undefined value when the server
|
|
6394 |
receives the message.
|
|
6395 |
*/
|
|
6396 |
ENothing
|
|
6397 |
};
|
|
6398 |
public:
|
|
6399 |
/**
|
|
6400 |
Default constructor.
|
|
6401 |
|
|
6402 |
An argument package constructed using this constructor has no arguments;
|
|
6403 |
however, arguments can subsequently be set into this argument package object
|
|
6404 |
using the Set() member functions.
|
|
6405 |
*/
|
|
6406 |
inline TIpcArgs()
|
|
6407 |
:iFlags(0)
|
|
6408 |
{}
|
|
6409 |
|
|
6410 |
|
|
6411 |
/**
|
|
6412 |
A templated constructor that constructs the argument package; it takes
|
|
6413 |
1 argument.
|
|
6414 |
|
|
6415 |
@param a0 An argument of general class type T0 to be contained by
|
|
6416 |
this object.
|
|
6417 |
*/
|
|
6418 |
template <class T0>
|
|
6419 |
inline explicit TIpcArgs(T0 a0)
|
|
6420 |
{
|
|
6421 |
Assign(iArgs[0],a0);
|
|
6422 |
iFlags=(Type(a0)<<(0*KBitsPerType));
|
|
6423 |
}
|
|
6424 |
|
|
6425 |
|
|
6426 |
/**
|
|
6427 |
A templated constructor that constructs the argument package; it takes
|
|
6428 |
2 arguments.
|
|
6429 |
|
|
6430 |
@param a0 An argument of general class type T0 to be contained by
|
|
6431 |
this object.
|
|
6432 |
@param a1 An argument of general class type T1 to be contained by
|
|
6433 |
this object.
|
|
6434 |
*/
|
|
6435 |
template <class T0,class T1>
|
|
6436 |
inline TIpcArgs(T0 a0,T1 a1)
|
|
6437 |
{
|
|
6438 |
Assign(iArgs[0],a0);
|
|
6439 |
Assign(iArgs[1],a1);
|
|
6440 |
iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType));
|
|
6441 |
}
|
|
6442 |
|
|
6443 |
|
|
6444 |
/**
|
|
6445 |
A templated constructor that constructs the argument package; it takes
|
|
6446 |
3 arguments.
|
|
6447 |
|
|
6448 |
@param a0 An argument of general class type T0 to be contained by
|
|
6449 |
this object.
|
|
6450 |
@param a1 An argument of general class type T1 to be contained by
|
|
6451 |
this object.
|
|
6452 |
@param a2 An argument of general class type T2 to be contained by
|
|
6453 |
this object.
|
|
6454 |
*/
|
|
6455 |
template <class T0,class T1,class T2>
|
|
6456 |
inline TIpcArgs(T0 a0,T1 a1,T2 a2)
|
|
6457 |
{
|
|
6458 |
Assign(iArgs[0],a0);
|
|
6459 |
Assign(iArgs[1],a1);
|
|
6460 |
Assign(iArgs[2],a2);
|
|
6461 |
iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType));
|
|
6462 |
}
|
|
6463 |
|
|
6464 |
|
|
6465 |
/**
|
|
6466 |
A templated constructor that constructs the argument package; it takes
|
|
6467 |
4 arguments.
|
|
6468 |
|
|
6469 |
@param a0 An argument of general class type T0 to be contained by
|
|
6470 |
this object.
|
|
6471 |
@param a1 An argument of general class type T1 to be contained by
|
|
6472 |
this object.
|
|
6473 |
@param a2 An argument of general class type T2 to be contained by
|
|
6474 |
this object.
|
|
6475 |
@param a3 An argument of general class type T3 to be contained by
|
|
6476 |
this object.
|
|
6477 |
*/
|
|
6478 |
template <class T0,class T1,class T2,class T3>
|
|
6479 |
inline TIpcArgs(T0 a0,T1 a1,T2 a2,T3 a3)
|
|
6480 |
{
|
|
6481 |
Assign(iArgs[0],a0);
|
|
6482 |
Assign(iArgs[1],a1);
|
|
6483 |
Assign(iArgs[2],a2);
|
|
6484 |
Assign(iArgs[3],a3);
|
|
6485 |
iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType))|(Type(a3)<<(3*KBitsPerType));
|
|
6486 |
}
|
|
6487 |
//
|
|
6488 |
inline void Set(TInt aIndex,TNothing);
|
|
6489 |
inline void Set(TInt aIndex,TInt aValue);
|
|
6490 |
inline void Set(TInt aIndex,const TAny* aValue);
|
|
6491 |
inline void Set(TInt aIndex,RHandleBase aValue);
|
|
6492 |
inline void Set(TInt aIndex,const TDesC8* aValue);
|
|
6493 |
#ifndef __KERNEL_MODE__
|
|
6494 |
inline void Set(TInt aIndex,const TDesC16* aValue);
|
|
6495 |
#endif
|
|
6496 |
inline void Set(TInt aIndex,TDes8* aValue);
|
|
6497 |
#ifndef __KERNEL_MODE__
|
|
6498 |
inline void Set(TInt aIndex,TDes16* aValue);
|
|
6499 |
#endif
|
|
6500 |
|
|
6501 |
inline TIpcArgs& PinArgs(TBool aPinArg0=ETrue, TBool aPinArg1=ETrue, TBool aPinArg2=ETrue, TBool aPinArg3=ETrue);
|
|
6502 |
private:
|
|
6503 |
inline static TArgType Type(TNothing);
|
|
6504 |
inline static TArgType Type(TInt);
|
|
6505 |
inline static TArgType Type(const TAny*);
|
|
6506 |
inline static TArgType Type(RHandleBase aValue);
|
|
6507 |
inline static TArgType Type(const TDesC8*);
|
|
6508 |
#ifndef __KERNEL_MODE__
|
|
6509 |
inline static TArgType Type(const TDesC16*);
|
|
6510 |
#endif
|
|
6511 |
inline static TArgType Type(TDes8*);
|
|
6512 |
#ifndef __KERNEL_MODE__
|
|
6513 |
inline static TArgType Type(TDes16*);
|
|
6514 |
#endif
|
|
6515 |
//
|
|
6516 |
inline static void Assign(TInt&,TNothing);
|
|
6517 |
inline static void Assign(TInt& aArg,TInt aValue);
|
|
6518 |
inline static void Assign(TInt& aArg,const TAny* aValue);
|
|
6519 |
inline static void Assign(TInt& aArg,RHandleBase aValue);
|
|
6520 |
inline static void Assign(TInt& aArg,const TDesC8* aValue);
|
|
6521 |
#ifndef __KERNEL_MODE__
|
|
6522 |
inline static void Assign(TInt& aArg,const TDesC16* aValue);
|
|
6523 |
#endif
|
|
6524 |
inline static void Assign(TInt& aArg,TDes8* aValue);
|
|
6525 |
#ifndef __KERNEL_MODE__
|
|
6526 |
inline static void Assign(TInt& aArg,TDes16* aValue);
|
|
6527 |
#endif
|
|
6528 |
public:
|
|
6529 |
|
|
6530 |
/**
|
|
6531 |
The location where the message arguments are stored.
|
|
6532 |
|
|
6533 |
There is no reason to access this data member directly and it should be
|
|
6534 |
considered as internal.
|
|
6535 |
*/
|
|
6536 |
TInt iArgs[KMaxMessageArguments];
|
|
6537 |
|
|
6538 |
/**
|
|
6539 |
The location where the flag bits describing the argument types are stored.
|
|
6540 |
|
|
6541 |
The symbolic values describing the argument types are internal to Symbian,
|
|
6542 |
and there is therefore no reason to access this data member directly.
|
|
6543 |
It should be considered as internal.
|
|
6544 |
*/
|
|
6545 |
TInt iFlags;
|
|
6546 |
};
|
|
6547 |
|
|
6548 |
// Structures for passing 64 bit integers and doubles across GCC/EABI boundaries
|
|
6549 |
|
|
6550 |
/**
|
|
6551 |
@internalComponent
|
|
6552 |
*/
|
|
6553 |
struct SInt64
|
|
6554 |
{
|
|
6555 |
public:
|
|
6556 |
inline SInt64();
|
|
6557 |
inline SInt64(Int64 a);
|
|
6558 |
inline SInt64& operator=(Int64 a);
|
|
6559 |
inline operator Int64() const;
|
|
6560 |
public:
|
|
6561 |
TUint32 iData[2]; // little endian
|
|
6562 |
};
|
|
6563 |
|
|
6564 |
/**
|
|
6565 |
@internalComponent
|
|
6566 |
*/
|
|
6567 |
struct SUint64
|
|
6568 |
{
|
|
6569 |
public:
|
|
6570 |
inline SUint64();
|
|
6571 |
inline SUint64(Uint64 a);
|
|
6572 |
inline SUint64& operator=(Uint64 a);
|
|
6573 |
inline operator Uint64() const;
|
|
6574 |
public:
|
|
6575 |
TUint32 iData[2]; // little endian
|
|
6576 |
};
|
|
6577 |
|
|
6578 |
/**
|
|
6579 |
@internalComponent
|
|
6580 |
*/
|
|
6581 |
struct SDouble
|
|
6582 |
{
|
|
6583 |
public:
|
|
6584 |
inline SDouble();
|
|
6585 |
inline SDouble(TReal a);
|
|
6586 |
inline SDouble& operator=(TReal a);
|
|
6587 |
inline operator TReal() const;
|
|
6588 |
public:
|
|
6589 |
TUint32 iData[2]; // always little endian
|
|
6590 |
};
|
|
6591 |
|
|
6592 |
/**
|
|
6593 |
@publishedAll
|
|
6594 |
@released
|
|
6595 |
|
|
6596 |
Stores information about a thread's stack.
|
|
6597 |
|
|
6598 |
Note, on the emulator, the memory between iLimit and the thread's current stack pointer
|
|
6599 |
may not actually be committed.
|
|
6600 |
|
|
6601 |
@see RThread::StackInfo()
|
|
6602 |
*/
|
|
6603 |
class TThreadStackInfo
|
|
6604 |
{
|
|
6605 |
public:
|
|
6606 |
/**
|
|
6607 |
The address which the stack pointer would contain if the stack were empty.
|
|
6608 |
*/
|
|
6609 |
TLinAddr iBase;
|
|
6610 |
|
|
6611 |
/**
|
|
6612 |
The address which the stack pointer would contain if the stack were full,
|
|
6613 |
(The lowest valid address).
|
|
6614 |
*/
|
|
6615 |
TLinAddr iLimit;
|
|
6616 |
|
|
6617 |
/**
|
|
6618 |
The limit value for the stack if it were expanded to its maximum size.
|
|
6619 |
|
|
6620 |
Currently expanding stacks is not supported so iExpandLimit==iLimit
|
|
6621 |
*/
|
|
6622 |
TLinAddr iExpandLimit;
|
|
6623 |
};
|
|
6624 |
|
|
6625 |
|
|
6626 |
|
|
6627 |
|
|
6628 |
#ifdef __SUPPORT_CPP_EXCEPTIONS__
|
|
6629 |
/**
|
|
6630 |
@internalComponent
|
|
6631 |
@released
|
|
6632 |
|
|
6633 |
The class used to implement User::Leave in term of throw and TRAP in terms of catch.
|
|
6634 |
|
|
6635 |
*/
|
|
6636 |
class XLeaveException
|
|
6637 |
{
|
|
6638 |
public:
|
|
6639 |
inline XLeaveException() {}
|
|
6640 |
inline XLeaveException(TInt aReason) {iR = aReason;}
|
|
6641 |
inline TInt Reason() const {return iR;}
|
|
6642 |
IMPORT_C TInt GetReason() const;
|
|
6643 |
private:
|
|
6644 |
#if __ARMCC_VERSION >= 220000
|
|
6645 |
// From rvct 2.2 onwards we want the class impedimenta to be shared, so create a key function.
|
|
6646 |
// Unfortunately we can't make this the key function the dtor since this would make it impossible for existing 2.1
|
|
6647 |
// derived binaries to be 'BC' with 2.2 binaries (in the general case (which I wont attempt to describe coz its
|
|
6648 |
// too complex) so its best to be safe). As a clue: if 2.1 is used to compile with a key function its not possible
|
|
6649 |
// for catch handlers to work :-( (see the old code).
|
|
6650 |
virtual void ForceKeyFunction();
|
|
6651 |
#endif
|
|
6652 |
private:
|
|
6653 |
#if __ARMCC_VERSION < 220000
|
|
6654 |
TAny* iVtable; // reserve space for vtable
|
|
6655 |
#endif
|
|
6656 |
TInt iR;
|
|
6657 |
};
|
|
6658 |
|
|
6659 |
// The standard header file <exception> defines the following guard macro for EDG and CW, VC++, GCC respectively.
|
|
6660 |
// The guard below is ugly. It will surely come back and bite us unless we resolve the whole issue of standard headers
|
|
6661 |
// when we move to supporting Standard C++.
|
|
6662 |
|
|
6663 |
// The macro __SYMBIAN_STDCPP_SUPPORT__ is defined when building a StdC++ target.
|
|
6664 |
// In this case, we include the StdC++ specification <exception> rather than declaring uncaught_exception.
|
|
6665 |
|
|
6666 |
#ifdef __SYMBIAN_STDCPP_SUPPORT__
|
|
6667 |
#include <stdapis/stlportv5/exception>
|
|
6668 |
#elif !defined(_EXCEPTION) && !defined(_EXCEPTION_) && !defined(__EXCEPTION__)
|
|
6669 |
// Declare standard C++ functions relating to exceptions here
|
|
6670 |
namespace std {
|
|
6671 |
#if defined(__VC32__) || defined(__CW32__)
|
|
6672 |
bool uncaught_exception();
|
|
6673 |
#else
|
|
6674 |
IMPORT_C bool uncaught_exception();
|
|
6675 |
#endif
|
|
6676 |
void terminate(void);
|
|
6677 |
void unexpected(void);
|
|
6678 |
typedef void (*terminate_handler)();
|
|
6679 |
terminate_handler set_terminate(terminate_handler h) throw();
|
|
6680 |
typedef void (*unexpected_handler)();
|
|
6681 |
unexpected_handler set_unexpected(unexpected_handler h) throw();
|
|
6682 |
}
|
|
6683 |
|
|
6684 |
#endif
|
|
6685 |
#endif //__SUPPORT_CPP_EXCEPTIONS__
|
|
6686 |
|
|
6687 |
#ifdef __WINS__
|
|
6688 |
|
|
6689 |
#ifndef __WIN32_SEH_TYPES_KNOWN__
|
|
6690 |
class __UnknownWindowsType1;
|
|
6691 |
class __UnknownWindowsType2;
|
|
6692 |
#endif
|
|
6693 |
|
|
6694 |
class TWin32SEHTrap;
|
|
6695 |
|
|
6696 |
/**
|
|
6697 |
* Typedef for the SEH handler function
|
|
6698 |
* @internalComponent
|
|
6699 |
*/
|
|
6700 |
typedef TUint32 (TWin32SEHExceptionHandler)(__UnknownWindowsType1* aExceptionRecord, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
|
|
6701 |
|
|
6702 |
/**
|
|
6703 |
* @internalComponent
|
|
6704 |
*/
|
|
6705 |
class TWin32SEHTrap
|
|
6706 |
{
|
|
6707 |
private:
|
|
6708 |
// Prevent copy/assign
|
|
6709 |
TWin32SEHTrap(TWin32SEHTrap const &);
|
|
6710 |
TWin32SEHTrap& operator=(TWin32SEHTrap const &);
|
|
6711 |
|
|
6712 |
#ifdef __KERNEL_MODE__
|
|
6713 |
//
|
|
6714 |
// Kernel-side functions for nkern exception handler
|
|
6715 |
//
|
|
6716 |
public:
|
|
6717 |
/** Find final exception handler in SEH chain */
|
|
6718 |
static TWin32SEHTrap* IterateForFinal();
|
|
6719 |
|
|
6720 |
/** Access exception handler */
|
|
6721 |
TWin32SEHExceptionHandler* ExceptionHandler();
|
|
6722 |
|
|
6723 |
private:
|
|
6724 |
|
|
6725 |
#else // !__KERNEL_MODE__
|
|
6726 |
//
|
|
6727 |
// User-side functions for use in TRAP(...)
|
|
6728 |
//
|
|
6729 |
public:
|
|
6730 |
UIMPORT_C TWin32SEHTrap();
|
|
6731 |
|
|
6732 |
public:
|
|
6733 |
/** Add object to SEH chain */
|
|
6734 |
UIMPORT_C void Trap();
|
|
6735 |
|
|
6736 |
/** Remove object from SEH chain */
|
|
6737 |
UIMPORT_C void UnTrap();
|
|
6738 |
|
|
6739 |
#ifndef __IN_SEH_CPP__
|
|
6740 |
private:
|
|
6741 |
#endif
|
|
6742 |
/** Handle Win32 exceptions */
|
|
6743 |
static TUint32 ExceptionHandler(__UnknownWindowsType1* aException, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
|
|
6744 |
|
|
6745 |
#endif //__KERNEL_MODE__
|
|
6746 |
|
|
6747 |
//
|
|
6748 |
// NB: This is really an _EXCEPTION_REGISTRATION_RECORD
|
|
6749 |
//
|
|
6750 |
TWin32SEHTrap* iPrevExceptionRegistrationRecord; /** Link to previous SEH record */
|
|
6751 |
TWin32SEHExceptionHandler* iExceptionHandler; /** SEH handler function */
|
|
6752 |
|
|
6753 |
private:
|
|
6754 |
TUint32 iPadding[254]; // discourage the compiler from putting this in reused function parameter space
|
|
6755 |
};
|
|
6756 |
|
|
6757 |
#else // !__WINS__
|
|
6758 |
|
|
6759 |
#ifdef __X86__
|
|
6760 |
/**
|
|
6761 |
* @internalComponent
|
|
6762 |
*/
|
|
6763 |
class TWin32SEHTrap
|
|
6764 |
{
|
|
6765 |
public:
|
|
6766 |
UIMPORT_C TWin32SEHTrap();
|
|
6767 |
UIMPORT_C void Trap();
|
|
6768 |
UIMPORT_C void UnTrap();
|
|
6769 |
};
|
|
6770 |
#endif //__X86__
|
|
6771 |
#endif //__WINS__
|
|
6772 |
|
|
6773 |
/**
|
|
6774 |
@internalTechnology
|
|
6775 |
*/
|
|
6776 |
struct TEmulatorImageHeader
|
|
6777 |
{
|
|
6778 |
TUid iUids[KMaxCheckedUid];
|
|
6779 |
TProcessPriority iPriority;
|
|
6780 |
SSecurityInfo iS;
|
|
6781 |
TUint32 iSpare1;
|
|
6782 |
TUint32 iSpare2;
|
|
6783 |
TUint32 iModuleVersion;
|
|
6784 |
TUint32 iFlags;
|
|
6785 |
};
|
|
6786 |
|
|
6787 |
// forward declaration of shareable data buffers pool infomation
|
|
6788 |
class TShPoolInfo;
|
|
6789 |
|
|
6790 |
#include <e32cmn.inl>
|
|
6791 |
|
|
6792 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
6793 |
#include <e32cmn_private.h>
|
|
6794 |
#endif
|
|
6795 |
|
|
6796 |
#endif //__E32CMN_H__
|