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