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