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