|
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 "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\include\e32std.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __E32STD_H__ |
|
19 #define __E32STD_H__ |
|
20 |
|
21 #ifdef __KERNEL_MODE__ |
|
22 #error !! Including e32std.h in kernel code !! |
|
23 #endif |
|
24 |
|
25 #include <e32cmn.h> |
|
26 |
|
27 /** |
|
28 @publishedAll |
|
29 @released |
|
30 */ |
|
31 class TFunctor |
|
32 { |
|
33 public: |
|
34 IMPORT_C virtual void operator()() =0; |
|
35 }; |
|
36 |
|
37 /** |
|
38 @publishedAll |
|
39 @released |
|
40 |
|
41 Encapsulates a general call-back function. |
|
42 |
|
43 The class encapsulates: |
|
44 |
|
45 1. a pointer to a function which takes an argument of type TAny* and returns |
|
46 a TInt. |
|
47 |
|
48 2. a pointer which is passed to the function every time it is called. |
|
49 The pointer can point to any object. It can also be NULL. |
|
50 |
|
51 The callback function can be a static function of a class, |
|
52 e.g. TInt X::Foo(TAny *) or it can be a function which is not a member of |
|
53 any class, e.g. TInt Foo(TAny *). |
|
54 |
|
55 When used with the CIdle and the CPeriodic classes, the callback function |
|
56 is intended to be called repeatedly; the encapsulated pointer is passed on |
|
57 each call. Typically, the pointer refers to an object which records the state |
|
58 of the task across each call. When used with CIdle, the callback function |
|
59 should also return a true (non-zero) value if it is intended to be called |
|
60 again, otherwise it should return a false (zero) value. |
|
61 |
|
62 @see CIdle |
|
63 @see CPeriodic |
|
64 */ |
|
65 class TCallBack |
|
66 { |
|
67 public: |
|
68 inline TCallBack(); |
|
69 inline TCallBack(TInt (*aFunction)(TAny* aPtr)); |
|
70 inline TCallBack(TInt (*aFunction)(TAny* aPtr),TAny* aPtr); |
|
71 inline TInt CallBack() const; |
|
72 public: |
|
73 |
|
74 /** |
|
75 A pointer to the callback function. |
|
76 */ |
|
77 TInt (*iFunction)(TAny* aPtr); |
|
78 |
|
79 |
|
80 /** |
|
81 A pointer that is passed to the callback function when |
|
82 the function is called. |
|
83 */ |
|
84 TAny* iPtr; |
|
85 }; |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 /** |
|
91 @publishedAll |
|
92 @released |
|
93 |
|
94 An object embedded within a class T so that objects of type T can form part |
|
95 of a singly linked list. |
|
96 |
|
97 A link object encapsulates a pointer to the next link object in the list. |
|
98 |
|
99 @see TSglQue |
|
100 */ |
|
101 class TSglQueLink |
|
102 { |
|
103 #if defined _DEBUG |
|
104 public: |
|
105 inline TSglQueLink() : iNext(NULL) |
|
106 /** |
|
107 An explicitly coded default constructor that is only defined for DEBUG builds. |
|
108 |
|
109 It sets the pointer to the next link object to NULL. |
|
110 |
|
111 @see iNext |
|
112 */ |
|
113 {} |
|
114 #endif |
|
115 private: |
|
116 IMPORT_C void Enque(TSglQueLink* aLink); |
|
117 public: |
|
118 /** |
|
119 A pointer to the next link object in the list. |
|
120 */ |
|
121 TSglQueLink* iNext; |
|
122 friend class TSglQueBase; |
|
123 }; |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 /** |
|
129 @publishedAll |
|
130 @released |
|
131 |
|
132 A base class that provides implementation for the link object of a doubly |
|
133 linked list. |
|
134 |
|
135 It also encapsulates pointers both to the next and the previous link |
|
136 objects in the doubly linked list. |
|
137 |
|
138 The class is abstract and is not intended to be instantiated. |
|
139 |
|
140 @see TDblQueLink |
|
141 */ |
|
142 class TDblQueLinkBase |
|
143 { |
|
144 public: |
|
145 inline TDblQueLinkBase() : iNext(NULL) |
|
146 /** |
|
147 Default constructor. |
|
148 |
|
149 It sets the pointer to the next link object to NULL. |
|
150 |
|
151 @see iNext |
|
152 */ |
|
153 {} |
|
154 IMPORT_C void Enque(TDblQueLinkBase* aLink); |
|
155 IMPORT_C void AddBefore(TDblQueLinkBase* aLink); |
|
156 public: |
|
157 /** |
|
158 A pointer to the next link object in the list. |
|
159 */ |
|
160 TDblQueLinkBase* iNext; |
|
161 |
|
162 /** |
|
163 A pointer to the previous link object in the list. |
|
164 */ |
|
165 TDblQueLinkBase* iPrev; |
|
166 }; |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 /** |
|
172 @publishedAll |
|
173 @released |
|
174 |
|
175 An object embedded within a class T so that objects of type T can form part |
|
176 of a doubly linked list. |
|
177 */ |
|
178 class TDblQueLink : public TDblQueLinkBase |
|
179 { |
|
180 public: |
|
181 IMPORT_C void Deque(); |
|
182 }; |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 /** |
|
188 @publishedAll |
|
189 @released |
|
190 |
|
191 An object embedded within a class T so that objects of type T can form part |
|
192 of an ordered doubly linked list. |
|
193 |
|
194 Objects are added to the doubly linked list in descending priority order. |
|
195 */ |
|
196 class TPriQueLink : public TDblQueLink |
|
197 { |
|
198 public: |
|
199 /** |
|
200 The priority value. |
|
201 |
|
202 Objects are added to the doubly linked list in descending order of this value. |
|
203 */ |
|
204 TInt iPriority; |
|
205 }; |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 /** |
|
211 @publishedAll |
|
212 @released |
|
213 |
|
214 An object embedded within a class T so that objects of type T can form part |
|
215 of a delta doubly linked list. |
|
216 */ |
|
217 class TDeltaQueLink : public TDblQueLinkBase |
|
218 { |
|
219 public: |
|
220 /** |
|
221 The delta value. |
|
222 */ |
|
223 TInt iDelta; |
|
224 }; |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 /** |
|
230 @publishedAll |
|
231 @released |
|
232 |
|
233 An object embedded within a class T so that objects of type T can form part |
|
234 of a doubly linked list sorted by tick count. |
|
235 */ |
|
236 class TTickCountQueLink : public TDblQueLink |
|
237 { |
|
238 public: |
|
239 /** |
|
240 The tick count. |
|
241 */ |
|
242 TUint iTickCount; |
|
243 }; |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 /** |
|
249 @publishedAll |
|
250 @released |
|
251 |
|
252 A base class that provides implementation for the singly linked list header. |
|
253 |
|
254 It also encapsulates the offset value of a link object. |
|
255 |
|
256 The class is abstract and is not intended to be instantiated. |
|
257 |
|
258 @see TSglQue |
|
259 */ |
|
260 class TSglQueBase |
|
261 { |
|
262 public: |
|
263 IMPORT_C TBool IsEmpty() const; |
|
264 IMPORT_C void SetOffset(TInt aOffset); |
|
265 IMPORT_C void Reset(); |
|
266 protected: |
|
267 IMPORT_C TSglQueBase(); |
|
268 IMPORT_C TSglQueBase(TInt aOffset); |
|
269 IMPORT_C void DoAddFirst(TAny* aPtr); |
|
270 IMPORT_C void DoAddLast(TAny* aPtr); |
|
271 IMPORT_C void DoRemove(TAny* aPtr); |
|
272 protected: |
|
273 /** |
|
274 A pointer to the first element in the list. |
|
275 */ |
|
276 TSglQueLink* iHead; |
|
277 |
|
278 /** |
|
279 A pointer to the last element in the list. |
|
280 */ |
|
281 TSglQueLink* iLast; |
|
282 |
|
283 /** |
|
284 The offset of a component link object within elements that form the list. |
|
285 */ |
|
286 TInt iOffset; |
|
287 private: |
|
288 TSglQueBase(const TSglQueBase& aQue); |
|
289 TSglQueBase &operator=(const TSglQueBase& aQue); |
|
290 friend class TSglQueIterBase; |
|
291 }; |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 /** |
|
297 @publishedAll |
|
298 @released |
|
299 |
|
300 A base class that provides implementation for the doubly linked list header. |
|
301 |
|
302 It also encapsulates the offset value of a link object. |
|
303 |
|
304 The class is abstract and is not intended to be instantiated. |
|
305 |
|
306 @see TDblQue |
|
307 */ |
|
308 class TDblQueBase |
|
309 { |
|
310 public: |
|
311 IMPORT_C TBool IsEmpty() const; |
|
312 IMPORT_C void SetOffset(TInt aOffset); |
|
313 IMPORT_C void Reset(); |
|
314 protected: |
|
315 IMPORT_C TDblQueBase(); |
|
316 IMPORT_C TDblQueBase(TInt aOffset); |
|
317 IMPORT_C void DoAddFirst(TAny* aPtr); |
|
318 IMPORT_C void DoAddLast(TAny* aPtr); |
|
319 IMPORT_C void DoAddPriority(TAny* aPtr); |
|
320 IMPORT_C void __DbgTestEmpty() const; |
|
321 protected: |
|
322 /** |
|
323 The head, or anchor point of the queue. |
|
324 */ |
|
325 TDblQueLink iHead; |
|
326 |
|
327 /** |
|
328 The offset of a component link object within elements that form the list. |
|
329 */ |
|
330 TInt iOffset; |
|
331 private: |
|
332 TDblQueBase(const TDblQueBase& aQue); |
|
333 TDblQueBase& operator=(const TDblQueBase& aQue); |
|
334 friend class TDblQueIterBase; |
|
335 }; |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 /** |
|
341 @publishedAll |
|
342 @released |
|
343 |
|
344 A base class that provides implementation for the TDeltaQue template class. |
|
345 |
|
346 The class is abstract and is not intended to be instantiated. |
|
347 |
|
348 @see TDeltaQue |
|
349 */ |
|
350 class TDeltaQueBase : public TDblQueBase |
|
351 { |
|
352 public: |
|
353 IMPORT_C TBool CountDown(); |
|
354 IMPORT_C TBool CountDown(TInt aValue); |
|
355 IMPORT_C TBool FirstDelta(TInt& aValue); |
|
356 IMPORT_C void Reset(); |
|
357 protected: |
|
358 IMPORT_C TDeltaQueBase(); |
|
359 IMPORT_C TDeltaQueBase(TInt aOffset); |
|
360 IMPORT_C void DoAddDelta(TAny* aPtr,TInt aDelta); |
|
361 IMPORT_C void DoRemove(TAny* aPtr); |
|
362 IMPORT_C TAny* DoRemoveFirst(); |
|
363 protected: |
|
364 /** |
|
365 Pointer to the delta value in the first link element. |
|
366 */ |
|
367 TInt* iFirstDelta; |
|
368 }; |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 /** |
|
374 @publishedAll |
|
375 @released |
|
376 |
|
377 A templated class that provides the behaviour for managing a singly linked |
|
378 list. |
|
379 |
|
380 It also acts as the head of the list, maintaining the pointers into the list. |
|
381 |
|
382 The template parameter defines the type of element that forms the singly linked |
|
383 list and is the class that acts as host to the link object. |
|
384 |
|
385 @see TSglQueLink |
|
386 */ |
|
387 template <class T> |
|
388 class TSglQue : public TSglQueBase |
|
389 { |
|
390 public: |
|
391 inline TSglQue(); |
|
392 inline explicit TSglQue(TInt aOffset); |
|
393 inline void AddFirst(T& aRef); |
|
394 inline void AddLast(T& aRef); |
|
395 inline TBool IsFirst(const T* aPtr) const; |
|
396 inline TBool IsLast(const T* aPtr) const; |
|
397 inline T* First() const; |
|
398 inline T* Last() const; |
|
399 inline void Remove(T& aRef); |
|
400 }; |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 /** |
|
406 @publishedAll |
|
407 @released |
|
408 |
|
409 A templated class that provides the behaviour for managing a doubly linked |
|
410 list. |
|
411 |
|
412 It also acts as the head of the list, maintaining the pointers into the list. |
|
413 |
|
414 The template parameter defines the type of element that forms the doubly linked |
|
415 list and is the class that acts as host to the link object. |
|
416 |
|
417 @see TDblQueLink |
|
418 */ |
|
419 template <class T> |
|
420 class TDblQue : public TDblQueBase |
|
421 { |
|
422 public: |
|
423 inline TDblQue(); |
|
424 inline explicit TDblQue(TInt aOffset); |
|
425 inline void AddFirst(T& aRef); |
|
426 inline void AddLast(T& aRef); |
|
427 inline TBool IsHead(const T* aPtr) const; |
|
428 inline TBool IsFirst(const T* aPtr) const; |
|
429 inline TBool IsLast(const T* aPtr) const; |
|
430 inline T* First() const; |
|
431 inline T* Last() const; |
|
432 }; |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 /** |
|
438 @publishedAll |
|
439 @released |
|
440 |
|
441 A templated class that provides the behaviour for managing a doubly linked |
|
442 list in which the elements are added in descending priority order. |
|
443 |
|
444 Priority is defined by the value of the TPriQueLink::iPriority member of |
|
445 the link element. |
|
446 |
|
447 The template parameter defines the type of element that forms the doubly linked |
|
448 list and is the class that acts as host to the link object. |
|
449 |
|
450 @see TPriQueLink |
|
451 @see TPriQueLink::iPriority |
|
452 */ |
|
453 template <class T> |
|
454 class TPriQue : public TDblQueBase |
|
455 { |
|
456 public: |
|
457 inline TPriQue(); |
|
458 inline explicit TPriQue(TInt aOffset); |
|
459 inline void Add(T& aRef); |
|
460 inline TBool IsHead(const T* aPtr) const; |
|
461 inline TBool IsFirst(const T* aPtr) const; |
|
462 inline TBool IsLast(const T* aPtr) const; |
|
463 inline T* First() const; |
|
464 inline T* Last() const; |
|
465 }; |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 /** |
|
471 @publishedAll |
|
472 @released |
|
473 |
|
474 A templated class that provides the behaviour for managing a doubly linked |
|
475 list in which elements represent values which are increments, or deltas, on |
|
476 the value represented by a preceding element. |
|
477 |
|
478 The list is ordered so that the head of the queue represents a nominal zero |
|
479 point. |
|
480 |
|
481 The delta value of a new element represents its 'distance' from the nominal |
|
482 zero point. The new element is added into the list, and the delta values of |
|
483 adjacent elements (and of the new element, if necessary) are adjusted, so |
|
484 that the sum of all deltas, up to and including the new element, is the same |
|
485 as the new element's intended 'distance' from the nominal zero point. |
|
486 |
|
487 A common use for a list of this type is as a queue of timed events, where |
|
488 the delta values represent the intervals between the events. |
|
489 |
|
490 The delta value is defined by the value of the TDeltaQueLink::iDelta member |
|
491 of the link element. |
|
492 |
|
493 The template parameter defines the type of element that forms the doubly linked |
|
494 list and is the class that acts as host to the link object. |
|
495 |
|
496 @see TDeltaQueLink |
|
497 @see TDeltaQueLink::iDelta |
|
498 */ |
|
499 template <class T> |
|
500 class TDeltaQue : public TDeltaQueBase |
|
501 { |
|
502 public: |
|
503 inline TDeltaQue(); |
|
504 inline explicit TDeltaQue(TInt aOffset); |
|
505 inline void Add(T& aRef,TInt aDelta); |
|
506 inline void Remove(T& aRef); |
|
507 inline T* RemoveFirst(); |
|
508 }; |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 // Forward declaration |
|
514 class TTickCountQueLink; |
|
515 |
|
516 /** |
|
517 @internalComponent |
|
518 @released |
|
519 |
|
520 A class that provides the behaviour for managing a doubly linked list |
|
521 in which elements are added in order of the time until their tick count. |
|
522 |
|
523 A common use for a list of this type is as a queue of timed events, where |
|
524 the tick counts are the expiry times of the events. |
|
525 |
|
526 The tick count is defined by the value of the TTickCountQueLink::iTickCount |
|
527 member of the link element. |
|
528 |
|
529 @see TTickCountQueLink |
|
530 @see TTickCountQueLink::iTickCount |
|
531 */ |
|
532 class TTickCountQue : public TDblQueBase |
|
533 { |
|
534 public: |
|
535 TTickCountQue(); |
|
536 void Add(TTickCountQueLink& aRef); |
|
537 TTickCountQueLink* First() const; |
|
538 TTickCountQueLink* RemoveFirst(); |
|
539 TTickCountQueLink* RemoveFirst(TUint aTickCount); |
|
540 }; |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 /** |
|
546 @publishedAll |
|
547 @released |
|
548 |
|
549 A base class that provides implementation for the singly linked list iterator. |
|
550 |
|
551 It also encapsulates a pointer to the current link link list element. |
|
552 |
|
553 The class is abstract and is not intended to be instantiated. |
|
554 */ |
|
555 class TSglQueIterBase |
|
556 { |
|
557 public: |
|
558 IMPORT_C void SetToFirst(); |
|
559 protected: |
|
560 IMPORT_C TSglQueIterBase(TSglQueBase& aQue); |
|
561 IMPORT_C TAny* DoPostInc(); |
|
562 IMPORT_C TAny* DoCurrent(); |
|
563 IMPORT_C void DoSet(TAny* aLink); |
|
564 protected: |
|
565 TInt iOffset; |
|
566 TSglQueLink* iHead; |
|
567 TSglQueLink* iNext; |
|
568 }; |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 /** |
|
574 @publishedAll |
|
575 @released |
|
576 |
|
577 A templated class that provides the behaviour for iterating through a set of |
|
578 singly linked list elements. |
|
579 |
|
580 The template parameter defines the type of element that forms the singly linked |
|
581 list. The class defined in the template parameter contains the link object. |
|
582 */ |
|
583 template <class T> |
|
584 class TSglQueIter : public TSglQueIterBase |
|
585 { |
|
586 public: |
|
587 inline TSglQueIter(TSglQueBase& aQue); |
|
588 inline void Set(T& aLink); |
|
589 inline operator T*(); |
|
590 inline T* operator++(TInt); |
|
591 }; |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 /** |
|
597 @publishedAll |
|
598 @released |
|
599 |
|
600 A base class that provides implementation for the doubly linked list iterator. |
|
601 |
|
602 It also encapsulates a pointer to the current link list element. |
|
603 |
|
604 The class is abstract and is not intended to be instantiated. |
|
605 */ |
|
606 class TDblQueIterBase |
|
607 { |
|
608 public: |
|
609 IMPORT_C void SetToFirst(); |
|
610 IMPORT_C void SetToLast(); |
|
611 protected: |
|
612 IMPORT_C TDblQueIterBase(TDblQueBase& aQue); |
|
613 IMPORT_C TAny* DoPostInc(); |
|
614 IMPORT_C TAny* DoPostDec(); |
|
615 IMPORT_C TAny* DoCurrent(); |
|
616 IMPORT_C void DoSet(TAny* aLink); |
|
617 protected: |
|
618 /** |
|
619 The offset of a component link object within elements that form the list. |
|
620 */ |
|
621 TInt iOffset; |
|
622 |
|
623 /** |
|
624 Pointer to the anchor for the list. |
|
625 */ |
|
626 TDblQueLinkBase* iHead; |
|
627 |
|
628 /** |
|
629 Pointer to the current element. |
|
630 */ |
|
631 TDblQueLinkBase* iNext; |
|
632 }; |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 /** |
|
638 @publishedAll |
|
639 @released |
|
640 |
|
641 A templated class that provides the behaviour for iterating through a set of |
|
642 doubly linked list elements. |
|
643 |
|
644 The template parameter defines the type of element that forms the doubly linked |
|
645 list. The class defined in the template parameter contains the link object. |
|
646 */ |
|
647 template <class T> |
|
648 class TDblQueIter : public TDblQueIterBase |
|
649 { |
|
650 public: |
|
651 inline TDblQueIter(TDblQueBase& aQue); |
|
652 inline void Set(T& aLink); |
|
653 inline operator T*(); |
|
654 inline T* operator++(TInt); |
|
655 inline T* operator--(TInt); |
|
656 }; |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 /** |
|
662 @publishedAll |
|
663 @released |
|
664 |
|
665 Governs the type of comparison to be made between descriptor keys or between |
|
666 text keys. |
|
667 |
|
668 @see TKeyArrayFix |
|
669 @see TKeyArrayVar |
|
670 @see TKeyArrayPak |
|
671 */ |
|
672 enum TKeyCmpText |
|
673 { |
|
674 /** |
|
675 For a Unicode build, this is the same as ECmpNormal16. |
|
676 For a non-Unicode build, this is the same as ECmpNormal8. |
|
677 |
|
678 Using the build independent names (i.e. TPtrC, TPtr, TBufC, TBuf or TText) |
|
679 allows the compiler to chose the correct variant according to the build. |
|
680 */ |
|
681 ECmpNormal, |
|
682 |
|
683 |
|
684 /** |
|
685 For descriptor keys, the key is assumed to be the 8 bit variant, derived |
|
686 from TDesc8. A simple comparison is done between the content of the |
|
687 descriptors; the data is not folded and collation rules are not applied for |
|
688 the purpose of the comparison. |
|
689 |
|
690 For text keys, the key is assumed to be the 8 bit variant, of type TText8. |
|
691 A normal comparison is done between the text data; the data is not folded |
|
692 and collation rules are not applied for the purpose of the comparison. |
|
693 */ |
|
694 ECmpNormal8, |
|
695 |
|
696 |
|
697 /** |
|
698 For descriptor keys, the key is assumed to be the 16 bit variant, derived |
|
699 from TDesc16. A simple comparison is done between the content of the |
|
700 descriptors; the data is not folded and collation rules are not applied for |
|
701 the purpose of the comparison. |
|
702 |
|
703 For text keys, the key is assumed to be the 16 bit variant, of type |
|
704 TText16. A normal comparison is done between the text data; the data is |
|
705 not folded and collation rules are not applied for the purpose of the |
|
706 comparison. |
|
707 */ |
|
708 ECmpNormal16, |
|
709 |
|
710 |
|
711 /** |
|
712 For a Unicode build, this is the same as EcmpFolded16. |
|
713 For a non-Unicode build, this is the same as EcmpFolded8. |
|
714 |
|
715 Using the build independent names (i.e. TPtrC, TPtr, TBufC, TBuf or TText) |
|
716 allows the compiler to chose the correct variant according to the build. |
|
717 */ |
|
718 ECmpFolded, |
|
719 |
|
720 |
|
721 /** |
|
722 For descriptor keys, the key is assumed to be the 8 bit variant, |
|
723 derived from TDesc8. The descriptor contents are folded for the purpose |
|
724 of the comparison. |
|
725 |
|
726 For text keys, the key is assumed to be the 8 bit variant, of type |
|
727 TText8. The text data is folded for the purpose of the comparison. |
|
728 */ |
|
729 ECmpFolded8, |
|
730 |
|
731 |
|
732 /** |
|
733 For descriptor keys, the key is assumed to be the 16 bit variant, |
|
734 derived from TDesc16. The descriptor contents are folded for the purpose |
|
735 of the comparison. |
|
736 |
|
737 For text keys, the key is assumed to be the 16 bit variant, of type |
|
738 TText16. The text data is folded for the purpose of the comparison. |
|
739 */ |
|
740 ECmpFolded16, |
|
741 |
|
742 |
|
743 /** |
|
744 For a Unicode build, this is the same as EcmpCollated16. |
|
745 For a non-Unicode build, this is the same as EcmpCollated8. |
|
746 |
|
747 Using the build independent names (i.e. TPtrC, TPtr, TBufC, TBuf or TText) |
|
748 allows the compiler to chose the correct variant according to the build. |
|
749 */ |
|
750 ECmpCollated, |
|
751 |
|
752 |
|
753 /** |
|
754 For descriptor keys, the key is assumed to be the 8 bit variant, |
|
755 derived from TDesc8. Collation rules are applied for the purpose of |
|
756 the comparison. |
|
757 |
|
758 For text keys, the key is assumed to be the 8 bit variant, of type |
|
759 TText8. Collation rules are applied for the purpose of the comparison. |
|
760 */ |
|
761 ECmpCollated8, |
|
762 |
|
763 |
|
764 /** |
|
765 For descriptor keys, the key is assumed to be the 16 bit variant, |
|
766 derived from TDesc16. Collation rules are applied for the purpose of |
|
767 the comparison. |
|
768 |
|
769 For text keys, the key is assumed to be the 16 bit variant, |
|
770 of type TText16. Collation rules are applied for the purpose of |
|
771 the comparison. |
|
772 */ |
|
773 ECmpCollated16 |
|
774 }; |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 /** |
|
780 @publishedAll |
|
781 @released |
|
782 |
|
783 Governs the type of comparison to be made between numeric keys. |
|
784 |
|
785 @see TKeyArrayFix |
|
786 @see TKeyArrayVar |
|
787 @see TKeyArrayPak |
|
788 */ |
|
789 enum TKeyCmpNumeric |
|
790 { |
|
791 /** |
|
792 The key is assumed to be of type TInt8. |
|
793 */ |
|
794 ECmpTInt8=((ECmpCollated16+1)<<1), |
|
795 |
|
796 |
|
797 /** |
|
798 The key is assumed to be of type TInt16. |
|
799 */ |
|
800 ECmpTInt16, |
|
801 |
|
802 |
|
803 /** |
|
804 The key is assumed to be of type TInt32. |
|
805 */ |
|
806 ECmpTInt32, |
|
807 |
|
808 |
|
809 /** |
|
810 The key is assumed to be of type TInt. |
|
811 */ |
|
812 ECmpTInt, |
|
813 |
|
814 |
|
815 /** |
|
816 The key is assumed to be of type TUint8. |
|
817 */ |
|
818 ECmpTUint8, |
|
819 |
|
820 |
|
821 /** |
|
822 The key is assumed to be of type TUint16. |
|
823 */ |
|
824 ECmpTUint16, |
|
825 |
|
826 |
|
827 /** |
|
828 The key is assumed to be of type TUint32. |
|
829 */ |
|
830 ECmpTUint32, |
|
831 |
|
832 |
|
833 /** |
|
834 The key is assumed to be of type TUint. |
|
835 */ |
|
836 ECmpTUint, |
|
837 |
|
838 |
|
839 /** |
|
840 The key is assumed to be of type TInt64. |
|
841 */ |
|
842 ECmpTInt64 |
|
843 }; |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 /** |
|
849 @publishedAll |
|
850 @released |
|
851 |
|
852 Defines the characteristics of a key used to access the elements of an array. |
|
853 |
|
854 The class is abstract and cannot be instantiated. A derived class must be |
|
855 defined and implemented. |
|
856 |
|
857 The classes TKeyArrayFix, TKeyArrayVar and TKeyArrayPak, derived from TKey, |
|
858 are already supplied to implement keys for the fixed length element, variable |
|
859 length element and packed arrays. |
|
860 |
|
861 A derived class would normally be written to define the characteristics of |
|
862 a key for a non standard array. |
|
863 |
|
864 @see TKeyArrayFix |
|
865 @see TKeyArrayVar |
|
866 @see TKeyArrayPak |
|
867 */ |
|
868 class TKey |
|
869 { |
|
870 public: |
|
871 inline void SetPtr(const TAny* aPtr); |
|
872 IMPORT_C virtual TInt Compare(TInt aLeft,TInt aRight) const; |
|
873 IMPORT_C virtual TAny* At(TInt anIndex) const; |
|
874 protected: |
|
875 IMPORT_C TKey(); |
|
876 IMPORT_C TKey(TInt aOffset,TKeyCmpText aType); |
|
877 IMPORT_C TKey(TInt aOffset,TKeyCmpText aType,TInt aLength); |
|
878 IMPORT_C TKey(TInt aOffset,TKeyCmpNumeric aType); |
|
879 protected: |
|
880 TInt iKeyOffset; |
|
881 TInt iKeyLength; |
|
882 TInt iCmpType; |
|
883 const TAny* iPtr; |
|
884 }; |
|
885 |
|
886 /** |
|
887 @publishedAll |
|
888 @released |
|
889 |
|
890 Defines the basic behaviour for swapping two elements of an array. |
|
891 |
|
892 The class is abstract. A derived class must be defined and implemented to |
|
893 use the functionality. |
|
894 |
|
895 A derived class can define how to swap two elements of an array. In practice, |
|
896 this means providing an implementation for the virtual function Swap(). |
|
897 |
|
898 To support this, the derived class is also likely to need a pointer to the |
|
899 array itself and suitable constructors and/or other member functions to set |
|
900 such a pointer. |
|
901 */ |
|
902 class TSwap |
|
903 { |
|
904 public: |
|
905 IMPORT_C TSwap(); |
|
906 IMPORT_C virtual void Swap(TInt aLeft,TInt aRight) const; |
|
907 }; |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 /** |
|
913 @publishedAll |
|
914 @released |
|
915 |
|
916 Folds a specified character and provides functions to fold additional |
|
917 characters after construction of the object. |
|
918 |
|
919 Folding converts the character to a form which can be used in tolerant |
|
920 comparisons without control over the operations performed. Tolerant comparisons |
|
921 are those which ignore character differences like case and accents. |
|
922 |
|
923 Note that folding is locale-independent behaviour. It is also important to |
|
924 note that there can be no guarantee that folding is in any way culturally |
|
925 appropriate, and should not be used for matching characters in |
|
926 natural language. |
|
927 |
|
928 @see User::Fold |
|
929 */ |
|
930 class TCharF : public TChar |
|
931 { |
|
932 public: |
|
933 inline TCharF(TUint aChar); |
|
934 inline TCharF(const TChar& aChar); |
|
935 inline TCharF& operator=(TUint aChar); |
|
936 inline TCharF& operator=(const TChar& aChar); |
|
937 }; |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 /** |
|
943 @publishedAll |
|
944 @released |
|
945 |
|
946 Converts a specified character to lower case and provides functions to convert |
|
947 additional characters after construction of the object. |
|
948 */ |
|
949 class TCharLC : public TChar |
|
950 { |
|
951 public: |
|
952 inline TCharLC(TUint aChar); |
|
953 inline TCharLC(const TChar& aChar); |
|
954 inline TCharLC& operator=(TUint aChar); |
|
955 inline TCharLC& operator=(const TChar& aChar); |
|
956 }; |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 /** |
|
962 @publishedAll |
|
963 @released |
|
964 |
|
965 Converts a specified character to upper case and provides functions to convert |
|
966 additional characters after construction of the object. |
|
967 */ |
|
968 class TCharUC : public TChar |
|
969 { |
|
970 public: |
|
971 inline TCharUC(TUint aChar); |
|
972 inline TCharUC(const TChar& aChar); |
|
973 inline TCharUC& operator=(TUint aChar); |
|
974 inline TCharUC& operator=(const TChar& aChar); |
|
975 }; |
|
976 |
|
977 |
|
978 |
|
979 /** |
|
980 @publishedAll |
|
981 @released |
|
982 |
|
983 Defines the character representation of a real number type such |
|
984 as a TReal or a TRealX. |
|
985 |
|
986 An object of this type is used by functions that convert real values to |
|
987 character format, for example, the descriptor functions: |
|
988 Num(), AppendNum() and Format(). |
|
989 |
|
990 There are three constructors for constructing a suitable object. |
|
991 The data members of the class, however, are public and can be |
|
992 explicitly set after construction. |
|
993 */ |
|
994 class TRealFormat |
|
995 { |
|
996 public: |
|
997 IMPORT_C TRealFormat(); |
|
998 IMPORT_C TRealFormat(TInt aWidth); |
|
999 IMPORT_C TRealFormat(TInt aWidth,TInt aDecimalPlaces); |
|
1000 public: |
|
1001 /** |
|
1002 Governs the format of the character representation of the real number. |
|
1003 |
|
1004 This is set to one of the defined format types. |
|
1005 |
|
1006 One or more of the defined format flags can subsequently be ORed into this member. |
|
1007 |
|
1008 @see KRealFormatFixed |
|
1009 @see KRealFormatExponent |
|
1010 @see KRealFormatGeneral |
|
1011 @see KRealFormatNoExponent |
|
1012 @see KRealFormatCalculator |
|
1013 @see KExtraSpaceForSign |
|
1014 @see KAllowThreeDigitExp |
|
1015 @see KDoNotUseTriads |
|
1016 @see KGeneralLimit |
|
1017 @see KUseSigFigs |
|
1018 */ |
|
1019 TInt iType; |
|
1020 |
|
1021 |
|
1022 /** |
|
1023 Defines the maximum number of characters required to represent the number. |
|
1024 */ |
|
1025 TInt iWidth; |
|
1026 |
|
1027 |
|
1028 /** |
|
1029 Defines either the number of characters to be used to represent the decimal |
|
1030 portion of the number, or the maximum number of significant digits in |
|
1031 the character representation of the number. |
|
1032 |
|
1033 The interpretation depends on the chosen format as defined by iType. |
|
1034 |
|
1035 @see TRealFormat::iType |
|
1036 */ |
|
1037 TInt iPlaces; |
|
1038 |
|
1039 |
|
1040 /** |
|
1041 Defines the character to be used to separate the integer portion of |
|
1042 a number representation from its decimal portion. |
|
1043 |
|
1044 In general, the character used for this purpose is a matter of local |
|
1045 convention. The TLocale::DecimalSeparator() function can supply the |
|
1046 desired character. |
|
1047 |
|
1048 @see TLocale |
|
1049 */ |
|
1050 TChar iPoint; |
|
1051 |
|
1052 |
|
1053 /** |
|
1054 Defines the character to be used to delimit groups of three digits in |
|
1055 the integer part of the number. |
|
1056 |
|
1057 In general, the character used for this purpose is a matter of local |
|
1058 convention. The TLocale::ThousandsSeparator() function can supply the |
|
1059 desired character. |
|
1060 |
|
1061 @see TLocale |
|
1062 */ |
|
1063 TChar iTriad; |
|
1064 |
|
1065 |
|
1066 /** |
|
1067 Defines the threshold number of digits above which triad separation is to |
|
1068 occur. A value of zero disables triad separation and no triad separation |
|
1069 character (i.e. the character held in iTriad) is inserted into the |
|
1070 resulting character representation regardless of the number of characters. |
|
1071 |
|
1072 For example, a value of 1 causes the number 1000 to be represented by the |
|
1073 characters "1,000" whereas a value of 4 causes the same number to be |
|
1074 represented by the characters "1000" (This assumes the ‘,’ triad separation |
|
1075 character). |
|
1076 |
|
1077 Note that no triad separation occurs if the flag KDoNotUseTriads is set in |
|
1078 the iType data member. |
|
1079 |
|
1080 @see TRealFormat::iTriad |
|
1081 @see KDoNotUseTriads |
|
1082 */ |
|
1083 TInt iTriLen; |
|
1084 }; |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 /** |
|
1090 @publishedAll |
|
1091 @released |
|
1092 |
|
1093 Defines the extraction mark used by the TLex8 class to indicate the current |
|
1094 lexical element being analysed. |
|
1095 |
|
1096 In practice, objects of this type are accessed through the TLexMark typedef. |
|
1097 |
|
1098 @see TLexMark |
|
1099 @see TLex8 |
|
1100 */ |
|
1101 class TLexMark8 |
|
1102 { |
|
1103 public: |
|
1104 inline TLexMark8(); |
|
1105 private: |
|
1106 inline TLexMark8(const TUint8* aString); |
|
1107 const TUint8* iPtr; |
|
1108 friend class TLex8; |
|
1109 __DECLARE_TEST; |
|
1110 }; |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 class TRealX; |
|
1116 /** |
|
1117 @publishedAll |
|
1118 @released |
|
1119 |
|
1120 Provides general string-parsing functions suitable for numeric format |
|
1121 conversions and syntactical-element parsing. |
|
1122 |
|
1123 The class is the 8-bit variant for non-Unicode strings and 8-bit wide |
|
1124 characters. |
|
1125 |
|
1126 An instance of this class stores a string, maintaining an extraction mark |
|
1127 to indicate the current lexical element being analysed and a pointer to the |
|
1128 next character to be examined. |
|
1129 |
|
1130 Objects of this type are normally accessed through the build independent type |
|
1131 TLex. |
|
1132 |
|
1133 @see TLex |
|
1134 */ |
|
1135 class TLex8 |
|
1136 { |
|
1137 public: |
|
1138 IMPORT_C TLex8(); |
|
1139 inline TLex8(const TUint8* aString); |
|
1140 inline TLex8(const TDesC8& aDes); |
|
1141 inline TLex8& operator=(const TUint8* aString); |
|
1142 inline TLex8& operator=(const TDesC8& aDes); |
|
1143 inline TBool Eos() const; |
|
1144 inline void Mark(TLexMark8& aMark) const; |
|
1145 inline void Mark(); |
|
1146 IMPORT_C void Inc(); |
|
1147 IMPORT_C void Inc(TInt aNumber); |
|
1148 IMPORT_C TChar Get(); |
|
1149 IMPORT_C TChar Peek() const; |
|
1150 IMPORT_C void UnGet(); |
|
1151 inline void UnGetToMark(); |
|
1152 IMPORT_C void UnGetToMark(const TLexMark8 aMark); |
|
1153 IMPORT_C void SkipSpace(); |
|
1154 inline void SkipAndMark(TInt aNumber); |
|
1155 IMPORT_C void SkipAndMark(TInt aNumber, TLexMark8& aMark); |
|
1156 inline void SkipSpaceAndMark(); |
|
1157 IMPORT_C void SkipSpaceAndMark(TLexMark8& aMark); |
|
1158 IMPORT_C void SkipCharacters(); |
|
1159 inline TInt TokenLength() const; |
|
1160 IMPORT_C TInt TokenLength(const TLexMark8 aMark) const; |
|
1161 IMPORT_C TPtrC8 MarkedToken() const; |
|
1162 IMPORT_C TPtrC8 MarkedToken(const TLexMark8 aMark) const; |
|
1163 IMPORT_C TPtrC8 NextToken(); |
|
1164 IMPORT_C TPtrC8 Remainder() const; |
|
1165 IMPORT_C TPtrC8 RemainderFromMark() const; |
|
1166 IMPORT_C TPtrC8 RemainderFromMark(const TLexMark8 aMark) const; |
|
1167 IMPORT_C TInt Offset() const; |
|
1168 inline TInt MarkedOffset() const; |
|
1169 IMPORT_C TInt MarkedOffset(const TLexMark8 aMark) const; |
|
1170 IMPORT_C TInt Val(TInt8& aVal); |
|
1171 IMPORT_C TInt Val(TInt16& aVal); |
|
1172 IMPORT_C TInt Val(TInt32& aVal); |
|
1173 IMPORT_C TInt Val(TInt64& aVal); |
|
1174 inline TInt Val(TInt& aVal); |
|
1175 IMPORT_C TInt Val(TUint8& aVal,TRadix aRadix); |
|
1176 IMPORT_C TInt Val(TUint16& aVal,TRadix aRadix); |
|
1177 IMPORT_C TInt Val(TUint32& aVal,TRadix aRadix); |
|
1178 IMPORT_C TInt Val(TInt64& aVal, TRadix aRadix); |
|
1179 inline TInt Val(TUint& aVal,TRadix aRadix=EDecimal); |
|
1180 IMPORT_C TInt BoundedVal(TInt32& aVal,TInt aLimit); |
|
1181 IMPORT_C TInt BoundedVal(TInt64& aVal, const TInt64& aLimit); |
|
1182 IMPORT_C TInt BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit); |
|
1183 IMPORT_C TInt BoundedVal(TInt64& aVal, TRadix aRadix, const TInt64& aLimit); |
|
1184 IMPORT_C TInt Val(TReal32& aVal); |
|
1185 IMPORT_C TInt Val(TReal32& aVal,TChar aPoint); |
|
1186 IMPORT_C TInt Val(TReal64& aVal); |
|
1187 IMPORT_C TInt Val(TReal64& aVal,TChar aPoint); |
|
1188 inline void Assign(const TLex8& aLex); |
|
1189 IMPORT_C void Assign(const TUint8* aString); |
|
1190 IMPORT_C void Assign(const TDesC8& aDes); |
|
1191 TInt Val(TRealX& aVal); |
|
1192 TInt Val(TRealX& aVal, TChar aPoint); |
|
1193 |
|
1194 /** @deprecated Use BoundedVal(TInt32& aVal,TInt aLimit) */ |
|
1195 inline TInt Val(TInt32& aVal,TInt aLimit) { return BoundedVal(aVal,aLimit); }; |
|
1196 |
|
1197 /** @deprecated Use BoundedVal(TInt64& aVal,const TInt64& aLimit) */ |
|
1198 inline TInt Val(TInt64& aVal,const TInt64& aLimit) { return BoundedVal(aVal,aLimit); }; |
|
1199 |
|
1200 /** @deprecated Use BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit) */ |
|
1201 inline TInt Val(TUint32& aVal,TRadix aRadix,TUint aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; |
|
1202 |
|
1203 /** @deprecated Use BoundedVal(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) */ |
|
1204 inline TInt Val(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; |
|
1205 private: |
|
1206 void Scndig(TInt& aSig,TInt& aExp,TInt64& aDl); |
|
1207 void ScndigAfterPoint(TInt& aSig,TInt64& aDl); |
|
1208 void ValidateMark(const TLexMark8 aMark) const; |
|
1209 private: |
|
1210 const TUint8* iNext; |
|
1211 const TUint8* iBuf; |
|
1212 const TUint8* iEnd; |
|
1213 TLexMark8 iMark; |
|
1214 __DECLARE_TEST; |
|
1215 }; |
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 /** |
|
1221 @publishedAll |
|
1222 @released |
|
1223 |
|
1224 Defines the extraction mark used by the TLex16 class to indicate the current |
|
1225 lexical element being analysed. |
|
1226 |
|
1227 In practice, objects of this type are accessed through the TLexMark typedef. |
|
1228 |
|
1229 @see TLexMark |
|
1230 @see TLex16 |
|
1231 */ |
|
1232 class TLexMark16 |
|
1233 { |
|
1234 public: |
|
1235 inline TLexMark16(); |
|
1236 private: |
|
1237 inline TLexMark16(const TUint16* aString); |
|
1238 const TUint16* iPtr; |
|
1239 friend class TLex16; |
|
1240 __DECLARE_TEST; |
|
1241 }; |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 /** |
|
1247 @publishedAll |
|
1248 @released |
|
1249 |
|
1250 Provides general string-parsing functions suitable for numeric format |
|
1251 conversions and syntactical-element parsing. |
|
1252 |
|
1253 The class is the 16-bit variant for Unicode strings and 16-bit wide |
|
1254 characters. |
|
1255 |
|
1256 An instance of this class stores a string, maintaining an extraction mark |
|
1257 to indicate the current lexical element being analysed and a pointer to the |
|
1258 next character to be examined. |
|
1259 |
|
1260 Objects of this type are normally accessed through the build independent type |
|
1261 TLex. |
|
1262 |
|
1263 @see TLex |
|
1264 */ |
|
1265 class TLex16 |
|
1266 { |
|
1267 public: |
|
1268 IMPORT_C TLex16(); |
|
1269 inline TLex16(const TUint16* aString); |
|
1270 inline TLex16(const TDesC16& aDes); |
|
1271 inline TLex16& operator=(const TUint16* aString); |
|
1272 inline TLex16& operator=(const TDesC16& aDes); |
|
1273 inline TBool Eos() const; |
|
1274 inline void Mark(); |
|
1275 inline void Mark(TLexMark16& aMark) const; |
|
1276 IMPORT_C void Inc(); |
|
1277 IMPORT_C void Inc(TInt aNumber); |
|
1278 IMPORT_C TChar Get(); |
|
1279 IMPORT_C TChar Peek() const; |
|
1280 IMPORT_C void UnGet(); |
|
1281 inline void UnGetToMark(); |
|
1282 IMPORT_C void UnGetToMark(const TLexMark16 aMark); |
|
1283 IMPORT_C void SkipSpace(); |
|
1284 inline void SkipAndMark(TInt aNumber); |
|
1285 IMPORT_C void SkipAndMark(TInt aNumber, TLexMark16& aMark); |
|
1286 IMPORT_C void SkipSpaceAndMark(TLexMark16& aMark); |
|
1287 inline void SkipSpaceAndMark(); |
|
1288 IMPORT_C void SkipCharacters(); |
|
1289 inline TInt TokenLength() const; |
|
1290 IMPORT_C TInt TokenLength(const TLexMark16 aMark) const; |
|
1291 IMPORT_C TPtrC16 MarkedToken() const; |
|
1292 IMPORT_C TPtrC16 MarkedToken(const TLexMark16 aMark) const; |
|
1293 IMPORT_C TPtrC16 NextToken(); |
|
1294 IMPORT_C TPtrC16 Remainder() const; |
|
1295 IMPORT_C TPtrC16 RemainderFromMark() const; |
|
1296 IMPORT_C TPtrC16 RemainderFromMark(const TLexMark16 aMark) const; |
|
1297 IMPORT_C TInt Offset() const; |
|
1298 inline TInt MarkedOffset() const; |
|
1299 IMPORT_C TInt MarkedOffset(const TLexMark16 aMark) const; |
|
1300 IMPORT_C TInt Val(TInt8& aVal); |
|
1301 IMPORT_C TInt Val(TInt16& aVal); |
|
1302 IMPORT_C TInt Val(TInt32& aVal); |
|
1303 IMPORT_C TInt Val(TInt64& aVal); |
|
1304 inline TInt Val(TInt& aVal); |
|
1305 IMPORT_C TInt Val(TUint8& aVal,TRadix aRadix); |
|
1306 IMPORT_C TInt Val(TUint16& aVal,TRadix aRadix); |
|
1307 IMPORT_C TInt Val(TUint32& aVal,TRadix aRadix); |
|
1308 IMPORT_C TInt Val(TInt64& aVal, TRadix aRadix); |
|
1309 // inline TInt Val(TInt64& aVal, TRadix aRadix) {return Val(aVal,aRadix);} |
|
1310 inline TInt Val(TUint& aVal,TRadix aRadix=EDecimal); |
|
1311 IMPORT_C TInt BoundedVal(TInt32& aVal,TInt aLimit); |
|
1312 IMPORT_C TInt BoundedVal(TInt64& aVal, const TInt64& aLimit); |
|
1313 IMPORT_C TInt BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit); |
|
1314 IMPORT_C TInt BoundedVal(TInt64& aVal, TRadix aRadix, const TInt64& aLimit); |
|
1315 IMPORT_C TInt Val(TReal32& aVal); |
|
1316 IMPORT_C TInt Val(TReal32& aVal,TChar aPoint); |
|
1317 IMPORT_C TInt Val(TReal64& aVal); |
|
1318 IMPORT_C TInt Val(TReal64& aVal,TChar aPoint); |
|
1319 inline void Assign(const TLex16& aLex); |
|
1320 IMPORT_C void Assign(const TUint16* aString); |
|
1321 IMPORT_C void Assign(const TDesC16& aDes); |
|
1322 TInt Val(TRealX& aVal); |
|
1323 TInt Val(TRealX& aVal, TChar aPoint); |
|
1324 |
|
1325 /** @deprecated Use BoundedVal(TInt32& aVal,TInt aLimit) */ |
|
1326 inline TInt Val(TInt32& aVal,TInt aLimit) { return BoundedVal(aVal,aLimit); }; |
|
1327 |
|
1328 /** @deprecated Use BoundedVal(TInt64& aVal,const TInt64& aLimit) */ |
|
1329 inline TInt Val(TInt64& aVal,const TInt64& aLimit) { return BoundedVal(aVal,aLimit); }; |
|
1330 |
|
1331 /** @deprecated Use BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit) */ |
|
1332 inline TInt Val(TUint32& aVal,TRadix aRadix,TUint aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; |
|
1333 |
|
1334 /** @deprecated Use BoundedVal(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) */ |
|
1335 inline TInt Val(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; |
|
1336 private: |
|
1337 void Scndig(TInt& aSig,TInt& aExp,TInt64& aDl); |
|
1338 void ValidateMark(const TLexMark16 aMark) const; |
|
1339 private: |
|
1340 const TUint16* iNext; |
|
1341 const TUint16* iBuf; |
|
1342 const TUint16* iEnd; |
|
1343 TLexMark16 iMark; |
|
1344 __DECLARE_TEST; |
|
1345 }; |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 #if defined(_UNICODE) |
|
1351 /** |
|
1352 @publishedAll |
|
1353 @released |
|
1354 |
|
1355 Provides access to general string-parsing functions suitable for numeric format |
|
1356 conversions and syntactical-element parsing. |
|
1357 |
|
1358 It maps directly to either a TLex16 for a Unicode build or a TLex8 for a non-Unicode |
|
1359 build. |
|
1360 |
|
1361 The build independent type should always be used unless an explicit 16 bit |
|
1362 or 8 bit build variant is required. |
|
1363 |
|
1364 @see TLex16 |
|
1365 @see TLex8 |
|
1366 */ |
|
1367 typedef TLex16 TLex; |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 /** |
|
1373 @publishedAll |
|
1374 @released |
|
1375 |
|
1376 Defines the extraction mark used by the TLex classes to indicate the current |
|
1377 lexical element being analysed. |
|
1378 |
|
1379 It maps directly to either a TLexMark16 for a Unicode build or a TLexMark8 |
|
1380 for a non-Unicode build. |
|
1381 |
|
1382 The build independent type should always be used unless an explicit 16 bit |
|
1383 or 8 bit build variant is required. |
|
1384 */ |
|
1385 typedef TLexMark16 TLexMark; |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 #else |
|
1391 |
|
1392 |
|
1393 |
|
1394 /** |
|
1395 @publishedAll |
|
1396 @released |
|
1397 |
|
1398 Provides access to general string-parsing functions suitable for numeric format |
|
1399 conversions and syntactical-element parsing. |
|
1400 |
|
1401 It maps directly to either a TLex16 for a Unicode build or a TLex8 for a non-Unicode |
|
1402 build. |
|
1403 |
|
1404 The build independent type should always be used unless an explicit 16 bit |
|
1405 or 8 bit build variant is required. |
|
1406 |
|
1407 @see TLex16 |
|
1408 @see TLex8 |
|
1409 */ |
|
1410 typedef TLex8 TLex; |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 /** |
|
1416 @publishedAll |
|
1417 @released |
|
1418 |
|
1419 Defines the extraction mark used by the TLex classes to indicate the current |
|
1420 lexical element being analysed. |
|
1421 |
|
1422 It maps directly to either a TLexMark16 for a Unicode build or a TLexMark8 |
|
1423 for a non-Unicode build. |
|
1424 |
|
1425 The build independent type should always be used unless an explicit 16 bit |
|
1426 or 8 bit build variant is required. |
|
1427 */ |
|
1428 typedef TLexMark8 TLexMark; |
|
1429 #endif |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 /** |
|
1435 @publishedAll |
|
1436 @released |
|
1437 |
|
1438 Packages a Uid type together with a checksum. |
|
1439 |
|
1440 @see TUidType |
|
1441 */ |
|
1442 class TCheckedUid |
|
1443 { |
|
1444 public: |
|
1445 IMPORT_C TCheckedUid(); |
|
1446 IMPORT_C TCheckedUid(const TUidType& aUidType); |
|
1447 IMPORT_C TCheckedUid(const TDesC8& aPtr); |
|
1448 IMPORT_C void Set(const TUidType& aUidType); |
|
1449 IMPORT_C void Set(const TDesC8& aPtr); |
|
1450 IMPORT_C TPtrC8 Des() const; |
|
1451 inline const TUidType& UidType() const; |
|
1452 protected: |
|
1453 IMPORT_C TUint Check() const; |
|
1454 private: |
|
1455 TUidType iType; |
|
1456 TUint iCheck; |
|
1457 }; |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 /** |
|
1463 @publishedAll |
|
1464 @released |
|
1465 |
|
1466 A date and time object in which the individual components are accessible in |
|
1467 human-readable form. |
|
1468 |
|
1469 The individual components are: year, month, day, hour, minute, |
|
1470 second and microsecond. |
|
1471 |
|
1472 These components are stored as integers and all except the year are checked for |
|
1473 validity when a TDateTime is constructed or assigned new values. |
|
1474 |
|
1475 This class only supports getting and setting the entire date/time or any component |
|
1476 of it. It does not support adding or subtracting intervals to or from a time. |
|
1477 For functions which manipulate times, use class TTime. |
|
1478 |
|
1479 @see TTime |
|
1480 */ |
|
1481 class TDateTime |
|
1482 { |
|
1483 public: |
|
1484 inline TDateTime(); |
|
1485 IMPORT_C TDateTime(TInt aYear,TMonth aMonth,TInt aDay,TInt aHour,TInt aMinute, TInt aSecond,TInt aMicroSecond); |
|
1486 IMPORT_C TInt Set(TInt aYear,TMonth aMonth,TInt aDay,TInt aHour,TInt aMinute, TInt aSecond,TInt aMicroSecond); |
|
1487 IMPORT_C TInt SetYear(TInt aYear); |
|
1488 IMPORT_C TInt SetYearLeapCheck(TInt aYear); |
|
1489 IMPORT_C TInt SetMonth(TMonth aMonth); |
|
1490 IMPORT_C TInt SetDay(TInt aDay); |
|
1491 IMPORT_C TInt SetHour(TInt aHour); |
|
1492 IMPORT_C TInt SetMinute(TInt aMinute); |
|
1493 IMPORT_C TInt SetSecond(TInt aSecond); |
|
1494 IMPORT_C TInt SetMicroSecond(TInt aMicroSecond); |
|
1495 inline TInt Year() const; |
|
1496 inline TMonth Month() const; |
|
1497 inline TInt Day() const; |
|
1498 inline TInt Hour() const; |
|
1499 inline TInt Minute() const; |
|
1500 inline TInt Second() const; |
|
1501 inline TInt MicroSecond() const; |
|
1502 private: |
|
1503 TInt iYear; |
|
1504 TMonth iMonth; |
|
1505 TInt iDay; |
|
1506 TInt iHour; |
|
1507 TInt iMinute; |
|
1508 TInt iSecond; |
|
1509 TInt iMicroSecond; |
|
1510 }; |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 /** |
|
1516 @publishedAll |
|
1517 @released |
|
1518 |
|
1519 Represents a time interval of a millionth of a second stored as |
|
1520 a 64-bit integer. |
|
1521 |
|
1522 It supports the initialisation, setting and getting of an interval and provides |
|
1523 standard comparison operations. Objects of this class can be added to and |
|
1524 subtracted from TTime objects. |
|
1525 |
|
1526 @see TTime |
|
1527 */ |
|
1528 class TTimeIntervalMicroSeconds |
|
1529 { |
|
1530 public: |
|
1531 inline TTimeIntervalMicroSeconds(); |
|
1532 inline TTimeIntervalMicroSeconds(const TInt64& aInterval); |
|
1533 inline TTimeIntervalMicroSeconds& operator=(const TInt64& aInterval); |
|
1534 inline TBool operator==(const TTimeIntervalMicroSeconds& aInterval) const; |
|
1535 inline TBool operator!=(const TTimeIntervalMicroSeconds& aInterval) const; |
|
1536 inline TBool operator>=(const TTimeIntervalMicroSeconds& aInterval) const; |
|
1537 inline TBool operator<=(const TTimeIntervalMicroSeconds& aInterval) const; |
|
1538 inline TBool operator>(const TTimeIntervalMicroSeconds& aInterval) const; |
|
1539 inline TBool operator<(const TTimeIntervalMicroSeconds& aInterval) const; |
|
1540 inline const TInt64& Int64() const; |
|
1541 private: |
|
1542 TInt64 iInterval; |
|
1543 }; |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 /** |
|
1549 @publishedAll |
|
1550 @released |
|
1551 |
|
1552 Provides a base class for all time interval classes using |
|
1553 a 32-bit representation. |
|
1554 |
|
1555 It supports retrieving the interval and provides various operations for |
|
1556 comparing intervals. Its concrete derived classes can be added to and |
|
1557 subtracted from a TTime. |
|
1558 |
|
1559 The comparison operators simply compare the integer representations of the |
|
1560 two intervals. They do not take account of different time interval units. |
|
1561 So, for example, when comparing for equality an interval of three hours with |
|
1562 an interval of three days, the result is true. |
|
1563 |
|
1564 @see TTime |
|
1565 */ |
|
1566 class TTimeIntervalBase |
|
1567 { |
|
1568 public: |
|
1569 inline TBool operator==(TTimeIntervalBase aInterval) const; |
|
1570 inline TBool operator!=(TTimeIntervalBase aInterval) const; |
|
1571 inline TBool operator>=(TTimeIntervalBase aInterval) const; |
|
1572 inline TBool operator<=(TTimeIntervalBase aInterval) const; |
|
1573 inline TBool operator>(TTimeIntervalBase aInterval) const; |
|
1574 inline TBool operator<(TTimeIntervalBase aInterval) const; |
|
1575 inline TInt Int() const; |
|
1576 protected: |
|
1577 inline TTimeIntervalBase(); |
|
1578 inline TTimeIntervalBase(TInt aInterval); |
|
1579 protected: |
|
1580 TInt iInterval; |
|
1581 }; |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 /** |
|
1587 @publishedAll |
|
1588 @released |
|
1589 |
|
1590 Represents a microsecond time interval stored in 32 rather than 64 bits. |
|
1591 |
|
1592 Its range is +-2147483647, which is +-35 minutes, 47 seconds. Comparison and |
|
1593 interval retrieval functions are provided by the base class TTimeIntervalBase. |
|
1594 */ |
|
1595 class TTimeIntervalMicroSeconds32 : public TTimeIntervalBase |
|
1596 { |
|
1597 public: |
|
1598 inline TTimeIntervalMicroSeconds32(); |
|
1599 inline TTimeIntervalMicroSeconds32(TInt aInterval); |
|
1600 inline TTimeIntervalMicroSeconds32& operator=(TInt aInterval); |
|
1601 }; |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 /** |
|
1607 @publishedAll |
|
1608 @released |
|
1609 |
|
1610 Represents a time interval in seconds. |
|
1611 |
|
1612 Comparison and interval retrieval functions |
|
1613 are provided by the base class TTimeIntervalBase. |
|
1614 |
|
1615 The range of values which it can represent is +-2147483647, which is equal to |
|
1616 +-24855 days (approximately 68 years). |
|
1617 */ |
|
1618 class TTimeIntervalSeconds : public TTimeIntervalBase |
|
1619 { |
|
1620 public: |
|
1621 inline TTimeIntervalSeconds(); |
|
1622 inline TTimeIntervalSeconds(TInt aInterval); |
|
1623 inline TTimeIntervalSeconds& operator=(TInt aInterval); |
|
1624 }; |
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 /** |
|
1630 @publishedAll |
|
1631 @released |
|
1632 |
|
1633 Represents a time interval in minutes. |
|
1634 |
|
1635 Comparison and interval retrieval functions |
|
1636 are provided by the base class TTimeIntervalBase. |
|
1637 */ |
|
1638 class TTimeIntervalMinutes : public TTimeIntervalBase |
|
1639 { |
|
1640 public: |
|
1641 inline TTimeIntervalMinutes(); |
|
1642 inline TTimeIntervalMinutes(TInt aInterval); |
|
1643 inline TTimeIntervalMinutes& operator=(TInt aInterval); |
|
1644 }; |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 /** |
|
1650 @publishedAll |
|
1651 @released |
|
1652 |
|
1653 Represents a time interval in hours. |
|
1654 |
|
1655 Comparison and interval retrieval functions |
|
1656 are provided by the base class TTimeIntervalBase. |
|
1657 */ |
|
1658 class TTimeIntervalHours : public TTimeIntervalBase |
|
1659 { |
|
1660 public: |
|
1661 inline TTimeIntervalHours(); |
|
1662 inline TTimeIntervalHours(TInt aInterval); |
|
1663 inline TTimeIntervalHours& operator=(TInt aInterval); |
|
1664 }; |
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 /** |
|
1670 @publishedAll |
|
1671 @released |
|
1672 |
|
1673 Represents a time interval in days. |
|
1674 |
|
1675 Comparison and interval retrieval functions |
|
1676 are provided by the base class TTimeIntervalBase. |
|
1677 */ |
|
1678 class TTimeIntervalDays : public TTimeIntervalBase |
|
1679 { |
|
1680 public: |
|
1681 inline TTimeIntervalDays(); |
|
1682 inline TTimeIntervalDays(TInt aInterval); |
|
1683 inline TTimeIntervalDays& operator=(TInt aInterval); |
|
1684 }; |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 /** |
|
1690 @publishedAll |
|
1691 @released |
|
1692 |
|
1693 Represents a time interval in months. |
|
1694 |
|
1695 Comparison and interval retrieval functions |
|
1696 are provided by the base class TTimeIntervalBase. |
|
1697 */ |
|
1698 class TTimeIntervalMonths : public TTimeIntervalBase |
|
1699 { |
|
1700 public: |
|
1701 inline TTimeIntervalMonths(); |
|
1702 inline TTimeIntervalMonths(TInt aInterval); |
|
1703 inline TTimeIntervalMonths& operator=(TInt aInterval); |
|
1704 }; |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 /** |
|
1710 @publishedAll |
|
1711 @released |
|
1712 |
|
1713 Represents a time interval in years. |
|
1714 |
|
1715 Comparison and interval retrieval functions |
|
1716 are provided by the base class TTimeIntervalBase. |
|
1717 */ |
|
1718 class TTimeIntervalYears : public TTimeIntervalBase |
|
1719 { |
|
1720 public: |
|
1721 inline TTimeIntervalYears(); |
|
1722 inline TTimeIntervalYears(TInt aInterval); |
|
1723 inline TTimeIntervalYears& operator=(TInt aInterval); |
|
1724 }; |
|
1725 |
|
1726 |
|
1727 |
|
1728 /** |
|
1729 @publishedAll |
|
1730 @released |
|
1731 |
|
1732 An enumeration one or both of whose enumerator values may be returned |
|
1733 by TTime::Parse(). |
|
1734 |
|
1735 @see TTime::Parse |
|
1736 */ |
|
1737 enum { |
|
1738 /** |
|
1739 Indicates that a time is present. |
|
1740 |
|
1741 @see TTime::Parse |
|
1742 */ |
|
1743 EParseTimePresent=0x1, |
|
1744 /** |
|
1745 Indicates that a date is present. |
|
1746 |
|
1747 @see TTime::Parse |
|
1748 */ |
|
1749 EParseDatePresent=0x2 |
|
1750 }; |
|
1751 |
|
1752 |
|
1753 |
|
1754 class TLocale; |
|
1755 /** |
|
1756 @publishedAll |
|
1757 @released |
|
1758 |
|
1759 Stores and manipulates the date and time. |
|
1760 |
|
1761 It represents a date and time as a number of microseconds since midnight, |
|
1762 January 1st, 0 AD nominal Gregorian. BC dates are represented by negative |
|
1763 TTime values. A TTime object may be constructed from a TInt64, a TDateTime |
|
1764 a string literal, or by default, which initialises the time to an arbitrary |
|
1765 value. To access human-readable time information, the TTime may be converted |
|
1766 from a TInt64 into a TDateTime, which represents the date and time as seven |
|
1767 numeric fields and provides functions to extract these fields. Alternatively, |
|
1768 to display the time as text, the time may be formatted and placed into a |
|
1769 descriptor using a variety of formatting commands and which may or may not |
|
1770 honour the system's locale settings. The conversion between time and text may |
|
1771 be performed the other way around, so that a descriptor can be parsed and |
|
1772 converted into a TTime value. |
|
1773 |
|
1774 In addition to setting and getting the date and time and converting between |
|
1775 text and time, TTime provides functions to get intervals between times and |
|
1776 standard comparison and arithmetic operators which enable time intervals to |
|
1777 be added or subtracted to or from the time. |
|
1778 |
|
1779 @see TInt64 |
|
1780 @see TDateTime |
|
1781 */ |
|
1782 class TTime |
|
1783 { |
|
1784 public: |
|
1785 inline TTime(); |
|
1786 inline TTime(const TInt64& aTime); |
|
1787 IMPORT_C TTime(const TDesC& aString); |
|
1788 IMPORT_C TTime(const TDateTime& aDateTime); |
|
1789 inline TTime& operator=(const TInt64& aTime); |
|
1790 IMPORT_C TTime& operator=(const TDateTime& aDateTime); |
|
1791 IMPORT_C void HomeTime(); |
|
1792 IMPORT_C void UniversalTime(); |
|
1793 IMPORT_C TInt Set(const TDesC& aString); |
|
1794 IMPORT_C TInt HomeTimeSecure(); |
|
1795 IMPORT_C TInt UniversalTimeSecure(); |
|
1796 |
|
1797 IMPORT_C TDateTime DateTime() const; |
|
1798 IMPORT_C TTimeIntervalMicroSeconds MicroSecondsFrom(TTime aTime) const; |
|
1799 IMPORT_C TInt SecondsFrom(TTime aTime,TTimeIntervalSeconds& aInterval) const; |
|
1800 IMPORT_C TInt MinutesFrom(TTime aTime,TTimeIntervalMinutes& aInterval) const; |
|
1801 IMPORT_C TInt HoursFrom(TTime aTime,TTimeIntervalHours& aInterval) const; |
|
1802 IMPORT_C TTimeIntervalDays DaysFrom(TTime aTime) const; |
|
1803 IMPORT_C TTimeIntervalMonths MonthsFrom(TTime aTime) const; |
|
1804 IMPORT_C TTimeIntervalYears YearsFrom(TTime aTime) const; |
|
1805 |
|
1806 IMPORT_C TInt DaysInMonth() const; |
|
1807 IMPORT_C TDay DayNoInWeek() const; |
|
1808 IMPORT_C TInt DayNoInMonth() const; |
|
1809 IMPORT_C TInt DayNoInYear() const; |
|
1810 IMPORT_C TInt DayNoInYear(TTime aStartDate) const; |
|
1811 IMPORT_C TInt WeekNoInYear() const; |
|
1812 IMPORT_C TInt WeekNoInYear(TTime aStartDate) const; |
|
1813 IMPORT_C TInt WeekNoInYear(TFirstWeekRule aRule) const; |
|
1814 IMPORT_C TInt WeekNoInYear(TTime aStartDate,TFirstWeekRule aRule) const; |
|
1815 IMPORT_C void FormatL(TDes& aDes,const TDesC& aFormat) const; |
|
1816 IMPORT_C void FormatL(TDes& aDes,const TDesC& aFormat,const TLocale& aLocale) const; |
|
1817 IMPORT_C void RoundUpToNextMinute(); |
|
1818 IMPORT_C TInt Parse(const TDesC& aDes,TInt aCenturyOffset=0); |
|
1819 |
|
1820 IMPORT_C TTime operator+(TTimeIntervalYears aYear) const; |
|
1821 IMPORT_C TTime operator+(TTimeIntervalMonths aMonth) const; |
|
1822 IMPORT_C TTime operator+(TTimeIntervalDays aDay) const; |
|
1823 IMPORT_C TTime operator+(TTimeIntervalHours aHour) const; |
|
1824 IMPORT_C TTime operator+(TTimeIntervalMinutes aMinute) const; |
|
1825 IMPORT_C TTime operator+(TTimeIntervalSeconds aSecond) const; |
|
1826 IMPORT_C TTime operator+(TTimeIntervalMicroSeconds aMicroSecond) const; |
|
1827 IMPORT_C TTime operator+(TTimeIntervalMicroSeconds32 aMicroSecond) const; |
|
1828 IMPORT_C TTime operator-(TTimeIntervalYears aYear) const; |
|
1829 IMPORT_C TTime operator-(TTimeIntervalMonths aMonth) const; |
|
1830 IMPORT_C TTime operator-(TTimeIntervalDays aDay) const; |
|
1831 IMPORT_C TTime operator-(TTimeIntervalHours aHour) const; |
|
1832 IMPORT_C TTime operator-(TTimeIntervalMinutes aMinute) const; |
|
1833 IMPORT_C TTime operator-(TTimeIntervalSeconds aSecond) const; |
|
1834 IMPORT_C TTime operator-(TTimeIntervalMicroSeconds aMicroSecond) const; |
|
1835 IMPORT_C TTime operator-(TTimeIntervalMicroSeconds32 aMicroSecond) const; |
|
1836 IMPORT_C TTime& operator+=(TTimeIntervalYears aYear); |
|
1837 IMPORT_C TTime& operator+=(TTimeIntervalMonths aMonth); |
|
1838 IMPORT_C TTime& operator+=(TTimeIntervalDays aDay); |
|
1839 IMPORT_C TTime& operator+=(TTimeIntervalHours aHour); |
|
1840 IMPORT_C TTime& operator+=(TTimeIntervalMinutes aMinute); |
|
1841 IMPORT_C TTime& operator+=(TTimeIntervalSeconds aSecond); |
|
1842 IMPORT_C TTime& operator+=(TTimeIntervalMicroSeconds aMicroSecond); |
|
1843 IMPORT_C TTime& operator+=(TTimeIntervalMicroSeconds32 aMicroSecond); |
|
1844 IMPORT_C TTime& operator-=(TTimeIntervalYears aYear); |
|
1845 IMPORT_C TTime& operator-=(TTimeIntervalMonths aMonth); |
|
1846 IMPORT_C TTime& operator-=(TTimeIntervalDays aDay); |
|
1847 IMPORT_C TTime& operator-=(TTimeIntervalHours aHour); |
|
1848 IMPORT_C TTime& operator-=(TTimeIntervalMinutes aMinute); |
|
1849 IMPORT_C TTime& operator-=(TTimeIntervalSeconds aSecond); |
|
1850 IMPORT_C TTime& operator-=(TTimeIntervalMicroSeconds aMicroSecond); |
|
1851 IMPORT_C TTime& operator-=(TTimeIntervalMicroSeconds32 aMicroSecond); |
|
1852 inline TBool operator==(TTime aTime) const; |
|
1853 inline TBool operator!=(TTime aTime) const; |
|
1854 inline TBool operator>=(TTime aTime) const; |
|
1855 inline TBool operator<=(TTime aTime) const; |
|
1856 inline TBool operator>(TTime aTime) const; |
|
1857 inline TBool operator<(TTime aTime) const; |
|
1858 inline const TInt64& Int64() const; |
|
1859 private: |
|
1860 static TTime Convert(const TDateTime& aDateTime); |
|
1861 private: |
|
1862 TInt64 iTime; |
|
1863 __DECLARE_TEST; |
|
1864 }; |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 /** |
|
1870 @publishedAll |
|
1871 @released |
|
1872 |
|
1873 A utility class whose functions may be used by the other date/time related |
|
1874 classes. |
|
1875 */ |
|
1876 class Time |
|
1877 { |
|
1878 public: |
|
1879 IMPORT_C static TTime NullTTime(); |
|
1880 IMPORT_C static TTime MaxTTime(); |
|
1881 IMPORT_C static TTime MinTTime(); |
|
1882 IMPORT_C static TInt DaysInMonth(TInt aYear, TMonth aMonth); |
|
1883 IMPORT_C static TBool IsLeapYear(TInt aYear); |
|
1884 IMPORT_C static TInt LeapYearsUpTo(TInt aYear); |
|
1885 }; |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 /** |
|
1891 @publishedAll |
|
1892 @released |
|
1893 |
|
1894 Gets a copy of the current locale's full text name for a day of the week. |
|
1895 |
|
1896 After construction or after a call to Set(), the copy of the text can be accessed |
|
1897 and manipulated using the standard descriptor member functions provided by |
|
1898 the base class. |
|
1899 |
|
1900 @see KMaxDayName |
|
1901 */ |
|
1902 class TDayName : public TBuf<KMaxDayName> |
|
1903 { |
|
1904 public: |
|
1905 IMPORT_C TDayName(); |
|
1906 IMPORT_C TDayName(TDay aDay); |
|
1907 IMPORT_C void Set(TDay aDay); |
|
1908 }; |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 /** |
|
1914 @publishedAll |
|
1915 @released |
|
1916 |
|
1917 Gets a copy of the current locale's abbreviated text name for a day of the |
|
1918 week. |
|
1919 |
|
1920 After construction or after a call to Set(), the copy of the abbreviated text |
|
1921 can be accessed and manipulated using the standard descriptor member functions |
|
1922 provided by the base class. |
|
1923 |
|
1924 The abbreviated day name cannot be assumed to be one character. In English, |
|
1925 it is 3 characters (Mon, Tue, Wed etc.), but the length can vary from locale |
|
1926 to locale, with a maximum length of KMaxDayNameAbb. |
|
1927 |
|
1928 @see KMaxDayNameAbb |
|
1929 */ |
|
1930 class TDayNameAbb : public TBuf<KMaxDayNameAbb> |
|
1931 { |
|
1932 public: |
|
1933 IMPORT_C TDayNameAbb(); |
|
1934 IMPORT_C TDayNameAbb(TDay aDay); |
|
1935 IMPORT_C void Set(TDay aDay); |
|
1936 }; |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 /** |
|
1942 @publishedAll |
|
1943 @released |
|
1944 |
|
1945 Gets a copy of the current locale's full text name for a month. |
|
1946 |
|
1947 After construction or after a call to Set(), the copy of the text can be accessed |
|
1948 and manipulated using the standard descriptor member functions provided by |
|
1949 the base class. |
|
1950 |
|
1951 @see KMaxMonthName |
|
1952 */ |
|
1953 class TMonthName : public TBuf<KMaxMonthName> |
|
1954 { |
|
1955 public: |
|
1956 IMPORT_C TMonthName(); |
|
1957 IMPORT_C TMonthName(TMonth aMonth); |
|
1958 IMPORT_C void Set(TMonth aMonth); |
|
1959 }; |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 /** |
|
1965 @publishedAll |
|
1966 @released |
|
1967 |
|
1968 Gets a copy of the current locale's abbreviated text name for a month. |
|
1969 |
|
1970 After construction or after a call to Set(), the copy of the abbreviated text |
|
1971 can be accessed and manipulated using the standard descriptor member functions |
|
1972 provided by the base class. |
|
1973 |
|
1974 @see KMaxMonthNameAbb |
|
1975 */ |
|
1976 class TMonthNameAbb : public TBuf<KMaxMonthNameAbb> |
|
1977 { |
|
1978 public: |
|
1979 IMPORT_C TMonthNameAbb(); |
|
1980 IMPORT_C TMonthNameAbb(TMonth aMonth); |
|
1981 IMPORT_C void Set(TMonth aMonth); |
|
1982 }; |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 /** |
|
1988 @publishedAll |
|
1989 @released |
|
1990 |
|
1991 Gets a copy of the current locale's date suffix text for a specific day in |
|
1992 the month. |
|
1993 |
|
1994 The text is the set of characters which can be appended to dates of the month |
|
1995 (e.g. in English, st for 1st, nd for 2nd etc). |
|
1996 |
|
1997 After construction or after a call to Set(), the copy of the suffix text can |
|
1998 be accessed and manipulated using the standard descriptor member functions |
|
1999 provided by the base class. |
|
2000 */ |
|
2001 class TDateSuffix : public TBuf<KMaxSuffix> |
|
2002 { |
|
2003 public: |
|
2004 IMPORT_C TDateSuffix(); |
|
2005 IMPORT_C TDateSuffix(TInt aDateSuffix); |
|
2006 IMPORT_C void Set(TInt aDateSuffix); |
|
2007 }; |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 /** |
|
2013 @publishedAll |
|
2014 @released |
|
2015 |
|
2016 Current locale's am/pm text |
|
2017 |
|
2018 This class retrieves a copy of the current locale's text identifying time |
|
2019 before and after noon. In English, this is am and pm. |
|
2020 |
|
2021 After construction or after a call to Set(), the copy of the text can be accessed |
|
2022 and manipulated using the standard descriptor member functions provided by |
|
2023 the base class. |
|
2024 */ |
|
2025 class TAmPmName : public TBuf<KMaxAmPmName> |
|
2026 { |
|
2027 public: |
|
2028 IMPORT_C TAmPmName(); |
|
2029 IMPORT_C TAmPmName(TAmPm aSelector); |
|
2030 IMPORT_C void Set(TAmPm aSelector); |
|
2031 }; |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 /** |
|
2037 @publishedAll |
|
2038 @released |
|
2039 |
|
2040 Gets a copy of the currency symbol(s) in use by the current locale. |
|
2041 |
|
2042 After construction or after a call to TCurrencySymbol::Set(), the copy of |
|
2043 the currency symbol(s) can be accessed and manipulated using the standard |
|
2044 descriptor member functions provided by the base class. |
|
2045 */ |
|
2046 class TCurrencySymbol : public TBuf<KMaxCurrencySymbol> |
|
2047 { |
|
2048 public: |
|
2049 IMPORT_C TCurrencySymbol(); |
|
2050 IMPORT_C void Set(); |
|
2051 }; |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 /** |
|
2057 @publishedAll |
|
2058 @released |
|
2059 |
|
2060 Contains a format list that defines the short date format. |
|
2061 |
|
2062 An instance of this class should be passed as the second argument |
|
2063 to TTime::FormatL(). |
|
2064 The string does not include any time components. The content of the long |
|
2065 date format specification is taken from the system-wide settings. |
|
2066 |
|
2067 For example, in the English locale, the short date format would be something |
|
2068 like 14/1/2000. |
|
2069 |
|
2070 This class is used as follows: |
|
2071 |
|
2072 @code |
|
2073 TTime now; |
|
2074 now.HomeTime(); |
|
2075 TBuf<KMaxShortDateFormatSpec*2> buffer; |
|
2076 now.FormatL(buffer,TShortDateFormatSpec()); |
|
2077 @endcode |
|
2078 |
|
2079 @see KMaxShortDateFormatSpec |
|
2080 @see TTime::FormatL |
|
2081 */ |
|
2082 class TShortDateFormatSpec : public TBuf<KMaxShortDateFormatSpec> // to be passed into TTime::FormatL |
|
2083 { |
|
2084 public: |
|
2085 IMPORT_C TShortDateFormatSpec(); |
|
2086 IMPORT_C void Set(); |
|
2087 }; |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 /** |
|
2093 @publishedAll |
|
2094 @released |
|
2095 |
|
2096 Contains a format list that defines the long date format. |
|
2097 |
|
2098 An instance of this class should be passed as the second argument |
|
2099 to TTime::FormatL(). |
|
2100 The string does not include any time components. The content of the long |
|
2101 date format specification is taken from the system-wide settings. |
|
2102 |
|
2103 For example, in the English locale, the long date format would be |
|
2104 something like 14th January 2000. |
|
2105 |
|
2106 This class is used as follows: |
|
2107 |
|
2108 @code |
|
2109 TTime now; |
|
2110 now.HomeTime(); |
|
2111 TBuf<KMaxLongDateFormatSpec*2> buffer; |
|
2112 now.FormatL(buffer,TLongDateFormatSpec()); |
|
2113 @endcode |
|
2114 |
|
2115 @see KMaxLongDateFormatSpec |
|
2116 @see TTime::FormatL |
|
2117 */ |
|
2118 class TLongDateFormatSpec : public TBuf<KMaxLongDateFormatSpec> // to be passed into TTime::FormatL |
|
2119 { |
|
2120 public: |
|
2121 IMPORT_C TLongDateFormatSpec(); |
|
2122 IMPORT_C void Set(); |
|
2123 }; |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 /** |
|
2129 @publishedAll |
|
2130 @released |
|
2131 |
|
2132 Contains a format list that defines the time string format. |
|
2133 |
|
2134 An instance of this class should be passed as the second argument |
|
2135 to TTime::FormatL(). |
|
2136 The string does not include any time components. The content of the time format |
|
2137 specification is taken from the system-wide settings. |
|
2138 |
|
2139 This class is used as follows: |
|
2140 |
|
2141 @code |
|
2142 TTime now; |
|
2143 now.HomeTime(); |
|
2144 TBuf<KMaxTimeFormatSpec*2> buffer; |
|
2145 now.FormatL(buffer,TTimeFormatSpec()); |
|
2146 @endcode |
|
2147 |
|
2148 @see KMaxTimeFormatSpec |
|
2149 @see TTime::FormatL |
|
2150 */ |
|
2151 class TTimeFormatSpec : public TBuf<KMaxTimeFormatSpec> // to be passed into TTime::FormatL |
|
2152 { |
|
2153 public: |
|
2154 IMPORT_C TTimeFormatSpec(); |
|
2155 IMPORT_C void Set(); |
|
2156 }; |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 /** |
|
2162 @publishedAll |
|
2163 @released |
|
2164 |
|
2165 Sets and gets the system's locale settings. |
|
2166 |
|
2167 Symbian OS maintains the locale information internally. On |
|
2168 construction, this object is initialized with the system information |
|
2169 for all locale items. |
|
2170 */ |
|
2171 class TLocale |
|
2172 { |
|
2173 public: |
|
2174 |
|
2175 /** |
|
2176 Indicates how negative currency values are formatted. |
|
2177 */ |
|
2178 enum TNegativeCurrencyFormat |
|
2179 { |
|
2180 /** |
|
2181 A minus sign is inserted before the currency symbol and value. |
|
2182 */ |
|
2183 ELeadingMinusSign, |
|
2184 |
|
2185 /** |
|
2186 The currency value and symbol are enclosed in brackets (no minus sign |
|
2187 is used). |
|
2188 */ |
|
2189 EInBrackets, //this one must be non-zero for binary compatibility with the old TBool TLocale::iCurrencyNegativeInBrackets which was exposed in the binary interface because it was accessed via *inline* functions |
|
2190 |
|
2191 /** |
|
2192 A minus sign is inserted after the currency symbol and value. |
|
2193 */ |
|
2194 ETrailingMinusSign, |
|
2195 |
|
2196 /** |
|
2197 A minus sign is inserted between the currency symbol and the value. |
|
2198 */ |
|
2199 EInterveningMinusSign |
|
2200 }; |
|
2201 |
|
2202 /** |
|
2203 Flags for negative currency values formatting |
|
2204 */ |
|
2205 enum |
|
2206 { |
|
2207 /** |
|
2208 If this flag is set and the currency value being formatted is negative, |
|
2209 if there is a space between the currency symbol and the value, |
|
2210 that space is lost. |
|
2211 */ |
|
2212 EFlagNegativeLoseSpace = 0x00000001, |
|
2213 |
|
2214 /** |
|
2215 If this flag is set and the currency value being formatted is negative, |
|
2216 the position of the currency symbol is placed in the opposite direction |
|
2217 from the position set for the positive currency value. |
|
2218 */ |
|
2219 EFlagNegativeCurrencySymbolOpposite=0x00000002 |
|
2220 }; |
|
2221 /** Indicates how the device universal time is maintained */ |
|
2222 enum TDeviceTimeState |
|
2223 { |
|
2224 /** Universal time is maintained by the device RTC and the user selection |
|
2225 of the locale of the device indicating offset from GMT and daylight saving*/ |
|
2226 EDeviceUserTime, |
|
2227 |
|
2228 /** Universal time and offset from GMT is supplied by the mobile network |
|
2229 and maintained by device RTC */ |
|
2230 ENITZNetworkTimeSync |
|
2231 }; |
|
2232 public: |
|
2233 IMPORT_C TLocale(); |
|
2234 inline TLocale(TInt); |
|
2235 IMPORT_C void Refresh(); |
|
2236 IMPORT_C TInt Set() const; |
|
2237 IMPORT_C void FormatCurrency(TDes& aText, TInt aAmount); |
|
2238 IMPORT_C void FormatCurrency(TDes& aText, TInt64 aAmount); |
|
2239 IMPORT_C void FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt aAmount); |
|
2240 IMPORT_C void FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt64 aAmount); |
|
2241 |
|
2242 inline TInt CountryCode() const; |
|
2243 inline void SetCountryCode(TInt aCode); |
|
2244 inline TTimeIntervalSeconds UniversalTimeOffset() const; |
|
2245 inline TDateFormat DateFormat() const; |
|
2246 inline void SetDateFormat(TDateFormat aFormat); |
|
2247 inline TTimeFormat TimeFormat() const; |
|
2248 inline void SetTimeFormat(TTimeFormat aFormat); |
|
2249 inline TLocalePos CurrencySymbolPosition() const; |
|
2250 inline void SetCurrencySymbolPosition(TLocalePos aPos); |
|
2251 inline TBool CurrencySpaceBetween() const; |
|
2252 inline void SetCurrencySpaceBetween(TBool aSpace); |
|
2253 inline TInt CurrencyDecimalPlaces() const; |
|
2254 inline void SetCurrencyDecimalPlaces(TInt aPlaces); |
|
2255 inline TBool CurrencyNegativeInBrackets() const; // These two functions are deprecated |
|
2256 inline void SetCurrencyNegativeInBrackets(TBool aBool); // They are here to maintain compatibility. Use the New functions -> NegativeCurrencyFormat setter/getter. |
|
2257 inline TBool CurrencyTriadsAllowed() const; |
|
2258 inline void SetCurrencyTriadsAllowed(TBool aBool); |
|
2259 inline TChar ThousandsSeparator() const; |
|
2260 inline void SetThousandsSeparator(const TChar& aChar); |
|
2261 inline TChar DecimalSeparator() const; |
|
2262 inline void SetDecimalSeparator(const TChar& aChar); |
|
2263 inline TChar DateSeparator(TInt aIndex) const; |
|
2264 inline void SetDateSeparator(const TChar& aChar,TInt aIndex); |
|
2265 inline TChar TimeSeparator(TInt aIndex) const; |
|
2266 inline void SetTimeSeparator(const TChar& aChar,TInt aIndex); |
|
2267 inline TBool AmPmSpaceBetween() const; |
|
2268 inline void SetAmPmSpaceBetween(TBool aSpace); |
|
2269 inline TLocalePos AmPmSymbolPosition() const; |
|
2270 inline void SetAmPmSymbolPosition(TLocalePos aPos); |
|
2271 inline TUint DaylightSaving() const; |
|
2272 inline TBool QueryHomeHasDaylightSavingOn() const; |
|
2273 inline TDaylightSavingZone HomeDaylightSavingZone() const; |
|
2274 inline TUint WorkDays() const; |
|
2275 inline void SetWorkDays(TUint aMask); |
|
2276 inline TDay StartOfWeek() const; |
|
2277 inline void SetStartOfWeek(TDay aDay); |
|
2278 inline TClockFormat ClockFormat() const; |
|
2279 inline void SetClockFormat(TClockFormat aFormat); |
|
2280 inline TUnitsFormat UnitsGeneral() const; |
|
2281 inline void SetUnitsGeneral(TUnitsFormat aFormat); |
|
2282 inline TUnitsFormat UnitsDistanceShort() const; |
|
2283 inline void SetUnitsDistanceShort(TUnitsFormat aFormat); |
|
2284 inline TUnitsFormat UnitsDistanceLong() const; |
|
2285 inline void SetUnitsDistanceLong(TUnitsFormat aFormat); |
|
2286 inline TNegativeCurrencyFormat NegativeCurrencyFormat() const; |
|
2287 inline void SetNegativeCurrencyFormat(TNegativeCurrencyFormat aNegativeCurrencyFormat); |
|
2288 inline TBool NegativeLoseSpace() const; |
|
2289 inline void SetNegativeLoseSpace(TBool aBool); |
|
2290 inline TBool NegativeCurrencySymbolOpposite() const; |
|
2291 inline void SetNegativeCurrencySymbolOpposite(TBool aBool); |
|
2292 inline TLanguage LanguageDowngrade(TInt aIndex) const; // 0 <= aIndex < 3 |
|
2293 inline void SetLanguageDowngrade(TInt aIndex, TLanguage aLanguage); |
|
2294 inline TDigitType DigitType() const; |
|
2295 inline void SetDigitType(TDigitType aDigitType); |
|
2296 inline TDeviceTimeState DeviceTime() const; |
|
2297 inline void SetDeviceTime(TDeviceTimeState aState); |
|
2298 |
|
2299 void SetDefaults(); /**< @internalComponent */ |
|
2300 |
|
2301 private: |
|
2302 friend class TExtendedLocale; |
|
2303 private: |
|
2304 TInt iCountryCode; |
|
2305 TTimeIntervalSeconds iUniversalTimeOffset; |
|
2306 TDateFormat iDateFormat; |
|
2307 TTimeFormat iTimeFormat; |
|
2308 TLocalePos iCurrencySymbolPosition; |
|
2309 TBool iCurrencySpaceBetween; |
|
2310 TInt iCurrencyDecimalPlaces; |
|
2311 TNegativeCurrencyFormat iNegativeCurrencyFormat; // replaced TBool iCurrencyNegativeInBrackets |
|
2312 TBool iCurrencyTriadsAllowed; |
|
2313 TChar iThousandsSeparator; |
|
2314 TChar iDecimalSeparator; |
|
2315 TChar iDateSeparator[KMaxDateSeparators]; |
|
2316 TChar iTimeSeparator[KMaxTimeSeparators]; |
|
2317 TLocalePos iAmPmSymbolPosition; |
|
2318 TBool iAmPmSpaceBetween; |
|
2319 TUint iDaylightSaving; |
|
2320 TDaylightSavingZone iHomeDaylightSavingZone; |
|
2321 TUint iWorkDays; |
|
2322 TDay iStartOfWeek; |
|
2323 TClockFormat iClockFormat; |
|
2324 TUnitsFormat iUnitsGeneral; |
|
2325 TUnitsFormat iUnitsDistanceShort; |
|
2326 TUnitsFormat iUnitsDistanceLong; |
|
2327 TUint iExtraNegativeCurrencyFormatFlags; |
|
2328 TUint16 iLanguageDowngrade[3]; |
|
2329 TUint16 iSpare16; |
|
2330 TDigitType iDigitType; |
|
2331 TDeviceTimeState iDeviceTimeState; |
|
2332 TInt iSpare[0x1E]; |
|
2333 }; |
|
2334 |
|
2335 /** |
|
2336 @publishedAll |
|
2337 @released |
|
2338 |
|
2339 TLocaleAspect |
|
2340 |
|
2341 Enumeration used with TExtendedLocale::LoadLocaleAspect to select which |
|
2342 locale information is to be replaced from the contents of the Locale |
|
2343 DLL being loaded. |
|
2344 |
|
2345 ELocaleLanguageSettings - Replaces everything that should change with |
|
2346 language selection e.g. Month names, Day names, |
|
2347 etc, |
|
2348 |
|
2349 ELocaleLocaleSettings - Replaces the currently selected currency symbol, |
|
2350 TLocale settings, and FAT utility functions |
|
2351 |
|
2352 ELocaleTimeAndDateSettings - Replaces the current time and date display |
|
2353 format settings. |
|
2354 |
|
2355 ELocaleCollateSettings - Replaces the "system" preferred Charset |
|
2356 (because that's where the collation table |
|
2357 is!). The "Default" charset will remain |
|
2358 unchanged until after the next power |
|
2359 off/on cycle |
|
2360 */ |
|
2361 enum TLocaleAspect |
|
2362 { |
|
2363 ELocaleLanguageSettings = 0x01, |
|
2364 ELocaleCollateSetting = 0x02, |
|
2365 ELocaleLocaleSettings = 0x04, |
|
2366 ELocaleTimeDateSettings = 0x08, |
|
2367 }; |
|
2368 |
|
2369 /** |
|
2370 @internalComponent |
|
2371 */ |
|
2372 struct SLocaleLanguage |
|
2373 { |
|
2374 TLanguage iLanguage; |
|
2375 const TText* iDateSuffixTable; |
|
2376 const TText* iDayTable; |
|
2377 const TText* iDayAbbTable; |
|
2378 const TText* iMonthTable; |
|
2379 const TText* iMonthAbbTable; |
|
2380 const TText* iAmPmTable; |
|
2381 const TText16* const* iMsgTable; |
|
2382 }; |
|
2383 |
|
2384 /** |
|
2385 @internalComponent |
|
2386 */ |
|
2387 struct SLocaleLocaleSettings |
|
2388 { |
|
2389 TText iCurrencySymbol[KMaxCurrencySymbol+1]; |
|
2390 TAny* iLocaleExtraSettingsDllPtr; |
|
2391 }; |
|
2392 |
|
2393 /** |
|
2394 @internalComponent |
|
2395 */ |
|
2396 struct SLocaleTimeDateFormat |
|
2397 { |
|
2398 TText iShortDateFormatSpec[KMaxShortDateFormatSpec+1]; |
|
2399 TText iLongDateFormatSpec[KMaxLongDateFormatSpec+1]; |
|
2400 TText iTimeFormatSpec[KMaxTimeFormatSpec+1]; |
|
2401 TAny* iLocaleTimeDateFormatDllPtr; |
|
2402 }; |
|
2403 |
|
2404 struct LCharSet; |
|
2405 |
|
2406 /** |
|
2407 @publishedAll |
|
2408 @released |
|
2409 |
|
2410 Extended locale class |
|
2411 |
|
2412 This class holds a collection of locale information. It contains a TLocale internally. |
|
2413 It has methods to load a locale DLL and to set the system wide locale information. |
|
2414 |
|
2415 */ |
|
2416 class TExtendedLocale |
|
2417 { |
|
2418 public: |
|
2419 |
|
2420 // Default constructor, create an empty instance |
|
2421 IMPORT_C TExtendedLocale(); |
|
2422 |
|
2423 // Initialise to (or restore from!) current system wide locale |
|
2424 // settings |
|
2425 IMPORT_C void LoadSystemSettings(); |
|
2426 |
|
2427 // Overwrite current system wide locale settings with the current |
|
2428 // contents of this TExtendedLocale |
|
2429 IMPORT_C TInt SaveSystemSettings(); |
|
2430 |
|
2431 // Load a complete set of locale data from a named Locale DLL |
|
2432 IMPORT_C TInt LoadLocale(const TDesC& aLocaleDllName); |
|
2433 |
|
2434 // Load an additional Locale DLL and over-ride a selected subset |
|
2435 // (currently ELocaleLanguageSettings to select an alternative set |
|
2436 // of language specific text strings, ELocaleCollateSetting to |
|
2437 // select a new system collation table, |
|
2438 // ELocaleOverRideMatchCollationTable to locally select an |
|
2439 // alternative collation order for matching text strings, or |
|
2440 // ELocaleOverRideSortCollationTable for ordering text strings) |
|
2441 // of settings with its contents |
|
2442 IMPORT_C TInt LoadLocaleAspect(TUint aAspectGroup, const TDesC& aLocaleDllName); |
|
2443 |
|
2444 // Set the currency Symbol |
|
2445 IMPORT_C TInt SetCurrencySymbol(const TDesC &aSymbol); |
|
2446 |
|
2447 // Get the name of the DLL holding the data for a particular set |
|
2448 // of Locale properties |
|
2449 IMPORT_C TInt GetLocaleDllName(TLocaleAspect aLocaleDataSet, TDes& aDllName); |
|
2450 |
|
2451 // Get the preferred collation method. |
|
2452 // Note that some Charsets may contain more than one Collation |
|
2453 // method (e.g "dictionary" v "phonebook" ordering) so an optional |
|
2454 // index parameter can be used to select between them |
|
2455 IMPORT_C TCollationMethod GetPreferredCollationMethod(TInt index = 0) ; |
|
2456 |
|
2457 //Get the Currency Symbol |
|
2458 IMPORT_C TPtrC GetCurrencySymbol(); |
|
2459 |
|
2460 //Get the Long Date Format |
|
2461 IMPORT_C TPtrC GetLongDateFormatSpec(); |
|
2462 |
|
2463 //Get the Short Date Format |
|
2464 IMPORT_C TPtrC GetShortDateFormatSpec(); |
|
2465 |
|
2466 //Get the Time Format |
|
2467 IMPORT_C TPtrC GetTimeFormatSpec(); |
|
2468 |
|
2469 // Retrieve a reference to the encapsulated TLocale |
|
2470 inline TLocale* GetLocale(); |
|
2471 |
|
2472 inline const LCharSet* GetDefaultCharSet(); |
|
2473 inline const LCharSet* GetPreferredCharSet(); |
|
2474 inline SLocaleLanguage* GetLanguageSettings(); |
|
2475 inline SLocaleLocaleSettings* GetLocaleExtraSettings(); |
|
2476 inline SLocaleTimeDateFormat* GetLocaleTimeDateFormat(); |
|
2477 |
|
2478 private: |
|
2479 |
|
2480 TInt DoLoadLocale(const TDesC& aLocaleDllName, TLibraryFunction* aExportList); |
|
2481 void DoUpdateLanguageSettings(TLibraryFunction* aExportList); |
|
2482 void DoUpdateLocaleSettings(TLibraryFunction* aExportList); |
|
2483 void DoUpdateTimeDateFormat(TLibraryFunction* aExportList); |
|
2484 |
|
2485 private: |
|
2486 |
|
2487 TLocale iLocale; |
|
2488 SLocaleLanguage iLanguageSettings; |
|
2489 SLocaleLocaleSettings iLocaleExtraSettings; |
|
2490 SLocaleTimeDateFormat iLocaleTimeDateFormat; |
|
2491 const LCharSet* iDefaultCharSet; |
|
2492 const LCharSet* iPreferredCharSet; |
|
2493 }; |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 /** |
|
2499 @publishedAll |
|
2500 @released |
|
2501 |
|
2502 Geometric rectangle. |
|
2503 |
|
2504 The class represents a rectangle whose sides are parallel with the axes of |
|
2505 the co-ordinate system. |
|
2506 |
|
2507 The co-ordinates of the top-left and bottom-right corners are used to set |
|
2508 the dimensions of the rectangle. The bottom right co-ordinate is outside the |
|
2509 rectangle. Thus TRect(TPoint(2,2),TSize(4,4)) is equal |
|
2510 to TRect(TPoint(2,2),TPoint(6,6)), |
|
2511 and in both cases you get a 4x4 pixel rectangle on the screen. |
|
2512 |
|
2513 Functions are provided to initialise and manipulate the rectangle and to extract |
|
2514 information about it. |
|
2515 */ |
|
2516 class TRect |
|
2517 { |
|
2518 public: |
|
2519 enum TUninitialized { EUninitialized }; |
|
2520 /** |
|
2521 Constructs a default rectangle. |
|
2522 |
|
2523 This initialises the co-ordinates of its top |
|
2524 left and bottom right corners to (0,0). |
|
2525 */ |
|
2526 TRect(TUninitialized) {} |
|
2527 IMPORT_C TRect(); |
|
2528 IMPORT_C TRect(TInt aAx,TInt aAy,TInt aBx,TInt aBy); |
|
2529 IMPORT_C TRect(const TPoint& aPointA,const TPoint& aPointB); |
|
2530 IMPORT_C TRect(const TPoint& aPoint,const TSize& aSize); |
|
2531 IMPORT_C TRect(const TSize& aSize); |
|
2532 IMPORT_C TBool operator==(const TRect& aRect) const; |
|
2533 IMPORT_C TBool operator!=(const TRect& aRect) const; |
|
2534 IMPORT_C void SetRect(TInt aAx,TInt aAy,TInt aBx,TInt aBy); |
|
2535 IMPORT_C void SetRect(const TPoint& aPointTL,const TPoint& aPointBR); |
|
2536 IMPORT_C void SetRect(const TPoint& aPoint,const TSize& aSize); |
|
2537 IMPORT_C void Move(TInt aDx,TInt aDy); |
|
2538 IMPORT_C void Move(const TPoint& aOffset); |
|
2539 IMPORT_C void Resize(TInt aDx,TInt aDy); |
|
2540 IMPORT_C void Resize(const TSize& aSize); |
|
2541 IMPORT_C void Shrink(TInt aDx,TInt aDy); |
|
2542 IMPORT_C void Shrink(const TSize& aSize); |
|
2543 IMPORT_C void Grow(TInt aDx,TInt aDy); |
|
2544 IMPORT_C void Grow(const TSize& aSize); |
|
2545 IMPORT_C void BoundingRect(const TRect& aRect); |
|
2546 IMPORT_C TBool IsEmpty() const; |
|
2547 IMPORT_C TBool Intersects(const TRect& aRect) const; |
|
2548 IMPORT_C void Intersection(const TRect& aRect); |
|
2549 IMPORT_C void Normalize(); |
|
2550 IMPORT_C TBool Contains(const TPoint& aPoint) const; |
|
2551 IMPORT_C TSize Size() const; |
|
2552 IMPORT_C TInt Width() const; |
|
2553 IMPORT_C TInt Height() const; |
|
2554 IMPORT_C TBool IsNormalized() const; |
|
2555 IMPORT_C TPoint Center() const; |
|
2556 IMPORT_C void SetSize(const TSize& aSize); |
|
2557 IMPORT_C void SetWidth(TInt aWidth); |
|
2558 IMPORT_C void SetHeight(TInt aHeight); |
|
2559 private: |
|
2560 void Adjust(TInt aDx,TInt aDy); |
|
2561 public: |
|
2562 /** |
|
2563 The x and y co-ordinates of the top left hand corner of the rectangle. |
|
2564 */ |
|
2565 TPoint iTl; |
|
2566 |
|
2567 /** |
|
2568 The x and y co-ordinates of the bottom right hand corner of the rectangle. |
|
2569 */ |
|
2570 TPoint iBr; |
|
2571 }; |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 /** |
|
2577 @publishedAll |
|
2578 @released |
|
2579 |
|
2580 Clipping region - abstract base class. |
|
2581 |
|
2582 This abstract base class represents a 2-dimensional area which is used by |
|
2583 Graphics, the graphics window server, and the text window server to define |
|
2584 regions of the display which need to be updated, or regions within which all |
|
2585 operations must occur. |
|
2586 |
|
2587 A TRegion is defined in terms of an array of TRects and the more complex the |
|
2588 region, the more TRects are required to represent it. |
|
2589 |
|
2590 A clipping region initially has space allocated for five rectangles. |
|
2591 If manipulations result in a region which requires more than this, an attempt |
|
2592 is made to allocate more rectangles. If this cannot be done, an error flag |
|
2593 is set, and all subsequent operations involving the region have no effect |
|
2594 (except possibly to propagate the error flag to other regions). |
|
2595 The CheckError() member function allows |
|
2596 the error flag to be tested; Clear() can be used to clear it. |
|
2597 |
|
2598 The redraw logic of application programs may use the TRegion in various ways: |
|
2599 |
|
2600 1. minimally, they pass it to the graphics context as the clipping region; when |
|
2601 a graphics context is activated to a window, the clipping region is set up |
|
2602 automatically |
|
2603 |
|
2604 2. if they wish to avoid redrawing objects which are outside the general area |
|
2605 of the region, they may use TRegion::BoundingRect() to return the rectangle |
|
2606 which bounds the clipping region, and draw only primitives that lie within |
|
2607 that rectangle |
|
2608 |
|
2609 3. if they wish to exercise finer control, they may extract the individual rectangles |
|
2610 that comprise the clipping region using Operator[](). |
|
2611 |
|
2612 Application programs may also manipulate clipping regions in order to constrain |
|
2613 parts of their redrawing to narrower areas of the screen than the clipping |
|
2614 region offered by the window server. To do this, functions that allow clipping |
|
2615 region manipulation may be used; for example, adding or removing rectangles |
|
2616 or finding the intersection or union of two regions. |
|
2617 */ |
|
2618 class TRegion |
|
2619 { |
|
2620 public: |
|
2621 inline TInt Count() const; |
|
2622 inline const TRect* RectangleList() const; |
|
2623 inline TBool CheckError() const; |
|
2624 IMPORT_C TBool IsEmpty() const; |
|
2625 IMPORT_C TRect BoundingRect() const; |
|
2626 IMPORT_C const TRect& operator[](TInt aIndex) const; |
|
2627 IMPORT_C void Copy(const TRegion& aRegion); |
|
2628 IMPORT_C void AddRect(const TRect& aRect); |
|
2629 IMPORT_C void SubRect(const TRect& aRect,TRegion* aSubtractedRegion=NULL); |
|
2630 IMPORT_C void Offset(TInt aXoffset,TInt aYoffset); |
|
2631 IMPORT_C void Offset(const TPoint& aOffset); |
|
2632 IMPORT_C void Union(const TRegion& aRegion); |
|
2633 IMPORT_C void Intersection(const TRegion& aRegion,const TRegion& aRegion2); |
|
2634 IMPORT_C void Intersect(const TRegion& aRegion); |
|
2635 IMPORT_C void SubRegion(const TRegion& aRegion,TRegion* aSubtractedRegion=NULL); |
|
2636 IMPORT_C void ClipRect(const TRect& aRect); |
|
2637 IMPORT_C void Clear(); |
|
2638 IMPORT_C void Tidy(); |
|
2639 IMPORT_C TInt Sort(); |
|
2640 IMPORT_C TInt Sort(const TPoint& aOffset); |
|
2641 IMPORT_C void ForceError(); |
|
2642 IMPORT_C TBool IsContainedBy(const TRect& aRect) const; |
|
2643 IMPORT_C TBool Contains(const TPoint& aPoint) const; |
|
2644 IMPORT_C TBool Intersects(const TRect& aRect) const; |
|
2645 protected: |
|
2646 IMPORT_C TRect* RectangleListW(); |
|
2647 IMPORT_C TRegion(TInt aAllocedRects); |
|
2648 inline TRegion(); |
|
2649 TBool SetListSize(TInt aCount); |
|
2650 void AppendRect(const TRect& aRect); |
|
2651 void DeleteRect(TRect* aRect); |
|
2652 void AppendRegion(TRegion& aRegion); |
|
2653 protected: |
|
2654 TInt iCount; |
|
2655 TBool iError; |
|
2656 TInt iAllocedRects; |
|
2657 protected: |
|
2658 enum {ERRegionBuf=0x40000000}; |
|
2659 }; |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 /** |
|
2665 @publishedAll |
|
2666 @released |
|
2667 |
|
2668 Expandable region. |
|
2669 |
|
2670 This class provides for the construction and destruction of a TRegion, including |
|
2671 a granularity for expanding the region. A region;s granularity represents |
|
2672 the number of memory slots allocated when the object is created, and the number |
|
2673 of new memory slots allocated each time an RRegion is expanded beyond the |
|
2674 number of free slots. The default granularity is five. |
|
2675 */ |
|
2676 class RRegion : public TRegion |
|
2677 { |
|
2678 private: |
|
2679 enum {EDefaultGranularity=5}; |
|
2680 protected: |
|
2681 IMPORT_C RRegion(TInt aBuf,TInt aGran); |
|
2682 public: |
|
2683 IMPORT_C RRegion(); |
|
2684 IMPORT_C RRegion(TInt aGran); |
|
2685 IMPORT_C RRegion(const RRegion& aRegion); |
|
2686 IMPORT_C RRegion(const TRect& aRect,TInt aGran=EDefaultGranularity); |
|
2687 IMPORT_C RRegion(TInt aCount,TRect* aRectangleList,TInt aGran=EDefaultGranularity); |
|
2688 IMPORT_C void Close(); |
|
2689 IMPORT_C void Destroy(); |
|
2690 inline TInt CheckSpare() const; |
|
2691 private: |
|
2692 TInt iGranularity; |
|
2693 TRect* iRectangleList; |
|
2694 friend class TRegion; |
|
2695 }; |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 /** |
|
2701 @publishedAll |
|
2702 @released |
|
2703 |
|
2704 Region with pre-allocated buffer. |
|
2705 |
|
2706 This class provides the functionality of an RRegion, but in addition, for |
|
2707 optimisation purposes, uses a buffer containing pre-allocated space for as |
|
2708 many rectangles as are specified in the granularity. |
|
2709 |
|
2710 When this buffer is full, cell allocation takes place as for an RRegion, and |
|
2711 the RRegionBuf effectively becomes an RRegion. In this case, the region does |
|
2712 not revert to using the buffer, even if the region were to shrink so that |
|
2713 the buffer could, once again, contain the region. When the region is no longer |
|
2714 required, call Close(), defined in the base class RRegion, to free up all |
|
2715 memory. |
|
2716 */ |
|
2717 template <TInt S> |
|
2718 class RRegionBuf : public RRegion |
|
2719 { |
|
2720 public: |
|
2721 inline RRegionBuf(); |
|
2722 inline RRegionBuf(const RRegion& aRegion); |
|
2723 inline RRegionBuf(const RRegionBuf<S>& aRegion); |
|
2724 inline RRegionBuf(const TRect& aRect); |
|
2725 private: |
|
2726 TInt8 iRectangleBuf[S*sizeof(TRect)]; |
|
2727 }; |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 /** |
|
2733 @publishedAll |
|
2734 @released |
|
2735 |
|
2736 A fixed size region. |
|
2737 |
|
2738 The region consists of a fixed number of rectangles; this number is specified |
|
2739 in the templated argument. The region cannot be expanded to contain more than |
|
2740 this number of rectangles. If an attempt is made to do so, the region's |
|
2741 error flag is set, and the region is cleared. |
|
2742 |
|
2743 Note that when adding a rectangle to a region, if that rectangle overlaps |
|
2744 an existing rectangle, the operation causes more than one rectangle to be |
|
2745 created. |
|
2746 */ |
|
2747 template <TInt S> |
|
2748 class TRegionFix : public TRegion |
|
2749 { |
|
2750 public: |
|
2751 inline TRegionFix(); |
|
2752 inline TRegionFix(const TRect& aRect); |
|
2753 inline TRegionFix(const TRegionFix<S>& aRegion); |
|
2754 private: |
|
2755 TInt8 iRectangleBuf[S*sizeof(TRect)]; |
|
2756 }; |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 /** |
|
2762 @publishedAll |
|
2763 @released |
|
2764 |
|
2765 Base class for searching for global kernel objects. |
|
2766 |
|
2767 This is the base class for a number of classes which are used to find specific |
|
2768 types of global kernel object such as semaphores, threads and mutexes; |
|
2769 TFindSemaphore, TFindThread and TFindMutex are typical examples of such |
|
2770 derived classes. |
|
2771 |
|
2772 The class implements the common behaviour, specifically, the storage of the |
|
2773 match pattern which is used to search for object names. |
|
2774 |
|
2775 This class is not intended to be explicitly instantiated; it has public |
|
2776 constructors but they are part of the class implementation and are described |
|
2777 for information only. |
|
2778 */ |
|
2779 class TFindHandleBase : public TFindHandle |
|
2780 { |
|
2781 public: |
|
2782 IMPORT_C TFindHandleBase(); |
|
2783 IMPORT_C TFindHandleBase(const TDesC& aMatch); |
|
2784 IMPORT_C void Find(const TDesC& aMatch); |
|
2785 protected: |
|
2786 TInt NextObject(TFullName& aResult,TInt aObjectType); |
|
2787 private: |
|
2788 |
|
2789 /** |
|
2790 The full name of the last kernel side object found. |
|
2791 */ |
|
2792 TFullName iMatch; |
|
2793 }; |
|
2794 |
|
2795 |
|
2796 |
|
2797 |
|
2798 /** |
|
2799 @publishedAll |
|
2800 @released |
|
2801 |
|
2802 Finds all global semaphores whose full names match a specified pattern. |
|
2803 |
|
2804 The match pattern can be set into the TFindSemaphore object at construction; |
|
2805 it can also be changed at any time after construction by using the Find() |
|
2806 member function of the TFindHandleBase base class. |
|
2807 |
|
2808 After construction, the Next() member function can be used repeatedly to find |
|
2809 successive global semaphores whose full names match the current pattern. |
|
2810 |
|
2811 A successful call to Next() means that a matching global semaphore has been |
|
2812 found. To open a handle on this semaphore, call the RSemaphore::Open() function |
|
2813 and pass a reference to this TFindSemaphore. |
|
2814 |
|
2815 Pattern matching is part of descriptor behaviour. |
|
2816 |
|
2817 @see TFindHandleBase::Find |
|
2818 @see TFindSemaphore::Next |
|
2819 @see RSemaphore::Open |
|
2820 @see TDesC16::Match |
|
2821 @see TDesC8::Match |
|
2822 */ |
|
2823 class TFindSemaphore : public TFindHandleBase |
|
2824 { |
|
2825 public: |
|
2826 inline TFindSemaphore(); |
|
2827 inline TFindSemaphore(const TDesC& aMatch); |
|
2828 IMPORT_C TInt Next(TFullName& aResult); |
|
2829 }; |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 /** |
|
2835 @publishedAll |
|
2836 @released |
|
2837 |
|
2838 Finds all global mutexes whose full names match a specified pattern. |
|
2839 |
|
2840 The match pattern can be set into the object at construction; it can also |
|
2841 be changed at any time after construction by using the Find() member function |
|
2842 of the base class. |
|
2843 |
|
2844 After construction, the Next() member function may be used repeatedly to find |
|
2845 successive global mutexes whose full names match the current pattern. |
|
2846 |
|
2847 A successful call to Next() means that a matching global mutex has been found. |
|
2848 To open a handle on this mutex, call the Open() member function of RMutex |
|
2849 and pass a reference to this TFindMutex object. |
|
2850 |
|
2851 Pattern matching is part of descriptors behaviour. |
|
2852 |
|
2853 @see TFindHandleBase::Find |
|
2854 @see TFindMutex::Next |
|
2855 @see RMutex::Open |
|
2856 @see TDesC16::Match |
|
2857 @see TDesC8::Match |
|
2858 */ |
|
2859 class TFindMutex : public TFindHandleBase |
|
2860 { |
|
2861 public: |
|
2862 inline TFindMutex(); |
|
2863 inline TFindMutex(const TDesC& aMatch); |
|
2864 IMPORT_C TInt Next(TFullName& aResult); |
|
2865 }; |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 /** |
|
2871 @publishedAll |
|
2872 @released |
|
2873 |
|
2874 Searches for all global chunks by pattern matching against the names of (Kernel |
|
2875 side) chunk objects. |
|
2876 |
|
2877 The match pattern can be set into this object at construction; it can also |
|
2878 be changed at any time after construction by using TFindHandleBase::Find(). |
|
2879 |
|
2880 After construction, call TFindChunk::Next() repeatedly to find successive |
|
2881 chunks whose names match the current pattern. A successful call |
|
2882 to TFindChunk::Next() means that a matching chunk has been found. |
|
2883 |
|
2884 @see TFindHandleBase |
|
2885 */ |
|
2886 class TFindChunk : public TFindHandleBase |
|
2887 { |
|
2888 public: |
|
2889 inline TFindChunk(); |
|
2890 inline TFindChunk(const TDesC& aMatch); |
|
2891 IMPORT_C TInt Next(TFullName& aResult); |
|
2892 }; |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 /** |
|
2899 @publishedAll |
|
2900 @released |
|
2901 |
|
2902 Searches for threads by pattern matching against the names |
|
2903 of thread objects. |
|
2904 |
|
2905 The match pattern can be set into this object at construction; it can also be |
|
2906 changed at any time after construction by using TFindHandleBase::Find(). |
|
2907 |
|
2908 After construction, call TFindThread::Next() repeatedly to find successive |
|
2909 threads whose names match the current pattern. |
|
2910 A successful call to TFindThread::Next() means that a matching thread has |
|
2911 been found. To open a handle on this thread, call RThread::Open() and pass |
|
2912 a reference to this TFindThread. |
|
2913 |
|
2914 @see RThread |
|
2915 */ |
|
2916 class TFindThread : public TFindHandleBase |
|
2917 { |
|
2918 public: |
|
2919 inline TFindThread(); |
|
2920 inline TFindThread(const TDesC& aMatch); |
|
2921 IMPORT_C TInt Next(TFullName& aResult); |
|
2922 }; |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 /** |
|
2928 @publishedAll |
|
2929 @released |
|
2930 |
|
2931 Searches for processes by pattern matching against the names |
|
2932 of process objects. |
|
2933 |
|
2934 The match pattern can be set into this object at construction; it can also be |
|
2935 changed at any time after construction by using TFindHandleBase::Find(). |
|
2936 |
|
2937 After construction, call TFindProcess::Next() repeatedly to find successive |
|
2938 processes whose names match the current pattern. |
|
2939 A successful call to TFindProcess::Next() means that a matching process has |
|
2940 been found. To open a handle on this process, call RProcess::Open() and pass |
|
2941 a reference to this TFindProcess. |
|
2942 |
|
2943 @see RProcess |
|
2944 */ |
|
2945 class TFindProcess : public TFindHandleBase |
|
2946 { |
|
2947 public: |
|
2948 inline TFindProcess(); |
|
2949 inline TFindProcess(const TDesC& aMatch); |
|
2950 IMPORT_C TInt Next(TFullName& aResult); |
|
2951 }; |
|
2952 |
|
2953 |
|
2954 |
|
2955 /** |
|
2956 @publishedAll |
|
2957 @released |
|
2958 |
|
2959 Searches for LDD factory objects by pattern matching against the names of |
|
2960 LDD factory objects. |
|
2961 |
|
2962 An LDD factory object is an instance of a DLogicalDevice derived class. |
|
2963 |
|
2964 The match pattern can be set into this object at construction; it can also |
|
2965 be changed at any time after construction by using TFindHandleBase::Find(). |
|
2966 |
|
2967 After construction, call TFindLogicalDevice::Next() repeatedly to find successive |
|
2968 LDD factory objects whose names match the current pattern. A successful call to |
|
2969 TFindLogicalDevice::Next() means that a matching LDD factory object has been found. |
|
2970 |
|
2971 The name of an LDD factory object is set by its Install() member function as |
|
2972 part of the construction process. |
|
2973 */ |
|
2974 class TFindLogicalDevice : public TFindHandleBase |
|
2975 { |
|
2976 public: |
|
2977 inline TFindLogicalDevice(); |
|
2978 inline TFindLogicalDevice(const TDesC& aMatch); |
|
2979 IMPORT_C TInt Next(TFullName& aResult); |
|
2980 }; |
|
2981 |
|
2982 /** |
|
2983 @publishedAll |
|
2984 @released |
|
2985 |
|
2986 Searches for PDD factory objects by pattern matching against the names of |
|
2987 PDD factory objects. |
|
2988 |
|
2989 A PDD factory object is an instance of a DPhysicalDevice derived class. |
|
2990 |
|
2991 The match pattern can be set into this object at construction; it can also be |
|
2992 changed at any time after construction by using TFindHandleBase::Find(). |
|
2993 |
|
2994 After construction, call TFindPhysicalDevice::Next() repeatedly to find successive |
|
2995 PDD factory objects whose names match the current pattern. A successful call to |
|
2996 TFindPhysicalDevice::Next() means that a matching PDD factory object has been found. |
|
2997 |
|
2998 The name of a PDD factory object is set by its Install() member function as part |
|
2999 of the construction process. |
|
3000 */ |
|
3001 class TFindPhysicalDevice : public TFindHandleBase |
|
3002 { |
|
3003 public: |
|
3004 inline TFindPhysicalDevice(); |
|
3005 inline TFindPhysicalDevice(const TDesC& aMatch); |
|
3006 IMPORT_C TInt Next(TFullName& aResult); |
|
3007 }; |
|
3008 |
|
3009 |
|
3010 |
|
3011 |
|
3012 |
|
3013 /** |
|
3014 @publishedAll |
|
3015 @released |
|
3016 |
|
3017 Searches for servers by pattern matching against the names of kernel side |
|
3018 server objects. |
|
3019 |
|
3020 The match pattern can be set into this object at construction; it can also |
|
3021 be changed at any time after construction by using the TFindHandleBase::Find() |
|
3022 base class. |
|
3023 |
|
3024 After construction, call TFindServer::Next() repeatedly to find successive |
|
3025 servers whose names match the current pattern. |
|
3026 A successful call to TFindServer::Next() means that a matching server |
|
3027 has been found. |
|
3028 */ |
|
3029 class TFindServer : public TFindHandleBase |
|
3030 { |
|
3031 public: |
|
3032 inline TFindServer(); |
|
3033 inline TFindServer(const TDesC& aMatch); |
|
3034 IMPORT_C TInt Next(TFullName& aResult); |
|
3035 }; |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 /** |
|
3041 @publishedAll |
|
3042 @released |
|
3043 |
|
3044 Searches for DLLs whose full names match a specified pattern. |
|
3045 |
|
3046 The match pattern is set at construction but can also be changed at any time |
|
3047 after construction by using TFindHandleBase::Find(). |
|
3048 |
|
3049 After construction, use TFindLibrary::Next() to repeatedly find successive DLLs |
|
3050 whose names match the current pattern. A successful call to |
|
3051 TFindLibrary::Next() means that a matching DLL has been found. |
|
3052 */ |
|
3053 class TFindLibrary : public TFindHandleBase |
|
3054 { |
|
3055 public: |
|
3056 inline TFindLibrary(); |
|
3057 inline TFindLibrary(const TDesC& aMatch); |
|
3058 IMPORT_C TInt Next(TFullName& aResult); |
|
3059 }; |
|
3060 |
|
3061 |
|
3062 |
|
3063 /** |
|
3064 @publishedAll |
|
3065 @released |
|
3066 |
|
3067 User side handle to an LDD factory object, an instance of a DLogicalDevice |
|
3068 derived class. |
|
3069 |
|
3070 The LDD factory object is a Kernel side object which is constructed on the |
|
3071 Kernel heap when the logical device is opened using User::LoadLogicalDevice(). |
|
3072 The handle allows the User side to get information about the logical device. |
|
3073 |
|
3074 To use the device, a thread must create and use an instance of an |
|
3075 RBusLogicalChannel derived class. |
|
3076 |
|
3077 */ |
|
3078 class RDevice : public RHandleBase |
|
3079 { |
|
3080 public: |
|
3081 inline TInt Open(const TFindLogicalDevice& aFind,TOwnerType aType=EOwnerProcess); |
|
3082 IMPORT_C TInt Open(const TDesC& aName,TOwnerType aType=EOwnerProcess); |
|
3083 IMPORT_C void GetCaps(TDes8& aDes) const; |
|
3084 IMPORT_C TBool QueryVersionSupported(const TVersion& aVer) const; |
|
3085 IMPORT_C TBool IsAvailable(TInt aUnit, const TDesC* aPhysicalDevice, const TDesC8* anInfo) const; |
|
3086 }; |
|
3087 |
|
3088 /** |
|
3089 @publishedAll |
|
3090 @released |
|
3091 |
|
3092 Asynchronous timer services. |
|
3093 |
|
3094 Five types of asynchronous request are supported by the class: |
|
3095 |
|
3096 1. Requesting an event after a specified interval |
|
3097 |
|
3098 2. Requesting an event at a specified system time |
|
3099 |
|
3100 3. Requesting a timer event on a specific second fraction |
|
3101 |
|
3102 4. Requesting an event if an interval elapses with no user activity. |
|
3103 |
|
3104 5. Requesting an event after a specified interval, to a resolution of 1ms. |
|
3105 |
|
3106 Each of these requests can be cancelled. |
|
3107 |
|
3108 The timer exists from its creation, following a call to RTimer::CreateLocal(), |
|
3109 until it is destroyed by a call to the Close() member function of the base |
|
3110 class RHandleBase. |
|
3111 |
|
3112 This class is ultimately implemented in terms of the nanokernel tick, and |
|
3113 therefore the granularity of the generated events is limited to the period of |
|
3114 this timer. This is variant specific, but is usually 1 millisecond. |
|
3115 |
|
3116 Note that the CTimer active object uses an RTimer. |
|
3117 */ |
|
3118 class RTimer : public RHandleBase |
|
3119 { |
|
3120 public: |
|
3121 IMPORT_C TInt CreateLocal(); |
|
3122 IMPORT_C void Cancel(); |
|
3123 IMPORT_C void After(TRequestStatus& aStatus,TTimeIntervalMicroSeconds32 anInterval); |
|
3124 IMPORT_C void AfterTicks(TRequestStatus &aStatus, TInt aTicks); |
|
3125 IMPORT_C void At(TRequestStatus& aStatus,const TTime& aTime); |
|
3126 IMPORT_C void AtUTC(TRequestStatus& aStatus,const TTime& aUTCTime); |
|
3127 IMPORT_C void Lock(TRequestStatus& aStatus,TTimerLockSpec aLock); |
|
3128 IMPORT_C void Inactivity(TRequestStatus& aStatus, TTimeIntervalSeconds aSeconds); |
|
3129 IMPORT_C void HighRes(TRequestStatus& aStatus,TTimeIntervalMicroSeconds32 anInterval); |
|
3130 }; |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 /** |
|
3136 @publishedAll |
|
3137 @released |
|
3138 |
|
3139 A handle to a dynamically loadable DLL. |
|
3140 |
|
3141 The class is not intended for user derivation. |
|
3142 */ |
|
3143 class RLibrary : public RHandleBase |
|
3144 { |
|
3145 public: |
|
3146 IMPORT_C void Close(); |
|
3147 IMPORT_C TInt Load(const TDesC& aFileName, const TUidType& aType); |
|
3148 IMPORT_C TInt Load(const TDesC& aFileName, const TDesC& aPath=KNullDesC); |
|
3149 IMPORT_C TInt Load(const TDesC& aFileName, const TDesC& aPath, const TUidType& aType); |
|
3150 IMPORT_C TInt Load(const TDesC& aFileName, const TDesC& aPath, const TUidType& aType, TUint32 aModuleVersion); |
|
3151 IMPORT_C TInt LoadRomLibrary(const TDesC& aFileName, const TDesC& aPath); |
|
3152 IMPORT_C TLibraryFunction Lookup(TInt anOrdinal) const; |
|
3153 IMPORT_C TUidType Type() const; |
|
3154 IMPORT_C TFileName FileName() const; |
|
3155 IMPORT_C TInt GetRamSizes(TInt& aCodeSize, TInt& aConstDataSize); |
|
3156 IMPORT_C TInt Init(); /**< @internalTechnology */ |
|
3157 public: |
|
3158 /** |
|
3159 Class representing information about an executable binary, (DLL or EXE). |
|
3160 @internalTechnology |
|
3161 */ |
|
3162 struct TInfo |
|
3163 { |
|
3164 TUint32 iModuleVersion; /**< Version number */ |
|
3165 TUidType iUids; /**< UIDs */ |
|
3166 TSecurityInfo iSecurityInfo; /**< Security Info */ |
|
3167 }; |
|
3168 |
|
3169 /** |
|
3170 Class representing information about an executable binary, (DLL or EXE), version 2. |
|
3171 @internalTechnology |
|
3172 */ |
|
3173 struct TInfoV2 : public TInfo |
|
3174 { |
|
3175 TUint8 iHardwareFloatingPoint; /**< Which hardware floating point used, from TFloatingPointType */ |
|
3176 enum TDebugAttributes |
|
3177 { |
|
3178 EDebugAllowed = 1<<0, ///< Flags set if executable may be debugged. |
|
3179 ETraceAllowed = 1<<1 ///< Flags set if executable may be traced. |
|
3180 }; |
|
3181 TUint8 iDebugAttributes; ///< Bitmask of values from enum TDebugAttributes |
|
3182 TUint8 iSpare[6]; |
|
3183 }; |
|
3184 |
|
3185 /** |
|
3186 Type representing a TInfo struct packaged as a descriptor. |
|
3187 @internalTechnology |
|
3188 */ |
|
3189 typedef TPckgBuf<TInfo> TInfoBuf; |
|
3190 |
|
3191 /** |
|
3192 Type representing a TInfo struct packaged as a descriptor, version 2. |
|
3193 @internalTechnology |
|
3194 */ |
|
3195 typedef TPckgBuf<TInfoV2> TInfoBufV2; |
|
3196 |
|
3197 /** |
|
3198 @internalTechnology |
|
3199 */ |
|
3200 enum TRequiredImageHeaderSize |
|
3201 { |
|
3202 #ifdef __WINS__ |
|
3203 /** |
|
3204 Size of header data which should be passed to GetInfoFromHeader() |
|
3205 */ |
|
3206 KRequiredImageHeaderSize = KMaxTInt |
|
3207 #else |
|
3208 KRequiredImageHeaderSize = 9*1024 |
|
3209 #endif |
|
3210 }; |
|
3211 |
|
3212 IMPORT_C static TInt GetInfoFromHeader(const TDesC8& aHeader, TDes8& aInfoBuf); |
|
3213 |
|
3214 /** |
|
3215 @internalTechnology |
|
3216 @deprecated Use TInfo |
|
3217 */ |
|
3218 struct SInfo |
|
3219 { |
|
3220 TUint32 iModuleVersion; |
|
3221 TUidType iUids; |
|
3222 SSecurityInfo iS; |
|
3223 }; |
|
3224 |
|
3225 /** |
|
3226 @internalTechnology |
|
3227 @deprecated Use TInfoBuf |
|
3228 */ |
|
3229 typedef TPckgBuf<SInfo> SInfoBuf; |
|
3230 |
|
3231 /** |
|
3232 @internalTechnology |
|
3233 */ |
|
3234 IMPORT_C static TInt GetInfo(const TDesC& aFileName, TDes8& aInfoBuf); |
|
3235 private: |
|
3236 TInt InitL(); |
|
3237 }; |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 /** |
|
3243 @publishedAll |
|
3244 @released |
|
3245 |
|
3246 A handle to a critical section. |
|
3247 |
|
3248 A critical section itself is a kernel object, and is implemented using |
|
3249 a semaphore. The class RCriticalSection inherits privately from RSemaphore |
|
3250 as a matter of implementation and this is, in effect, equivalent to using |
|
3251 a semaphore. |
|
3252 |
|
3253 The public functions of RSemaphore are not part of the public API of this |
|
3254 class. |
|
3255 |
|
3256 As with all handles, they should be closed after use. This class provides |
|
3257 the necessary Close() function, which should be called when the handle is |
|
3258 no longer required. |
|
3259 |
|
3260 @see RHandleBase::Close |
|
3261 */ |
|
3262 class RCriticalSection : private RSemaphore |
|
3263 { |
|
3264 public: |
|
3265 IMPORT_C RCriticalSection(); |
|
3266 IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess); |
|
3267 IMPORT_C void Close(); |
|
3268 IMPORT_C void Wait(); |
|
3269 IMPORT_C void Signal(); |
|
3270 inline TBool IsBlocked() const; |
|
3271 private: |
|
3272 TInt iBlocked; |
|
3273 }; |
|
3274 |
|
3275 |
|
3276 |
|
3277 /** |
|
3278 @publishedAll |
|
3279 @released |
|
3280 |
|
3281 A handle to a mutex. |
|
3282 |
|
3283 The mutex itself is a kernel side object. |
|
3284 |
|
3285 Handles should be closed after use. RHandleBase provides the necessary Close() |
|
3286 function which should be called when the handle is no longer required. |
|
3287 |
|
3288 @see RHandleBase::Close |
|
3289 */ |
|
3290 class RMutex : public RHandleBase |
|
3291 { |
|
3292 public: |
|
3293 inline TInt Open(const TFindMutex& aFind,TOwnerType aType=EOwnerProcess); |
|
3294 IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess); |
|
3295 IMPORT_C TInt CreateGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess); |
|
3296 IMPORT_C TInt OpenGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess); |
|
3297 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess); |
|
3298 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); |
|
3299 IMPORT_C void Wait(); |
|
3300 IMPORT_C void Signal(); |
|
3301 IMPORT_C TBool IsHeld(); |
|
3302 }; |
|
3303 |
|
3304 |
|
3305 |
|
3306 /** |
|
3307 @publishedAll |
|
3308 @released |
|
3309 |
|
3310 A handle to a condition variable. |
|
3311 |
|
3312 The condition variable itself is a kernel side object. |
|
3313 |
|
3314 Handles should be closed after use. RHandleBase provides the necessary Close() |
|
3315 function which should be called when the handle is no longer required. |
|
3316 |
|
3317 @see RHandleBase::Close |
|
3318 */ |
|
3319 class RCondVar : public RHandleBase |
|
3320 { |
|
3321 public: |
|
3322 IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess); |
|
3323 IMPORT_C TInt CreateGlobal(const TDesC& aName, TOwnerType aType=EOwnerProcess); |
|
3324 IMPORT_C TInt OpenGlobal(const TDesC& aName, TOwnerType aType=EOwnerProcess); |
|
3325 IMPORT_C TInt Open(RMessagePtr2 aMessage, TInt aParam, TOwnerType aType=EOwnerProcess); |
|
3326 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); |
|
3327 IMPORT_C TInt Wait(RMutex& aMutex); |
|
3328 IMPORT_C TInt TimedWait(RMutex& aMutex, TInt aTimeout); // timeout in microseconds |
|
3329 IMPORT_C void Signal(); |
|
3330 IMPORT_C void Broadcast(); |
|
3331 }; |
|
3332 |
|
3333 |
|
3334 |
|
3335 class UserHeap; |
|
3336 class TChunkCreate; |
|
3337 struct TChunkCreateInfo; |
|
3338 /** |
|
3339 @publishedAll |
|
3340 @released |
|
3341 |
|
3342 A handle to a chunk. |
|
3343 |
|
3344 The chunk itself is a kernel side object. |
|
3345 */ |
|
3346 class RChunk : public RHandleBase |
|
3347 { |
|
3348 public: |
|
3349 /** |
|
3350 @internalComponent |
|
3351 */ |
|
3352 enum TAttribs |
|
3353 { |
|
3354 ENormal=0x00, |
|
3355 EDoubleEnded=0x01, |
|
3356 EDisconnected=0x02, |
|
3357 ELocal=0x00, |
|
3358 EGlobal=0x10, |
|
3359 EData=0x00, |
|
3360 ECode=0x20, |
|
3361 }; |
|
3362 |
|
3363 /** |
|
3364 Set of flags used by SetRestrictions(). |
|
3365 |
|
3366 @see RChunk::SetRestrictions |
|
3367 */ |
|
3368 enum TRestrictions |
|
3369 { |
|
3370 EPreventAdjust = 0x01, // Prevent Adjust, Commit, Allocate and Decommit |
|
3371 }; |
|
3372 public: |
|
3373 inline TInt Open(const TFindChunk& aFind,TOwnerType aType=EOwnerProcess); |
|
3374 IMPORT_C TInt CreateLocal(TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess); |
|
3375 IMPORT_C TInt CreateLocalCode(TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess); |
|
3376 IMPORT_C TInt CreateGlobal(const TDesC& aName,TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess); |
|
3377 IMPORT_C TInt CreateDoubleEndedLocal(TInt aInitialBottom, TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); |
|
3378 IMPORT_C TInt CreateDoubleEndedGlobal(const TDesC& aName,TInt aInitialBottom,TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); |
|
3379 IMPORT_C TInt CreateDisconnectedLocal(TInt aInitialBottom, TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); |
|
3380 IMPORT_C TInt CreateDisconnectedGlobal(const TDesC& aName,TInt aInitialBottom,TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); |
|
3381 IMPORT_C TInt Create(TChunkCreateInfo& aCreateInfo); |
|
3382 IMPORT_C TInt SetRestrictions(TUint aFlags); |
|
3383 IMPORT_C TInt OpenGlobal(const TDesC& aName,TBool isReadOnly,TOwnerType aType=EOwnerProcess); |
|
3384 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TBool isReadOnly,TOwnerType aType=EOwnerProcess); |
|
3385 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); |
|
3386 IMPORT_C TInt Adjust(TInt aNewSize) const; |
|
3387 IMPORT_C TInt AdjustDoubleEnded(TInt aBottom, TInt aTop) const; |
|
3388 IMPORT_C TInt Commit(TInt anOffset, TInt aSize) const; |
|
3389 IMPORT_C TInt Allocate(TInt aSize) const; |
|
3390 IMPORT_C TInt Decommit(TInt anOffset, TInt aSize) const; |
|
3391 IMPORT_C TInt Unlock(TInt aOffset, TInt aSize); /**< @internalTechnology */ |
|
3392 IMPORT_C TInt Lock(TInt aOffset, TInt aSize); /**< @internalTechnology */ |
|
3393 IMPORT_C TUint8* Base() const; |
|
3394 IMPORT_C TInt Size() const; |
|
3395 IMPORT_C TInt Bottom() const; |
|
3396 IMPORT_C TInt Top() const; |
|
3397 IMPORT_C TInt MaxSize() const; |
|
3398 inline TBool IsReadable() const; |
|
3399 inline TBool IsWritable() const; |
|
3400 private: |
|
3401 friend class UserHeap; |
|
3402 }; |
|
3403 |
|
3404 |
|
3405 /** |
|
3406 This structure specifies the type and properties of the chunk to be created. It |
|
3407 is passed as a parameter to the RChunk::Create() method. |
|
3408 |
|
3409 @publishedAll |
|
3410 @released |
|
3411 */ |
|
3412 struct TChunkCreateInfo |
|
3413 { |
|
3414 public : |
|
3415 /** |
|
3416 Currently supported version numbers |
|
3417 @internalComponent |
|
3418 */ |
|
3419 enum TChunkCreateVersions |
|
3420 { |
|
3421 EVersion0, |
|
3422 ESupportedVersions, |
|
3423 }; |
|
3424 |
|
3425 friend class RChunk; |
|
3426 |
|
3427 IMPORT_C TChunkCreateInfo(); |
|
3428 IMPORT_C void SetNormal(TInt aInitialSize, TInt aMaxSize); |
|
3429 IMPORT_C void SetCode(TInt aInitialSize, TInt aMaxSize); |
|
3430 IMPORT_C void SetDoubleEnded(TInt aInitialBottom, TInt aInitialTop, TInt aMaxSize); |
|
3431 IMPORT_C void SetDisconnected(TInt aInitialBottom, TInt aInitialTop, TInt aMaxSize); |
|
3432 IMPORT_C void SetOwner(TOwnerType aType); |
|
3433 IMPORT_C void SetGlobal(const TDesC& aName); |
|
3434 IMPORT_C void SetClearByte(TUint8 aClearByte); |
|
3435 void SetThreadHeap(TInt aInitialSize, TInt aMaxSize, const TDesC& aName); |
|
3436 |
|
3437 protected : |
|
3438 /** The version number of this TChunkCreateInfo. |
|
3439 @internalComponent |
|
3440 */ |
|
3441 TUint iVersionNumber; |
|
3442 /** The type of the chunk to be created. |
|
3443 @internalComponent |
|
3444 */ |
|
3445 TUint iType; |
|
3446 /** Specify if chunk is global or not. |
|
3447 @internalComponent |
|
3448 */ |
|
3449 TBool iGlobal; |
|
3450 /** The maximum size in bytes of the chunk to be created. |
|
3451 @internalComponent |
|
3452 */ |
|
3453 TInt iMaxSize; |
|
3454 /** An enumeration whose enumerators define the ownership of this chunk |
|
3455 handle. If not explicitly specified, EOwnerProcess is taken as default. |
|
3456 @internalComponent |
|
3457 */ |
|
3458 TOwnerType iOwnerType; |
|
3459 /** A pointer to a descriptor containing the name to be assigned to |
|
3460 global chunks. The length of the descriptor must be no greater than |
|
3461 that allowed for a TKName type. Must be NULL for local chunks. |
|
3462 @internalComponent |
|
3463 */ |
|
3464 const TDesC* iName; |
|
3465 /** The offset of the bottom of the region to commit to the chunk on |
|
3466 creation from the base of the chunk's reserved region. |
|
3467 This is only used for double ended and disconnected chunks. |
|
3468 @internalComponent |
|
3469 */ |
|
3470 TInt iInitialBottom; |
|
3471 /** The offset of the top of the region to commit to the chunk on |
|
3472 creation from the base of the chunk's reserved region. |
|
3473 This is only used for double ended and disconnected chunks. |
|
3474 @internalComponent |
|
3475 */ |
|
3476 TInt iInitialTop; |
|
3477 /** Attributes to the chunk to be created should have. |
|
3478 Should be set from one or more the values in TChunkCreateAttributes. |
|
3479 @internalComponent |
|
3480 */ |
|
3481 TUint iAttributes; |
|
3482 /** The byte to clear all the memory committed to the chunk to. |
|
3483 @internalComponent |
|
3484 */ |
|
3485 TUint8 iClearByte; |
|
3486 /** @internalComponent*/ |
|
3487 TUint8 iSpare1[3]; |
|
3488 /** @internalComponent*/ |
|
3489 TUint iSpare2; |
|
3490 }; |
|
3491 |
|
3492 |
|
3493 struct SStdEpocThreadCreateInfo; |
|
3494 /** |
|
3495 @publishedAll |
|
3496 @released |
|
3497 |
|
3498 A set of static functions for constructing fixed length heaps and local or |
|
3499 global heaps. |
|
3500 |
|
3501 @see RHeap |
|
3502 @see RChunk |
|
3503 */ |
|
3504 class UserHeap |
|
3505 { |
|
3506 public: |
|
3507 enum TChunkHeapCreateMode {EChunkHeapSwitchTo=1, EChunkHeapDuplicate=2}; |
|
3508 IMPORT_C static RHeap* FixedHeap(TAny* aBase, TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue); |
|
3509 IMPORT_C static RHeap* ChunkHeap(const TDesC* aName, TInt aMinLength, TInt aMaxLength, TInt aGrowBy=1, TInt aAlign=0, TBool aSingleThread=EFalse); |
|
3510 IMPORT_C static RHeap* ChunkHeap(RChunk aChunk, TInt aMinLength, TInt aGrowBy=1, TInt aMaxLength=0, TInt aAlign=0, TBool aSingleThread=EFalse, TUint32 aMode=0); |
|
3511 IMPORT_C static RHeap* OffsetChunkHeap(RChunk aChunk, TInt aMinLength, TInt aOffset, TInt aGrowBy=1, TInt aMaxLength=0, TInt aAlign=0, TBool aSingleThread=EFalse, TUint32 aMode=0); |
|
3512 IMPORT_C static TInt SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo); |
|
3513 IMPORT_C static TInt CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RHeap*& aHeap, TInt aAlign=0, TBool aSingleThread=EFalse); |
|
3514 }; |
|
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 /** |
|
3520 @publishedAll |
|
3521 @released |
|
3522 |
|
3523 Encapsulates the Id of a kernel object. |
|
3524 */ |
|
3525 class TObjectId |
|
3526 { |
|
3527 public: |
|
3528 inline TObjectId(); |
|
3529 inline TObjectId(TUint64 anId); |
|
3530 inline TUint64 Id() const; |
|
3531 inline operator TUint() const; |
|
3532 inline TBool operator==(TObjectId aId) const; |
|
3533 inline TBool operator!=(TObjectId aId) const; |
|
3534 private: |
|
3535 TUint64 iId; |
|
3536 }; |
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 /** |
|
3542 @publishedAll |
|
3543 @released |
|
3544 |
|
3545 Encapsulates the Id of a thread. |
|
3546 |
|
3547 An object of this type is not explicitly constructed in open code, |
|
3548 but is returned by the Id() member function of a thread handle, |
|
3549 an RThread type. |
|
3550 |
|
3551 @see RThread |
|
3552 */ |
|
3553 class TThreadId : public TObjectId |
|
3554 { |
|
3555 public: |
|
3556 inline TThreadId(); |
|
3557 inline TThreadId(TUint64 anId); |
|
3558 }; |
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 class RProcess; |
|
3564 |
|
3565 |
|
3566 /** |
|
3567 @publishedAll |
|
3568 @released |
|
3569 |
|
3570 A handle to a thread. |
|
3571 |
|
3572 The thread itself is a kernel object. |
|
3573 */ |
|
3574 class RThread : public RHandleBase |
|
3575 { |
|
3576 public: |
|
3577 inline RThread(); |
|
3578 IMPORT_C TInt Create(const TDesC& aName, TThreadFunction aFunction, TInt aStackSize, TInt aHeapMinSize, TInt aHeapMaxSize, TAny *aPtr, TOwnerType aType=EOwnerProcess); |
|
3579 IMPORT_C TInt Create(const TDesC& aName, TThreadFunction aFunction, TInt aStackSize, RAllocator* aHeap, TAny* aPtr, TOwnerType aType=EOwnerProcess); |
|
3580 IMPORT_C TInt Open(const TDesC& aFullName, TOwnerType aType=EOwnerProcess); |
|
3581 IMPORT_C TInt Open(TThreadId aID, TOwnerType aType=EOwnerProcess); |
|
3582 IMPORT_C TThreadId Id() const; |
|
3583 IMPORT_C void Resume() const; |
|
3584 IMPORT_C void Suspend() const; |
|
3585 /** |
|
3586 @publishedAll |
|
3587 @deprecated Use User::RenameThread() instead |
|
3588 */ |
|
3589 inline static TInt RenameMe(const TDesC& aName); |
|
3590 |
|
3591 IMPORT_C void Kill(TInt aReason); |
|
3592 IMPORT_C void Terminate(TInt aReason); |
|
3593 IMPORT_C void Panic(const TDesC& aCategory,TInt aReason); |
|
3594 IMPORT_C TInt Process(RProcess& aProcess) const; |
|
3595 IMPORT_C TThreadPriority Priority() const; |
|
3596 IMPORT_C void SetPriority(TThreadPriority aPriority) const; |
|
3597 IMPORT_C TProcessPriority ProcessPriority() const; |
|
3598 IMPORT_C void SetProcessPriority(TProcessPriority aPriority) const; |
|
3599 IMPORT_C TInt RequestCount() const; |
|
3600 IMPORT_C TExitType ExitType() const; |
|
3601 IMPORT_C TInt ExitReason() const; |
|
3602 IMPORT_C TExitCategoryName ExitCategory() const; |
|
3603 IMPORT_C void RequestComplete(TRequestStatus*& aStatus,TInt aReason) const; |
|
3604 IMPORT_C void RequestSignal() const; |
|
3605 IMPORT_C void Logon(TRequestStatus& aStatus) const; |
|
3606 IMPORT_C TInt LogonCancel(TRequestStatus& aStatus) const; |
|
3607 IMPORT_C void HandleCount(TInt& aProcessHandleCount, TInt& aThreadHandleCount) const; |
|
3608 IMPORT_C void Context(TDes8& aDes) const; |
|
3609 IMPORT_C TInt StackInfo(TThreadStackInfo& aInfo) const; |
|
3610 IMPORT_C TInt GetCpuTime(TTimeIntervalMicroSeconds& aCpuTime) const; |
|
3611 inline TInt Open(const TFindThread& aFind,TOwnerType aType=EOwnerProcess); |
|
3612 IMPORT_C void Rendezvous(TRequestStatus& aStatus) const; |
|
3613 IMPORT_C TInt RendezvousCancel(TRequestStatus& aStatus) const; |
|
3614 IMPORT_C static void Rendezvous(TInt aReason); |
|
3615 |
|
3616 /** |
|
3617 Return the Secure ID of the process to which the thread belongs. |
|
3618 |
|
3619 If an intended use of this method is to check that the Secure ID is |
|
3620 a given value, then the use of a TSecurityPolicy object should be |
|
3621 considered. E.g. Instead of something like: |
|
3622 |
|
3623 @code |
|
3624 RThread& thread; |
|
3625 TInt error = thread.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied; |
|
3626 @endcode |
|
3627 |
|
3628 this could be used; |
|
3629 |
|
3630 @code |
|
3631 RThread& thread; |
|
3632 static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId); |
|
3633 TBool pass = mySidPolicy().CheckPolicy(thread); |
|
3634 @endcode |
|
3635 |
|
3636 This has the benefit that the TSecurityPolicy::CheckPolicy methods are |
|
3637 configured by the system wide Platform Security configuration. I.e. are |
|
3638 capable of emitting diagnostic messages when a check fails and/or the |
|
3639 check can be forced to always pass. |
|
3640 |
|
3641 @see TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const |
|
3642 @see _LIT_SECURITY_POLICY_S0 |
|
3643 |
|
3644 @return The Secure ID. |
|
3645 @publishedAll |
|
3646 @released |
|
3647 */ |
|
3648 IMPORT_C TSecureId SecureId() const; |
|
3649 |
|
3650 /** |
|
3651 Return the Vendor ID of the process to which the thread belongs. |
|
3652 |
|
3653 If an intended use of this method is to check that the Vendor ID is |
|
3654 a given value, then the use of a TSecurityPolicy object should be |
|
3655 considered. E.g. Instead of something like: |
|
3656 |
|
3657 @code |
|
3658 RThread& thread; |
|
3659 TInt error = thread.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied; |
|
3660 @endcode |
|
3661 |
|
3662 this could be used; |
|
3663 |
|
3664 @code |
|
3665 RThread& thread; |
|
3666 static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId); |
|
3667 TBool pass = myVidPolicy().CheckPolicy(thread); |
|
3668 @endcode |
|
3669 |
|
3670 This has the benefit that the TSecurityPolicy::CheckPolicy methods are |
|
3671 configured by the system wide Platform Security configuration. I.e. are |
|
3672 capable of emitting diagnostic messages when a check fails and/or the |
|
3673 check can be forced to always pass. |
|
3674 |
|
3675 @see TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const |
|
3676 @see _LIT_SECURITY_POLICY_V0 |
|
3677 |
|
3678 @return The Vendor ID. |
|
3679 @publishedAll |
|
3680 @released |
|
3681 */ |
|
3682 IMPORT_C TVendorId VendorId() const; |
|
3683 |
|
3684 /** |
|
3685 Check if the process to which the thread belongs has a given capability |
|
3686 |
|
3687 When a check fails the action taken is determined by the system wide Platform Security |
|
3688 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
3689 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
3690 check failed. |
|
3691 |
|
3692 @param aCapability The capability to test. |
|
3693 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
3694 that may be issued if the test finds the capability is not present. |
|
3695 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
3696 which enables it to be easily removed from the system. |
|
3697 @return ETrue if the process to which the thread belongs has the capability, EFalse otherwise. |
|
3698 @publishedAll |
|
3699 @released |
|
3700 */ |
|
3701 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3702 inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const; |
|
3703 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3704 // Only available to NULL arguments |
|
3705 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const; |
|
3706 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3707 // For things using KSuppressPlatSecDiagnostic |
|
3708 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; |
|
3709 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3710 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3711 |
|
3712 /** |
|
3713 Check if the process to which the thread belongs has both of the given capabilities |
|
3714 |
|
3715 When a check fails the action taken is determined by the system wide Platform Security |
|
3716 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
3717 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
3718 check failed. |
|
3719 |
|
3720 @param aCapability1 The first capability to test. |
|
3721 @param aCapability2 The second capability to test. |
|
3722 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
3723 that may be issued if the test finds a capability is not present. |
|
3724 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
3725 which enables it to be easily removed from the system. |
|
3726 @return ETrue if the process to which the thread belongs has both the capabilities, EFalse otherwise. |
|
3727 @publishedAll |
|
3728 @released |
|
3729 */ |
|
3730 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3731 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const; |
|
3732 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3733 // Only available to NULL arguments |
|
3734 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const; |
|
3735 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3736 // For things using KSuppressPlatSecDiagnostic |
|
3737 inline TBool HasCapability(TCapability aCapability, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; |
|
3738 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3739 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3740 |
|
3741 /** Function only temporarily supported to aid migration to process emulation... |
|
3742 |
|
3743 @publishedAll |
|
3744 @deprecated Use process emulation instead |
|
3745 */ |
|
3746 inline TInt Create(const TDesC& aName,TThreadFunction aFunction,TInt aStackSize,TAny* aPtr,RLibrary* aLibrary,RHeap* aHeap, TInt aHeapMinSize,TInt aHeapMaxSize,TOwnerType aType); |
|
3747 |
|
3748 private: |
|
3749 // Implementations of functions with diagnostics |
|
3750 IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const; |
|
3751 IMPORT_C TBool DoHasCapability(TCapability aCapability) const; |
|
3752 IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) const; |
|
3753 IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2) const; |
|
3754 }; |
|
3755 |
|
3756 /** |
|
3757 @publishedAll |
|
3758 @deprecated |
|
3759 */ |
|
3760 inline TInt RThread::Create(const TDesC& /*aName*/,TThreadFunction /*aFunction*/,TInt /*aStackSize*/,TAny* /*aPtr*/,RLibrary* /*aLibrary*/,RHeap* /*aHeap*/, TInt /*aHeapMinSize*/,TInt /*aHeapMaxSize*/,TOwnerType /*aType*/) |
|
3761 {return KErrNotSupported; } |
|
3762 |
|
3763 |
|
3764 |
|
3765 /** |
|
3766 @publishedAll |
|
3767 @released |
|
3768 |
|
3769 Encapsulates the Id of a process. |
|
3770 |
|
3771 An object of this type is not explicitly constructed in open code, |
|
3772 but is returned by the Id() member function of a process handle, |
|
3773 an RProcess type. |
|
3774 |
|
3775 @see RProcess |
|
3776 */ |
|
3777 class TProcessId : public TObjectId |
|
3778 { |
|
3779 public: |
|
3780 inline TProcessId(); |
|
3781 inline TProcessId(TUint64 anId); |
|
3782 }; |
|
3783 |
|
3784 |
|
3785 |
|
3786 |
|
3787 class RSubSessionBase; |
|
3788 |
|
3789 /** |
|
3790 @publishedAll |
|
3791 @released |
|
3792 |
|
3793 A handle to a process. |
|
3794 |
|
3795 The process itself is a kernel object. |
|
3796 */ |
|
3797 class RProcess : public RHandleBase |
|
3798 { |
|
3799 public: |
|
3800 inline RProcess(); |
|
3801 IMPORT_C TInt Create(const TDesC& aFileName,const TDesC& aCommand,TOwnerType aType=EOwnerProcess); |
|
3802 IMPORT_C TInt Create(const TDesC& aFileName,const TDesC& aCommand,const TUidType &aUidType, TOwnerType aType=EOwnerProcess); |
|
3803 IMPORT_C TInt Open(const TDesC& aName,TOwnerType aType=EOwnerProcess); |
|
3804 IMPORT_C TInt Open(TProcessId aId,TOwnerType aType=EOwnerProcess); |
|
3805 IMPORT_C TUidType Type() const; |
|
3806 IMPORT_C TProcessId Id() const; |
|
3807 /** |
|
3808 @publishedAll |
|
3809 @deprecated Use User::RenameProcess() instead |
|
3810 */ |
|
3811 inline static TInt RenameMe(const TDesC& aName); |
|
3812 |
|
3813 IMPORT_C void Kill(TInt aReason); |
|
3814 IMPORT_C void Terminate(TInt aReason); |
|
3815 IMPORT_C void Panic(const TDesC& aCategory,TInt aReason); |
|
3816 IMPORT_C void Resume(); |
|
3817 IMPORT_C TFileName FileName() const; |
|
3818 IMPORT_C TExitType ExitType() const; |
|
3819 IMPORT_C TInt ExitReason() const; |
|
3820 IMPORT_C TExitCategoryName ExitCategory() const; |
|
3821 IMPORT_C TProcessPriority Priority() const; |
|
3822 IMPORT_C void SetPriority(TProcessPriority aPriority) const; |
|
3823 IMPORT_C TBool JustInTime() const; |
|
3824 IMPORT_C void SetJustInTime(TBool aBoolean) const; |
|
3825 IMPORT_C void Logon(TRequestStatus& aStatus) const; |
|
3826 IMPORT_C TInt LogonCancel(TRequestStatus& aStatus) const; |
|
3827 IMPORT_C TInt GetMemoryInfo(TModuleMemoryInfo& aInfo) const; |
|
3828 inline TInt Open(const TFindProcess& aFind,TOwnerType aType=EOwnerProcess); |
|
3829 IMPORT_C void Rendezvous(TRequestStatus& aStatus) const; |
|
3830 IMPORT_C TInt RendezvousCancel(TRequestStatus& aStatus) const; |
|
3831 IMPORT_C static void Rendezvous(TInt aReason); |
|
3832 |
|
3833 /** |
|
3834 Return the Secure ID of the process. |
|
3835 |
|
3836 If an intended use of this method is to check that the Secure ID is |
|
3837 a given value, then the use of a TSecurityPolicy object should be |
|
3838 considered. E.g. Instead of something like: |
|
3839 |
|
3840 @code |
|
3841 RProcess& process; |
|
3842 TInt error = process.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied; |
|
3843 @endcode |
|
3844 |
|
3845 this could be used; |
|
3846 |
|
3847 @code |
|
3848 RProcess& process; |
|
3849 static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId); |
|
3850 TBool pass = mySidPolicy().CheckPolicy(process); |
|
3851 @endcode |
|
3852 |
|
3853 This has the benefit that the TSecurityPolicy::CheckPolicy methods are |
|
3854 configured by the system wide Platform Security configuration. I.e. are |
|
3855 capable of emitting diagnostic messages when a check fails and/or the |
|
3856 check can be forced to always pass. |
|
3857 |
|
3858 @see TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) const |
|
3859 @see _LIT_SECURITY_POLICY_S0 |
|
3860 |
|
3861 @return The Secure ID. |
|
3862 @publishedAll |
|
3863 @released |
|
3864 */ |
|
3865 IMPORT_C TSecureId SecureId() const; |
|
3866 |
|
3867 /** |
|
3868 Return the Vendor ID of the process. |
|
3869 |
|
3870 If an intended use of this method is to check that the Vendor ID is |
|
3871 a given value, then the use of a TSecurityPolicy object should be |
|
3872 considered. E.g. Instead of something like: |
|
3873 |
|
3874 @code |
|
3875 RProcess& process; |
|
3876 TInt error = process.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied; |
|
3877 @endcode |
|
3878 |
|
3879 this could be used; |
|
3880 |
|
3881 @code |
|
3882 RProcess& process; |
|
3883 static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId); |
|
3884 TBool pass = myVidPolicy().CheckPolicy(process); |
|
3885 @endcode |
|
3886 |
|
3887 This has the benefit that the TSecurityPolicy::CheckPolicy methods are |
|
3888 configured by the system wide Platform Security configuration. I.e. are |
|
3889 capable of emitting diagnostic messages when a check fails and/or the |
|
3890 check can be forced to always pass. |
|
3891 |
|
3892 @see TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) const |
|
3893 @see _LIT_SECURITY_POLICY_V0 |
|
3894 |
|
3895 @return The Vendor ID. |
|
3896 @publishedAll |
|
3897 @released |
|
3898 */ |
|
3899 IMPORT_C TVendorId VendorId() const; |
|
3900 |
|
3901 /** |
|
3902 Check if the process has a given capability |
|
3903 |
|
3904 When a check fails the action taken is determined by the system wide Platform Security |
|
3905 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
3906 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
3907 check failed. |
|
3908 |
|
3909 @param aCapability The capability to test. |
|
3910 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
3911 that may be issued if the test finds the capability is not present. |
|
3912 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
3913 which enables it to be easily removed from the system. |
|
3914 @return ETrue if the process has the capability, EFalse otherwise. |
|
3915 @publishedAll |
|
3916 @released |
|
3917 */ |
|
3918 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3919 inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const; |
|
3920 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3921 // Only available to NULL arguments |
|
3922 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const; |
|
3923 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3924 // For things using KSuppressPlatSecDiagnostic |
|
3925 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; |
|
3926 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3927 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3928 |
|
3929 /** |
|
3930 Check if the process has both of the given capabilities |
|
3931 |
|
3932 When a check fails the action taken is determined by the system wide Platform Security |
|
3933 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
3934 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
3935 check failed. |
|
3936 |
|
3937 @param aCapability1 The first capability to test. |
|
3938 @param aCapability2 The second capability to test. |
|
3939 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
3940 that may be issued if the test finds a capability is not present. |
|
3941 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
3942 which enables it to be easily removed from the system. |
|
3943 @return ETrue if the process has both the capabilities, EFalse otherwise. |
|
3944 @publishedAll |
|
3945 @released |
|
3946 */ |
|
3947 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3948 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const; |
|
3949 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3950 // Only available to NULL arguments |
|
3951 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const; |
|
3952 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3953 // For things using KSuppressPlatSecDiagnostic |
|
3954 inline TBool HasCapability(TCapability aCapability, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; |
|
3955 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ |
|
3956 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
3957 |
|
3958 IMPORT_C TInt SetParameter(TInt aIndex, RHandleBase aHandle); |
|
3959 IMPORT_C TInt SetParameter(TInt aSlot, const RSubSessionBase& aSession); |
|
3960 IMPORT_C TInt SetParameter(TInt aSlot, const TDesC16& aDes); |
|
3961 IMPORT_C TInt SetParameter(TInt aSlot, const TDesC8& aDes); |
|
3962 IMPORT_C TInt SetParameter(TInt aSlot, TInt aData); |
|
3963 inline RProcess(TInt aHandle); |
|
3964 |
|
3965 /** |
|
3966 @deprecated Use RProcess::SecureId() instead |
|
3967 */ |
|
3968 inline TUid Identity() const { return SecureId(); } |
|
3969 |
|
3970 /** |
|
3971 Legacy Platform Security development and migration support |
|
3972 @internalAll |
|
3973 @deprecated No replacement |
|
3974 */ |
|
3975 enum TSecureApi { ESecureApiOff, ESecureApiOn, ESecureApiQuery }; // __SECURE_API__ remove this |
|
3976 |
|
3977 /** |
|
3978 Legacy Platform Security development and migration support |
|
3979 @internalAll |
|
3980 @deprecated No replacement |
|
3981 */ |
|
3982 IMPORT_C TInt SecureApi(TInt aState); // __SECURE_API__ remove this |
|
3983 |
|
3984 /** |
|
3985 Legacy Platform Security development and migration support |
|
3986 @internalAll |
|
3987 @deprecated No replacement |
|
3988 */ |
|
3989 enum TDataCaging { EDataCagingOff, EDataCagingOn, EDataCagingQuery}; // __DATA_CAGING__ __SECURE_API__ remove this |
|
3990 |
|
3991 /** |
|
3992 Legacy Platform Security development and migration support |
|
3993 @internalAll |
|
3994 @deprecated No replacement |
|
3995 */ |
|
3996 IMPORT_C TInt DataCaging(TInt aState); // __DATA_CAGING__ __SECURE_API__ remove this |
|
3997 |
|
3998 |
|
3999 IMPORT_C TInt CreateWithStackOverride(const TDesC& aFileName,const TDesC& aCommand, const TUidType &aUidType, TInt aMinStackSize, TOwnerType aType); |
|
4000 |
|
4001 IMPORT_C static TAny* ExeExportData(void); |
|
4002 |
|
4003 private: |
|
4004 // Implementations of functions with diagnostics |
|
4005 IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const; |
|
4006 IMPORT_C TBool DoHasCapability(TCapability aCapability) const; |
|
4007 IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) const; |
|
4008 IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2) const; |
|
4009 }; |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 /** |
|
4020 @internalTechnology |
|
4021 */ |
|
4022 class RServer2 : public RHandleBase |
|
4023 { |
|
4024 public: |
|
4025 IMPORT_C TInt CreateGlobal(const TDesC& aName); |
|
4026 IMPORT_C TInt CreateGlobal(const TDesC& aName, TInt aMode); |
|
4027 IMPORT_C void Receive(RMessage2& aMessage,TRequestStatus& aStatus); |
|
4028 IMPORT_C void Receive(RMessage2& aMessage); |
|
4029 IMPORT_C void Cancel(); |
|
4030 }; |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 /** |
|
4036 @publishedAll |
|
4037 @released |
|
4038 |
|
4039 Client-side handle to a session with a server. |
|
4040 |
|
4041 This is the client-side interface through which communication with the server |
|
4042 is channelled. |
|
4043 |
|
4044 Clients normally define and implement a derived class to provide |
|
4045 a richer interface. |
|
4046 */ |
|
4047 class RSessionBase : public RHandleBase |
|
4048 { |
|
4049 friend class RSubSessionBase; |
|
4050 public: |
|
4051 /** |
|
4052 Indicates whether or not threads in the process are automatically attached |
|
4053 to the session when passed as a parameter to the Share() function. |
|
4054 */ |
|
4055 enum TAttachMode {EExplicitAttach,EAutoAttach}; |
|
4056 public: |
|
4057 /** |
|
4058 Creates a session that can be shared by other threads in the current |
|
4059 process. |
|
4060 |
|
4061 After calling this function the session object may be used by threads other |
|
4062 than than the one that created it. |
|
4063 |
|
4064 Note that this can only be done with servers that mark their sessions |
|
4065 as sharable. |
|
4066 |
|
4067 @return KErrNone, if the session is successfully shared; |
|
4068 KErrNoMmemory, if the attempt fails for lack of memory. |
|
4069 |
|
4070 @panic KERN-EXEC 23 The session cannot be shared. |
|
4071 |
|
4072 @see CServer2 |
|
4073 @see RSessionBase::ShareProtected() |
|
4074 @see CServer2::TServerType |
|
4075 */ |
|
4076 inline TInt ShareAuto() { return DoShare(EAutoAttach); } |
|
4077 |
|
4078 |
|
4079 /** |
|
4080 Creates a session handle that can be be passed via IPC to another process |
|
4081 as well as being shared by other threads in the current process. |
|
4082 |
|
4083 After calling this function the session object may be used by threads other |
|
4084 than than the one that created it. |
|
4085 |
|
4086 Note that this can only be done with servers that mark their sessions |
|
4087 as globally sharable. |
|
4088 |
|
4089 @return KErrNone, if the session is successfully shared; |
|
4090 KErrNoMmemory, if the attempt fails for lack of memory. |
|
4091 |
|
4092 @panic KERN-EXEC 23 The session cannot be shared. |
|
4093 |
|
4094 @see CServer2 |
|
4095 @see RSessionBase::ShareAuto() |
|
4096 @see CServer2::TServerType |
|
4097 */ |
|
4098 inline TInt ShareProtected() { return DoShare(EAutoAttach|KCreateProtectedObject); } |
|
4099 |
|
4100 |
|
4101 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess); |
|
4102 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,const TSecurityPolicy& aServerPolicy,TOwnerType aType=EOwnerProcess); |
|
4103 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); |
|
4104 IMPORT_C TInt Open(TInt aArgumentIndex, const TSecurityPolicy& aServerPolicy, TOwnerType aType=EOwnerProcess); |
|
4105 inline TInt SetReturnedHandle(TInt aHandleOrError); |
|
4106 IMPORT_C TInt SetReturnedHandle(TInt aHandleOrError,const TSecurityPolicy& aServerPolicy); |
|
4107 protected: |
|
4108 inline TInt CreateSession(const TDesC& aServer,const TVersion& aVersion); |
|
4109 IMPORT_C TInt CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots); |
|
4110 IMPORT_C TInt CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TIpcSessionType aType,const TSecurityPolicy* aPolicy=0, TRequestStatus* aStatus=0); |
|
4111 inline TInt CreateSession(RServer2 aServer,const TVersion& aVersion); |
|
4112 IMPORT_C TInt CreateSession(RServer2 aServer,const TVersion& aVersion,TInt aAsyncMessageSlots); |
|
4113 IMPORT_C TInt CreateSession(RServer2 aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TIpcSessionType aType,const TSecurityPolicy* aPolicy=0, TRequestStatus* aStatus=0); |
|
4114 inline static TInt SetReturnedHandle(TInt aHandleOrError,RHandleBase& aHandle); |
|
4115 |
|
4116 /** |
|
4117 @deprecated Use CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TIpcSessionType aType,const TSecurityPolicy* aPolicy=0, TRequestStatus* aStatus=0); |
|
4118 */ |
|
4119 inline TInt CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TRequestStatus* aStatus) |
|
4120 { return CreateSession(aServer, aVersion, aAsyncMessageSlots, EIpcSession_Unsharable, (TSecurityPolicy*)0, aStatus); } |
|
4121 inline TInt Send(TInt aFunction,const TIpcArgs& aArgs) const; |
|
4122 inline void SendReceive(TInt aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const; |
|
4123 inline TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
4124 inline TInt Send(TInt aFunction) const; |
|
4125 inline void SendReceive(TInt aFunction,TRequestStatus& aStatus) const; |
|
4126 inline TInt SendReceive(TInt aFunction) const; |
|
4127 private: |
|
4128 IMPORT_C TInt DoSend(TInt aFunction,const TIpcArgs* aArgs) const; |
|
4129 IMPORT_C void DoSendReceive(TInt aFunction,const TIpcArgs* aArgs,TRequestStatus& aStatus) const; |
|
4130 IMPORT_C TInt DoSendReceive(TInt aFunction,const TIpcArgs* aArgs) const; |
|
4131 TInt SendAsync(TInt aFunction,const TIpcArgs* aArgs,TRequestStatus* aStatus) const; |
|
4132 TInt SendSync(TInt aFunction,const TIpcArgs* aArgs) const; |
|
4133 IMPORT_C TInt DoShare(TInt aAttachMode); |
|
4134 TInt DoConnect(const TVersion &aVersion,TRequestStatus* aStatus); |
|
4135 }; |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 /** |
|
4141 @publishedAll |
|
4142 @released |
|
4143 |
|
4144 Client-side handle to a sub-session. |
|
4145 |
|
4146 It represents a client-side sub-session, and has a corresponding sub-session |
|
4147 object on the server-side. |
|
4148 |
|
4149 Clients normally define and implement a derived class to provide a richer |
|
4150 interface. In particular, a derived class should: |
|
4151 |
|
4152 1. provide a function to create a new sub-session with the server; |
|
4153 this should call CreateSubSession(). |
|
4154 |
|
4155 2. provide a function to close the current sub-session; |
|
4156 this should call CloseSubSession(). |
|
4157 |
|
4158 A session must already exist with a server before a client can establish |
|
4159 any sub-sessions. |
|
4160 */ |
|
4161 class RSubSessionBase |
|
4162 { |
|
4163 public: |
|
4164 inline TInt SubSessionHandle() const; |
|
4165 protected: |
|
4166 inline RSubSessionBase(); |
|
4167 IMPORT_C const RSessionBase Session() const; |
|
4168 inline TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); |
|
4169 inline TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction); |
|
4170 IMPORT_C TInt CreateAutoCloseSubSession(RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); |
|
4171 IMPORT_C void CloseSubSession(TInt aFunction); |
|
4172 inline TInt Send(TInt aFunction,const TIpcArgs& aArgs) const; |
|
4173 inline void SendReceive(TInt aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const; |
|
4174 inline TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
4175 inline TInt Send(TInt aFunction) const; |
|
4176 inline void SendReceive(TInt aFunction,TRequestStatus& aStatus) const; |
|
4177 inline TInt SendReceive(TInt aFunction) const; |
|
4178 private: |
|
4179 IMPORT_C TInt DoCreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs* aArgs); |
|
4180 IMPORT_C TInt DoSend(TInt aFunction,const TIpcArgs* aArgs) const; |
|
4181 IMPORT_C void DoSendReceive(TInt aFunction,const TIpcArgs* aArgs,TRequestStatus& aStatus) const; |
|
4182 IMPORT_C TInt DoSendReceive(TInt aFunction,const TIpcArgs* aArgs) const; |
|
4183 TInt DoCreateSubSession(RSessionBase& aSession,TInt aFunction,const TIpcArgs* aArgs, TBool aAutoClose); |
|
4184 private: |
|
4185 RSessionBase iSession; |
|
4186 TInt iSubSessionHandle; |
|
4187 }; |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 /** |
|
4193 @publishedAll |
|
4194 @released |
|
4195 |
|
4196 Base class that provides an implementation for the templated |
|
4197 RRef class. |
|
4198 |
|
4199 @see RRef |
|
4200 */ |
|
4201 class RRefBase |
|
4202 { |
|
4203 public: |
|
4204 IMPORT_C void Free(); |
|
4205 protected: |
|
4206 inline RRefBase(); |
|
4207 inline RRefBase(const RRefBase& aRef); |
|
4208 IMPORT_C void DoAlloc(const TAny* aPtr,TInt aSize); |
|
4209 IMPORT_C void DoAllocL(const TAny* aPtr,TInt aSize); |
|
4210 IMPORT_C void Copy(const RRefBase& aRef); |
|
4211 private: |
|
4212 IMPORT_C void operator=(const RRefBase& aRef); |
|
4213 protected: |
|
4214 TInt* iPtr; |
|
4215 }; |
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 /** |
|
4221 @publishedAll |
|
4222 @released |
|
4223 |
|
4224 Contains, or packages, a copy of an instance of another class. |
|
4225 |
|
4226 The template parameter defines the type of the contained object. |
|
4227 |
|
4228 The contained object is held in allocated memory, and can be accessed |
|
4229 through the member selection and dereference operators. |
|
4230 */ |
|
4231 template <class T> |
|
4232 class RRef : public RRefBase |
|
4233 { |
|
4234 public: |
|
4235 inline RRef(); |
|
4236 inline RRef(const RRef<T>& anObject); |
|
4237 inline void operator=(const RRef<T>& anObject); |
|
4238 inline T* operator->(); |
|
4239 inline operator T*(); |
|
4240 inline void Alloc(const T& anObject); |
|
4241 inline void Alloc(const T& anObject,TInt aSize); |
|
4242 inline void AllocL(const T& anObject); |
|
4243 inline void AllocL(const T& anObject,TInt aSize); |
|
4244 }; |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 /** |
|
4250 @publishedAll |
|
4251 @released |
|
4252 |
|
4253 A handle to a change notifier. |
|
4254 |
|
4255 The change notifier itself is a kernel object. |
|
4256 */ |
|
4257 class RChangeNotifier : public RHandleBase |
|
4258 { |
|
4259 public: |
|
4260 IMPORT_C TInt Create(); |
|
4261 IMPORT_C TInt Logon(TRequestStatus& aStatus) const; |
|
4262 IMPORT_C TInt LogonCancel() const; |
|
4263 }; |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 /** |
|
4269 @publishedAll |
|
4270 @released |
|
4271 |
|
4272 Handle to a thread death notifier. |
|
4273 |
|
4274 The notifier allows threads to be notified of the death of another thread. |
|
4275 |
|
4276 The thread-death notifier itself is a kernel object. |
|
4277 */ |
|
4278 class RUndertaker : public RHandleBase |
|
4279 { |
|
4280 public: |
|
4281 IMPORT_C TInt Create(); |
|
4282 IMPORT_C TInt Logon(TRequestStatus& aStatus,TInt& aThreadHandle) const; |
|
4283 IMPORT_C TInt LogonCancel() const; |
|
4284 }; |
|
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 class HBufC16; |
|
4291 /** |
|
4292 @publishedAll |
|
4293 @released |
|
4294 |
|
4295 A handle to a session with the extended notifier server that provides support |
|
4296 for plug-in notifiers. |
|
4297 |
|
4298 The interface allows engines or other low level components |
|
4299 to communicate with the UI. |
|
4300 */ |
|
4301 class RNotifier : public RSessionBase |
|
4302 { |
|
4303 public: |
|
4304 IMPORT_C RNotifier(); |
|
4305 IMPORT_C TInt Connect(); |
|
4306 IMPORT_C void Close(); |
|
4307 IMPORT_C TInt StartNotifier(TUid aNotifierUid,const TDesC8& aBuffer); |
|
4308 IMPORT_C TInt StartNotifier(TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); |
|
4309 IMPORT_C TInt StartNotifier(TUid aNotifierDllUid,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); |
|
4310 IMPORT_C TInt CancelNotifier(TUid aNotifierUid); |
|
4311 IMPORT_C TInt UpdateNotifier(TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); |
|
4312 IMPORT_C void UpdateNotifierAndGetResponse(TRequestStatus& aRs,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); |
|
4313 IMPORT_C void StartNotifierAndGetResponse(TRequestStatus& aRs,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); |
|
4314 IMPORT_C void StartNotifierAndGetResponse(TRequestStatus& aRs,TUid aNotifierDllUid,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); |
|
4315 IMPORT_C TInt UnloadNotifiers(TUid aNotifierUid); |
|
4316 IMPORT_C TInt LoadNotifiers(TUid aNotifierUid); |
|
4317 IMPORT_C void Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aBut1,const TDesC& aBut2,TInt& aButtonVal,TRequestStatus& aStatus); |
|
4318 IMPORT_C void NotifyCancel(); |
|
4319 IMPORT_C TInt InfoPrint(const TDesC& aDes); |
|
4320 private: |
|
4321 TPtr8 iButtonVal; |
|
4322 HBufC16* iCombinedBuffer; |
|
4323 }; |
|
4324 |
|
4325 /** |
|
4326 @publishedAll |
|
4327 @released |
|
4328 |
|
4329 Abstract class that defines a handler to work with the TRAP mechanism. |
|
4330 |
|
4331 Symbian OS provides a trap handler and this class does not normally need to be |
|
4332 used or accessed directly by applications and third party code. |
|
4333 */ |
|
4334 class TTrapHandler |
|
4335 { |
|
4336 public: |
|
4337 IMPORT_C TTrapHandler(); |
|
4338 |
|
4339 /** |
|
4340 Called when a TRAP is invoked. |
|
4341 */ |
|
4342 IMPORT_C virtual void Trap()=0; |
|
4343 |
|
4344 /** |
|
4345 Called when a function exits a TRAP without leaving. |
|
4346 */ |
|
4347 IMPORT_C virtual void UnTrap()=0; |
|
4348 |
|
4349 /** |
|
4350 Called when a function within a TRAP leaves. |
|
4351 |
|
4352 @param aValue The leave value. |
|
4353 */ |
|
4354 IMPORT_C virtual void Leave(TInt aValue)=0; |
|
4355 }; |
|
4356 |
|
4357 |
|
4358 |
|
4359 |
|
4360 struct TCollationMethod; // forward declaration |
|
4361 |
|
4362 |
|
4363 |
|
4364 |
|
4365 /** |
|
4366 @publishedAll |
|
4367 @released |
|
4368 |
|
4369 Contains a set of static functions which perform manipulation of |
|
4370 data in memory. |
|
4371 |
|
4372 The arguments passed to the functions of this class are pointers to memory |
|
4373 locations and length values. These functions are, therefore, not normally |
|
4374 used in open code but are suitable for implementing data manipulation for |
|
4375 other classes. Typically the interface provided by such classes is typesafe |
|
4376 and hides this direct memory to memory manipulation. |
|
4377 */ |
|
4378 class Mem |
|
4379 { |
|
4380 public: |
|
4381 inline static TUint8* Copy(TAny* aTrg, const TAny* aSrc, TInt aLength); |
|
4382 inline static TUint8* Move(TAny* aTrg, const TAny* aSrc, TInt aLength); |
|
4383 inline static void Fill(TAny* aTrg, TInt aLength, TChar aChar); |
|
4384 inline static void FillZ(TAny* aTrg, TInt aLength); |
|
4385 #ifndef __GCC32__ |
|
4386 inline static TInt Compare(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); |
|
4387 #else |
|
4388 IMPORT_C static TInt Compare(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); |
|
4389 #endif |
|
4390 |
|
4391 IMPORT_C static TInt Compare(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL); |
|
4392 IMPORT_C static TInt CompareF(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); |
|
4393 IMPORT_C static TInt CompareF(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL); |
|
4394 IMPORT_C static TInt CompareC(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); |
|
4395 IMPORT_C static TInt CompareC(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL); |
|
4396 IMPORT_C static TInt CompareC(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL, |
|
4397 TInt aMaxLevel, const TCollationMethod* aCollationMethod); |
|
4398 IMPORT_C static TInt CollationMethods(); |
|
4399 IMPORT_C static TUint CollationMethodId(TInt aIndex); |
|
4400 IMPORT_C static const TCollationMethod* CollationMethodByIndex(TInt aIndex); |
|
4401 IMPORT_C static const TCollationMethod* CollationMethodById(TUint aId); |
|
4402 IMPORT_C static const TCollationMethod* GetDefaultMatchingTable(); |
|
4403 IMPORT_C static void Swap(TAny* aPtr1, TAny* aPtr2, TInt aLength); |
|
4404 IMPORT_C static void Crc(TUint16& aCrc, const TAny* aPtr, TInt aLength); |
|
4405 IMPORT_C static void Crc32(TUint32& aCrc, const TAny* aPtr, TInt aLength); |
|
4406 }; |
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 |
|
4412 /** |
|
4413 @publishedAll |
|
4414 @released |
|
4415 |
|
4416 Set of static user functions. |
|
4417 |
|
4418 These functions are related to a number of System component APIs. |
|
4419 |
|
4420 The majority of the functions are related to either the current thread, or |
|
4421 its heap. Examples in this category include User::Exit(), which causes the |
|
4422 thread to terminate, and User::Alloc(), which allocates memory from the current |
|
4423 thread's heap. |
|
4424 |
|
4425 Some of these functions are equivalent to functions in the RThread or RHeap |
|
4426 classes. In these cases, the User function is a convenient way to access the |
|
4427 function without first having to get a handle to the current thread. |
|
4428 |
|
4429 Functions are also provided to support debugging of memory leaks. These function |
|
4430 calls can be written explicitly or can be generated using a corresponding |
|
4431 macro - the advantage of using a macro is that the function call is only |
|
4432 generated for debug builds. |
|
4433 |
|
4434 A final category of functions, which includes User::BinarySearch() and User::QuickSort(), |
|
4435 are just useful functions which have no other natural home. |
|
4436 |
|
4437 @see RThread |
|
4438 @see RHeap |
|
4439 */ |
|
4440 class User : public UserHeap |
|
4441 { |
|
4442 public: |
|
4443 // Execution control |
|
4444 IMPORT_C static void InitProcess(); /**< @internalComponent */ |
|
4445 IMPORT_C static void Exit(TInt aReason); |
|
4446 IMPORT_C static void Panic(const TDesC& aCategory,TInt aReason); |
|
4447 IMPORT_C static void HandleException(TAny* aInfo); /**< @internalComponent */ |
|
4448 // Cleanup support |
|
4449 IMPORT_C static void Leave(TInt aReason); |
|
4450 IMPORT_C static void LeaveNoMemory(); |
|
4451 IMPORT_C static TInt LeaveIfError(TInt aReason); |
|
4452 IMPORT_C static TAny* LeaveIfNull(TAny* aPtr); |
|
4453 IMPORT_C static TTrapHandler* SetTrapHandler(TTrapHandler* aHandler); |
|
4454 IMPORT_C static TTrapHandler* TrapHandler(); |
|
4455 IMPORT_C static TTrapHandler* MarkCleanupStack(); /**< @internalComponent */ |
|
4456 IMPORT_C static void UnMarkCleanupStack(TTrapHandler* aHandler); /**< @internalComponent */ |
|
4457 IMPORT_C static void LeaveEnd(); /**< @internalComponent */ |
|
4458 // Infoprint |
|
4459 IMPORT_C static TInt InfoPrint(const TDesC& aDes); |
|
4460 // Asynchronous service support |
|
4461 IMPORT_C static void RequestComplete(TRequestStatus*& aStatus,TInt aReason); |
|
4462 IMPORT_C static void WaitForAnyRequest(); |
|
4463 IMPORT_C static void WaitForRequest(TRequestStatus& aStatus); |
|
4464 IMPORT_C static void WaitForRequest(TRequestStatus& aStatus1,TRequestStatus& aStatus2); |
|
4465 IMPORT_C static void WaitForNRequest(TRequestStatus *aStatusArray[], TInt aNum); |
|
4466 // User heap management |
|
4467 IMPORT_C static TInt AllocLen(const TAny* aCell); |
|
4468 IMPORT_C static TAny* Alloc(TInt aSize); |
|
4469 IMPORT_C static TAny* AllocL(TInt aSize); |
|
4470 IMPORT_C static TAny* AllocLC(TInt aSize); |
|
4471 IMPORT_C static TAny* AllocZ(TInt aSize); |
|
4472 IMPORT_C static TAny* AllocZL(TInt aSize); |
|
4473 IMPORT_C static TInt AllocSize(TInt& aTotalAllocSize); |
|
4474 IMPORT_C static TInt Available(TInt& aBiggestBlock); |
|
4475 IMPORT_C static TInt CountAllocCells(); |
|
4476 IMPORT_C static TInt CountAllocCells(TInt& aFreeCount); |
|
4477 IMPORT_C static void Free(TAny* aCell); |
|
4478 IMPORT_C static void FreeZ(TAny*& aCell); |
|
4479 IMPORT_C static RAllocator& Allocator(); |
|
4480 inline static RHeap& Heap(); |
|
4481 IMPORT_C static TAny* ReAlloc(TAny* aCell, TInt aSize, TInt aMode=0); |
|
4482 IMPORT_C static TAny* ReAllocL(TAny* aCell, TInt aSize, TInt aMode=0); |
|
4483 IMPORT_C static RAllocator* SwitchAllocator(RAllocator* aAllocator); |
|
4484 inline static RHeap* SwitchHeap(RAllocator* aHeap); |
|
4485 IMPORT_C static TInt CompressAllHeaps(); |
|
4486 // Synchronous timer services |
|
4487 IMPORT_C static void After(TTimeIntervalMicroSeconds32 aInterval); |
|
4488 IMPORT_C static TInt At(const TTime& aTime); |
|
4489 IMPORT_C static void AfterHighRes(TTimeIntervalMicroSeconds32 aInterval); |
|
4490 // Set time and deal with timezones |
|
4491 IMPORT_C static TInt SetHomeTime(const TTime& aTime); |
|
4492 IMPORT_C static TInt SetHomeTimeSecure(const TTime& aTime); |
|
4493 IMPORT_C static TInt SetUTCTime(const TTime& aUTCTime); |
|
4494 IMPORT_C static TInt SetUTCTimeSecure(const TTime& aUTCTime); |
|
4495 IMPORT_C static TTimeIntervalSeconds UTCOffset(); |
|
4496 IMPORT_C static void SetUTCOffset(TTimeIntervalSeconds aOffset); |
|
4497 IMPORT_C static TInt SetUTCTimeAndOffset(const TTime& aUTCTime, TTimeIntervalSeconds aOffset); |
|
4498 // Set locale information |
|
4499 IMPORT_C static TInt SetCurrencySymbol(const TDesC& aSymbol); |
|
4500 // Set floating point mode |
|
4501 IMPORT_C static TInt SetFloatingPointMode(TFloatingPointMode aMode, TFloatingPointRoundingMode aRoundingMode=EFpRoundToNearest); |
|
4502 // Timers |
|
4503 IMPORT_C static TUint TickCount(); |
|
4504 IMPORT_C static TUint32 NTickCount(); |
|
4505 IMPORT_C static TTimerLockSpec LockPeriod(); |
|
4506 IMPORT_C static TTimeIntervalSeconds InactivityTime(); |
|
4507 IMPORT_C static void ResetInactivityTime(); |
|
4508 IMPORT_C static TUint32 FastCounter(); |
|
4509 // Atomic operations |
|
4510 IMPORT_C static TInt LockedInc(TInt& aValue); |
|
4511 IMPORT_C static TInt LockedDec(TInt& aValue); |
|
4512 IMPORT_C static TInt SafeInc(TInt& aValue); |
|
4513 IMPORT_C static TInt SafeDec(TInt& aValue); |
|
4514 // Beep |
|
4515 IMPORT_C static TInt Beep(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration); |
|
4516 // Information |
|
4517 IMPORT_C static TInt IsRomAddress(TBool& aBool,TAny* aPtr); |
|
4518 // Algorithms |
|
4519 IMPORT_C static TInt BinarySearch(TInt aCount,const TKey& aKey,TInt& aPos); |
|
4520 IMPORT_C static TInt QuickSort(TInt aCount,const TKey& aKey,const TSwap& aSwap); |
|
4521 // Language-dependent character functions |
|
4522 IMPORT_C static TLanguage Language(); |
|
4523 IMPORT_C static TUint Collate(TUint aChar); |
|
4524 IMPORT_C static TUint Fold(TUint aChar); |
|
4525 IMPORT_C static TUint LowerCase(TUint aChar); |
|
4526 IMPORT_C static TUint UpperCase(TUint aChar); |
|
4527 IMPORT_C static TUint Fold(TUint aChar,TInt aFlags); |
|
4528 IMPORT_C static TUint TitleCase(TUint aChar); |
|
4529 // C-style string length |
|
4530 IMPORT_C static TInt StringLength(const TUint8* aString); |
|
4531 IMPORT_C static TInt StringLength(const TUint16* aString); |
|
4532 // Device management |
|
4533 IMPORT_C static TInt FreeLogicalDevice(const TDesC& aDeviceName); |
|
4534 IMPORT_C static TInt FreePhysicalDevice(const TDesC& aDriverName); |
|
4535 IMPORT_C static TInt LoadLogicalDevice(const TDesC& aFileName); |
|
4536 IMPORT_C static TInt LoadPhysicalDevice(const TDesC& aFileName); |
|
4537 // Version information |
|
4538 IMPORT_C static TBool QueryVersionSupported(const TVersion& aCurrent,const TVersion& aRequested); |
|
4539 IMPORT_C static TVersion Version(); |
|
4540 // Machine configuration |
|
4541 IMPORT_C static TInt SetMachineConfiguration(const TDesC8& aConfig); |
|
4542 IMPORT_C static TInt MachineConfiguration(TDes8& aConfig,TInt& aSize); |
|
4543 // Debugging support |
|
4544 IMPORT_C static void SetDebugMask(TUint32 aVal); |
|
4545 IMPORT_C static void SetDebugMask(TUint32 aVal, TUint aIndex); |
|
4546 IMPORT_C static void SetJustInTime(const TBool aBoolean); |
|
4547 IMPORT_C static void Check(); |
|
4548 IMPORT_C static void Invariant(); |
|
4549 IMPORT_C static TBool JustInTime(); |
|
4550 IMPORT_C static void __DbgMarkStart(TBool aKernel); |
|
4551 IMPORT_C static void __DbgMarkCheck(TBool aKernel, TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum); |
|
4552 IMPORT_C static TUint32 __DbgMarkEnd(TBool aKernel, TInt aCount); |
|
4553 IMPORT_C static void __DbgSetAllocFail(TBool aKernel, RAllocator::TAllocFail aFail, TInt aRate); |
|
4554 IMPORT_C static void __DbgSetBurstAllocFail(TBool aKernel, RAllocator::TAllocFail aFail, TUint aRate, TUint aBurst); |
|
4555 IMPORT_C static TUint __DbgCheckFailure(TBool aKernel); |
|
4556 IMPORT_C static void PanicUnexpectedLeave(); /**< @internalComponent */ |
|
4557 // Name Validation |
|
4558 IMPORT_C static TInt ValidateName(const TDesC& aName); |
|
4559 // Instruction Memory Barrier |
|
4560 IMPORT_C static void IMB_Range(TAny* aStart, TAny* aEnd); |
|
4561 // |
|
4562 IMPORT_C static TInt CommandLineLength(); |
|
4563 IMPORT_C static void CommandLine(TDes &aCommand); |
|
4564 IMPORT_C static TExceptionHandler ExceptionHandler(); |
|
4565 IMPORT_C static TInt SetExceptionHandler(TExceptionHandler aHandler,TUint32 aMask); |
|
4566 IMPORT_C static void ModifyExceptionMask(TUint32 aClearMask, TUint32 aSetMask); |
|
4567 IMPORT_C static TInt RaiseException(TExcType aType); |
|
4568 IMPORT_C static TBool IsExceptionHandled(TExcType aType); |
|
4569 |
|
4570 /** |
|
4571 A set of values that defines the effect that terminating a thread |
|
4572 has, either on its owning process or on the whole system. |
|
4573 |
|
4574 A thread is said to be critical if its owning process or the entire system |
|
4575 terminates when the thread itself terminates. |
|
4576 |
|
4577 You pass one of these values to the functions: |
|
4578 - User::SetCritical() |
|
4579 - User::SetProcessCritical() |
|
4580 |
|
4581 The meaning of a value when passed to one function is different to |
|
4582 its meaning when passed the other function. See the description of each |
|
4583 individual value. |
|
4584 |
|
4585 @see User::SetCritical() |
|
4586 @see User::SetProcessCritical() |
|
4587 */ |
|
4588 enum TCritical { |
|
4589 |
|
4590 |
|
4591 /** |
|
4592 This value can be passed to both: |
|
4593 - User::SetCritical(), which means that the current thread |
|
4594 is no longer critical, i.e. termination of the current |
|
4595 thread will no longer cause termination of the current thread's |
|
4596 owning process (i.e. the current process) or a reboot of the system. |
|
4597 - User::SetProcessCritical(), which means that threads |
|
4598 subsequently created in the current thread's owning |
|
4599 process (i.e. the current process) will no longer cause termination of that |
|
4600 process or a reboot of the system. Note, however, that existing |
|
4601 threads are NOT affected when you call this function. |
|
4602 |
|
4603 @see User::SetCritical() |
|
4604 @see User::SetProcessCritical() |
|
4605 */ |
|
4606 ENotCritical, |
|
4607 |
|
4608 |
|
4609 /** |
|
4610 This value can only be passed to User::SetCritical() and |
|
4611 affects the current thread only. |
|
4612 |
|
4613 It means that the owning process (i.e.the current process) |
|
4614 terminates if: |
|
4615 - the current thread is terminated. |
|
4616 - the current thread panics. |
|
4617 |
|
4618 @see User::SetCritical() |
|
4619 */ |
|
4620 EProcessCritical, |
|
4621 |
|
4622 |
|
4623 /** |
|
4624 This value can only be passed to User::SetCritical() and |
|
4625 affects the current thread only. |
|
4626 |
|
4627 It means that the owning process (i.e.the current process) |
|
4628 terminates if the current thread terminates for any reason. |
|
4629 |
|
4630 @see User::SetCritical() |
|
4631 */ |
|
4632 EProcessPermanent, |
|
4633 |
|
4634 |
|
4635 /** |
|
4636 This value can only be passed to User::SetProcessCritical() and |
|
4637 affects any new threads created in the current process. |
|
4638 |
|
4639 It means that the current process terminates if: |
|
4640 - any new thread subsequently created in the current process is terminated. |
|
4641 - any new thread subsequently created in the current process panics. |
|
4642 . |
|
4643 Note, however, that existing threads in the current process |
|
4644 are NOT affected when you call User::SetProcessCritical() |
|
4645 with this value. |
|
4646 |
|
4647 @see EProcessCritical |
|
4648 @see User::SetProcessCritical() |
|
4649 */ |
|
4650 EAllThreadsCritical, |
|
4651 |
|
4652 |
|
4653 /** |
|
4654 This value can be passed to both: User::SetCritical() and |
|
4655 User::SetProcessCritical(). |
|
4656 |
|
4657 When passed to User::SetCritical(), it means that |
|
4658 the entire system is rebooted if: |
|
4659 - the current thread is terminated. |
|
4660 - the current thread panics. |
|
4661 |
|
4662 When passed to User::SetProcessCritical(), it means that |
|
4663 the entire system is rebooted if: |
|
4664 - any new thread subsequently created in the current process is terminated. |
|
4665 - any new thread subsequently created in the current process panics. |
|
4666 - the process itself is terminated |
|
4667 - the process itself panics |
|
4668 |
|
4669 Note: |
|
4670 -# existing threads in the current process are NOT affected when you |
|
4671 call User::SetProcessCritical() with this value. |
|
4672 -# Only a process with 'Protected Server' capability can set a |
|
4673 thread to system-critical. |
|
4674 |
|
4675 @see User::SetCritical() |
|
4676 @see User::SetProcessCritical() |
|
4677 */ |
|
4678 ESystemCritical, |
|
4679 |
|
4680 |
|
4681 /** |
|
4682 This value can be passed to both: User::SetCritical() |
|
4683 and User::SetProcessCritical(). |
|
4684 |
|
4685 When passed to User::SetCritical(), it means that |
|
4686 the entire system is rebooted if the current thread |
|
4687 exits for any reason. |
|
4688 |
|
4689 When passed to User::SetProcessCritical(), it means that |
|
4690 the entire system is rebooted if any new thread |
|
4691 subsequently created in the current process exits |
|
4692 for any reason, or if the process itself exits for any reason. |
|
4693 |
|
4694 Note: |
|
4695 -# existing threads in the current process are NOT affected when you |
|
4696 call User::SetProcessCritical() with this value. |
|
4697 -# Only a process with 'Protected Server' capability can set a |
|
4698 thread to system-permanent. |
|
4699 |
|
4700 @see User::SetCritical() |
|
4701 @see User::SetProcessCritical() |
|
4702 */ |
|
4703 ESystemPermanent |
|
4704 }; |
|
4705 IMPORT_C static TCritical Critical(); |
|
4706 IMPORT_C static TCritical Critical(RThread aThread); |
|
4707 IMPORT_C static TInt SetCritical(TCritical aCritical); |
|
4708 IMPORT_C static TCritical ProcessCritical(); |
|
4709 IMPORT_C static TCritical ProcessCritical(RProcess aProcess); |
|
4710 IMPORT_C static TInt SetProcessCritical(TCritical aCritical); |
|
4711 IMPORT_C static TBool PriorityControl(); |
|
4712 IMPORT_C static void SetPriorityControl(TBool aEnable); |
|
4713 |
|
4714 /** |
|
4715 A threads realtime state. |
|
4716 Some non-realtime behaviour can be detected by the kernel. When it does so, |
|
4717 action is taken depending on the thread state: |
|
4718 - ERealtimeStateOff - no action. |
|
4719 - ERealtimeStateOn - the the thread will be panicked with KERN-EXEC 61 (EIllegalFunctionForRealtimeThread). |
|
4720 - ERealtimeStateWarn - no action. However, if the kernel trace flag KREALTIME is enabled |
|
4721 then tracing will be emitted as if the thread state was ERealtimeStateOn. |
|
4722 @publishedPartner |
|
4723 @prototype |
|
4724 */ |
|
4725 enum TRealtimeState |
|
4726 { |
|
4727 ERealtimeStateOff, /**< Thread is not realtime */ |
|
4728 ERealtimeStateOn, /**< Thread is realtime */ |
|
4729 ERealtimeStateWarn /**< Thread is realtime but doesn't want this enforced */ |
|
4730 }; |
|
4731 |
|
4732 /** |
|
4733 Set the current threads realtime state. |
|
4734 @see TRealtimeState |
|
4735 @param aState The state |
|
4736 @return KErrNone if successful. KErrArgument if aState is invalid. |
|
4737 @publishedPartner |
|
4738 @prototype |
|
4739 */ |
|
4740 IMPORT_C static TInt SetRealtimeState(TRealtimeState aState); |
|
4741 |
|
4742 /** |
|
4743 Return the Secure ID of the process that created the current process. |
|
4744 @return The Secure ID. |
|
4745 @publishedAll |
|
4746 @released |
|
4747 */ |
|
4748 IMPORT_C static TSecureId CreatorSecureId(); |
|
4749 |
|
4750 /** |
|
4751 Return the Vendor ID of the process that created the current process. |
|
4752 @return The Vendor ID. |
|
4753 @publishedAll |
|
4754 @released |
|
4755 */ |
|
4756 IMPORT_C static TVendorId CreatorVendorId(); |
|
4757 |
|
4758 /** |
|
4759 Check if the process that created the current process has a given capability |
|
4760 |
|
4761 When a check fails the action taken is determined by the system wide Platform Security |
|
4762 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
4763 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
4764 check failed. |
|
4765 |
|
4766 @param aCapability The capability to test. |
|
4767 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
4768 that may be issued if the test finds the capability is not present. |
|
4769 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
4770 which enables it to be easily removed from the system. |
|
4771 @return ETrue if the creator process has the capability, EFalse otherwise. |
|
4772 @publishedAll |
|
4773 @released |
|
4774 */ |
|
4775 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
4776 inline static TBool CreatorHasCapability(TCapability aCapability, const char* aDiagnostic=0); |
|
4777 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
4778 // Only available to NULL arguments |
|
4779 inline static TBool CreatorHasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL); |
|
4780 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ |
|
4781 // For things using KSuppressPlatSecDiagnostic |
|
4782 inline static TBool CreatorHasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress); |
|
4783 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ |
|
4784 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
4785 |
|
4786 /** |
|
4787 Check if the process that created the current process has both of the given capabilities |
|
4788 |
|
4789 When a check fails the action taken is determined by the system wide Platform Security |
|
4790 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
4791 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
4792 check failed. |
|
4793 |
|
4794 @param aCapability1 The first capability to test. |
|
4795 @param aCapability2 The second capability to test. |
|
4796 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
4797 that may be issued if the test finds a capability is not present. |
|
4798 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
4799 which enables it to be easily removed from the system. |
|
4800 @return ETrue if the creator process has both the capabilities, EFalse otherwise. |
|
4801 @publishedAll |
|
4802 @released |
|
4803 */ |
|
4804 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
4805 inline static TBool CreatorHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0); |
|
4806 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
4807 // Only available to NULL arguments |
|
4808 inline static TBool CreatorHasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL); |
|
4809 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ |
|
4810 // For things using KSuppressPlatSecDiagnostic |
|
4811 inline static TBool CreatorHasCapability(TCapability aCapability, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress); |
|
4812 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ |
|
4813 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
4814 |
|
4815 IMPORT_C static TInt ParameterLength(TInt aSlot); |
|
4816 IMPORT_C static TInt GetTIntParameter(TInt aSlot, TInt& aData); |
|
4817 IMPORT_C static TInt GetDesParameter(TInt aSlot, TDes8& aDes); |
|
4818 IMPORT_C static TInt GetDesParameter(TInt aSlot, TDes16& aDes); |
|
4819 IMPORT_C static TInt RenameThread(const TDesC &aName); |
|
4820 IMPORT_C static TInt RenameProcess(const TDesC &aName); |
|
4821 /* |
|
4822 User::Identity() has been deprecated and is available for backward |
|
4823 compatibility purposes only. |
|
4824 |
|
4825 Use RProcess().SecureId() instead. |
|
4826 |
|
4827 @deprecated |
|
4828 */ |
|
4829 inline static TUid Identity() { return RProcess().SecureId(); } |
|
4830 |
|
4831 /* |
|
4832 User::CreatorIdentity() has been deprecated and is available for backward |
|
4833 compatibility purposes only. |
|
4834 |
|
4835 Use CreatorSecureId() instead. |
|
4836 |
|
4837 @deprecated |
|
4838 */ |
|
4839 static inline TUid CreatorIdentity() { return CreatorSecureId(); } |
|
4840 |
|
4841 IMPORT_C static void NotifyOnIdle(TRequestStatus& aStatus); /**< @internalTechnology */ |
|
4842 IMPORT_C static void CancelMiscNotifier(TRequestStatus& aStatus); /**< @internalTechnology */ |
|
4843 private: |
|
4844 // Implementations of functions with diagnostics |
|
4845 IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability, const char* aDiagnostic); |
|
4846 IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability); |
|
4847 IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic); |
|
4848 IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability1, TCapability aCapability2); |
|
4849 }; |
|
4850 |
|
4851 |
|
4852 |
|
4853 |
|
4854 class ExecHandler; |
|
4855 |
|
4856 /** |
|
4857 @internalComponent |
|
4858 @removed |
|
4859 */ |
|
4860 typedef void (*TTlsCleanupHandler)(TAny*); //don't use |
|
4861 |
|
4862 /** |
|
4863 @publishedAll |
|
4864 @released |
|
4865 |
|
4866 A collection of static functions involved in managing access to |
|
4867 thread-local storage. |
|
4868 |
|
4869 Thread-local storage is a single machine word of static writable memory. |
|
4870 The scope of this machine word is the thread, which means that there is one |
|
4871 word per thread. The word is only accessible to code running in a DLL. |
|
4872 |
|
4873 In practice, this word is almost always used to hold a pointer to allocated |
|
4874 memory; this makes that memory available to all DLL code running on behalf |
|
4875 of the same thread. |
|
4876 |
|
4877 Note that DLL code running on behalf of one thread does not see the same word when |
|
4878 running on behalf of another thread. |
|
4879 |
|
4880 The class in not intended for user derivation. |
|
4881 */ |
|
4882 class Dll |
|
4883 { |
|
4884 public: |
|
4885 static TInt SetTls(TAny* aPtr); |
|
4886 static TAny* Tls(); |
|
4887 static void FreeTls(); |
|
4888 static void FileName(TFileName &aFileName); |
|
4889 }; |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 #ifndef __TOOLS__ |
|
4895 /** |
|
4896 @publishedAll |
|
4897 @released |
|
4898 |
|
4899 A thin wrapper class for C++ arrays allowing automatic checking of index values |
|
4900 to ensure that all accesses are legal. |
|
4901 |
|
4902 The class also supports the deletion of objects. |
|
4903 |
|
4904 The class is templated, based on a class type and an integer value. The class |
|
4905 type defines the type of object contained in the array; the integer value |
|
4906 defines the size (dimension) of the array. |
|
4907 |
|
4908 A wrapper object can be: |
|
4909 |
|
4910 1. embedded in objects allocated on the heap. |
|
4911 |
|
4912 2. used on the program stack. |
|
4913 */ |
|
4914 template <class T,TInt S> |
|
4915 class TFixedArray |
|
4916 { |
|
4917 typedef TFixedArray<T,S> ThisClass; |
|
4918 public: |
|
4919 inline TFixedArray(); |
|
4920 inline TFixedArray(const T* aList, TInt aLength); |
|
4921 // |
|
4922 inline void Copy(const T* aList, TInt aLength); |
|
4923 inline void Reset(); // zero fill |
|
4924 inline void DeleteAll(); |
|
4925 // |
|
4926 inline TInt Count() const; |
|
4927 inline TInt Length() const; |
|
4928 // Accessors - debug range checking |
|
4929 inline T& operator[](TInt aIndex); |
|
4930 inline const T& operator[] (TInt aIndex) const; |
|
4931 // Accessors - always range checking |
|
4932 inline T& At(TInt aIndex); |
|
4933 inline const T& At(TInt aIndex) const; |
|
4934 // Provides pointers to the beginning and end of the array |
|
4935 inline T* Begin(); |
|
4936 inline T* End(); |
|
4937 inline const T* Begin() const; |
|
4938 inline const T* End() const; |
|
4939 // |
|
4940 inline TArray<T> Array() const; |
|
4941 protected: |
|
4942 inline static TBool InRange(TInt aIndex); |
|
4943 inline static TInt CountFunctionR(const CBase* aThis); |
|
4944 inline static const TAny* AtFunctionR(const CBase* aThis,TInt aIndex); |
|
4945 protected: |
|
4946 T iRep[S]; |
|
4947 }; |
|
4948 |
|
4949 |
|
4950 |
|
4951 |
|
4952 /** |
|
4953 @publishedAll |
|
4954 @released |
|
4955 */ |
|
4956 #define DECLARE_ROM_ARRAY( AName, AData, AType ) \ |
|
4957 const TFixedArray<AType,(sizeof(AData)/sizeof((AData)[0]))>& \ |
|
4958 AName = *(reinterpret_cast<const TFixedArray<AType, \ |
|
4959 (sizeof(AData)/sizeof((AData)[0]))>* > (AData)) |
|
4960 #endif |
|
4961 |
|
4962 // Global leaving operator new |
|
4963 /** |
|
4964 @publishedAll |
|
4965 @released |
|
4966 */ |
|
4967 inline TAny* operator new(TUint aSize, TLeave); |
|
4968 /** |
|
4969 @publishedAll |
|
4970 @released |
|
4971 */ |
|
4972 inline TAny* operator new(TUint aSize, TLeave, TUint aExtraSize); |
|
4973 #if !defined(__VC32__) || defined (__MSVCDOTNET__) |
|
4974 /** |
|
4975 @publishedAll |
|
4976 @released |
|
4977 */ |
|
4978 inline TAny* operator new[](TUint aSize, TLeave); |
|
4979 #endif |
|
4980 |
|
4981 |
|
4982 #ifdef __LEAVE_EQUALS_THROW__ |
|
4983 /** Macro to assert in all builds that code does not leave |
|
4984 |
|
4985 @param _s C++ statements to be executed which should not leave |
|
4986 @panic USER 194 if the code being checked does leave |
|
4987 |
|
4988 @publishedAll |
|
4989 @released |
|
4990 */ |
|
4991 #define __ASSERT_ALWAYS_NO_LEAVE(_s) \ |
|
4992 { \ |
|
4993 try { \ |
|
4994 TTrapHandler* ____t = User::MarkCleanupStack(); \ |
|
4995 _s; \ |
|
4996 User::UnMarkCleanupStack(____t); \ |
|
4997 } \ |
|
4998 catch (XLeaveException& /*l*/) \ |
|
4999 { \ |
|
5000 User::PanicUnexpectedLeave(); \ |
|
5001 } \ |
|
5002 catch (...) \ |
|
5003 { \ |
|
5004 User::Invariant(); \ |
|
5005 } \ |
|
5006 } |
|
5007 |
|
5008 #else |
|
5009 /** Macro to assert in all builds that code does not leave |
|
5010 |
|
5011 @param _s C++ statements to be executed which should not leave |
|
5012 @panic USER 194 if the code being checked does leave |
|
5013 |
|
5014 @publishedAll |
|
5015 @released |
|
5016 */ |
|
5017 #define __ASSERT_ALWAYS_NO_LEAVE(_s) \ |
|
5018 { \ |
|
5019 TInt _r; \ |
|
5020 TTrap _t; \ |
|
5021 if (_t.Trap(_r) == 0) \ |
|
5022 { \ |
|
5023 _s; \ |
|
5024 TTrap::UnTrap(); \ |
|
5025 } \ |
|
5026 else \ |
|
5027 User::PanicUnexpectedLeave(); \ |
|
5028 } |
|
5029 #endif |
|
5030 |
|
5031 /** Macro to assert in debug builds that code does not leave |
|
5032 |
|
5033 @param _s C++ statements to be executed which should not leave |
|
5034 @panic USER 194 if the code being checked does leave |
|
5035 |
|
5036 @publishedAll |
|
5037 @released |
|
5038 */ |
|
5039 #ifdef _DEBUG |
|
5040 #define __ASSERT_DEBUG_NO_LEAVE(_s) __ASSERT_ALWAYS_NO_LEAVE(_s) |
|
5041 #else |
|
5042 #define __ASSERT_DEBUG_NO_LEAVE(_s) { _s; } |
|
5043 #endif |
|
5044 |
|
5045 /** |
|
5046 This is a panic handler function pointer for PREQ2104. |
|
5047 */ |
|
5048 typedef void (*TPanicHandler)(const TDesC&,TInt); |
|
5049 |
|
5050 |
|
5051 |
|
5052 // Inline methods |
|
5053 #include <e32std.inl> |
|
5054 |
|
5055 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
5056 #include <e32std_private.h> |
|
5057 #endif |
|
5058 |
|
5059 #endif |
|
5060 |