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