1.1 --- a/epoc32/include/e32cmn.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/e32cmn.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,6673 @@
1.4 -e32cmn.h
1.5 +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// e32\include\e32cmn.h
1.19 +//
1.20 +//
1.21 +
1.22 +#ifndef __E32CMN_H__
1.23 +#define __E32CMN_H__
1.24 +#include <e32const.h>
1.25 +
1.26 +extern "C" {
1.27 +/**
1.28 +@publishedAll
1.29 +@released
1.30 +
1.31 +A Nanokernel utility function that compares two memory buffers for equality.
1.32 +
1.33 +The two buffers are considered equal only if:
1.34 +
1.35 +1. the buffers have the same length
1.36 +
1.37 +and
1.38 +
1.39 +2. the binary content of both buffers is the same.
1.40 +
1.41 +@param aLeft The start address of the first buffer in the comparison.
1.42 +@param aLeftLen The length of the first buffer in the comparison.
1.43 +@param aRight The start address of the second buffer in the comparison.
1.44 +@param aRightLen The length of the second buffer in the comparison.
1.45 +
1.46 +@return Zero if both buffers are equal; non-zero, otherwise.
1.47 +
1.48 +@panic USER 88 In debug mode only, if aLeftL is negative,
1.49 + and the function is called on the user side.
1.50 +@panic KERN-COMMON 88 In debug mode only, if aLeftL is negative,
1.51 + and the function is called on the kernel side.
1.52 +@panic USER 89 In debug mode only, if aRightL is negative,
1.53 + and the function is called on the user side.
1.54 +@panic KERN-COMMON 89 In debug mode only, if aRightL is negative,
1.55 + and the function is called on the kernel side.
1.56 +*/
1.57 +IMPORT_C TInt memcompare(const TUint8* aLeft, TInt aLeftLen, const TUint8* aRight, TInt aRightLen);
1.58 +
1.59 +
1.60 +
1.61 +
1.62 +/**
1.63 +@publishedAll
1.64 +@released
1.65 +
1.66 +A Nanokernel utility function that moves (copies) bytes in memory.
1.67 +
1.68 +The function assumes that the addresses are aligned on word boundaries,
1.69 +and that the length value is a multiple of 4.
1.70 +
1.71 +@param aTrg The target address.
1.72 +@param aSrc The source address.
1.73 +@param aLength The number of bytes to be moved.
1.74 +
1.75 +@return The target address.
1.76 +
1.77 +@panic USER 91 In debug mode only, if aLength is not a multiple of 4,
1.78 + and the function is called on the user side.
1.79 +@panic KERN-COMMON 91 In debug mode only, if aLength is not a multiple of 4,
1.80 + and the function is called on the kernel side.
1.81 +@panic USER 92 In debug mode only, if aSrc is not aligned on a word boundary,
1.82 + and the function is called on the user side.
1.83 +@panic KERN-COMMON 92 In debug mode only, if aSrc is not aligned on a word boundary,
1.84 + and the function is called on the kernel side.
1.85 +@panic USER 93 In debug mode only, if aTrg is not aligned on a word boundary,
1.86 + and the function is called on the user side.
1.87 +@panic KERN-COMMON 93 In debug mode only, if aTrg is not aligned on a word boundary,
1.88 + and the function is called on the kernel side.
1.89 +*/
1.90 +IMPORT_C TAny* wordmove(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
1.91 +
1.92 +
1.93 +
1.94 +
1.95 +/**
1.96 +@publishedAll
1.97 +@released
1.98 +
1.99 +A Nanokernel utility function that sets the specified number of bytes
1.100 +to binary zero.
1.101 +
1.102 +@param aTrg The start address.
1.103 +@param aLength The number of bytes to be set.
1.104 +
1.105 +@return The target address.
1.106 +*/
1.107 +IMPORT_C TAny* memclr(TAny* aTrg, unsigned int aLength);
1.108 +}
1.109 +
1.110 +
1.111 +
1.112 +
1.113 +#ifndef __TOOLS__
1.114 +extern "C" {
1.115 +/**
1.116 +@publishedAll
1.117 +@released
1.118 +
1.119 +A Nanokernel utility function that sets all of the specified number of bytes to
1.120 +the specified fill value.
1.121 +
1.122 +@param aTrg The start address.
1.123 +@param aValue The fill value (the first or junior byte).
1.124 +@param aLength The number of bytes to be set.
1.125 +
1.126 +@return The target address.
1.127 +*/
1.128 + IMPORT_C TAny* memset(TAny* aTrg, TInt aValue, unsigned int aLength);
1.129 +
1.130 +
1.131 +
1.132 +
1.133 +/**
1.134 +@publishedAll
1.135 +@released
1.136 +
1.137 +A Nanokernel utility function that copies bytes in memory.
1.138 +
1.139 +@param aTrg The target address.
1.140 +@param aSrc The source address.
1.141 +@param aLength The number of bytes to be moved.
1.142 +
1.143 +@return The target address.
1.144 +*/
1.145 + IMPORT_C TAny* memcpy(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
1.146 +
1.147 +
1.148 +
1.149 +
1.150 +/**
1.151 +@publishedAll
1.152 +@released
1.153 +
1.154 +A Nanokernel utility function that moves (copies) bytes in memory.
1.155 +
1.156 +@param aTrg The target address.
1.157 +@param aSrc The source address.
1.158 +@param aLength The number of bytes to be moved.
1.159 +
1.160 +@return The target address.
1.161 +*/
1.162 + IMPORT_C TAny* memmove(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
1.163 +}
1.164 +#else
1.165 +#include <string.h>
1.166 +#endif
1.167 +
1.168 +
1.169 +
1.170 +
1.171 +/**
1.172 +@publishedAll
1.173 +@released
1.174 +
1.175 +Tests whether the specified value is less than or equal to the
1.176 +specified upper limit.
1.177 +
1.178 +@param aVal The value to be tested.
1.179 +@param aLimit The upper limit.
1.180 +
1.181 +@return True, if the value is less than or equal to the specified upper limit;
1.182 + false, otherwise.
1.183 +*/
1.184 +inline TInt Lim(TInt aVal,TUint aLimit)
1.185 + {return(((TUint)aVal)<=aLimit);}
1.186 +
1.187 +
1.188 +
1.189 +
1.190 +/**
1.191 +@publishedAll
1.192 +@released
1.193 +
1.194 +Tests whether the specified value is strictly less than the
1.195 +specified upper limit.
1.196 +
1.197 +@param aVal The value to be tested.
1.198 +@param aLimit The upper limit.
1.199 +
1.200 +@return True, if the value is strictly less than the specified upper limit;
1.201 + false, otherwise.
1.202 +*/
1.203 +inline TInt LimX(TInt aVal,TUint aLimit)
1.204 + {return(((TUint)aVal)<aLimit);}
1.205 +
1.206 +
1.207 +
1.208 +
1.209 +/**
1.210 +@publishedAll
1.211 +@released
1.212 +
1.213 +Returns the smaller of two values.
1.214 +
1.215 +@param aLeft The first value to be compared.
1.216 +@param aRight The second value to be compared.
1.217 +
1.218 +@return The smaller value.
1.219 +*/
1.220 +template <class T>
1.221 +inline T Min(T aLeft,T aRight)
1.222 + {return(aLeft<aRight ? aLeft : aRight);}
1.223 +
1.224 +
1.225 +
1.226 +
1.227 +/**
1.228 +@publishedAll
1.229 +@released
1.230 +
1.231 +Returns the smaller of two objects, where the right hand object is a treated
1.232 +as a TInt for the purpose of comparison.
1.233 +
1.234 +@param aLeft The first value to be compared.
1.235 +@param aRight The second value to be compared.
1.236 +
1.237 +@return The smaller value.
1.238 +*/
1.239 +template <class T>
1.240 +inline T Min(T aLeft,TUint aRight)
1.241 + {return(aLeft<(TInt)aRight ? aLeft : (T)aRight);}
1.242 +
1.243 +
1.244 +
1.245 +
1.246 +/**
1.247 +@publishedAll
1.248 +@released
1.249 +
1.250 +Returns the larger of two values.
1.251 +
1.252 +@param aLeft The first value to be compared.
1.253 +@param aRight The second value to be compared.
1.254 +
1.255 +@return The larger value.
1.256 +*/
1.257 +template <class T>
1.258 +inline T Max(T aLeft,T aRight)
1.259 + {return(aLeft<aRight ? aRight : aLeft);}
1.260 +
1.261 +
1.262 +
1.263 +
1.264 +/**
1.265 +@publishedAll
1.266 +@released
1.267 +
1.268 +Returns the larger of two objects, where the right hand object is a treated
1.269 +as a TInt for the purpose of comparison.
1.270 +
1.271 +@param aLeft The first value to be compared.
1.272 +@param aRight The second value to be compared.
1.273 +
1.274 +@return The larger value.
1.275 +*/
1.276 +template <class T>
1.277 +inline T Max(T aLeft,TUint aRight)
1.278 + {return(aLeft<(TInt)aRight ? (TInt)aRight : aLeft);}
1.279 +
1.280 +
1.281 +
1.282 +
1.283 +/**
1.284 +@publishedAll
1.285 +@released
1.286 +
1.287 +Returns an absolute value.
1.288 +
1.289 +@param aVal The source value.
1.290 +
1.291 +@return The absolute value
1.292 +*/
1.293 +template <class T>
1.294 +inline T Abs(T aVal)
1.295 + {return(aVal<0 ? -aVal : aVal);}
1.296 +
1.297 +
1.298 +
1.299 +
1.300 +/**
1.301 +@publishedAll
1.302 +@released
1.303 +
1.304 +Determines whether a specified value lies within a defined range of values.
1.305 +
1.306 +@param aMin The lower value of the range.
1.307 +@param aVal The value to be compared.
1.308 +@param aMax The higher value of the range.
1.309 +
1.310 +@return True, if the specified value lies within the range; false, otherwise.
1.311 +*/
1.312 +template <class T>
1.313 +inline TBool Rng(T aMin,T aVal,T aMax)
1.314 + {return(aVal>=aMin && aVal<=aMax);}
1.315 +
1.316 +
1.317 +
1.318 +
1.319 +/**
1.320 +@publishedAll
1.321 +@released
1.322 +
1.323 +Adds a value to a pointer.
1.324 +
1.325 +@param aPtr Pointer to an object of type T.
1.326 +@param aVal The value to be added.
1.327 +
1.328 +@return The resulting pointer value, as a pointer to a type T.
1.329 +*/
1.330 +template <class T,class S>
1.331 +inline T* PtrAdd(T* aPtr,S aVal)
1.332 + {return((T*)(((TUint8*)aPtr)+aVal));}
1.333 +
1.334 +
1.335 +
1.336 +
1.337 +/**
1.338 +@publishedAll
1.339 +@released
1.340 +
1.341 +Subtracts a value from a pointer.
1.342 +
1.343 +@param aPtr Pointer to an object of type T.
1.344 +@param aVal The value to be added.
1.345 +
1.346 +@return The resulting pointer value, as a pointer to a type T.
1.347 +*/
1.348 +template <class T,class S>
1.349 +inline T* PtrSub(T* aPtr,S aVal)
1.350 + {return((T*)(((TUint8*)aPtr)-aVal));}
1.351 +
1.352 +
1.353 +
1.354 +
1.355 +/**
1.356 +@publishedAll
1.357 +@released
1.358 +
1.359 +Aligns the specified value onto a 2-byte boundary.
1.360 +
1.361 +@param aValue The value to be aligned.
1.362 +
1.363 +@return The aligned value.
1.364 +*/
1.365 +template <class T>
1.366 +inline T Align2(T aValue)
1.367 + {return((T)((((TUint)aValue)+sizeof(TUint16)-1)&~(sizeof(TUint16)-1)));}
1.368 +
1.369 +
1.370 +
1.371 +
1.372 +/**
1.373 +@publishedAll
1.374 +@released
1.375 +
1.376 +Aligns the specified value onto a 4-byte boundary.
1.377 +
1.378 +@param aValue The value to be aligned.
1.379 +
1.380 +@return The aligned value.
1.381 +*/
1.382 +template <class T>
1.383 +inline T Align4(T aValue)
1.384 + {return((T)((((TUint)aValue)+sizeof(TUint32)-1)&~(sizeof(TUint32)-1)));}
1.385 +
1.386 +
1.387 +
1.388 +
1.389 +/**
1.390 +@publishedAll
1.391 +@released
1.392 +
1.393 +A templated class which encapsulates a reference to an object within a wrapper.
1.394 +
1.395 +The wrapper object can be passed to a function as a value type. This allows
1.396 +a reference to be passed to a function as a value type.
1.397 +
1.398 +This wrapper object is commonly termed a value reference.
1.399 +*/
1.400 +template <class T>
1.401 +class TRefByValue
1.402 + {
1.403 +public:
1.404 + inline TRefByValue(T& aRef);
1.405 + inline operator T&();
1.406 +private:
1.407 + TRefByValue& operator=(TRefByValue aRef);
1.408 +private:
1.409 + T &iRef;
1.410 + };
1.411 +
1.412 +
1.413 +
1.414 +
1.415 +#if !defined (__KERNEL_MODE__)
1.416 +class TDesC16; // forward declaration for TChar member functions
1.417 +class TPtrC16; // forward declaration for TChar member functions
1.418 +#endif
1.419 +
1.420 +
1.421 +
1.422 +
1.423 +/**
1.424 +@publishedAll
1.425 +@released
1.426 +
1.427 +Holds a character value and provides a number of utility functions to
1.428 +manipulate it and test its properties.
1.429 +
1.430 +For example, there are functions to convert the character
1.431 +to uppercase and test whether or not it is a control character.
1.432 +
1.433 +The character value is stored as a 32-bit unsigned integer. The shorthand
1.434 +"TChar value" is used to describe the character value wrapped by a TChar
1.435 +object.
1.436 +
1.437 +TChar can be used to represent Unicode values outside plane 0 (that is, the
1.438 +extended Unicode range from 0x10000 to 0xFFFFF). This differentiates it from
1.439 +TText which can only be used for 16-bit Unicode character values.
1.440 +
1.441 +@see TText
1.442 +*/
1.443 +class TChar
1.444 + {
1.445 +public:
1.446 +
1.447 +
1.448 + /**
1.449 + General Unicode character category.
1.450 +
1.451 + The high nibble encodes the major category (Mark, Number, etc.) and a low
1.452 + nibble encodes the subdivisions of that category.
1.453 +
1.454 + The category codes can be used in three ways:
1.455 +
1.456 + (i) as unique constants: there is one for each Unicode category, with a
1.457 + name of the form
1.458 + @code
1.459 + E<XX>Category
1.460 + @endcode
1.461 + where
1.462 + @code
1.463 + <XX>
1.464 + @endcode
1.465 + is the category name given by
1.466 + the Unicode database (e.g., the constant ELuCategory is used for lowercase
1.467 + letters, category Lu);
1.468 +
1.469 + (ii) as numbers in certain ranges: letter categories are all <= EMaxLetterCategory;
1.470 +
1.471 + (iii) as codes in which the upper nibble gives the category group
1.472 + (e.g., punctuation categories all yield TRUE for
1.473 + the test (category & 0xF0) ==EPunctuationGroup).
1.474 + */
1.475 + enum TCategory
1.476 + {
1.477 + /**
1.478 + Alphabetic letters.
1.479 +
1.480 + Includes ELuCategory, ELlCategory and ELtCategory.
1.481 + */
1.482 + EAlphaGroup = 0x00,
1.483 +
1.484 +
1.485 + /**
1.486 + Other letters.
1.487 +
1.488 + Includes ELoCategory.
1.489 + */
1.490 + ELetterOtherGroup = 0x10,
1.491 +
1.492 +
1.493 + /**
1.494 + Letter modifiers.
1.495 +
1.496 + Includes ELmCategory.
1.497 + */
1.498 + ELetterModifierGroup = 0x20,
1.499 +
1.500 +
1.501 + /**
1.502 + Marks group.
1.503 +
1.504 + Includes EMnCategory, EMcCategory and EMeCategory.
1.505 + */
1.506 + EMarkGroup = 0x30,
1.507 +
1.508 +
1.509 + /**
1.510 + Numbers group.
1.511 +
1.512 + Includes ENdCategory, ENlCategory and ENoCategory.
1.513 + */
1.514 + ENumberGroup = 0x40,
1.515 +
1.516 +
1.517 + /**
1.518 + Punctuation group.
1.519 +
1.520 + IncludesEPcCategory, PdCategory, EpeCategory, EPsCategory and EPoCategory.
1.521 + */
1.522 + EPunctuationGroup = 0x50,
1.523 +
1.524 +
1.525 + /**
1.526 + Symbols group.
1.527 +
1.528 + Includes ESmCategory, EScCategory, ESkCategory and ESoCategory.
1.529 + */
1.530 + ESymbolGroup = 0x60,
1.531 +
1.532 +
1.533 + /**
1.534 + Separators group.
1.535 +
1.536 + Includes EZsCategory, EZlCategory and EZlpCategory.
1.537 + */
1.538 + ESeparatorGroup = 0x70,
1.539 +
1.540 +
1.541 + /**
1.542 + Control, format, private use, unassigned.
1.543 +
1.544 + Includes ECcCategory, ECtCategory, ECsCategory,
1.545 + ECoCategory and ECnCategory.
1.546 + */
1.547 + EControlGroup = 0x80,
1.548 +
1.549 +
1.550 + /**
1.551 + The highest possible groups category.
1.552 + */
1.553 + EMaxAssignedGroup = 0xE0,
1.554 +
1.555 +
1.556 + /**
1.557 + Unassigned to any other group.
1.558 + */
1.559 + EUnassignedGroup = 0xF0,
1.560 +
1.561 +
1.562 + /**
1.563 + Letter, Uppercase.
1.564 + */
1.565 + ELuCategory = EAlphaGroup | 0,
1.566 +
1.567 +
1.568 + /**
1.569 + Letter, Lowercase.
1.570 + */
1.571 + ELlCategory = EAlphaGroup | 1,
1.572 +
1.573 +
1.574 + /**
1.575 + Letter, Titlecase.
1.576 + */
1.577 + ELtCategory = EAlphaGroup | 2,
1.578 +
1.579 +
1.580 + /**
1.581 + Letter, Other.
1.582 + */
1.583 + ELoCategory = ELetterOtherGroup | 0,
1.584 +
1.585 +
1.586 + /**
1.587 + The highest possible (non-modifier) letter category.
1.588 + */
1.589 + EMaxLetterCategory = ELetterOtherGroup | 0x0F,
1.590 +
1.591 + /**
1.592 + Letter, Modifier.
1.593 + */
1.594 + ELmCategory = ELetterModifierGroup | 0,
1.595 +
1.596 +
1.597 + /**
1.598 + The highest possible letter category.
1.599 + */
1.600 + EMaxLetterOrLetterModifierCategory = ELetterModifierGroup | 0x0F,
1.601 +
1.602 + /**
1.603 + Mark, Non-Spacing
1.604 + */
1.605 + EMnCategory = EMarkGroup | 0,
1.606 +
1.607 +
1.608 + /**
1.609 + Mark, Combining.
1.610 + */
1.611 + EMcCategory = EMarkGroup | 1,
1.612 +
1.613 +
1.614 + /**
1.615 + Mark, Enclosing.
1.616 + */
1.617 + EMeCategory = EMarkGroup | 2,
1.618 +
1.619 +
1.620 + /**
1.621 + Number, Decimal Digit.
1.622 + */
1.623 + ENdCategory = ENumberGroup | 0,
1.624 +
1.625 +
1.626 + /**
1.627 + Number, Letter.
1.628 + */
1.629 + ENlCategory = ENumberGroup | 1,
1.630 +
1.631 +
1.632 + /**
1.633 + Number, Other.
1.634 + */
1.635 + ENoCategory = ENumberGroup | 2,
1.636 +
1.637 +
1.638 + /**
1.639 + Punctuation, Connector.
1.640 + */
1.641 + EPcCategory = EPunctuationGroup | 0,
1.642 +
1.643 +
1.644 + /**
1.645 + Punctuation, Dash.
1.646 + */
1.647 + EPdCategory = EPunctuationGroup | 1,
1.648 +
1.649 +
1.650 + /**
1.651 + Punctuation, Open.
1.652 + */
1.653 + EPsCategory = EPunctuationGroup | 2,
1.654 +
1.655 +
1.656 + /**
1.657 + Punctuation, Close.
1.658 + */
1.659 + EPeCategory = EPunctuationGroup | 3,
1.660 +
1.661 +
1.662 + /**
1.663 + Punctuation, Initial Quote
1.664 + */
1.665 + EPiCategory = EPunctuationGroup | 4,
1.666 +
1.667 +
1.668 + /**
1.669 + Punctuation, Final Quote
1.670 + */
1.671 + EPfCategory = EPunctuationGroup | 5,
1.672 +
1.673 +
1.674 + /**
1.675 + Punctuation, Other.
1.676 + */
1.677 + EPoCategory = EPunctuationGroup | 6,
1.678 +
1.679 +
1.680 + /**
1.681 + Symbol, Math.
1.682 + */
1.683 + ESmCategory = ESymbolGroup | 0,
1.684 +
1.685 +
1.686 + /**
1.687 + Symbol, Currency.
1.688 + */
1.689 + EScCategory = ESymbolGroup | 1,
1.690 +
1.691 +
1.692 + /**
1.693 + Symbol, Modifier.
1.694 + */
1.695 + ESkCategory = ESymbolGroup | 2,
1.696 +
1.697 +
1.698 + /**
1.699 + Symbol, Other.
1.700 + */
1.701 + ESoCategory = ESymbolGroup | 3,
1.702 +
1.703 +
1.704 + /**
1.705 + The highest possible graphic character category.
1.706 + */
1.707 + EMaxGraphicCategory = ESymbolGroup | 0x0F,
1.708 +
1.709 +
1.710 + /**
1.711 + Separator, Space.
1.712 + */
1.713 + EZsCategory = ESeparatorGroup | 0,
1.714 +
1.715 +
1.716 + /**
1.717 + The highest possible printable character category.
1.718 + */
1.719 + EMaxPrintableCategory = EZsCategory,
1.720 +
1.721 +
1.722 + /**
1.723 + Separator, Line.
1.724 + */
1.725 + EZlCategory = ESeparatorGroup | 1,
1.726 +
1.727 +
1.728 + /**
1.729 + Separator, Paragraph.
1.730 + */
1.731 + EZpCategory = ESeparatorGroup | 2,
1.732 +
1.733 +
1.734 + /**
1.735 + Other, Control.
1.736 + */
1.737 + ECcCategory = EControlGroup | 0,
1.738 +
1.739 +
1.740 + /**
1.741 + Other, Format.
1.742 + */
1.743 + ECfCategory = EControlGroup | 1,
1.744 +
1.745 +
1.746 + /**
1.747 + The highest possible category for assigned 16-bit characters; does not
1.748 + include surrogates, which are interpreted as pairs and have no meaning
1.749 + on their own.
1.750 + */
1.751 + EMaxAssignedCategory = EMaxAssignedGroup | 0x0F,
1.752 +
1.753 +
1.754 + /**
1.755 + Other, Surrogate.
1.756 + */
1.757 + ECsCategory = EUnassignedGroup | 0,
1.758 +
1.759 +
1.760 + /**
1.761 + Other, Private Use.
1.762 + */
1.763 + ECoCategory = EUnassignedGroup | 1,
1.764 +
1.765 +
1.766 + /**
1.767 + Other, Not Assigned.
1.768 + */
1.769 + ECnCategory = EUnassignedGroup | 2
1.770 + };
1.771 +
1.772 +
1.773 + /**
1.774 + The bi-directional Unicode character category.
1.775 +
1.776 + For more information on the bi-directional algorithm, see Unicode Technical
1.777 + Report No. 9 available at: http://www.unicode.org/unicode/reports/tr9.
1.778 + */
1.779 + enum TBdCategory
1.780 + {
1.781 + /**
1.782 + Left to right.
1.783 + */
1.784 + ELeftToRight, // L Left-to-Right
1.785 +
1.786 +
1.787 + /**
1.788 + Left to right embedding.
1.789 + */
1.790 + ELeftToRightEmbedding, // LRE Left-to-Right Embedding
1.791 +
1.792 +
1.793 + /**
1.794 + Left-to-Right Override.
1.795 + */
1.796 + ELeftToRightOverride, // LRO Left-to-Right Override
1.797 +
1.798 +
1.799 + /**
1.800 + Right to left.
1.801 + */
1.802 + ERightToLeft, // R Right-to-Left
1.803 +
1.804 +
1.805 + /**
1.806 + Right to left Arabic.
1.807 + */
1.808 + ERightToLeftArabic, // AL Right-to-Left Arabic
1.809 +
1.810 +
1.811 + /**
1.812 + Right to left embedding.
1.813 + */
1.814 + ERightToLeftEmbedding, // RLE Right-to-Left Embedding
1.815 +
1.816 +
1.817 + /**
1.818 + Right-to-Left Override.
1.819 + */
1.820 + ERightToLeftOverride, // RLO Right-to-Left Override
1.821 +
1.822 +
1.823 + /**
1.824 + Pop Directional Format.
1.825 + */
1.826 + EPopDirectionalFormat, // PDF Pop Directional Format
1.827 +
1.828 +
1.829 + /**
1.830 + European number.
1.831 + */
1.832 + EEuropeanNumber, // EN European Number
1.833 +
1.834 +
1.835 + /**
1.836 + European number separator.
1.837 + */
1.838 + EEuropeanNumberSeparator, // ES European Number Separator
1.839 +
1.840 +
1.841 + /**
1.842 + European number terminator.
1.843 + */
1.844 + EEuropeanNumberTerminator, // ET European Number Terminator
1.845 +
1.846 +
1.847 + /**
1.848 + Arabic number.
1.849 + */
1.850 + EArabicNumber, // AN Arabic Number
1.851 +
1.852 +
1.853 + /**
1.854 + Common number separator.
1.855 + */
1.856 + ECommonNumberSeparator, // CS Common Number Separator
1.857 +
1.858 +
1.859 + /**
1.860 + Non Spacing Mark.
1.861 + */
1.862 + ENonSpacingMark, // NSM Non-Spacing Mark
1.863 +
1.864 +
1.865 + /**
1.866 + Boundary Neutral.
1.867 + */
1.868 + EBoundaryNeutral, // BN Boundary Neutral
1.869 +
1.870 +
1.871 + /**
1.872 + Paragraph Separator.
1.873 + */
1.874 + EParagraphSeparator, // B Paragraph Separator
1.875 +
1.876 +
1.877 + /**
1.878 + Segment separator.
1.879 + */
1.880 + ESegmentSeparator, // S Segment Separator
1.881 +
1.882 +
1.883 + /**
1.884 + Whitespace
1.885 + */
1.886 + EWhitespace, // WS Whitespace
1.887 +
1.888 +
1.889 + /**
1.890 + Other neutrals; all other characters: punctuation, symbols.
1.891 + */
1.892 + EOtherNeutral // ON Other Neutrals
1.893 + };
1.894 +
1.895 +
1.896 + /**
1.897 + Notional character width as known to East Asian (Chinese, Japanese,
1.898 + Korean (CJK)) coding systems.
1.899 + */
1.900 + enum TCjkWidth
1.901 + {
1.902 + /**
1.903 + Includes 'ambiguous width' defined in Unicode Technical Report 11: East Asian Width
1.904 + */
1.905 + ENeutralWidth,
1.906 +
1.907 +
1.908 + /**
1.909 + Character which occupies a single cell.
1.910 + */
1.911 + EHalfWidth, // other categories are as defined in the report
1.912 +
1.913 +
1.914 + /**
1.915 + Character which occupies 2 cells.
1.916 + */
1.917 + EFullWidth,
1.918 +
1.919 +
1.920 + /**
1.921 + Characters that are always narrow and have explicit full-width
1.922 + counterparts. All of ASCII is an example of East Asian Narrow
1.923 + characters.
1.924 + */
1.925 + ENarrow,
1.926 +
1.927 + /**
1.928 + Characters that are always wide. This category includes characters that
1.929 + have explicit half-width counterparts.
1.930 + */
1.931 + EWide
1.932 + };
1.933 +
1.934 +
1.935 + /**
1.936 + @deprecated
1.937 +
1.938 + Encoding systems used by the translation functions.
1.939 + */
1.940 + enum TEncoding
1.941 + {
1.942 + /**
1.943 + The Unicode encoding.
1.944 + */
1.945 + EUnicode,
1.946 +
1.947 +
1.948 + /**
1.949 + The shift-JIS encoding (used in Japan).
1.950 + */
1.951 + EShiftJIS
1.952 + };
1.953 +
1.954 +
1.955 + /**
1.956 + Flags defining operations to be performed using TChar::Fold().
1.957 +
1.958 + The flag values are passed to the Fold() funtion.
1.959 +
1.960 + @see TChar::Fold
1.961 + */
1.962 + enum
1.963 + {
1.964 + /**
1.965 + Convert characters to their lower case form if any.
1.966 + */
1.967 + EFoldCase = 1,
1.968 +
1.969 +
1.970 + /**
1.971 + Strip accents
1.972 + */
1.973 + EFoldAccents = 2,
1.974 +
1.975 +
1.976 + /**
1.977 + Convert digits representing values 0..9 to characters '0'..'9'
1.978 + */
1.979 + EFoldDigits = 4,
1.980 +
1.981 +
1.982 + /**
1.983 + Convert all spaces (ordinary, fixed-width, ideographic, etc.) to ' '
1.984 + */
1.985 + EFoldSpaces = 8,
1.986 +
1.987 +
1.988 + /**
1.989 + Convert hiragana to katakana.
1.990 + */
1.991 + EFoldKana = 16,
1.992 +
1.993 +
1.994 + /**
1.995 + Fold fullwidth and halfwidth variants to their standard forms
1.996 + */
1.997 + EFoldWidth = 32,
1.998 +
1.999 +
1.1000 + /**
1.1001 + Perform standard folding operations, i.e.those done by Fold() with no argument
1.1002 + */
1.1003 + EFoldStandard = EFoldCase | EFoldAccents | EFoldDigits | EFoldSpaces,
1.1004 +
1.1005 +
1.1006 + /**
1.1007 + Perform all possible folding operations
1.1008 + */
1.1009 + EFoldAll = -1
1.1010 + };
1.1011 +
1.1012 +
1.1013 + struct TCharInfo
1.1014 + /**
1.1015 + A structure to hold information about a Unicode character.
1.1016 +
1.1017 + An object of this type is passed to TChar::GetInfo().
1.1018 +
1.1019 + @see TChar::GetInfo
1.1020 + */
1.1021 + {
1.1022 + /**
1.1023 + General category.
1.1024 + */
1.1025 + TCategory iCategory;
1.1026 +
1.1027 +
1.1028 + /**
1.1029 + Bi-directional category.
1.1030 + */
1.1031 + TBdCategory iBdCategory;
1.1032 +
1.1033 +
1.1034 + /**
1.1035 + Combining class: number (currently) in the range 0..234
1.1036 + */
1.1037 + TInt iCombiningClass;
1.1038 +
1.1039 +
1.1040 + /**
1.1041 + Lower case form.
1.1042 + */
1.1043 + TUint iLowerCase;
1.1044 +
1.1045 +
1.1046 + /**
1.1047 + Upper case form.
1.1048 + */
1.1049 + TUint iUpperCase;
1.1050 +
1.1051 +
1.1052 + /**
1.1053 + Title case form.
1.1054 + */
1.1055 + TUint iTitleCase;
1.1056 +
1.1057 +
1.1058 + /**
1.1059 + True, if the character is mirrored.
1.1060 + */
1.1061 + TBool iMirrored;
1.1062 +
1.1063 +
1.1064 + /**
1.1065 + Integer numeric value: -1 if none, -2 if a fraction.
1.1066 + */
1.1067 + TInt iNumericValue;
1.1068 + };
1.1069 +
1.1070 + inline TChar();
1.1071 + inline TChar(TUint aChar);
1.1072 + inline TChar& operator-=(TUint aChar);
1.1073 + inline TChar& operator+=(TUint aChar);
1.1074 + inline TChar operator-(TUint aChar);
1.1075 + inline TChar operator+(TUint aChar);
1.1076 + inline operator TUint() const;
1.1077 +#ifndef __KERNEL_MODE__
1.1078 + inline void Fold();
1.1079 + inline void LowerCase();
1.1080 + inline void UpperCase();
1.1081 + inline TBool Eos() const;
1.1082 + IMPORT_C TUint GetUpperCase() const;
1.1083 + IMPORT_C TUint GetLowerCase() const;
1.1084 + IMPORT_C TBool IsLower() const;
1.1085 + IMPORT_C TBool IsUpper() const;
1.1086 + IMPORT_C TBool IsAlpha() const;
1.1087 + IMPORT_C TBool IsDigit() const;
1.1088 + IMPORT_C TBool IsAlphaDigit() const;
1.1089 + IMPORT_C TBool IsHexDigit() const;
1.1090 + IMPORT_C TBool IsSpace() const;
1.1091 + IMPORT_C TBool IsPunctuation() const;
1.1092 + IMPORT_C TBool IsGraph() const;
1.1093 + IMPORT_C TBool IsPrint() const;
1.1094 + IMPORT_C TBool IsControl() const;
1.1095 + inline void Fold(TInt aFlags);
1.1096 + inline void TitleCase();
1.1097 + IMPORT_C TUint GetTitleCase() const;
1.1098 + IMPORT_C TBool IsTitle() const;
1.1099 + IMPORT_C TBool IsAssigned() const;
1.1100 + IMPORT_C void GetInfo(TCharInfo& aInfo) const;
1.1101 + IMPORT_C TCategory GetCategory() const;
1.1102 + IMPORT_C TBdCategory GetBdCategory() const;
1.1103 + IMPORT_C TInt GetCombiningClass() const;
1.1104 + IMPORT_C TBool IsMirrored() const;
1.1105 + IMPORT_C TInt GetNumericValue() const;
1.1106 + IMPORT_C TCjkWidth GetCjkWidth() const;
1.1107 + IMPORT_C static TBool Compose(TUint& aResult,const TDesC16& aSource);
1.1108 + IMPORT_C TBool Decompose(TPtrC16& aResult) const;
1.1109 +
1.1110 +protected:
1.1111 + inline void SetChar(TUint aChar);
1.1112 +#endif
1.1113 +private:
1.1114 + TUint iChar;
1.1115 + __DECLARE_TEST;
1.1116 + };
1.1117 +
1.1118 +#include <e32des8.h>
1.1119 +#ifndef __KERNEL_MODE__
1.1120 +#include <e32des16.h>
1.1121 +#endif
1.1122 +
1.1123 +
1.1124 +
1.1125 +
1.1126 +#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1.1127 +#define __Size (sizeof(TUint)/sizeof(TUint16))
1.1128 +/**
1.1129 +@publishedAll
1.1130 +@released
1.1131 +
1.1132 +Defines a build-independent non-modifiable descriptor.
1.1133 +
1.1134 +A 16-bit build variant is generated for a Unicode, non-kernel
1.1135 +mode build.
1.1136 +
1.1137 +A build-independent type should always be used unless an explicit 8-bit
1.1138 +or 16-bit type is required.
1.1139 +
1.1140 +@see TDesC8
1.1141 +@see TDesC16
1.1142 +*/
1.1143 +typedef TDesC16 TDesC;
1.1144 +
1.1145 +
1.1146 +
1.1147 +
1.1148 +/**
1.1149 +@publishedAll
1.1150 +@released
1.1151 +
1.1152 +Defines a build-independent non-modifiable pointer descriptor.
1.1153 +
1.1154 +A 16-bit build variant is generated for a Unicode, non-kernel
1.1155 +mode build.
1.1156 +
1.1157 +A build-independent type should always be used unless an explicit 8-bit
1.1158 +or 16-bit type is required.
1.1159 +
1.1160 +@see TPtrC8
1.1161 +@see TPtrC16
1.1162 +*/
1.1163 +typedef TPtrC16 TPtrC;
1.1164 +
1.1165 +
1.1166 +
1.1167 +
1.1168 +/**
1.1169 +@publishedAll
1.1170 +@released
1.1171 +
1.1172 +Defines a build-independent modifiable descriptor.
1.1173 +
1.1174 +A 16-bit build variant is generated for a Unicode, non-kernel
1.1175 +mode build.
1.1176 +
1.1177 +A build-independent type should always be used unless an explicit 8-bit
1.1178 +or 16-bit type is required.
1.1179 +
1.1180 +@see TDes8
1.1181 +@see TDes16
1.1182 +*/
1.1183 +typedef TDes16 TDes;
1.1184 +
1.1185 +
1.1186 +
1.1187 +
1.1188 +/**
1.1189 +@publishedAll
1.1190 +@released
1.1191 +
1.1192 +Defines a build-independent modifiable pointer descriptor.
1.1193 +
1.1194 +A 16-bit build variant is generated for a Unicode, non-kernel
1.1195 +mode build.
1.1196 +
1.1197 +A build-independent type should always be used unless an explicit 8-bit
1.1198 +or 16-bit type is required.
1.1199 +
1.1200 +@see TPtr8
1.1201 +@see TPtr16
1.1202 +*/
1.1203 +typedef TPtr16 TPtr;
1.1204 +
1.1205 +
1.1206 +
1.1207 +
1.1208 +#ifndef __KERNEL_MODE__
1.1209 +/**
1.1210 +@publishedAll
1.1211 +@released
1.1212 +
1.1213 +Defines a build-independent heap descriptor.
1.1214 +
1.1215 +A 16-bit build variant is generated for a Unicode, non-kernel
1.1216 +mode build.
1.1217 +
1.1218 +A build-independent type should always be used unless an explicit 8-bit
1.1219 +or 16-bit type is required.
1.1220 +
1.1221 +@see HBufC8
1.1222 +@see HBufC16
1.1223 +*/
1.1224 +typedef HBufC16 HBufC;
1.1225 +
1.1226 +
1.1227 +
1.1228 +
1.1229 +/**
1.1230 +@publishedAll
1.1231 +@released
1.1232 +
1.1233 +Defines a build-independent descriptor overflow handler.
1.1234 +
1.1235 +A 16-bit build variant is generated for a Unicode, non-kernel
1.1236 +mode build.
1.1237 +
1.1238 +A build-independent type should always be used unless an explicit 8-bit
1.1239 +or 16-bit type is required.
1.1240 +
1.1241 +@see TDes8Overflow
1.1242 +@see TDes16Overflow
1.1243 +*/
1.1244 +typedef TDes16Overflow TDesOverflow;
1.1245 +
1.1246 +
1.1247 +/**
1.1248 +@publishedAll
1.1249 +@released
1.1250 +
1.1251 +Defines a build-independent resizable buffer descriptor.
1.1252 +
1.1253 +A 16-bit build variant is generated for a Unicode, non-kernel mode build.
1.1254 +
1.1255 +A build-independent type should always be used unless an explicit 8-bit
1.1256 +or 16-bit type is required.
1.1257 +
1.1258 +@see RBuf8
1.1259 +@see RBuf16
1.1260 +*/
1.1261 +typedef RBuf16 RBuf;
1.1262 +
1.1263 +#endif
1.1264 +#else
1.1265 +#define __Size (sizeof(TUint)/sizeof(TUint8))
1.1266 +
1.1267 +
1.1268 +
1.1269 +
1.1270 +/**
1.1271 +@publishedAll
1.1272 +@released
1.1273 +
1.1274 +Defines a build-independent non-modifiable descriptor.
1.1275 +
1.1276 +An 8-bit build variant is generated for a non-Unicode build.
1.1277 +
1.1278 +This build-independent type should always be used unless an explicit 8-bit
1.1279 +or 16-bit build variant is required.
1.1280 +
1.1281 +@see TDesC8
1.1282 +@see TDesC16
1.1283 +*/
1.1284 +typedef TDesC8 TDesC;
1.1285 +
1.1286 +
1.1287 +
1.1288 +
1.1289 +/**
1.1290 +@publishedAll
1.1291 +@released
1.1292 +
1.1293 +Defines a build-independent non-modifiable pointer descriptor.
1.1294 +
1.1295 +An 8-bit build variant is generated for a non-Unicode build.
1.1296 +
1.1297 +This build-independent type should always be used unless an explicit 8-bit
1.1298 +or 16-bit build variant is required.
1.1299 +
1.1300 +@see TPtrC8
1.1301 +@see TPtrC16
1.1302 +*/
1.1303 +typedef TPtrC8 TPtrC;
1.1304 +
1.1305 +
1.1306 +
1.1307 +
1.1308 +/**
1.1309 +@publishedAll
1.1310 +@released
1.1311 +
1.1312 +Defines a build-independent modifiable descriptor.
1.1313 +
1.1314 +An 8-bit build variant is generated for a non-Unicode build.
1.1315 +
1.1316 +This build-independent type should always be used unless an explicit 8-bit
1.1317 +or 16-bit build variant is required.
1.1318 +
1.1319 +@see TDes8
1.1320 +@see TDes16
1.1321 +*/
1.1322 +typedef TDes8 TDes;
1.1323 +
1.1324 +
1.1325 +
1.1326 +
1.1327 +/**
1.1328 +@publishedAll
1.1329 +@released
1.1330 +
1.1331 +Defines a build-independent modifiable pointer descriptor.
1.1332 +
1.1333 +An 8-bit build variant is generated for a non-Unicode build.
1.1334 +
1.1335 +This build-independent type should always be used unless an explicit 8-bit
1.1336 +or 16-bit build variant is required.
1.1337 +
1.1338 +@see TPtr8
1.1339 +@see TPtr16
1.1340 +*/
1.1341 +typedef TPtr8 TPtr;
1.1342 +#ifndef __KERNEL_MODE__
1.1343 +
1.1344 +
1.1345 +
1.1346 +
1.1347 +/**
1.1348 +@publishedAll
1.1349 +@released
1.1350 +
1.1351 +Defines a build-independent heap descriptor.
1.1352 +
1.1353 +An 8-bit build variant is generated for a non-Unicode, non-kernel
1.1354 +mode build.
1.1355 +
1.1356 +This build-independent type should always be used unless an explicit 8-bit
1.1357 +or 16-bit build variant is required.
1.1358 +
1.1359 +@see HBufC8
1.1360 +@see HBufC16
1.1361 +*/
1.1362 +typedef HBufC8 HBufC;
1.1363 +
1.1364 +
1.1365 +
1.1366 +
1.1367 +/**
1.1368 +@publishedAll
1.1369 +@released
1.1370 +
1.1371 +Defines a build-independent descriptor overflow handler.
1.1372 +
1.1373 +An 8-bit build variant is generated for a non-Unicode, non-kernel
1.1374 +mode build.
1.1375 +
1.1376 +This build-independent type should always be used unless an explicit 8-bit
1.1377 +or 16-bit build variant is required.
1.1378 +
1.1379 +@see TDes8Overflow
1.1380 +@see TDes16Overflow
1.1381 +*/
1.1382 +typedef TDes8Overflow TDesOverflow;
1.1383 +
1.1384 +
1.1385 +/**
1.1386 +@publishedAll
1.1387 +@released
1.1388 +
1.1389 +Defines a build-independent resizable buffer descriptor.
1.1390 +
1.1391 +An 8-bit build variant is generated for a non-Unicode, non-kernel mode build.
1.1392 +
1.1393 +This build-independent type should always be used unless an explicit 8-bit
1.1394 +or 16-bit build variant is required.
1.1395 +
1.1396 +@see RBuf8
1.1397 +@see RBuf16
1.1398 +*/
1.1399 +typedef RBuf8 RBuf;
1.1400 +
1.1401 +#endif
1.1402 +#endif
1.1403 +
1.1404 +
1.1405 +#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1.1406 +typedef TBufCBase16 TBufCBase;
1.1407 +#else
1.1408 +typedef TBufCBase8 TBufCBase;
1.1409 +#endif
1.1410 +
1.1411 +/**
1.1412 +@publishedAll
1.1413 +@released
1.1414 +
1.1415 +A build-independent non-modifiable buffer descriptor.
1.1416 +
1.1417 +This is a descriptor class which provides a buffer of fixed length for
1.1418 +containing and accessing TUint16 or TUint8 data, depending on the build.
1.1419 +
1.1420 +The class intended for instantiation. The data that the descriptor represents
1.1421 +is part of the descriptor object itself.
1.1422 +
1.1423 +The class is templated, based on an integer value which defines the size of
1.1424 +the descriptor's data area.
1.1425 +
1.1426 +The data is intended to be accessed, but not modified; however, it can be
1.1427 +completely replaced using the assignment operators of this class. The base
1.1428 +class provides the functions through which the data is accessed.
1.1429 +
1.1430 +This class derives from TBufCBase16 for a Unicode, non-kernel build, but
1.1431 +derives from TBufCBase8 for a non-Unicode build.
1.1432 +
1.1433 +@see TDesC
1.1434 +@see TDesC8
1.1435 +@see TDesC16
1.1436 +@see TPtr
1.1437 +@see TPtr8
1.1438 +@see TPtr16
1.1439 +@see TBufC8
1.1440 +@see TBufC16
1.1441 +*/
1.1442 +template <TInt S>
1.1443 +#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1.1444 +class TBufC : public TBufCBase16
1.1445 +#else
1.1446 +class TBufC : public TBufCBase8
1.1447 +#endif
1.1448 + {
1.1449 +public:
1.1450 + inline TBufC();
1.1451 + inline TBufC(const TText* aString);
1.1452 + inline TBufC(const TDesC& aDes);
1.1453 + inline TBufC<S>& operator=(const TText* aString);
1.1454 + inline TBufC<S>& operator=(const TDesC& aDes);
1.1455 + inline TPtr Des();
1.1456 +private:
1.1457 + TText iBuf[__Align(S)];
1.1458 + };
1.1459 +
1.1460 +
1.1461 +
1.1462 +/**
1.1463 +@publishedAll
1.1464 +@released
1.1465 +
1.1466 +A build-independent modifiable buffer descriptor.
1.1467 +
1.1468 +This is a descriptor class which provides a buffer of fixed length for
1.1469 +containing, accessing and manipulating TUint16 or TUint8 data, depending
1.1470 +on the build.
1.1471 +
1.1472 +The class is intended for instantiation. The data that the descriptor represents
1.1473 +is part of the descriptor object itself.
1.1474 +
1.1475 +The class is templated, based on an integer value which determines the size
1.1476 +of the data area created as part of the buffer descriptor object; this is
1.1477 +also the maximum length of the descriptor.
1.1478 +
1.1479 +The data is intended to be both accessed and modified. The base classes provide
1.1480 +the functions through which the data is accessed.
1.1481 +
1.1482 +This class derives from TBufCBase16 for a Unicode, non-kernel build, but
1.1483 +derives from TBufCBase8 for a non-Unicode build.
1.1484 +
1.1485 +@see TDesC
1.1486 +@see TDesC8
1.1487 +@see TDesC16
1.1488 +@see TDes
1.1489 +@see TDes8
1.1490 +@see TDes16
1.1491 +@see TPtr
1.1492 +@see TPtr8
1.1493 +@see TPtr16
1.1494 +*/
1.1495 +template <TInt S>
1.1496 +#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1.1497 +class TBuf : public TBufBase16
1.1498 +#else
1.1499 +class TBuf : public TBufBase8
1.1500 +#endif
1.1501 + {
1.1502 +public:
1.1503 + inline TBuf();
1.1504 + inline explicit TBuf(TInt aLength);
1.1505 + inline TBuf(const TText* aString);
1.1506 + inline TBuf(const TDesC& aDes);
1.1507 + inline TBuf<S>& operator=(const TText* aString);
1.1508 + inline TBuf<S>& operator=(const TDesC& aDes);
1.1509 + inline TBuf<S>& operator=(const TBuf<S>& aBuf);
1.1510 +private:
1.1511 + TText iBuf[__Align(S)];
1.1512 + };
1.1513 +
1.1514 +
1.1515 +
1.1516 +
1.1517 +/**
1.1518 +@publishedAll
1.1519 +@released
1.1520 +
1.1521 +Value reference used in operator TLitC::__TRefDesC().
1.1522 +
1.1523 +@see TRefByValue
1.1524 +*/
1.1525 +typedef TRefByValue<const TDesC> __TRefDesC;
1.1526 +
1.1527 +
1.1528 +
1.1529 +
1.1530 +/**
1.1531 +@publishedAll
1.1532 +@released
1.1533 +
1.1534 +Encapsulates literal text.
1.1535 +
1.1536 +This is always constructed using an _LIT macro.
1.1537 +
1.1538 +This class is build independent; i.e. for a non-Unicode build, an 8-bit build
1.1539 +variant is generated; for a Unicode build, a 16 bit build variant is generated.
1.1540 +
1.1541 +The class has no explicit constructors. See the _LIT macro definition.
1.1542 +*/
1.1543 +template <TInt S>
1.1544 +class TLitC
1.1545 + {
1.1546 +public:
1.1547 + /**
1.1548 + @internalComponent
1.1549 + */
1.1550 + enum {BufferSize=S-1};
1.1551 + inline const TDesC* operator&() const;
1.1552 + inline operator const TDesC&() const;
1.1553 + inline const TDesC& operator()() const;
1.1554 + inline operator const __TRefDesC() const;
1.1555 +public:
1.1556 +#if !defined(_UNICODE) || defined(__KERNEL_MODE__)
1.1557 +
1.1558 + /**
1.1559 + @internalComponent
1.1560 + */
1.1561 + typedef TUint8 __TText;
1.1562 +#elif defined(__GCC32__)
1.1563 +
1.1564 + /**
1.1565 + @internalComponent
1.1566 + */
1.1567 + typedef wchar_t __TText;
1.1568 +#elif defined(__VC32__)
1.1569 +
1.1570 + /**
1.1571 + @internalComponent
1.1572 + */
1.1573 + typedef TUint16 __TText;
1.1574 +
1.1575 +#elif defined(__CW32__)
1.1576 +
1.1577 + /**
1.1578 + @internalComponent
1.1579 + */
1.1580 + typedef TUint16 __TText;
1.1581 +#elif !defined(__TText_defined)
1.1582 +#error no typedef for __TText
1.1583 +#endif
1.1584 +public:
1.1585 + /**
1.1586 + @internalComponent
1.1587 + */
1.1588 + TUint iTypeLength;
1.1589 +
1.1590 + /**
1.1591 + @internalComponent
1.1592 + */
1.1593 + __TText iBuf[__Align(S)];
1.1594 + };
1.1595 +
1.1596 +
1.1597 +/**
1.1598 +@publishedAll
1.1599 +@released
1.1600 +
1.1601 +Defines an empty or null literal descriptor.
1.1602 +
1.1603 +This is the build independent form.
1.1604 +An 8 bit build variant is generated for a non-Unicode build;
1.1605 +a 16 bit build variant is generated for a Unicode build.
1.1606 +*/
1.1607 +_LIT(KNullDesC,"");
1.1608 +
1.1609 +
1.1610 +
1.1611 +/**
1.1612 +@publishedAll
1.1613 +@released
1.1614 +
1.1615 +Defines an empty or null literal descriptor for use with 8-bit descriptors.
1.1616 +*/
1.1617 +_LIT8(KNullDesC8,"");
1.1618 +#ifndef __KERNEL_MODE__
1.1619 +
1.1620 +
1.1621 +
1.1622 +/**
1.1623 +@publishedAll
1.1624 +@released
1.1625 +
1.1626 +Defines an empty or null literal descriptor for use with 16-bit descriptors
1.1627 +*/
1.1628 +_LIT16(KNullDesC16,"");
1.1629 +#endif
1.1630 +
1.1631 +
1.1632 +
1.1633 +
1.1634 +/**
1.1635 +@publishedAll
1.1636 +@released
1.1637 +
1.1638 +Packages a non-modifiable pointer descriptor which represents an object of
1.1639 +specific type.
1.1640 +
1.1641 +The template parameter defines the type of object.
1.1642 +
1.1643 +The object represented by the packaged pointer descriptor is accessible through
1.1644 +the package but cannot be changed. */
1.1645 +template <class T>
1.1646 +class TPckgC : public TPtrC8
1.1647 + {
1.1648 +public:
1.1649 + inline TPckgC(const T& aRef);
1.1650 + inline const T& operator()() const;
1.1651 +private:
1.1652 + TPckgC<T>& operator=(const TPckgC<T>& aRef);
1.1653 + };
1.1654 +
1.1655 +
1.1656 +
1.1657 +
1.1658 +/**
1.1659 +@publishedAll
1.1660 +@released
1.1661 +
1.1662 +Packages a modifiable pointer descriptor which represents an object of specific
1.1663 +type.
1.1664 +
1.1665 +The template parameter defines the type of object.
1.1666 +
1.1667 +The object represented by the packaged pointer descriptor is accessible through
1.1668 +the package.
1.1669 +*/
1.1670 +template <class T>
1.1671 +class TPckg : public TPtr8
1.1672 + {
1.1673 +public:
1.1674 + inline TPckg(const T& aRef);
1.1675 + inline T& operator()();
1.1676 +private:
1.1677 + TPckg<T>& operator=(const TPckg<T>& aRef);
1.1678 + };
1.1679 +
1.1680 +
1.1681 +
1.1682 +
1.1683 +/**
1.1684 +@publishedAll
1.1685 +@released
1.1686 +
1.1687 +Packages an object into a modifiable buffer descriptor.
1.1688 +
1.1689 +The template parameter defines the type of object to be packaged.
1.1690 +
1.1691 +The package provides a type safe way of transferring an object or data structure
1.1692 +which is contained within a modifiable buffer descriptor. Typically, a package
1.1693 +is used for passing data via inter thread communication.
1.1694 +
1.1695 +The contained object is accessible through the package.
1.1696 +*/
1.1697 +template <class T>
1.1698 +class TPckgBuf : public TAlignedBuf8<sizeof(T)>
1.1699 + {
1.1700 +public:
1.1701 + inline TPckgBuf();
1.1702 + inline TPckgBuf(const T& aRef);
1.1703 + inline TPckgBuf& operator=(const TPckgBuf<T>& aRef);
1.1704 + inline T& operator=(const T& aRef);
1.1705 + inline T& operator()();
1.1706 + inline const T& operator()() const;
1.1707 + };
1.1708 +
1.1709 +
1.1710 +
1.1711 +
1.1712 +/**
1.1713 +@publishedAll
1.1714 +@released
1.1715 +
1.1716 +Defines a modifiable buffer descriptor that can contain the name of a reference
1.1717 +counting object.
1.1718 +
1.1719 +@see TBuf
1.1720 +@see CObject
1.1721 +*/
1.1722 +typedef TBuf<KMaxName> TName;
1.1723 +
1.1724 +
1.1725 +
1.1726 +
1.1727 +/**
1.1728 +@internalTechnology
1.1729 +*/
1.1730 +typedef TBuf<KMaxKernelName> TKName;
1.1731 +
1.1732 +
1.1733 +/**
1.1734 +@internalTechnology
1.1735 +*/
1.1736 +typedef TBuf<KMaxInfoName> TInfoName;
1.1737 +
1.1738 +
1.1739 +
1.1740 +
1.1741 +/**
1.1742 +@publishedAll
1.1743 +@released
1.1744 +
1.1745 +Defines a modifiable buffer descriptor that can contain the full name of a
1.1746 +reference counting object.
1.1747 +
1.1748 +@see TBuf
1.1749 +@see CObject
1.1750 +*/
1.1751 +typedef TBuf<KMaxFullName> TFullName;
1.1752 +
1.1753 +
1.1754 +
1.1755 +/**
1.1756 +@publishedAll
1.1757 +@released
1.1758 +
1.1759 +Defines a modifiable buffer descriptor to contain the category name identifying
1.1760 +the cause of thread or process termination. The buffer takes a maximum length
1.1761 +of KMaxExitCategoryName.
1.1762 +
1.1763 +@see RThread::ExitCategory
1.1764 +@see RThread::ExitCategory
1.1765 +*/
1.1766 +typedef TBuf<KMaxExitCategoryName> TExitCategoryName;
1.1767 +
1.1768 +
1.1769 +
1.1770 +/**
1.1771 +@publishedAll
1.1772 +@released
1.1773 +
1.1774 +A buffer that can contain the name of a file.
1.1775 +The name can have a maximum length of KMaxFileName
1.1776 +(currently 256 but check the definition of KMaxFileName).
1.1777 +
1.1778 +@see KMaxFileName
1.1779 +*/
1.1780 +typedef TBuf<KMaxFileName> TFileName;
1.1781 +
1.1782 +
1.1783 +
1.1784 +/**
1.1785 +@publishedAll
1.1786 +@released
1.1787 +
1.1788 +A buffer that can contain the name of a path.
1.1789 +The name can have a maximum length of KMaxPath
1.1790 +(currently 256 but check the definition of KMaxPath).
1.1791 +
1.1792 +@see KMaxPath
1.1793 +*/
1.1794 +typedef TBuf<KMaxPath> TPath;
1.1795 +
1.1796 +
1.1797 +
1.1798 +/**
1.1799 +@internalComponent
1.1800 +*/
1.1801 +typedef TBuf<KMaxDeviceInfo> TDeviceInfo;
1.1802 +
1.1803 +
1.1804 +
1.1805 +/**
1.1806 +@publishedAll
1.1807 +@released
1.1808 +
1.1809 +Version name type.
1.1810 +
1.1811 +This is a buffer descriptor with a maximum length of KMaxVersionName.
1.1812 +A TVersion object returns the formatted character representation of its version
1.1813 +information in a descriptor of this type.
1.1814 +
1.1815 +@see TVersion
1.1816 +*/
1.1817 +typedef TBuf<KMaxVersionName> TVersionName;
1.1818 +
1.1819 +
1.1820 +
1.1821 +
1.1822 +typedef TBuf<KMaxPassword> TPassword;
1.1823 +
1.1824 +
1.1825 +
1.1826 +
1.1827 +/**
1.1828 +@publishedAll
1.1829 +@released
1.1830 +
1.1831 +Defines a modifiable buffer descriptor for the text form of the UID.
1.1832 +The descriptor has a maximum length of KMaxUidName and is used to contain
1.1833 +the standard text format returned by the function TUid::Name().
1.1834 +
1.1835 +@see TUid::Name
1.1836 +*/
1.1837 +typedef TBuf<KMaxUidName> TUidName;
1.1838 +
1.1839 +
1.1840 +
1.1841 +
1.1842 +/**
1.1843 +@publishedAll
1.1844 +@released
1.1845 +
1.1846 +Defines a null UID
1.1847 +*/
1.1848 +#define KNullUid TUid::Null()
1.1849 +
1.1850 +
1.1851 +
1.1852 +
1.1853 +/**
1.1854 +@publishedAll
1.1855 +@released
1.1856 +
1.1857 +A globally unique 32-bit number.
1.1858 +*/
1.1859 +class TUid
1.1860 + {
1.1861 +public:
1.1862 +#ifndef __KERNEL_MODE__
1.1863 + IMPORT_C TBool operator==(const TUid& aUid) const;
1.1864 + IMPORT_C TBool operator!=(const TUid& aUid) const;
1.1865 + IMPORT_C TUidName Name() const;
1.1866 +#endif
1.1867 + static inline TUid Uid(TInt aUid);
1.1868 + static inline TUid Null();
1.1869 +public:
1.1870 + /**
1.1871 + The 32-bit integer UID value.
1.1872 + */
1.1873 + TInt32 iUid;
1.1874 + };
1.1875 +
1.1876 +
1.1877 +
1.1878 +
1.1879 +/**
1.1880 +@publishedAll
1.1881 +@released
1.1882 +
1.1883 +Encapsulates a set of three unique identifiers (UIDs) which, in combination,
1.1884 +identify a system object such as a GUI application or a DLL. The three
1.1885 +component UIDs are referred to as UID1, UID2 and UID3.
1.1886 +
1.1887 +An object of this type is referred to as a compound identifier or a UID type.
1.1888 +*/
1.1889 +class TUidType
1.1890 + {
1.1891 +public:
1.1892 +#ifndef __KERNEL_MODE__
1.1893 + IMPORT_C TUidType();
1.1894 + IMPORT_C TUidType(TUid aUid1);
1.1895 + IMPORT_C TUidType(TUid aUid1,TUid aUid2);
1.1896 + IMPORT_C TUidType(TUid aUid1,TUid aUid2,TUid aUid3);
1.1897 + IMPORT_C TBool operator==(const TUidType& aUidType) const;
1.1898 + IMPORT_C TBool operator!=(const TUidType& aUidType) const;
1.1899 + IMPORT_C const TUid& operator[](TInt anIndex) const;
1.1900 + IMPORT_C TUid MostDerived() const;
1.1901 + IMPORT_C TBool IsPresent(TUid aUid) const;
1.1902 + IMPORT_C TBool IsValid() const;
1.1903 +private:
1.1904 +#endif
1.1905 + TUid iUid[KMaxCheckedUid];
1.1906 + };
1.1907 +
1.1908 +
1.1909 +
1.1910 +
1.1911 +/**
1.1912 +A class used to represent the Secure ID of a process or executable image.
1.1913 +
1.1914 +Constructors and conversion operators are provided to enable conversion
1.1915 +of this class to and from both TUint32 and TUid objects.
1.1916 +
1.1917 +Because this class has non-default constructors, compilers will not initialise
1.1918 +this objects at compile time, instead code will be generated to construct the object
1.1919 +at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
1.1920 +such uninitialised data. To overcome these problems a macro is provided to construct
1.1921 +a const object which behaves like a TSecureId. This is _LIT_SECURE_ID.
1.1922 +This macro should be used where it is desirable to define const TSecureId objects,
1.1923 +like in header files. E.g. Instead of writing:
1.1924 +@code
1.1925 + const TSecureId MyId=0x1234567
1.1926 +@endcode
1.1927 +use
1.1928 +@code
1.1929 + _LIT_SECURE_ID(MyId,0x1234567)
1.1930 +@endcode
1.1931 +
1.1932 +@publishedAll
1.1933 +@released
1.1934 +
1.1935 +@see _LIT_SECURE_ID
1.1936 +*/
1.1937 +class TSecureId
1.1938 + {
1.1939 +public:
1.1940 + inline TSecureId();
1.1941 + inline TSecureId(TUint32 aId);
1.1942 + inline operator TUint32() const;
1.1943 + inline TSecureId(TUid aId);
1.1944 + inline operator TUid() const;
1.1945 +public:
1.1946 + TUint32 iId;
1.1947 + };
1.1948 +
1.1949 +
1.1950 +
1.1951 +
1.1952 +/**
1.1953 +A class used to represent the Vendor ID of a process or executable image
1.1954 +
1.1955 +Constructors and conversion operators are provided to enable conversion
1.1956 +of this class to and from both TUint32 and TUid objects.
1.1957 +
1.1958 +Because this class has non-default constructors, compilers will not initialise
1.1959 +this objects at compile time, instead code will be generated to construct the object
1.1960 +at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
1.1961 +such uninitialised data. To overcome these problems a macro is provided to construct
1.1962 +a const object which behaves like a TSecureId. This is _LIT_VENDOR_ID.
1.1963 +This macro should be used where it is desirable to define const TSecureId objects,
1.1964 +like in header files. E.g. Instead of writing:
1.1965 +@code
1.1966 + const TVendorId MyId=0x1234567
1.1967 +@endcode
1.1968 +use
1.1969 +@code
1.1970 + _LIT_VENDOR_ID(MyId,0x1234567)
1.1971 +@endcode
1.1972 +
1.1973 +@publishedAll
1.1974 +@released
1.1975 +
1.1976 +@see _LIT_VENDOR_ID
1.1977 +*/
1.1978 +class TVendorId
1.1979 + {
1.1980 +public:
1.1981 + inline TVendorId();
1.1982 + inline TVendorId(TUint32 aId);
1.1983 + inline operator TUint32() const;
1.1984 + inline TVendorId(TUid aId);
1.1985 + inline operator TUid() const;
1.1986 +public:
1.1987 + TUint32 iId;
1.1988 + };
1.1989 +
1.1990 +
1.1991 +
1.1992 +/**
1.1993 +Structure for compile-time definition of a secure ID
1.1994 +@internalComponent
1.1995 +*/
1.1996 +class SSecureId
1.1997 + {
1.1998 +public:
1.1999 + inline const TSecureId* operator&() const;
1.2000 + inline operator const TSecureId&() const;
1.2001 + inline operator TUint32() const;
1.2002 + inline operator TUid() const;
1.2003 +public:
1.2004 + TUint32 iId;
1.2005 + };
1.2006 +
1.2007 +
1.2008 +
1.2009 +
1.2010 +/**
1.2011 +Structure for compile-time definition of a vendor ID
1.2012 +@internalComponent
1.2013 +*/
1.2014 +class SVendorId
1.2015 + {
1.2016 +public:
1.2017 + inline const TVendorId* operator&() const;
1.2018 + inline operator const TVendorId&() const;
1.2019 + inline operator TUint32() const;
1.2020 + inline operator TUid() const;
1.2021 +public:
1.2022 + TUint32 iId;
1.2023 + };
1.2024 +
1.2025 +
1.2026 +
1.2027 +
1.2028 +/**
1.2029 +Macro for compile-time definition of a secure ID
1.2030 +@param name Name to use for secure ID
1.2031 +@param value Value of secure ID
1.2032 +@publishedAll
1.2033 +@released
1.2034 +*/
1.2035 +#define _LIT_SECURE_ID(name,value) const SSecureId name={value}
1.2036 +
1.2037 +
1.2038 +
1.2039 +
1.2040 +/**
1.2041 +Macro for compile-time definition of a vendor ID
1.2042 +@param name Name to use for vendor ID
1.2043 +@param value Value of vendor ID
1.2044 +@publishedAll
1.2045 +@released
1.2046 +*/
1.2047 +#define _LIT_VENDOR_ID(name,value) const SVendorId name={value}
1.2048 +
1.2049 +
1.2050 +
1.2051 +
1.2052 +/**
1.2053 +@publishedAll
1.2054 +@released
1.2055 +
1.2056 +Contains version information.
1.2057 +
1.2058 +A version is defined by a set of three numbers:
1.2059 +
1.2060 +1. the major version number, ranging from 0 to 127, inclusive
1.2061 +
1.2062 +2. the minor version number, ranging from 0 to 99 inclusive
1.2063 +
1.2064 +3. the build number, ranging from 0 to 32767 inclusive.
1.2065 +
1.2066 +The class provides a constructor for setting all three numbers.
1.2067 +It also provides a member function to build a character representation of
1.2068 +this information in a TVersionName descriptor.
1.2069 +
1.2070 +@see TVersionName
1.2071 +*/
1.2072 +class TVersion
1.2073 + {
1.2074 +public:
1.2075 + IMPORT_C TVersion();
1.2076 + IMPORT_C TVersion(TInt aMajor,TInt aMinor,TInt aBuild);
1.2077 + IMPORT_C TVersionName Name() const;
1.2078 +public:
1.2079 + /**
1.2080 + The major version number.
1.2081 + */
1.2082 + TInt8 iMajor;
1.2083 +
1.2084 +
1.2085 + /**
1.2086 + The minor version number.
1.2087 + */
1.2088 + TInt8 iMinor;
1.2089 +
1.2090 +
1.2091 + /**
1.2092 + The build number.
1.2093 + */
1.2094 + TInt16 iBuild;
1.2095 + };
1.2096 +
1.2097 +
1.2098 +
1.2099 +
1.2100 +/**
1.2101 +@publishedAll
1.2102 +@released
1.2103 +
1.2104 +Indicates the completion status of a request made to a service provider.
1.2105 +
1.2106 +When a thread makes a request, it passes a request status as a parameter.
1.2107 +On completion, the provider signals the requesting thread's request semaphore
1.2108 +and stores a completion code in the request status. Typically, this is KErrNone
1.2109 +or one of the other system-wide error codes.
1.2110 +
1.2111 +This class is not intended for user derivation.
1.2112 +*/
1.2113 +class TRequestStatus
1.2114 + {
1.2115 +public:
1.2116 + inline TRequestStatus();
1.2117 + inline TRequestStatus(TInt aVal);
1.2118 + inline TInt operator=(TInt aVal);
1.2119 + inline TBool operator==(TInt aVal) const;
1.2120 + inline TBool operator!=(TInt aVal) const;
1.2121 + inline TBool operator>=(TInt aVal) const;
1.2122 + inline TBool operator<=(TInt aVal) const;
1.2123 + inline TBool operator>(TInt aVal) const;
1.2124 + inline TBool operator<(TInt aVal) const;
1.2125 + inline TInt Int() const;
1.2126 +private:
1.2127 + enum
1.2128 + {
1.2129 + EActive = 1, //bit0
1.2130 + ERequestPending = 2, //bit1
1.2131 + };
1.2132 + TInt iStatus;
1.2133 + TUint iFlags;
1.2134 + friend class CActive;
1.2135 + friend class CActiveScheduler;
1.2136 + friend class CServer2;
1.2137 + };
1.2138 +
1.2139 +
1.2140 +
1.2141 +
1.2142 +class TSize;
1.2143 +/**
1.2144 +@publishedAll
1.2145 +@released
1.2146 +
1.2147 +Stores a two-dimensional point in Cartesian co-ordinates.
1.2148 +
1.2149 +Its data members (iX and iY) are public and can be manipulated directly, or
1.2150 +by means of the functions provided. Functions are provided to set and manipulate
1.2151 +the point, and to compare points for equality.
1.2152 +*/
1.2153 +class TPoint
1.2154 + {
1.2155 +public:
1.2156 +#ifndef __KERNEL_MODE__
1.2157 + enum TUninitialized { EUninitialized };
1.2158 + /**
1.2159 + Constructs default point, initialising its iX and iY members to zero.
1.2160 + */
1.2161 + TPoint(TUninitialized) {}
1.2162 + inline TPoint();
1.2163 + inline TPoint(TInt aX,TInt aY);
1.2164 + IMPORT_C TBool operator==(const TPoint& aPoint) const;
1.2165 + IMPORT_C TBool operator!=(const TPoint& aPoint) const;
1.2166 + IMPORT_C TPoint& operator-=(const TPoint& aPoint);
1.2167 + IMPORT_C TPoint& operator+=(const TPoint& aPoint);
1.2168 + IMPORT_C TPoint& operator-=(const TSize& aSize);
1.2169 + IMPORT_C TPoint& operator+=(const TSize& aSize);
1.2170 + IMPORT_C TPoint operator-(const TPoint& aPoint) const;
1.2171 + IMPORT_C TPoint operator+(const TPoint& aPoint) const;
1.2172 + IMPORT_C TPoint operator-(const TSize& aSize) const;
1.2173 + IMPORT_C TPoint operator+(const TSize& aSize) const;
1.2174 + IMPORT_C TPoint operator-() const;
1.2175 + IMPORT_C void SetXY(TInt aX,TInt aY);
1.2176 + IMPORT_C TSize AsSize() const;
1.2177 +#endif
1.2178 +public:
1.2179 + /**
1.2180 + The x co-ordinate.
1.2181 + */
1.2182 + TInt iX;
1.2183 + /**
1.2184 + The y co-ordinate.
1.2185 + */
1.2186 + TInt iY;
1.2187 + };
1.2188 +
1.2189 +/**
1.2190 +@internalTechnology
1.2191 +@prototype For now, only intended to be used by TRwEvent and the Windows Server
1.2192 +
1.2193 +Stores a three-dimensional point in Cartesian or polar co-ordinates.
1.2194 +
1.2195 +Its data members (iX, iY and iZ) are public and can be manipulated directly.
1.2196 +*/
1.2197 +class TPoint3D
1.2198 + {
1.2199 +public:
1.2200 + /**
1.2201 + The x co-ordinate.
1.2202 + */
1.2203 + TInt iX;
1.2204 + /**
1.2205 + The y co-ordinate.
1.2206 + */
1.2207 + TInt iY;
1.2208 + /**
1.2209 + The z co-ordinate.
1.2210 + */
1.2211 + TInt iZ;
1.2212 + };
1.2213 +
1.2214 +/**
1.2215 +@internalTechnology
1.2216 +@prototype For now, only intended to be used by TRwEvent and the Windows Server
1.2217 +
1.2218 +Stores the angular spherical coordinates (Phi,Theta) of a three-dimensional point.
1.2219 +
1.2220 +Its data members (iPhi, iTheta) are public and can be manipulated directly.
1.2221 +*/
1.2222 +class TAngle3D
1.2223 + {
1.2224 +public:
1.2225 + /**
1.2226 + 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).
1.2227 + */
1.2228 + TInt iPhi;
1.2229 + /**
1.2230 + The Theta co-ordinate (angle between the Z-axis and the line that links the point and the origin).
1.2231 + */
1.2232 + TInt iTheta;
1.2233 + };
1.2234 +
1.2235 +
1.2236 +/**
1.2237 +@publishedAll
1.2238 +@released
1.2239 +
1.2240 +Stores a two-dimensional size as a width and a height value.
1.2241 +
1.2242 +Its data members are public and can be manipulated directly, or by means of
1.2243 +the functions provided.
1.2244 +*/
1.2245 +class TSize
1.2246 + {
1.2247 +public:
1.2248 +#ifndef __KERNEL_MODE__
1.2249 + enum TUninitialized { EUninitialized };
1.2250 + /**
1.2251 + Constructs the size object with its iWidth and iHeight members set to zero.
1.2252 + */
1.2253 + TSize(TUninitialized) {}
1.2254 + inline TSize();
1.2255 + inline TSize(TInt aWidth,TInt aHeight);
1.2256 + IMPORT_C TBool operator==(const TSize& aSize) const;
1.2257 + IMPORT_C TBool operator!=(const TSize& aSize) const;
1.2258 + IMPORT_C TSize& operator-=(const TSize& aSize);
1.2259 + IMPORT_C TSize& operator-=(const TPoint& aPoint);
1.2260 + IMPORT_C TSize& operator+=(const TSize& aSize);
1.2261 + IMPORT_C TSize& operator+=(const TPoint& aPoint);
1.2262 + IMPORT_C TSize operator-(const TSize& aSize) const;
1.2263 + IMPORT_C TSize operator-(const TPoint& aPoint) const;
1.2264 + IMPORT_C TSize operator+(const TSize& aSize) const;
1.2265 + IMPORT_C TSize operator+(const TPoint& aPoint) const;
1.2266 + IMPORT_C TSize operator-() const;
1.2267 + IMPORT_C void SetSize(TInt aWidth,TInt aHeight);
1.2268 + IMPORT_C TPoint AsPoint() const;
1.2269 +#endif
1.2270 +public:
1.2271 + /**
1.2272 + The width of this TSize object.
1.2273 + */
1.2274 + TInt iWidth;
1.2275 + /**
1.2276 + The height of this TSize object.
1.2277 + */
1.2278 + TInt iHeight;
1.2279 + };
1.2280 +
1.2281 +
1.2282 +
1.2283 +
1.2284 +/**
1.2285 +@publishedAll
1.2286 +@released
1.2287 +
1.2288 +Information about a kernel object.
1.2289 +
1.2290 +This type of object is passed to RHandleBase::HandleInfo(). The function
1.2291 +fetches information on the usage of the kernel object associated with that
1.2292 +handle and stores the information in the THandleInfo object.
1.2293 +
1.2294 +The class contains four data members and no explicitly defined function
1.2295 +members.
1.2296 +*/
1.2297 +class THandleInfo
1.2298 + {
1.2299 +public:
1.2300 + /**
1.2301 + The number of times that the kernel object is open in the current process.
1.2302 + */
1.2303 + TInt iNumOpenInProcess;
1.2304 +
1.2305 + /**
1.2306 + The number of times that the kernel object is open in the current thread.
1.2307 + */
1.2308 + TInt iNumOpenInThread;
1.2309 +
1.2310 + /**
1.2311 + The number of processes which have a handle on the kernel object.
1.2312 + */
1.2313 + TInt iNumProcesses;
1.2314 +
1.2315 + /**
1.2316 + The number of threads which have a handle on the kernel object.
1.2317 + */
1.2318 + TInt iNumThreads;
1.2319 + };
1.2320 +
1.2321 +
1.2322 +
1.2323 +
1.2324 +/**
1.2325 +@internalComponent
1.2326 +*/
1.2327 +class TFindHandle
1.2328 + {
1.2329 +public:
1.2330 + inline TFindHandle();
1.2331 + inline TInt Handle() const;
1.2332 +#ifdef __KERNEL_MODE__
1.2333 + inline TInt Index() const;
1.2334 + inline TInt UniqueID() const;
1.2335 + inline TUint64 ObjectID() const;
1.2336 + inline void Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId);
1.2337 +#else
1.2338 +protected:
1.2339 + inline void Reset();
1.2340 +#endif
1.2341 +private:
1.2342 + TInt iHandle;
1.2343 + TInt iSpare1;
1.2344 + TInt iObjectIdLow;
1.2345 + TInt iObjectIdHigh;
1.2346 + };
1.2347 +
1.2348 +
1.2349 +
1.2350 +class RThread;
1.2351 +class TFindHandleBase;
1.2352 +class TFindSemaphore;
1.2353 +/**
1.2354 +@publishedAll
1.2355 +@released
1.2356 +
1.2357 +A handle to an object.
1.2358 +
1.2359 +The class encapsulates the basic behaviour of a handle, hiding the
1.2360 +handle-number which identifies the object which the handle represents.
1.2361 +
1.2362 +The class is abstract in the sense that a RHandleBase object is never
1.2363 +explicitly instantiated. It is always a base class to a concrete handle class;
1.2364 +for example, RSemaphore, RThread, RProcess, RCriticalSection etc.
1.2365 +*/
1.2366 +class RHandleBase
1.2367 + {
1.2368 +public:
1.2369 + /**
1.2370 + @internalComponent
1.2371 + */
1.2372 + enum
1.2373 + {
1.2374 + EReadAccess=0x1,
1.2375 + EWriteAccess=0x2,
1.2376 + EDirectReadAccess=0x4,
1.2377 + EDirectWriteAccess=0x8,
1.2378 + };
1.2379 +public:
1.2380 + inline RHandleBase();
1.2381 + inline TInt Handle() const;
1.2382 + inline void SetHandle(TInt aHandle);
1.2383 + inline TInt SetReturnedHandle(TInt aHandleOrError);
1.2384 + static void DoExtendedClose();
1.2385 +#ifndef __KERNEL_MODE__
1.2386 + IMPORT_C void Close();
1.2387 + IMPORT_C TName Name() const;
1.2388 + IMPORT_C TFullName FullName() const;
1.2389 + IMPORT_C void FullName(TDes& aName) const;
1.2390 + IMPORT_C void SetHandleNC(TInt aHandle);
1.2391 + IMPORT_C TInt Duplicate(const RThread& aSrc,TOwnerType aType=EOwnerProcess);
1.2392 + IMPORT_C void HandleInfo(THandleInfo* anInfo);
1.2393 + IMPORT_C TUint Attributes() const;
1.2394 + IMPORT_C TInt BTraceId() const;
1.2395 + IMPORT_C void NotifyDestruction(TRequestStatus& aStatus); /**< @internalTechnology */
1.2396 +protected:
1.2397 + inline RHandleBase(TInt aHandle);
1.2398 + IMPORT_C TInt Open(const TFindHandleBase& aHandle,TOwnerType aType);
1.2399 + static TInt SetReturnedHandle(TInt aHandleOrError,RHandleBase& aHandle);
1.2400 + TInt OpenByName(const TDesC &aName,TOwnerType aOwnerType,TInt aObjectType);
1.2401 +#endif
1.2402 +private:
1.2403 + static void DoExtendedCloseL();
1.2404 +protected:
1.2405 + TInt iHandle;
1.2406 + };
1.2407 +
1.2408 +
1.2409 +
1.2410 +
1.2411 +class RMessagePtr2;
1.2412 +/**
1.2413 +@publishedAll
1.2414 +@released
1.2415 +
1.2416 +A handle to a semaphore.
1.2417 +
1.2418 +The semaphore itself is a Kernel side object.
1.2419 +
1.2420 +As with all handles, they should be closed after use. RHandleBase provides
1.2421 +the necessary Close() function, which should be called when the handle is
1.2422 +no longer required.
1.2423 +
1.2424 +@see RHandleBase::Close
1.2425 +*/
1.2426 +class RSemaphore : public RHandleBase
1.2427 + {
1.2428 +public:
1.2429 +#ifndef __KERNEL_MODE__
1.2430 + inline TInt Open(const TFindSemaphore& aFind,TOwnerType aType=EOwnerProcess);
1.2431 + IMPORT_C TInt CreateLocal(TInt aCount,TOwnerType aType=EOwnerProcess);
1.2432 + IMPORT_C TInt CreateGlobal(const TDesC& aName,TInt aCount,TOwnerType aType=EOwnerProcess);
1.2433 + IMPORT_C TInt OpenGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess);
1.2434 + IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
1.2435 + IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
1.2436 + IMPORT_C void Wait();
1.2437 + IMPORT_C TInt Wait(TInt aTimeout); // timeout in microseconds
1.2438 + IMPORT_C void Signal();
1.2439 + IMPORT_C void Signal(TInt aCount);
1.2440 +#endif
1.2441 + };
1.2442 +
1.2443 +
1.2444 +
1.2445 +
1.2446 +/**
1.2447 +@publishedAll
1.2448 +@released
1.2449 +
1.2450 +A fast semaphore.
1.2451 +
1.2452 +This is a layer over a standard semaphore, and only calls into the kernel side
1.2453 +if there is contention.
1.2454 +*/
1.2455 +class RFastLock : public RSemaphore
1.2456 + {
1.2457 +public:
1.2458 + inline RFastLock();
1.2459 + IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess);
1.2460 + IMPORT_C void Wait();
1.2461 + IMPORT_C void Signal();
1.2462 +private:
1.2463 + TInt iCount;
1.2464 + };
1.2465 +
1.2466 +
1.2467 +
1.2468 +
1.2469 +/**
1.2470 +@publishedAll
1.2471 +@released
1.2472 +
1.2473 +The user-side handle to a logical channel.
1.2474 +
1.2475 +The class provides functions that are used to open a channel
1.2476 +to a device driver, and to make requests. A device driver provides
1.2477 +a derived class to give the user-side a tailored interface to the driver.
1.2478 +*/
1.2479 +class RBusLogicalChannel : public RHandleBase
1.2480 + {
1.2481 +public:
1.2482 + IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
1.2483 + IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
1.2484 +protected:
1.2485 + inline TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* anInfo, TOwnerType aType=EOwnerProcess, TBool aProtected=EFalse);
1.2486 + IMPORT_C void DoCancel(TUint aReqMask);
1.2487 + IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus);
1.2488 + IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1);
1.2489 + IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1,TAny* a2);
1.2490 + IMPORT_C TInt DoControl(TInt aFunction);
1.2491 + IMPORT_C TInt DoControl(TInt aFunction,TAny* a1);
1.2492 + IMPORT_C TInt DoControl(TInt aFunction,TAny* a1,TAny* a2);
1.2493 + inline TInt DoSvControl(TInt aFunction) { return DoControl(aFunction); }
1.2494 + inline TInt DoSvControl(TInt aFunction,TAny* a1) { return DoControl(aFunction, a1); }
1.2495 + inline TInt DoSvControl(TInt aFunction,TAny* a1,TAny* a2) { return DoControl(aFunction, a1, a2); }
1.2496 +private:
1.2497 + IMPORT_C TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* aInfo, TInt aType);
1.2498 +private:
1.2499 + // Padding for Binary Compatibility purposes
1.2500 + TInt iPadding1;
1.2501 + TInt iPadding2;
1.2502 + };
1.2503 +
1.2504 +
1.2505 +
1.2506 +
1.2507 +/**
1.2508 +@internalComponent
1.2509 +
1.2510 +Base class for memory allocators.
1.2511 +*/
1.2512 +// Put pure virtual functions into a separate base class so that vptr is at same
1.2513 +// place in both GCC98r2 and EABI builds.
1.2514 +class MAllocator
1.2515 + {
1.2516 +public:
1.2517 + virtual TAny* Alloc(TInt aSize)=0;
1.2518 + virtual void Free(TAny* aPtr)=0;
1.2519 + virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0)=0;
1.2520 + virtual TInt AllocLen(const TAny* aCell) const =0;
1.2521 + virtual TInt Compress()=0;
1.2522 + virtual void Reset()=0;
1.2523 + virtual TInt AllocSize(TInt& aTotalAllocSize) const =0;
1.2524 + virtual TInt Available(TInt& aBiggestBlock) const =0;
1.2525 + virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL)=0;
1.2526 + virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)=0;
1.2527 + };
1.2528 +
1.2529 +
1.2530 +
1.2531 +
1.2532 +/**
1.2533 +@publishedAll
1.2534 +@released
1.2535 +
1.2536 +Base class for heaps.
1.2537 +*/
1.2538 +class RAllocator : public MAllocator
1.2539 + {
1.2540 +public:
1.2541 +
1.2542 +
1.2543 + /**
1.2544 + A set of heap allocation failure flags.
1.2545 +
1.2546 + This enumeration indicates how to simulate heap allocation failure.
1.2547 +
1.2548 + @see RAllocator::__DbgSetAllocFail()
1.2549 + */
1.2550 + enum TAllocFail {
1.2551 + /**
1.2552 + Attempts to allocate from this heap fail at a random rate;
1.2553 + however, the interval pattern between failures is the same
1.2554 + every time simulation is started.
1.2555 + */
1.2556 + ERandom,
1.2557 +
1.2558 +
1.2559 + /**
1.2560 + Attempts to allocate from this heap fail at a random rate.
1.2561 + The interval pattern between failures may be different every
1.2562 + time the simulation is started.
1.2563 + */
1.2564 + ETrueRandom,
1.2565 +
1.2566 +
1.2567 + /**
1.2568 + Attempts to allocate from this heap fail at a rate aRate;
1.2569 + for example, if aRate is 3, allocation fails at every
1.2570 + third attempt.
1.2571 + */
1.2572 + EDeterministic,
1.2573 +
1.2574 +
1.2575 + /**
1.2576 + Cancels simulated heap allocation failure.
1.2577 + */
1.2578 + ENone,
1.2579 +
1.2580 +
1.2581 + /**
1.2582 + An allocation from this heap will fail after the next aRate - 1
1.2583 + allocation attempts. For example, if aRate = 1 then the next
1.2584 + attempt to allocate from this heap will fail.
1.2585 + */
1.2586 + EFailNext,
1.2587 +
1.2588 + /**
1.2589 + Cancels simulated heap allocation failure, and sets
1.2590 + the nesting level for all allocated cells to zero.
1.2591 + */
1.2592 + EReset,
1.2593 +
1.2594 + /**
1.2595 + aBurst allocations from this heap fail at a random rate;
1.2596 + however, the interval pattern between failures is the same
1.2597 + every time the simulation is started.
1.2598 + */
1.2599 + EBurstRandom,
1.2600 +
1.2601 +
1.2602 + /**
1.2603 + aBurst allocations from this heap fail at a random rate.
1.2604 + The interval pattern between failures may be different every
1.2605 + time the simulation is started.
1.2606 + */
1.2607 + EBurstTrueRandom,
1.2608 +
1.2609 +
1.2610 + /**
1.2611 + aBurst allocations from this heap fail at a rate aRate.
1.2612 + For example, if aRate is 10 and aBurst is 2, then 2 allocations
1.2613 + will fail at every tenth attempt.
1.2614 + */
1.2615 + EBurstDeterministic,
1.2616 +
1.2617 + /**
1.2618 + aBurst allocations from this heap will fail after the next aRate - 1
1.2619 + allocation attempts have occurred. For example, if aRate = 1 and
1.2620 + aBurst = 3 then the next 3 attempts to allocate from this heap will fail.
1.2621 + */
1.2622 + EBurstFailNext,
1.2623 +
1.2624 + /**
1.2625 + Use this to determine how many times the current debug
1.2626 + failure mode has failed so far.
1.2627 + @see RAllocator::__DbgCheckFailure()
1.2628 + */
1.2629 + ECheckFailure,
1.2630 + };
1.2631 +
1.2632 +
1.2633 + /**
1.2634 + Heap debug checking type flag.
1.2635 + */
1.2636 + enum TDbgHeapType {
1.2637 + /**
1.2638 + The heap is a user heap.
1.2639 + */
1.2640 + EUser,
1.2641 +
1.2642 + /**
1.2643 + The heap is the Kernel heap.
1.2644 + */
1.2645 + EKernel
1.2646 + };
1.2647 +
1.2648 +
1.2649 + enum TAllocDebugOp {ECount, EMarkStart, EMarkEnd, ECheck, ESetFail, ECopyDebugInfo, ESetBurstFail};
1.2650 +
1.2651 +
1.2652 + /**
1.2653 + Flags controlling reallocation.
1.2654 + */
1.2655 + enum TReAllocMode {
1.2656 + /**
1.2657 + A reallocation of a cell must not change
1.2658 + the start address of the cell.
1.2659 + */
1.2660 + ENeverMove=1,
1.2661 +
1.2662 + /**
1.2663 + Allows the start address of the cell to change
1.2664 + if the cell shrinks in size.
1.2665 + */
1.2666 + EAllowMoveOnShrink=2
1.2667 + };
1.2668 +
1.2669 +
1.2670 + enum TFlags {ESingleThreaded=1, EFixedSize=2, ETraceAllocs=4};
1.2671 + struct SCheckInfo {TBool iAll; TInt iCount; const TDesC8* iFileName; TInt iLineNum;};
1.2672 + struct SRAllocatorBurstFail {TInt iBurst; TInt iRate; TInt iUnused[2];}; /**< @internalComponent*/
1.2673 + enum {EMaxHandles=32};
1.2674 +public:
1.2675 + inline RAllocator();
1.2676 +#ifndef __KERNEL_MODE__
1.2677 + IMPORT_C TInt Open();
1.2678 + IMPORT_C void Close();
1.2679 + IMPORT_C TAny* AllocZ(TInt aSize);
1.2680 + IMPORT_C TAny* AllocZL(TInt aSize);
1.2681 + IMPORT_C TAny* AllocL(TInt aSize);
1.2682 + IMPORT_C TAny* AllocLC(TInt aSize);
1.2683 + IMPORT_C void FreeZ(TAny*& aCell);
1.2684 + IMPORT_C TAny* ReAllocL(TAny* aCell, TInt aSize, TInt aMode=0);
1.2685 + IMPORT_C TInt Count() const;
1.2686 + IMPORT_C TInt Count(TInt& aFreeCount) const;
1.2687 +#endif
1.2688 + UIMPORT_C void Check() const;
1.2689 + UIMPORT_C void __DbgMarkStart();
1.2690 + UIMPORT_C TUint32 __DbgMarkEnd(TInt aCount);
1.2691 + UIMPORT_C TInt __DbgMarkCheck(TBool aCountAll, TInt aCount, const TDesC8& aFileName, TInt aLineNum);
1.2692 + inline void __DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum);
1.2693 + UIMPORT_C void __DbgSetAllocFail(TAllocFail aType, TInt aRate);
1.2694 + UIMPORT_C void __DbgSetBurstAllocFail(TAllocFail aType, TUint aRate, TUint aBurst);
1.2695 + UIMPORT_C TUint __DbgCheckFailure();
1.2696 +protected:
1.2697 + UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
1.2698 +#ifndef __KERNEL_MODE__
1.2699 + IMPORT_C virtual void DoClose();
1.2700 +#endif
1.2701 +protected:
1.2702 + TInt iAccessCount;
1.2703 + TInt iHandleCount;
1.2704 + TInt* iHandles;
1.2705 + TUint32 iFlags;
1.2706 + TInt iCellCount;
1.2707 + TInt iTotalAllocSize;
1.2708 + };
1.2709 +
1.2710 +
1.2711 +
1.2712 +
1.2713 +class UserHeap;
1.2714 +/**
1.2715 +@publishedAll
1.2716 +@released
1.2717 +
1.2718 +Represents the default implementation for a heap.
1.2719 +
1.2720 +The default implementation uses an address-ordered first fit type algorithm.
1.2721 +
1.2722 +The heap itself is contained in a chunk and may be the only occupant of the
1.2723 +chunk or may share the chunk with the program stack.
1.2724 +
1.2725 +The class contains member functions for allocating, adjusting, freeing individual
1.2726 +cells and generally managing the heap.
1.2727 +
1.2728 +The class is not a handle in the same sense that RChunk is a handle; i.e.
1.2729 +there is no Kernel object which corresponds to the heap.
1.2730 +*/
1.2731 +class RHeap : public RAllocator
1.2732 + {
1.2733 +public:
1.2734 + /**
1.2735 + The structure of a heap cell header for a heap cell on the free list.
1.2736 + */
1.2737 + struct SCell {
1.2738 + /**
1.2739 + The length of the cell, which includes the length of
1.2740 + this header.
1.2741 + */
1.2742 + TInt len;
1.2743 +
1.2744 +
1.2745 + /**
1.2746 + A pointer to the next cell in the free list.
1.2747 + */
1.2748 + SCell* next;
1.2749 + };
1.2750 +
1.2751 +
1.2752 + /**
1.2753 + The structure of a heap cell header for an allocated heap cell in a debug build.
1.2754 + */
1.2755 + struct SDebugCell {
1.2756 + /**
1.2757 + The length of the cell, which includes the length of
1.2758 + this header.
1.2759 + */
1.2760 + TInt len;
1.2761 +
1.2762 +
1.2763 + /**
1.2764 + The nested level.
1.2765 + */
1.2766 + TInt nestingLevel;
1.2767 +
1.2768 +
1.2769 + /**
1.2770 + The cumulative number of allocated cells
1.2771 + */
1.2772 + TInt allocCount;
1.2773 + };
1.2774 +
1.2775 + /**
1.2776 + @internalComponent
1.2777 + */
1.2778 + struct _s_align {char c; double d;};
1.2779 +
1.2780 +
1.2781 + /**
1.2782 + @internalComponent
1.2783 + */
1.2784 + struct SHeapCellInfo { RHeap* iHeap; TInt iTotalAlloc; TInt iTotalAllocSize; TInt iTotalFree; TInt iLevelAlloc; SDebugCell* iStranded; };
1.2785 +
1.2786 +
1.2787 + /**
1.2788 + The default cell alignment.
1.2789 + */
1.2790 + enum {ECellAlignment = sizeof(_s_align)-sizeof(double)};
1.2791 +
1.2792 +
1.2793 + /**
1.2794 + Size of a free cell header.
1.2795 + */
1.2796 + enum {EFreeCellSize = sizeof(SCell)};
1.2797 +
1.2798 +
1.2799 +#ifdef _DEBUG
1.2800 + /**
1.2801 + Size of an allocated cell header in a debug build.
1.2802 + */
1.2803 + enum {EAllocCellSize = sizeof(SDebugCell)};
1.2804 +#else
1.2805 + /**
1.2806 + Size of an allocated cell header in a release build.
1.2807 + */
1.2808 + enum {EAllocCellSize = sizeof(SCell*)};
1.2809 +#endif
1.2810 +
1.2811 +
1.2812 + /**
1.2813 + @internalComponent
1.2814 + */
1.2815 + enum TDebugOp {EWalk=128};
1.2816 +
1.2817 +
1.2818 + /**
1.2819 + @internalComponent
1.2820 + */
1.2821 + enum TCellType
1.2822 + {EGoodAllocatedCell, EGoodFreeCell, EBadAllocatedCellSize, EBadAllocatedCellAddress,
1.2823 + EBadFreeCellAddress, EBadFreeCellSize};
1.2824 +
1.2825 +
1.2826 + /**
1.2827 + @internalComponent
1.2828 + */
1.2829 + enum TDebugHeapId {EUser=0, EKernel=1};
1.2830 +
1.2831 + /**
1.2832 + @internalComponent
1.2833 + */
1.2834 + enum TDefaultShrinkRatios {EShrinkRatio1=256, EShrinkRatioDflt=512};
1.2835 +
1.2836 + /**
1.2837 + @internalComponent
1.2838 + */
1.2839 + typedef void (*TWalkFunc)(TAny*, TCellType, TAny*, TInt);
1.2840 +public:
1.2841 + UIMPORT_C virtual TAny* Alloc(TInt aSize);
1.2842 + UIMPORT_C virtual void Free(TAny* aPtr);
1.2843 + UIMPORT_C virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
1.2844 + UIMPORT_C virtual TInt AllocLen(const TAny* aCell) const;
1.2845 +#ifndef __KERNEL_MODE__
1.2846 + UIMPORT_C virtual TInt Compress();
1.2847 + UIMPORT_C virtual void Reset();
1.2848 + UIMPORT_C virtual TInt AllocSize(TInt& aTotalAllocSize) const;
1.2849 + UIMPORT_C virtual TInt Available(TInt& aBiggestBlock) const;
1.2850 +#endif
1.2851 + UIMPORT_C virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
1.2852 +protected:
1.2853 + UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
1.2854 +public:
1.2855 + UIMPORT_C RHeap(TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue);
1.2856 + UIMPORT_C RHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign=0, TBool aSingleThread=EFalse);
1.2857 + UIMPORT_C TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
1.2858 + inline void operator delete(TAny* aPtr, TAny* aBase);
1.2859 + inline TUint8* Base() const;
1.2860 + inline TInt Size() const;
1.2861 + inline TInt MaxLength() const;
1.2862 + inline TInt Align(TInt a) const;
1.2863 + inline const TAny* Align(const TAny* a) const;
1.2864 + inline TBool IsLastCell(const SCell* aCell) const;
1.2865 + inline void Lock() const;
1.2866 + inline void Unlock() const;
1.2867 + inline TInt ChunkHandle() const;
1.2868 +protected:
1.2869 + inline RHeap();
1.2870 + void Initialise();
1.2871 + SCell* DoAlloc(TInt aSize, SCell*& aLastFree);
1.2872 + void DoFree(SCell* pC);
1.2873 + TInt TryToGrowHeap(TInt aSize, SCell* aLastFree);
1.2874 + inline void FindFollowingFreeCell(SCell* aCell, SCell*& pPrev, SCell*& aNext);
1.2875 + TInt TryToGrowCell(SCell* pC, SCell* pP, SCell* pE, TInt aSize);
1.2876 + TInt Reduce(SCell* aCell);
1.2877 + UIMPORT_C SCell* GetAddress(const TAny* aCell) const;
1.2878 + void CheckCell(const SCell* aCell) const;
1.2879 + void Walk(TWalkFunc aFunc, TAny* aPtr);
1.2880 + static void WalkCheckCell(TAny* aPtr, TCellType aType, TAny* aCell, TInt aLen);
1.2881 + TInt DoCountAllocFree(TInt& aFree);
1.2882 + TInt DoCheckHeap(SCheckInfo* aInfo);
1.2883 + void DoMarkStart();
1.2884 + TUint32 DoMarkEnd(TInt aExpected);
1.2885 + void DoSetAllocFail(TAllocFail aType, TInt aRate);
1.2886 + TBool CheckForSimulatedAllocFail();
1.2887 + inline TInt SetBrk(TInt aBrk);
1.2888 + inline TAny* ReAllocImpl(TAny* aPtr, TInt aSize, TInt aMode);
1.2889 + void DoSetAllocFail(TAllocFail aType, TInt aRate, TUint aBurst);
1.2890 +protected:
1.2891 + TInt iMinLength;
1.2892 + TInt iMaxLength;
1.2893 + TInt iOffset;
1.2894 + TInt iGrowBy;
1.2895 + TInt iChunkHandle;
1.2896 + RFastLock iLock;
1.2897 + TUint8* iBase;
1.2898 + TUint8* iTop;
1.2899 + TInt iAlign;
1.2900 + TInt iMinCell;
1.2901 + TInt iPageSize;
1.2902 + SCell iFree;
1.2903 +protected:
1.2904 + TInt iNestingLevel;
1.2905 + TInt iAllocCount;
1.2906 + TAllocFail iFailType;
1.2907 + TInt iFailRate;
1.2908 + TBool iFailed;
1.2909 + TInt iFailAllocCount;
1.2910 + TInt iRand;
1.2911 + TAny* iTestData;
1.2912 +
1.2913 + friend class UserHeap;
1.2914 + };
1.2915 +
1.2916 +
1.2917 +
1.2918 +
1.2919 +
1.2920 +class OnlyCreateWithNull;
1.2921 +
1.2922 +/** @internalTechnology */
1.2923 +typedef void (OnlyCreateWithNull::* __NullPMF)();
1.2924 +
1.2925 +/** @internalTechnology */
1.2926 +class OnlyCreateWithNull
1.2927 + {
1.2928 +public:
1.2929 + inline OnlyCreateWithNull(__NullPMF /*aPointerToNull*/) {}
1.2930 + };
1.2931 +
1.2932 +/**
1.2933 +@publishedAll
1.2934 +@released
1.2935 +
1.2936 +A handle to a message sent by the client to the server.
1.2937 +
1.2938 +A server's interaction with its clients is channelled through an RMessagePtr2
1.2939 +object, which acts as a handle to a message sent by the client.
1.2940 +The details of the original message are kept by the kernel allowing it enforce
1.2941 +correct usage of the member functions of this class.
1.2942 +
1.2943 +@see RMessage2
1.2944 +*/
1.2945 +class RMessagePtr2
1.2946 + {
1.2947 +public:
1.2948 + inline RMessagePtr2();
1.2949 + inline TBool IsNull() const;
1.2950 + inline TInt Handle() const;
1.2951 +#ifndef __KERNEL_MODE__
1.2952 + IMPORT_C void Complete(TInt aReason) const;
1.2953 + IMPORT_C void Complete(RHandleBase aHandle) const;
1.2954 + IMPORT_C TInt GetDesLength(TInt aParam) const;
1.2955 + IMPORT_C TInt GetDesLengthL(TInt aParam) const;
1.2956 + IMPORT_C TInt GetDesMaxLength(TInt aParam) const;
1.2957 + IMPORT_C TInt GetDesMaxLengthL(TInt aParam) const;
1.2958 + IMPORT_C void ReadL(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
1.2959 + IMPORT_C void ReadL(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
1.2960 + IMPORT_C void WriteL(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
1.2961 + IMPORT_C void WriteL(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
1.2962 + IMPORT_C TInt Read(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
1.2963 + IMPORT_C TInt Read(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
1.2964 + IMPORT_C TInt Write(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
1.2965 + IMPORT_C TInt Write(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
1.2966 + IMPORT_C void Panic(const TDesC& aCategory,TInt aReason) const;
1.2967 + IMPORT_C void Kill(TInt aReason) const;
1.2968 + IMPORT_C void Terminate(TInt aReason) const;
1.2969 + IMPORT_C TInt SetProcessPriority(TProcessPriority aPriority) const;
1.2970 + inline void SetProcessPriorityL(TProcessPriority aPriority) const;
1.2971 + IMPORT_C TInt Client(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
1.2972 + inline void ClientL(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
1.2973 + IMPORT_C TUint ClientProcessFlags() const;
1.2974 + IMPORT_C const TRequestStatus* ClientStatus() const;
1.2975 +
1.2976 + /**
1.2977 + Return the Secure ID of the process which sent this message.
1.2978 +
1.2979 + If an intended use of this method is to check that the Secure ID is
1.2980 + a given value, then the use of a TSecurityPolicy object should be
1.2981 + considered. E.g. Instead of something like:
1.2982 +
1.2983 + @code
1.2984 + RMessagePtr2& message;
1.2985 + TInt error = message.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied;
1.2986 + @endcode
1.2987 +
1.2988 + this could be used;
1.2989 +
1.2990 + @code
1.2991 + RMessagePtr2& message;
1.2992 + static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId);
1.2993 + TInt error = mySidPolicy().CheckPolicy(message);
1.2994 + @endcode
1.2995 +
1.2996 + This has the benefit that the TSecurityPolicy::CheckPolicy methods are
1.2997 + configured by the system wide Platform Security configuration. I.e. are
1.2998 + capable of emitting diagnostic messages when a check fails and/or the
1.2999 + check can be forced to always pass.
1.3000 +
1.3001 + @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
1.3002 + @see _LIT_SECURITY_POLICY_S0
1.3003 +
1.3004 + @return The Secure ID.
1.3005 +
1.3006 + @publishedAll
1.3007 + @released
1.3008 + */
1.3009 + IMPORT_C TSecureId SecureId() const;
1.3010 +
1.3011 + /**
1.3012 + Return the Vendor ID of the process which sent this message.
1.3013 +
1.3014 + If an intended use of this method is to check that the Vendor ID is
1.3015 + a given value, then the use of a TSecurityPolicy object should be
1.3016 + considered. E.g. Instead of something like:
1.3017 +
1.3018 + @code
1.3019 + RMessagePtr2& message;
1.3020 + TInt error = message.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied;
1.3021 + @endcode
1.3022 +
1.3023 + this could be used;
1.3024 +
1.3025 + @code
1.3026 + RMessagePtr2& message;
1.3027 + static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId);
1.3028 + TInt error = myVidPolicy().CheckPolicy(message);
1.3029 + @endcode
1.3030 +
1.3031 + This has the benefit that the TSecurityPolicy::CheckPolicy methods are
1.3032 + configured by the system wide Platform Security configuration. I.e. are
1.3033 + capable of emitting diagnostic messages when a check fails and/or the
1.3034 + check can be forced to always pass.
1.3035 +
1.3036 + @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
1.3037 + @see _LIT_SECURITY_POLICY_V0
1.3038 +
1.3039 + @return The Vendor ID.
1.3040 + @publishedAll
1.3041 + @released
1.3042 + */
1.3043 + IMPORT_C TVendorId VendorId() const;
1.3044 +
1.3045 + /**
1.3046 + Check if the process which sent this message has a given capability.
1.3047 +
1.3048 + When a check fails the action taken is determined by the system wide Platform Security
1.3049 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.3050 + If PlatSecEnforcement is OFF, then this function will return ETrue even though the
1.3051 + check failed.
1.3052 +
1.3053 + @param aCapability The capability to test.
1.3054 + @param aDiagnostic A string that will be emitted along with any diagnostic message
1.3055 + that may be issued if the test finds the capability is not present.
1.3056 + This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.3057 + which enables it to be easily removed from the system.
1.3058 + @return ETrue if process which sent this message has the capability, EFalse otherwise.
1.3059 + @publishedAll
1.3060 + @released
1.3061 + */
1.3062 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3063 + inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const;
1.3064 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3065 + // Only available to NULL arguments
1.3066 + inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3067 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3068 + // For things using KSuppressPlatSecDiagnostic
1.3069 + inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3070 +#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
1.3071 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3072 +
1.3073 + /**
1.3074 + Check if the process which sent this message has a given capability.
1.3075 +
1.3076 + When a check fails the action taken is determined by the system wide Platform Security
1.3077 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.3078 + If PlatSecEnforcement is OFF, then this function will not leave even though the
1.3079 + check failed.
1.3080 +
1.3081 + @param aCapability The capability to test.
1.3082 + @param aDiagnosticMessage A string that will be emitted along with any diagnostic message
1.3083 + that may be issued if the test finds the capability is not present.
1.3084 + This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.3085 + which enables it to be easily removed from the system.
1.3086 + @leave KErrPermissionDenied, if the process does not have the capability.
1.3087 + @publishedAll
1.3088 + @released
1.3089 + */
1.3090 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3091 + inline void HasCapabilityL(TCapability aCapability, const char* aDiagnosticMessage=0) const;
1.3092 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3093 + // Only available to NULL arguments
1.3094 + inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
1.3095 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3096 + // For things using KSuppressPlatSecDiagnostic
1.3097 + inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3098 +#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
1.3099 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3100 +
1.3101 + /**
1.3102 + Check if the process which sent this message has both of the given capabilities.
1.3103 +
1.3104 + When a check fails the action taken is determined by the system wide Platform Security
1.3105 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.3106 + If PlatSecEnforcement is OFF, then this function will return ETrue even though the
1.3107 + check failed.
1.3108 +
1.3109 + @param aCapability1 The first capability to test.
1.3110 + @param aCapability2 The second capability to test.
1.3111 + @param aDiagnostic A string that will be emitted along with any diagnostic message
1.3112 + that may be issued if the test finds a capability is not present.
1.3113 + This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.3114 + which enables it to be easily removed from the system.
1.3115 + @return ETrue if the process which sent this message has both the capabilities, EFalse otherwise.
1.3116 + @publishedAll
1.3117 + @released
1.3118 + */
1.3119 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3120 + inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const;
1.3121 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3122 + // Only available to NULL arguments
1.3123 + inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3124 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3125 + // For things using KSuppressPlatSecDiagnostic
1.3126 + inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3127 +#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
1.3128 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3129 +
1.3130 + /**
1.3131 + Check if the process which sent this message has both of the given capabilities.
1.3132 +
1.3133 + When a check fails the action taken is determined by the system wide Platform Security
1.3134 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.3135 + If PlatSecEnforcement is OFF, then this function will not leave even though the
1.3136 + check failed.
1.3137 +
1.3138 + @param aCapability1 The first capability to test.
1.3139 + @param aCapability2 The second capability to test.
1.3140 + @param aDiagnosticMessage A string that will be emitted along with any diagnostic message
1.3141 + that may be issued if the test finds a capability is not present.
1.3142 + This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.3143 + which enables it to be easily removed from the system.
1.3144 + @leave KErrPermissionDenied, if the process does not have the capabilities.
1.3145 + @publishedAll
1.3146 + @released
1.3147 + */
1.3148 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3149 + inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, const char* aDiagnosticMessage=0) const;
1.3150 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3151 + // Only available to NULL arguments
1.3152 + inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
1.3153 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3154 + // For things using KSuppressPlatSecDiagnostic
1.3155 + inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3156 +#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
1.3157 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3158 +
1.3159 + /**
1.3160 + @deprecated Use SecureId()
1.3161 + */
1.3162 + inline TUid Identity() const { return SecureId(); }
1.3163 +#endif
1.3164 +
1.3165 +private:
1.3166 + // Implementations of functions with diagnostics
1.3167 + IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const;
1.3168 + IMPORT_C TBool DoHasCapability(TCapability aCapability) const;
1.3169 + IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2, const char* aDiagnostic) const;
1.3170 + IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2) const;
1.3171 +
1.3172 +protected:
1.3173 + TInt iHandle;
1.3174 + };
1.3175 +inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight);
1.3176 +inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight);
1.3177 +
1.3178 +class CSession2;
1.3179 +
1.3180 +#define __IPC_V2_PRESENT__
1.3181 +
1.3182 +/**
1.3183 +@publishedAll
1.3184 +@released
1.3185 +
1.3186 +An object that encapsulates the details of a client request.
1.3187 +*/
1.3188 +class RMessage2 : public RMessagePtr2
1.3189 + {
1.3190 + friend class CServer2;
1.3191 +public:
1.3192 +
1.3193 + /**
1.3194 + Defines internal message types.
1.3195 + */
1.3196 + enum TSessionMessages {
1.3197 + /**
1.3198 + A message type used internally that means connect.
1.3199 + */
1.3200 + EConnect=-1,
1.3201 +
1.3202 + /**
1.3203 + A message type used internally that means disconnect.
1.3204 + */
1.3205 + EDisConnect=-2
1.3206 + };
1.3207 +public:
1.3208 + inline RMessage2();
1.3209 +#ifndef __KERNEL_MODE__
1.3210 + IMPORT_C explicit RMessage2(const RMessagePtr2& aPtr);
1.3211 + void SetAuthorised() const;
1.3212 + void ClearAuthorised() const;
1.3213 + TBool Authorised() const;
1.3214 +#endif
1.3215 + inline TInt Function() const;
1.3216 + inline TInt Int0() const;
1.3217 + inline TInt Int1() const;
1.3218 + inline TInt Int2() const;
1.3219 + inline TInt Int3() const;
1.3220 + inline const TAny* Ptr0() const;
1.3221 + inline const TAny* Ptr1() const;
1.3222 + inline const TAny* Ptr2() const;
1.3223 + inline const TAny* Ptr3() const;
1.3224 + inline CSession2* Session() const;
1.3225 +protected:
1.3226 +
1.3227 + /**
1.3228 + The request type.
1.3229 + */
1.3230 + TInt iFunction;
1.3231 +
1.3232 + /**
1.3233 + A copy of the message arguments.
1.3234 + */
1.3235 + TInt iArgs[KMaxMessageArguments];
1.3236 +private:
1.3237 + TInt iSpare1;
1.3238 +protected:
1.3239 + /**
1.3240 + @internalComponent
1.3241 + */
1.3242 + const TAny* iSessionPtr;
1.3243 +private:
1.3244 + mutable TInt iFlags;// Currently only used for *Authorised above
1.3245 + TInt iSpare3; // Reserved for future use
1.3246 +
1.3247 + friend class RMessage;
1.3248 + };
1.3249 +
1.3250 +
1.3251 +
1.3252 +
1.3253 +/**
1.3254 +@publishedAll
1.3255 +@released
1.3256 +
1.3257 +Defines an 8-bit modifiable buffer descriptor to contain passwords when dealing
1.3258 +with password security support in a file server session.
1.3259 +
1.3260 +The descriptor takes a maximum length of KMaxMediaPassword.
1.3261 +
1.3262 +@see KMaxMediaPassword
1.3263 +*/
1.3264 +typedef TBuf8<KMaxMediaPassword> TMediaPassword; // 128 bit
1.3265 +
1.3266 +
1.3267 +
1.3268 +/**
1.3269 +@publishedPartner
1.3270 +@prototype
1.3271 +A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
1.3272 +set signifies that a buffer offset list follows the buffer configuration class. This list holds the offset of each buffer.
1.3273 +*/
1.3274 +const TUint KScFlagBufOffsetListInUse=0x00000001;
1.3275 +
1.3276 +/**
1.3277 +@publishedPartner
1.3278 +@prototype
1.3279 +A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
1.3280 +set is a suggestion that the shared chunk should be configured leaving guard pages around each buffers.
1.3281 +*/
1.3282 +const TUint KScFlagUseGuardPages=0x00000002;
1.3283 +
1.3284 +/**
1.3285 +@publishedPartner
1.3286 +@prototype
1.3287 +The shared chunk buffer configuration class (used by the multimedia device drivers). This is used to hold information
1.3288 +on the current buffer configuration within a shared chunk.
1.3289 +*/
1.3290 +class TSharedChunkBufConfigBase
1.3291 + {
1.3292 +public:
1.3293 + inline TSharedChunkBufConfigBase();
1.3294 +public:
1.3295 + /** The number of buffers. */
1.3296 + TInt iNumBuffers;
1.3297 + /** The size of each buffer in bytes. */
1.3298 + TInt iBufferSizeInBytes;
1.3299 + /** Reserved field. */
1.3300 + TInt iReserved1;
1.3301 + /** Shared chunk buffer flag settings. */
1.3302 + TUint iFlags;
1.3303 + };
1.3304 +
1.3305 +
1.3306 +/** Default value to clear all data to committed to a chunk to.
1.3307 +@see TChunkCreateInfo::SetClearByte()
1.3308 +@see RChunk::Create()
1.3309 +@internalComponent
1.3310 +*/
1.3311 +const TUint8 KChunkClearByteDefault = 0x3;
1.3312 +
1.3313 +/**
1.3314 +Values that specify the attributes of a chunk to be created.
1.3315 +
1.3316 +@see RChunk::Create()
1.3317 +@internalComponent
1.3318 +*/
1.3319 +enum TChunkCreateAttributes
1.3320 + {
1.3321 + /** Force local chunk to be named. Internal as only required for
1.3322 + thread heap chunks, all other local chunks should be nameless.
1.3323 + */
1.3324 + EChunkAttLocalNamed = 0x400,
1.3325 +
1.3326 + EChunkAttMask = EChunkAttLocalNamed,
1.3327 + };
1.3328 +
1.3329 +/**@internalComponent */
1.3330 +const TUint32 KEmulatorImageFlagAllowDllData = 0x01;
1.3331 +
1.3332 +/** Maximum size of capability set
1.3333 +
1.3334 +@internalTechnology
1.3335 +*/
1.3336 +const TInt KCapabilitySetMaxSize = (((TInt)ECapability_HardLimit + 7)>>3);
1.3337 +
1.3338 +/** Maximum size of any future extension to TSecurityPolicy
1.3339 +
1.3340 +@internalTechnology
1.3341 +*/
1.3342 +const TInt KMaxSecurityPolicySize = KCapabilitySetMaxSize + 3*sizeof(TUint32);
1.3343 +
1.3344 +/** Class representing an arbitrary set of capabilities.
1.3345 +
1.3346 +This class can only contain capabilities supported by the current OS version.
1.3347 +
1.3348 +@publishedAll
1.3349 +@released
1.3350 +*/
1.3351 +class TCapabilitySet
1.3352 + {
1.3353 +public:
1.3354 + inline TCapabilitySet();
1.3355 + inline TCapabilitySet(TCapability aCapability);
1.3356 + IMPORT_C TCapabilitySet(TCapability aCapability1, TCapability aCapability2);
1.3357 + IMPORT_C void SetEmpty();
1.3358 + inline void Set(TCapability aCapability);
1.3359 + inline void Set(TCapability aCapability1, TCapability aCapability2);
1.3360 + IMPORT_C void SetAllSupported();
1.3361 + IMPORT_C void AddCapability(TCapability aCapability);
1.3362 + IMPORT_C void RemoveCapability(TCapability aCapability);
1.3363 + IMPORT_C void Union(const TCapabilitySet& aCapabilities);
1.3364 + IMPORT_C void Intersection(const TCapabilitySet& aCapabilities);
1.3365 + IMPORT_C void Remove(const TCapabilitySet& aCapabilities);
1.3366 + IMPORT_C TBool HasCapability(TCapability aCapability) const;
1.3367 + IMPORT_C TBool HasCapabilities(const TCapabilitySet& aCapabilities) const;
1.3368 +
1.3369 + /**
1.3370 + Make this set consist of the capabilities which are disabled on this platform.
1.3371 + @internalTechnology
1.3372 + */
1.3373 + IMPORT_C void SetDisabled();
1.3374 + /**
1.3375 + @internalComponent
1.3376 + */
1.3377 + TBool NotEmpty() const;
1.3378 +private:
1.3379 + TUint32 iCaps[KCapabilitySetMaxSize / sizeof(TUint32)];
1.3380 + };
1.3381 +
1.3382 +#ifndef __SECURITY_INFO_DEFINED__
1.3383 +#define __SECURITY_INFO_DEFINED__
1.3384 +/**
1.3385 +@internalTechnology
1.3386 + */
1.3387 +struct SCapabilitySet
1.3388 + {
1.3389 + enum {ENCapW=2};
1.3390 +
1.3391 + inline void AddCapability(TCapability aCap1) {((TCapabilitySet*)this)->AddCapability(aCap1);}
1.3392 + inline void Remove(const SCapabilitySet& aCaps) {((TCapabilitySet*)this)->Remove(*((TCapabilitySet*)&aCaps));}
1.3393 + inline TBool NotEmpty() const {return ((TCapabilitySet*)this)->NotEmpty();}
1.3394 +
1.3395 + inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; }
1.3396 + inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; }
1.3397 +
1.3398 + TUint32 iCaps[ENCapW];
1.3399 + };
1.3400 +
1.3401 +/**
1.3402 +@internalTechnology
1.3403 + */
1.3404 +struct SSecurityInfo
1.3405 + {
1.3406 + TUint32 iSecureId;
1.3407 + TUint32 iVendorId;
1.3408 + SCapabilitySet iCaps; // Capabilities re. platform security
1.3409 + };
1.3410 +
1.3411 +#endif
1.3412 +
1.3413 +/** Define this macro to reference the set of all capabilities.
1.3414 + @internalTechnology
1.3415 +*/
1.3416 +#ifdef __REFERENCE_ALL_SUPPORTED_CAPABILITIES__
1.3417 +
1.3418 +extern const SCapabilitySet AllSupportedCapabilities;
1.3419 +
1.3420 +#endif //__REFERENCE_ALL_SUPPORTED_CAPABILITIES__
1.3421 +
1.3422 +/** Define this macro to include the set of all capabilities.
1.3423 + @internalTechnology
1.3424 +*/
1.3425 +#ifdef __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
1.3426 +
1.3427 +/** The set of all capabilities.
1.3428 + @internalTechnology
1.3429 +*/
1.3430 +const SCapabilitySet AllSupportedCapabilities = {
1.3431 + {
1.3432 + ECapability_Limit<32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0xffffffffu
1.3433 + ,
1.3434 + ECapability_Limit>=32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0u
1.3435 + }
1.3436 + };
1.3437 +
1.3438 +#endif // __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
1.3439 +
1.3440 +#ifndef __KERNEL_MODE__
1.3441 +class RProcess;
1.3442 +class RThread;
1.3443 +class RMessagePtr2;
1.3444 +class RSessionBase;
1.3445 +#else
1.3446 +class DProcess;
1.3447 +class DThread;
1.3448 +#endif
1.3449 +
1.3450 +/** Class representing all security attributes of a process or DLL.
1.3451 + These comprise a set of capabilities, a Secure ID and a Vendor ID.
1.3452 +
1.3453 +@publishedAll
1.3454 +@released
1.3455 +*/
1.3456 +class TSecurityInfo
1.3457 + {
1.3458 +public:
1.3459 + inline TSecurityInfo();
1.3460 +#ifndef __KERNEL_MODE__
1.3461 + IMPORT_C TSecurityInfo(RProcess aProcess);
1.3462 + IMPORT_C TSecurityInfo(RThread aThread);
1.3463 + IMPORT_C TSecurityInfo(RMessagePtr2 aMesPtr);
1.3464 + inline void Set(RProcess aProcess);
1.3465 + inline void Set(RThread aThread);
1.3466 + inline void Set(RMessagePtr2 aMsgPtr);
1.3467 + TInt Set(RSessionBase aSession); /**< @internalComponent */
1.3468 + inline void SetToCurrentInfo();
1.3469 + IMPORT_C void SetToCreatorInfo();
1.3470 +#endif //__KERNEL_MODE__
1.3471 +public:
1.3472 + TSecureId iSecureId; /**< Secure ID */
1.3473 + TVendorId iVendorId; /**< Vendor ID */
1.3474 + TCapabilitySet iCaps; /**< Capability Set */
1.3475 + };
1.3476 +
1.3477 +
1.3478 +/** Class representing a generic security policy
1.3479 +
1.3480 +This class can specify a security policy consisting of either:
1.3481 +
1.3482 +-# A check for between 0 and 7 capabilities
1.3483 +-# A check for a given Secure ID along with 0-3 capabilities
1.3484 +-# A check for a given Vendor ID along with 0-3 capabilities
1.3485 +
1.3486 +If multiple capabilities are specified, all of them must be present for the
1.3487 +security check to succeed ('AND' relation).
1.3488 +
1.3489 +The envisaged use case for this class is to specify access rights to an object
1.3490 +managed either by the kernel or by a server but in principle owned by a client
1.3491 +and usable in a limited way by other clients. For example
1.3492 +- Publish and Subscribe properties
1.3493 +- DBMS databases
1.3494 +
1.3495 +In these cases the owning client would pass one (or more) of these objects to
1.3496 +the server to specify which security checks should be done on other clients
1.3497 +before allowing access to the object.
1.3498 +
1.3499 +To pass a TSecurityPolicy object via IPC, a client should obtain a descriptor
1.3500 +for the object using Package() and send this. When a server receives this descriptor
1.3501 +it should read the descriptor contents into a TSecurityPolicyBuf and then
1.3502 +Set() should be used to create a policy object from this.
1.3503 +
1.3504 +Because this class has non-default constructors, compilers will not initialise
1.3505 +this object at compile time, instead code will be generated to construct the object
1.3506 +at run-time. This is wasteful - and Symbian OS DLLs are not permitted to have
1.3507 +such uninitialised data. To overcome these problems a set of macros are provided to
1.3508 +construct a const object which behaves like a TSecurityPolicy. These are:
1.3509 +
1.3510 +_LIT_SECURITY_POLICY_C1 through _LIT_SECURITY_POLICY_C7,
1.3511 +_LIT_SECURITY_POLICY_S0 through _LIT_SECURITY_POLICY_S3 and
1.3512 +_LIT_SECURITY_POLICY_V0 through _LIT_SECURITY_POLICY_V3.
1.3513 +
1.3514 +Also, the macros _LIT_SECURITY_POLICY_PASS and _LIT_SECURITY_POLICY_FAIL are provided
1.3515 +in order to allow easy construction of a const object which can be used as a
1.3516 +TSecuityPolicy which always passes or always fails, respectively.
1.3517 +
1.3518 +If a security policy object is needed to be embedded in another class then the
1.3519 +TStaticSecurityPolicy structure can be used. This behaves in the same way as a
1.3520 +TSecurityPolicy object but may be initialised at compile time.
1.3521 +
1.3522 +@see TStaticSecurityPolicy
1.3523 +@see TSecurityPolicyBuf
1.3524 +@see _LIT_SECURITY_POLICY_PASS
1.3525 +@see _LIT_SECURITY_POLICY_FAIL
1.3526 +@see _LIT_SECURITY_POLICY_C1
1.3527 +@see _LIT_SECURITY_POLICY_C2
1.3528 +@see _LIT_SECURITY_POLICY_C3
1.3529 +@see _LIT_SECURITY_POLICY_C4
1.3530 +@see _LIT_SECURITY_POLICY_C5
1.3531 +@see _LIT_SECURITY_POLICY_C6
1.3532 +@see _LIT_SECURITY_POLICY_C7
1.3533 +@see _LIT_SECURITY_POLICY_S0
1.3534 +@see _LIT_SECURITY_POLICY_S1
1.3535 +@see _LIT_SECURITY_POLICY_S2
1.3536 +@see _LIT_SECURITY_POLICY_S3
1.3537 +@see _LIT_SECURITY_POLICY_V0
1.3538 +@see _LIT_SECURITY_POLICY_V1
1.3539 +@see _LIT_SECURITY_POLICY_V2
1.3540 +@see _LIT_SECURITY_POLICY_V3
1.3541 +
1.3542 +@publishedAll
1.3543 +@released
1.3544 +*/
1.3545 +class TSecurityPolicy
1.3546 + {
1.3547 +public:
1.3548 + enum TSecPolicyType
1.3549 + {
1.3550 + EAlwaysFail=0,
1.3551 + EAlwaysPass=1,
1.3552 + };
1.3553 +
1.3554 +public:
1.3555 + inline TSecurityPolicy();
1.3556 + IMPORT_C TSecurityPolicy(TSecPolicyType aType);
1.3557 + IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
1.3558 + IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2, TCapability aCap3, TCapability aCap4, TCapability aCap5 = ECapability_None, TCapability aCap6 = ECapability_None, TCapability aCap7 = ECapability_None);
1.3559 + IMPORT_C TSecurityPolicy(TSecureId aSecureId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
1.3560 + IMPORT_C TSecurityPolicy(TVendorId aVendorId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
1.3561 + IMPORT_C TInt Set(const TDesC8& aDes);
1.3562 + IMPORT_C TPtrC8 Package() const;
1.3563 +
1.3564 +#ifdef __KERNEL_MODE__
1.3565 +
1.3566 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3567 + inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const;
1.3568 + inline TBool CheckPolicy(DThread* aThread, const char* aDiagnostic=0) const;
1.3569 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3570 + // Only available to NULL arguments
1.3571 + inline TBool CheckPolicy(DProcess* aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3572 + inline TBool CheckPolicy(DThread* aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3573 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3574 +
1.3575 +#else // !__KERNEL_MODE__
1.3576 +
1.3577 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3578 + inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
1.3579 + inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
1.3580 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
1.3581 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
1.3582 + inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
1.3583 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3584 + // Only available to NULL arguments
1.3585 + inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3586 + inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3587 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3588 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3589 + inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
1.3590 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3591 + // For things using KSuppressPlatSecDiagnostic
1.3592 + inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3593 + inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3594 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3595 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3596 + inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3597 +#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
1.3598 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3599 + TInt CheckPolicy(RSessionBase aSession) const; /**< @internalComponent */
1.3600 +
1.3601 +#endif //__KERNEL_MODE__
1.3602 +
1.3603 + TBool Validate() const;
1.3604 +
1.3605 +private:
1.3606 +#ifdef __KERNEL_MODE__
1.3607 + IMPORT_C TBool DoCheckPolicy(DProcess* aProcess, const char* aDiagnostic) const;
1.3608 + IMPORT_C TBool DoCheckPolicy(DProcess* aProcess) const;
1.3609 + IMPORT_C TBool DoCheckPolicy(DThread* aThread, const char* aDiagnostic) const;
1.3610 + IMPORT_C TBool DoCheckPolicy(DThread* aThread) const;
1.3611 +#else // !__KERNEL_MODE__
1.3612 + IMPORT_C TBool DoCheckPolicy(RProcess aProcess, const char* aDiagnostic) const;
1.3613 + IMPORT_C TBool DoCheckPolicy(RProcess aProcess) const;
1.3614 + IMPORT_C TBool DoCheckPolicy(RThread aThread, const char* aDiagnostic) const;
1.3615 + IMPORT_C TBool DoCheckPolicy(RThread aThread) const;
1.3616 + IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const;
1.3617 + IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr) const;
1.3618 + IMPORT_C TBool DoCheckPolicyCreator(const char* aDiagnostic) const;
1.3619 + IMPORT_C TBool DoCheckPolicyCreator() const;
1.3620 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3621 + TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) const;
1.3622 +#endif //__REMOVE_PLATSEC_DIAGNOSTICS__
1.3623 + TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing) const;
1.3624 +#endif //__KERNEL_MODE__
1.3625 +
1.3626 +public:
1.3627 + /** Constants to specify the type of TSecurityPolicy objects.
1.3628 + */
1.3629 + enum TType
1.3630 + {
1.3631 + ETypeFail=0, /**< Always fail*/
1.3632 + ETypePass=1, /**< Always pass*/
1.3633 + ETypeC3=2, /**< Up to 3 capabilities*/
1.3634 + ETypeC7=3, /**< Up to 7 capabilities*/
1.3635 + ETypeS3=4, /**< Secure ID and up to 3 capabilities*/
1.3636 + ETypeV3=5, /**< Vendor ID and up to 3 capabilities*/
1.3637 +
1.3638 + /** The number of possible TSecurityPolicy types
1.3639 + This is intended of internal Symbian use only.
1.3640 + @internalTechnology
1.3641 + */
1.3642 + ETypeLimit
1.3643 +
1.3644 + // other values may be added to indicate expanded policy objects (future extensions)
1.3645 + };
1.3646 +protected:
1.3647 + TBool CheckPolicy(const SSecurityInfo& aSecInfo, SSecurityInfo& aMissing) const;
1.3648 +private:
1.3649 + void ConstructAndCheck3(TCapability aCap1, TCapability aCap2, TCapability aCap3);
1.3650 +private:
1.3651 + TUint8 iType;
1.3652 + TUint8 iCaps[3]; // missing capabilities are set to 0xff
1.3653 + union
1.3654 + {
1.3655 + TUint32 iSecureId;
1.3656 + TUint32 iVendorId;
1.3657 + TUint8 iExtraCaps[4]; // missing capabilities are set to 0xff
1.3658 + };
1.3659 + friend class TCompiledSecurityPolicy;
1.3660 + };
1.3661 +
1.3662 +/** Provides a TPkcgBuf wrapper for a descriptorised TSecurityPolicy. This a
1.3663 +suitable container for passing a security policy across IPC.
1.3664 +@publishedAll
1.3665 +@released
1.3666 +*/
1.3667 +typedef TPckgBuf<TSecurityPolicy> TSecurityPolicyBuf;
1.3668 +
1.3669 +
1.3670 +/** Structure for compile-time initialisation of a security policy.
1.3671 +
1.3672 +This structure behaves in the same way as a TSecurityPolicy object but has
1.3673 +the advantage that it may be initialised at compile time. E.g.
1.3674 +the following line defines a security policy 'KSecurityPolictReadUserData'
1.3675 +which checks ReadUserData capability.
1.3676 +
1.3677 +@code
1.3678 +_LIT_SECURITY_POLICY_C1(KSecurityPolictReadUserData,ECapabilityReadUserData)
1.3679 +@endcode
1.3680 +
1.3681 +Or, an array of security policies may be created like this:
1.3682 +@code
1.3683 +static const TStaticSecurityPolicy MyPolicies[] =
1.3684 + {
1.3685 + _INIT_SECURITY_POLICY_C1(ECapabilityReadUserData),
1.3686 + _INIT_SECURITY_POLICY_PASS(),
1.3687 + _INIT_SECURITY_POLICY_S0(0x1234567)
1.3688 + }
1.3689 +@endcode
1.3690 +
1.3691 +This class should not be initialised directly, instead one of the following
1.3692 +macros should be used:
1.3693 +
1.3694 +- _INIT_SECURITY_POLICY_PASS
1.3695 +- _INIT_SECURITY_POLICY_FAIL
1.3696 +- _INIT_SECURITY_POLICY_C1
1.3697 +- _INIT_SECURITY_POLICY_C2
1.3698 +- _INIT_SECURITY_POLICY_C3
1.3699 +- _INIT_SECURITY_POLICY_C4
1.3700 +- _INIT_SECURITY_POLICY_C5
1.3701 +- _INIT_SECURITY_POLICY_C6
1.3702 +- _INIT_SECURITY_POLICY_C7
1.3703 +- _INIT_SECURITY_POLICY_S0
1.3704 +- _INIT_SECURITY_POLICY_S1
1.3705 +- _INIT_SECURITY_POLICY_S2
1.3706 +- _INIT_SECURITY_POLICY_S3
1.3707 +- _INIT_SECURITY_POLICY_V0
1.3708 +- _INIT_SECURITY_POLICY_V1
1.3709 +- _INIT_SECURITY_POLICY_V2
1.3710 +- _INIT_SECURITY_POLICY_V3
1.3711 +- _LIT_SECURITY_POLICY_PASS
1.3712 +- _LIT_SECURITY_POLICY_FAIL
1.3713 +- _LIT_SECURITY_POLICY_C1
1.3714 +- _LIT_SECURITY_POLICY_C2
1.3715 +- _LIT_SECURITY_POLICY_C3
1.3716 +- _LIT_SECURITY_POLICY_C4
1.3717 +- _LIT_SECURITY_POLICY_C5
1.3718 +- _LIT_SECURITY_POLICY_C6
1.3719 +- _LIT_SECURITY_POLICY_C7
1.3720 +- _LIT_SECURITY_POLICY_S0
1.3721 +- _LIT_SECURITY_POLICY_S1
1.3722 +- _LIT_SECURITY_POLICY_S2
1.3723 +- _LIT_SECURITY_POLICY_S3
1.3724 +- _LIT_SECURITY_POLICY_V0
1.3725 +- _LIT_SECURITY_POLICY_V1
1.3726 +- _LIT_SECURITY_POLICY_V2
1.3727 +- _LIT_SECURITY_POLICY_V3
1.3728 +
1.3729 +@see TSecurityPolicy
1.3730 +@publishedAll
1.3731 +@released
1.3732 +*/
1.3733 +struct TStaticSecurityPolicy
1.3734 + {
1.3735 + inline const TSecurityPolicy* operator&() const;
1.3736 + inline operator const TSecurityPolicy&() const;
1.3737 + inline const TSecurityPolicy& operator()() const;
1.3738 +
1.3739 +#ifndef __KERNEL_MODE__
1.3740 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3741 + inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
1.3742 + inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
1.3743 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
1.3744 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
1.3745 + inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
1.3746 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3747 + // Only available to NULL arguments
1.3748 + inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3749 + inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3750 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3751 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
1.3752 + inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
1.3753 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.3754 + // For things using KSuppressPlatSecDiagnostic
1.3755 + inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3756 + inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3757 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3758 + inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3759 + inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
1.3760 +#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
1.3761 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.3762 +#endif // !__KERNEL_MODE__
1.3763 +
1.3764 + TUint32 iA; /**< @internalComponent */
1.3765 + TUint32 iB; /**< @internalComponent */
1.3766 + };
1.3767 +
1.3768 +
1.3769 +/**
1.3770 +A dummy enum for use by the CAPABILITY_AS_TUINT8 macro
1.3771 +@internalComponent
1.3772 +*/
1.3773 +enum __invalid_capability_value {};
1.3774 +
1.3775 +/**
1.3776 +A macro to cast a TCapability to a TUint8.
1.3777 +
1.3778 +If an invlid capability value is specified then, dependant on the compiler,
1.3779 +a compile time error or warning will be produced which includes the label
1.3780 +"__invalid_capability_value"
1.3781 +
1.3782 +@param cap The capability value
1.3783 +@internalComponent
1.3784 +*/
1.3785 +#define CAPABILITY_AS_TUINT8(cap) \
1.3786 + ((TUint8)(int)( \
1.3787 + (cap)==ECapability_None \
1.3788 + ? (__invalid_capability_value(*)[1])(ECapability_None) \
1.3789 + : (__invalid_capability_value(*)[((TUint)(cap+1)<=(TUint)ECapability_Limit)?1:2])(cap) \
1.3790 + ))
1.3791 +
1.3792 +
1.3793 +/**
1.3794 +A macro to construct a TUint32 from four TUint8s. The TUint32 is in BigEndian
1.3795 +ordering useful for class layout rather than number generation.
1.3796 +
1.3797 +@param i1 The first TUint8
1.3798 +@param i2 The second TUint8
1.3799 +@param i3 The third TUint8
1.3800 +@param i4 The fourth TUint8
1.3801 +@internalComponent
1.3802 +*/
1.3803 +#define FOUR_TUINT8(i1,i2,i3,i4) \
1.3804 + (TUint32)( \
1.3805 + (TUint8)i1 | \
1.3806 + (TUint8)i2 << 8 | \
1.3807 + (TUint8)i3 << 16 | \
1.3808 + (TUint8)i4 << 24 \
1.3809 + )
1.3810 +
1.3811 +
1.3812 +/** Macro for compile-time initialisation of a security policy object that
1.3813 +always fails. That is, checks against this policy will always fail,
1.3814 +irrespective of the security attributes of the item being checked.
1.3815 +
1.3816 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3817 +Taking the address of the object will return a const TSecurityPolicy*.
1.3818 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3819 +function call operator n().
1.3820 +@publishedAll
1.3821 +@released
1.3822 +*/
1.3823 +#define _INIT_SECURITY_POLICY_FAIL \
1.3824 + { \
1.3825 + FOUR_TUINT8( \
1.3826 + (TUint8)TSecurityPolicy::ETypeFail, \
1.3827 + (TUint8)0xff, \
1.3828 + (TUint8)0xff, \
1.3829 + (TUint8)0xff \
1.3830 + ), \
1.3831 + (TUint32)0xffffffff \
1.3832 + }
1.3833 +
1.3834 +
1.3835 +/** Macro for compile-time definition of a security policy object that always
1.3836 +fails. That is, checks against this policy will always fail, irrespective of
1.3837 +the security attributes of the item being checked.
1.3838 +
1.3839 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3840 +Taking the address of the object will return a const TSecurityPolicy*.
1.3841 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3842 +function call operator n().
1.3843 +@param n Name to use for policy object
1.3844 +@publishedAll
1.3845 +@released
1.3846 +*/
1.3847 +#define _LIT_SECURITY_POLICY_FAIL(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_FAIL
1.3848 +
1.3849 +
1.3850 +/** Macro for compile-time initialisation of a security policy object that
1.3851 +always passes. That is, checks against this policy will always pass,
1.3852 +irrespective of the security attributes of the item being checked.
1.3853 +
1.3854 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3855 +Taking the address of the object will return a const TSecurityPolicy*.
1.3856 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3857 +function call operator n().
1.3858 +@publishedAll
1.3859 +@released
1.3860 +*/
1.3861 +#define _INIT_SECURITY_POLICY_PASS \
1.3862 + { \
1.3863 + FOUR_TUINT8( \
1.3864 + (TUint8)TSecurityPolicy::ETypePass, \
1.3865 + (TUint8)0xff, \
1.3866 + (TUint8)0xff, \
1.3867 + (TUint8)0xff \
1.3868 + ), \
1.3869 + (TUint32)0xffffffff \
1.3870 + }
1.3871 +
1.3872 +
1.3873 +/** Macro for compile-time definition of a security policy object that always
1.3874 +passes. That is, checks against this policy will always pass, irrespective of
1.3875 +the security attributes of the item being checked.
1.3876 +
1.3877 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3878 +Taking the address of the object will return a const TSecurityPolicy*.
1.3879 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3880 +function call operator n().
1.3881 +@param n Name to use for policy object
1.3882 +@publishedAll
1.3883 +@released
1.3884 +*/
1.3885 +#define _LIT_SECURITY_POLICY_PASS(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_PASS
1.3886 +
1.3887 +
1.3888 +/** Macro for compile-time initialisation of a security policy object
1.3889 +The policy will check for seven capabilities.
1.3890 +
1.3891 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3892 +Taking the address of the object will return a const TSecurityPolicy*.
1.3893 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3894 +function call operator n().
1.3895 +
1.3896 +If an invlid capability value is specified then, dependant on the compiler,
1.3897 +a compile time error or warning will be produced which includes the label
1.3898 +"__invalid_capability_value"
1.3899 +
1.3900 +@param c1 The first capability to check (enumerator of TCapability)
1.3901 +@param c2 The second capability to check (enumerator of TCapability)
1.3902 +@param c3 The third capability to check (enumerator of TCapability)
1.3903 +@param c4 The fourth capability to check (enumerator of TCapability)
1.3904 +@param c5 The fifth capability to check (enumerator of TCapability)
1.3905 +@param c6 The sixth capability to check (enumerator of TCapability)
1.3906 +@param c7 The seventh capability to check (enumerator of TCapability)
1.3907 +
1.3908 +@publishedAll
1.3909 +@released
1.3910 +*/
1.3911 +#define _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7) \
1.3912 + { \
1.3913 + FOUR_TUINT8( \
1.3914 + (TUint8)TSecurityPolicy::ETypeC7, \
1.3915 + CAPABILITY_AS_TUINT8(c1), \
1.3916 + CAPABILITY_AS_TUINT8(c2), \
1.3917 + CAPABILITY_AS_TUINT8(c3) \
1.3918 + ), \
1.3919 + FOUR_TUINT8( \
1.3920 + CAPABILITY_AS_TUINT8(c4), \
1.3921 + CAPABILITY_AS_TUINT8(c5), \
1.3922 + CAPABILITY_AS_TUINT8(c6), \
1.3923 + CAPABILITY_AS_TUINT8(c7) \
1.3924 + ) \
1.3925 + }
1.3926 +
1.3927 +
1.3928 +/** Macro for compile-time definition of a security policy object
1.3929 +The policy will check for seven capabilities.
1.3930 +
1.3931 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3932 +Taking the address of the object will return a const TSecurityPolicy*.
1.3933 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3934 +function call operator n().
1.3935 +
1.3936 +If an invlid capability value is specified then, dependant on the compiler,
1.3937 +a compile time error or warning will be produced which includes the label
1.3938 +"__invalid_capability_value"
1.3939 +
1.3940 +@param n Name to use for policy object
1.3941 +@param c1 The first capability to check (enumerator of TCapability)
1.3942 +@param c2 The second capability to check (enumerator of TCapability)
1.3943 +@param c3 The third capability to check (enumerator of TCapability)
1.3944 +@param c4 The fourth capability to check (enumerator of TCapability)
1.3945 +@param c5 The fifth capability to check (enumerator of TCapability)
1.3946 +@param c6 The sixth capability to check (enumerator of TCapability)
1.3947 +@param c7 The seventh capability to check (enumerator of TCapability)
1.3948 +
1.3949 +@publishedAll
1.3950 +@released
1.3951 +*/
1.3952 +#define _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,c7) \
1.3953 + const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7)
1.3954 +
1.3955 +
1.3956 +/** Macro for compile-time initialisation of a security policy object
1.3957 +The policy will check for six capabilities.
1.3958 +
1.3959 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3960 +Taking the address of the object will return a const TSecurityPolicy*.
1.3961 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3962 +function call operator n().
1.3963 +
1.3964 +If an invlid capability value is specified then, dependant on the compiler,
1.3965 +a compile time error or warning will be produced which includes the label
1.3966 +"__invalid_capability_value"
1.3967 +
1.3968 +@param c1 The first capability to check (enumerator of TCapability)
1.3969 +@param c2 The second capability to check (enumerator of TCapability)
1.3970 +@param c3 The third capability to check (enumerator of TCapability)
1.3971 +@param c4 The fourth capability to check (enumerator of TCapability)
1.3972 +@param c5 The fifth capability to check (enumerator of TCapability)
1.3973 +@param c6 The sixth capability to check (enumerator of TCapability)
1.3974 +
1.3975 +@publishedAll
1.3976 +@released
1.3977 +*/
1.3978 +#define _INIT_SECURITY_POLICY_C6(c1,c2,c3,c4,c5,c6) \
1.3979 + _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,ECapability_None)
1.3980 +
1.3981 +
1.3982 +/** Macro for compile-time definition of a security policy object
1.3983 +The policy will check for six capabilities.
1.3984 +
1.3985 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.3986 +Taking the address of the object will return a const TSecurityPolicy*.
1.3987 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.3988 +function call operator n().
1.3989 +
1.3990 +If an invlid capability value is specified then, dependant on the compiler,
1.3991 +a compile time error or warning will be produced which includes the label
1.3992 +"__invalid_capability_value"
1.3993 +
1.3994 +@param n Name to use for policy object
1.3995 +@param c1 The first capability to check (enumerator of TCapability)
1.3996 +@param c2 The second capability to check (enumerator of TCapability)
1.3997 +@param c3 The third capability to check (enumerator of TCapability)
1.3998 +@param c4 The fourth capability to check (enumerator of TCapability)
1.3999 +@param c5 The fifth capability to check (enumerator of TCapability)
1.4000 +@param c6 The sixth capability to check (enumerator of TCapability)
1.4001 +
1.4002 +@publishedAll
1.4003 +@released
1.4004 +*/
1.4005 +#define _LIT_SECURITY_POLICY_C6(n,c1,c2,c3,c4,c5,c6) \
1.4006 + _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,ECapability_None)
1.4007 +
1.4008 +
1.4009 +/** Macro for compile-time initialisation of a security policy object
1.4010 +The policy will check for five capabilities.
1.4011 +
1.4012 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4013 +Taking the address of the object will return a const TSecurityPolicy*.
1.4014 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4015 +function call operator n().
1.4016 +
1.4017 +If an invlid capability value is specified then, dependant on the compiler,
1.4018 +a compile time error or warning will be produced which includes the label
1.4019 +"__invalid_capability_value"
1.4020 +
1.4021 +@param c1 The first capability to check (enumerator of TCapability)
1.4022 +@param c2 The second capability to check (enumerator of TCapability)
1.4023 +@param c3 The third capability to check (enumerator of TCapability)
1.4024 +@param c4 The fourth capability to check (enumerator of TCapability)
1.4025 +@param c5 The fifth capability to check (enumerator of TCapability)
1.4026 +
1.4027 +@publishedAll
1.4028 +@released
1.4029 +*/
1.4030 +#define _INIT_SECURITY_POLICY_C5(c1,c2,c3,c4,c5) \
1.4031 + _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
1.4032 +
1.4033 +
1.4034 +/** Macro for compile-time definition of a security policy object
1.4035 +The policy will check for five capabilities.
1.4036 +
1.4037 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4038 +Taking the address of the object will return a const TSecurityPolicy*.
1.4039 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4040 +function call operator n().
1.4041 +
1.4042 +If an invlid capability value is specified then, dependant on the compiler,
1.4043 +a compile time error or warning will be produced which includes the label
1.4044 +"__invalid_capability_value"
1.4045 +
1.4046 +@param n Name to use for policy object
1.4047 +@param c1 The first capability to check (enumerator of TCapability)
1.4048 +@param c2 The second capability to check (enumerator of TCapability)
1.4049 +@param c3 The third capability to check (enumerator of TCapability)
1.4050 +@param c4 The fourth capability to check (enumerator of TCapability)
1.4051 +@param c5 The fifth capability to check (enumerator of TCapability)
1.4052 +
1.4053 +@publishedAll
1.4054 +@released
1.4055 +*/
1.4056 +#define _LIT_SECURITY_POLICY_C5(n,c1,c2,c3,c4,c5) \
1.4057 + _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
1.4058 +
1.4059 +
1.4060 +/** Macro for compile-time initialisation of a security policy object
1.4061 +The policy will check for four capabilities.
1.4062 +
1.4063 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4064 +Taking the address of the object will return a const TSecurityPolicy*.
1.4065 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4066 +function call operator n().
1.4067 +
1.4068 +If an invlid capability value is specified then, dependant on the compiler,
1.4069 +a compile time error or warning will be produced which includes the label
1.4070 +"__invalid_capability_value"
1.4071 +
1.4072 +@param c1 The first capability to check (enumerator of TCapability)
1.4073 +@param c2 The second capability to check (enumerator of TCapability)
1.4074 +@param c3 The third capability to check (enumerator of TCapability)
1.4075 +@param c4 The fourth capability to check (enumerator of TCapability)
1.4076 +
1.4077 +@publishedAll
1.4078 +@released
1.4079 +*/
1.4080 +#define _INIT_SECURITY_POLICY_C4(c1,c2,c3,c4) \
1.4081 + _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
1.4082 +
1.4083 +
1.4084 +/** Macro for compile-time definition of a security policy object
1.4085 +The policy will check for four capabilities.
1.4086 +
1.4087 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4088 +Taking the address of the object will return a const TSecurityPolicy*.
1.4089 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4090 +function call operator n().
1.4091 +
1.4092 +If an invlid capability value is specified then, dependant on the compiler,
1.4093 +a compile time error or warning will be produced which includes the label
1.4094 +"__invalid_capability_value"
1.4095 +
1.4096 +@param n Name to use for policy object
1.4097 +@param c1 The first capability to check (enumerator of TCapability)
1.4098 +@param c2 The second capability to check (enumerator of TCapability)
1.4099 +@param c3 The third capability to check (enumerator of TCapability)
1.4100 +@param c4 The fourth capability to check (enumerator of TCapability)
1.4101 +
1.4102 +@publishedAll
1.4103 +@released
1.4104 +*/
1.4105 +#define _LIT_SECURITY_POLICY_C4(n,c1,c2,c3,c4) \
1.4106 + _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
1.4107 +
1.4108 +
1.4109 +/** Macro for compile-time initialisation of a security policy object
1.4110 +The policy will check for three capabilities.
1.4111 +
1.4112 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4113 +Taking the address of the object will return a const TSecurityPolicy*.
1.4114 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4115 +function call operator n().
1.4116 +
1.4117 +If an invlid capability value is specified then, dependant on the compiler,
1.4118 +a compile time error or warning will be produced which includes the label
1.4119 +"__invalid_capability_value"
1.4120 +
1.4121 +@param c1 The first capability to check (enumerator of TCapability)
1.4122 +@param c2 The second capability to check (enumerator of TCapability)
1.4123 +@param c3 The third capability to check (enumerator of TCapability)
1.4124 +
1.4125 +@publishedAll
1.4126 +@released
1.4127 +*/
1.4128 +#define _INIT_SECURITY_POLICY_C3(c1,c2,c3) \
1.4129 + { \
1.4130 + FOUR_TUINT8( \
1.4131 + (TUint8)TSecurityPolicy::ETypeC3, \
1.4132 + CAPABILITY_AS_TUINT8(c1), \
1.4133 + CAPABILITY_AS_TUINT8(c2), \
1.4134 + CAPABILITY_AS_TUINT8(c3) \
1.4135 + ), \
1.4136 + (TUint32)0xffffffff \
1.4137 + }
1.4138 +
1.4139 +
1.4140 +/** Macro for compile-time definition of a security policy object
1.4141 +The policy will check for three capabilities.
1.4142 +
1.4143 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4144 +Taking the address of the object will return a const TSecurityPolicy*.
1.4145 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4146 +function call operator n().
1.4147 +
1.4148 +If an invlid capability value is specified then, dependant on the compiler,
1.4149 +a compile time error or warning will be produced which includes the label
1.4150 +"__invalid_capability_value"
1.4151 +
1.4152 +@param n Name to use for policy object
1.4153 +@param c1 The first capability to check (enumerator of TCapability)
1.4154 +@param c2 The second capability to check (enumerator of TCapability)
1.4155 +@param c3 The third capability to check (enumerator of TCapability)
1.4156 +
1.4157 +@publishedAll
1.4158 +@released
1.4159 +*/
1.4160 +#define _LIT_SECURITY_POLICY_C3(n,c1,c2,c3) \
1.4161 + const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C3(c1,c2,c3)
1.4162 +
1.4163 +
1.4164 +/** Macro for compile-time initialisation of a security policy object
1.4165 +The policy will check for two capabilities.
1.4166 +
1.4167 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4168 +Taking the address of the object will return a const TSecurityPolicy*.
1.4169 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4170 +function call operator n().
1.4171 +
1.4172 +If an invlid capability value is specified then, dependant on the compiler,
1.4173 +a compile time error or warning will be produced which includes the label
1.4174 +"__invalid_capability_value"
1.4175 +
1.4176 +@param c1 The first capability to check (enumerator of TCapability)
1.4177 +@param c2 The second capability to check (enumerator of TCapability)
1.4178 +
1.4179 +@publishedAll
1.4180 +@released
1.4181 +*/
1.4182 +#define _INIT_SECURITY_POLICY_C2(c1,c2) \
1.4183 + _INIT_SECURITY_POLICY_C3(c1,c2,ECapability_None)
1.4184 +
1.4185 +
1.4186 +/** Macro for compile-time definition of a security policy object
1.4187 +The policy will check for two capabilities.
1.4188 +
1.4189 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4190 +Taking the address of the object will return a const TSecurityPolicy*.
1.4191 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4192 +function call operator n().
1.4193 +
1.4194 +If an invlid capability value is specified then, dependant on the compiler,
1.4195 +a compile time error or warning will be produced which includes the label
1.4196 +"__invalid_capability_value"
1.4197 +
1.4198 +@param n Name to use for policy object
1.4199 +@param c1 The first capability to check (enumerator of TCapability)
1.4200 +@param c2 The second capability to check (enumerator of TCapability)
1.4201 +
1.4202 +@publishedAll
1.4203 +@released
1.4204 +*/
1.4205 +#define _LIT_SECURITY_POLICY_C2(n,c1,c2) \
1.4206 + _LIT_SECURITY_POLICY_C3(n,c1,c2,ECapability_None)
1.4207 +
1.4208 +
1.4209 +/** Macro for compile-time initialisation of a security policy object
1.4210 +The policy will check for one capability.
1.4211 +
1.4212 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4213 +Taking the address of the object will return a const TSecurityPolicy*.
1.4214 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4215 +function call operator n().
1.4216 +
1.4217 +If an invlid capability value is specified then, dependant on the compiler,
1.4218 +a compile time error or warning will be produced which includes the label
1.4219 +"__invalid_capability_value"
1.4220 +
1.4221 +@param c1 The first capability to check (enumerator of TCapability)
1.4222 +
1.4223 +
1.4224 +@publishedAll
1.4225 +@released
1.4226 +*/
1.4227 +#define _INIT_SECURITY_POLICY_C1(c1) \
1.4228 + _INIT_SECURITY_POLICY_C3(c1,ECapability_None,ECapability_None)
1.4229 +
1.4230 +
1.4231 +/** Macro for compile-time definition of a security policy object
1.4232 +The policy will check for one capability.
1.4233 +
1.4234 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4235 +Taking the address of the object will return a const TSecurityPolicy*.
1.4236 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4237 +function call operator n().
1.4238 +
1.4239 +If an invlid capability value is specified then, dependant on the compiler,
1.4240 +a compile time error or warning will be produced which includes the label
1.4241 +"__invalid_capability_value"
1.4242 +
1.4243 +@param n Name to use for policy object
1.4244 +@param c1 The first capability to check (enumerator of TCapability)
1.4245 +
1.4246 +@publishedAll
1.4247 +@released
1.4248 +*/
1.4249 +#define _LIT_SECURITY_POLICY_C1(n,c1) \
1.4250 + _LIT_SECURITY_POLICY_C3(n,c1,ECapability_None,ECapability_None)
1.4251 +
1.4252 +
1.4253 +/** Macro for compile-time initialisation of a security policy object
1.4254 +The policy will check for a secure ID and three capabilities.
1.4255 +
1.4256 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4257 +Taking the address of the object will return a const TSecurityPolicy*.
1.4258 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4259 +function call operator n().
1.4260 +
1.4261 +If an invlid capability value is specified then, dependant on the compiler,
1.4262 +a compile time error or warning be produced which includes the label
1.4263 +"__invalid_capability_value"
1.4264 +
1.4265 +@param sid The SID value to check for
1.4266 +@param c1 The first capability to check (enumerator of TCapability)
1.4267 +@param c2 The second capability to check (enumerator of TCapability)
1.4268 +@param c3 The third capability to check (enumerator of TCapability)
1.4269 +
1.4270 +@publishedAll
1.4271 +@released
1.4272 +*/
1.4273 +#define _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3) \
1.4274 + { \
1.4275 + FOUR_TUINT8( \
1.4276 + (TUint8)TSecurityPolicy::ETypeS3, \
1.4277 + CAPABILITY_AS_TUINT8(c1), \
1.4278 + CAPABILITY_AS_TUINT8(c2), \
1.4279 + CAPABILITY_AS_TUINT8(c3) \
1.4280 + ), \
1.4281 + (TUint32)(sid) \
1.4282 + }
1.4283 +
1.4284 +
1.4285 +/** Macro for compile-time definition of a security policy object
1.4286 +The policy will check for a secure ID and three capabilities.
1.4287 +
1.4288 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4289 +Taking the address of the object will return a const TSecurityPolicy*.
1.4290 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4291 +function call operator n().
1.4292 +
1.4293 +If an invlid capability value is specified then, dependant on the compiler,
1.4294 +a compile time error or warning be produced which includes the label
1.4295 +"__invalid_capability_value"
1.4296 +
1.4297 +@param n Name to use for policy object
1.4298 +@param sid The SID value to check for
1.4299 +@param c1 The first capability to check (enumerator of TCapability)
1.4300 +@param c2 The second capability to check (enumerator of TCapability)
1.4301 +@param c3 The third capability to check (enumerator of TCapability)
1.4302 +
1.4303 +@publishedAll
1.4304 +@released
1.4305 +*/
1.4306 +#define _LIT_SECURITY_POLICY_S3(n,sid,c1,c2,c3) \
1.4307 + const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3)
1.4308 +
1.4309 +
1.4310 +/** Macro for compile-time initialisation of a security policy object
1.4311 +The policy will check for a secure ID and two capabilities.
1.4312 +
1.4313 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4314 +Taking the address of the object will return a const TSecurityPolicy*.
1.4315 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4316 +function call operator n().
1.4317 +
1.4318 +If an invlid capability value is specified then, dependant on the compiler,
1.4319 +a compile time error or warning be produced which includes the label
1.4320 +"__invalid_capability_value"
1.4321 +
1.4322 +@param sid The SID value to check for
1.4323 +@param c1 The first capability to check (enumerator of TCapability)
1.4324 +@param c2 The second capability to check (enumerator of TCapability)
1.4325 +
1.4326 +@publishedAll
1.4327 +@released
1.4328 +*/
1.4329 +#define _INIT_SECURITY_POLICY_S2(sid,c1,c2) \
1.4330 + _INIT_SECURITY_POLICY_S3(sid,c1,c2,ECapability_None)
1.4331 +
1.4332 +
1.4333 +/** Macro for compile-time definition of a security policy object
1.4334 +The policy will check for a secure ID and two capabilities.
1.4335 +
1.4336 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4337 +Taking the address of the object will return a const TSecurityPolicy*.
1.4338 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4339 +function call operator n().
1.4340 +
1.4341 +If an invlid capability value is specified then, dependant on the compiler,
1.4342 +a compile time error or warning be produced which includes the label
1.4343 +"__invalid_capability_value"
1.4344 +
1.4345 +@param n Name to use for policy object
1.4346 +@param sid The SID value to check for
1.4347 +@param c1 The first capability to check (enumerator of TCapability)
1.4348 +@param c2 The second capability to check (enumerator of TCapability)
1.4349 +
1.4350 +@publishedAll
1.4351 +@released
1.4352 +*/
1.4353 +#define _LIT_SECURITY_POLICY_S2(n,sid,c1,c2) \
1.4354 + _LIT_SECURITY_POLICY_S3(n,sid,c1,c2,ECapability_None)
1.4355 +
1.4356 +
1.4357 +/** Macro for compile-time initialisation of a security policy object
1.4358 +The policy will check for a secure ID and one capability.
1.4359 +
1.4360 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4361 +Taking the address of the object will return a const TSecurityPolicy*.
1.4362 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4363 +function call operator n().
1.4364 +
1.4365 +If an invlid capability value is specified then, dependant on the compiler,
1.4366 +a compile time error or warning be produced which includes the label
1.4367 +"__invalid_capability_value"
1.4368 +
1.4369 +@param sid The SID value to check for
1.4370 +@param c1 The first capability to check (enumerator of TCapability)
1.4371 +
1.4372 +@publishedAll
1.4373 +@released
1.4374 +*/
1.4375 +#define _INIT_SECURITY_POLICY_S1(sid,c1) \
1.4376 + _INIT_SECURITY_POLICY_S3(sid,c1,ECapability_None,ECapability_None)
1.4377 +
1.4378 +
1.4379 +/** Macro for compile-time definition of a security policy object
1.4380 +The policy will check for a secure ID and one capability.
1.4381 +
1.4382 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4383 +Taking the address of the object will return a const TSecurityPolicy*.
1.4384 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4385 +function call operator n().
1.4386 +
1.4387 +If an invlid capability value is specified then, dependant on the compiler,
1.4388 +a compile time error or warning be produced which includes the label
1.4389 +"__invalid_capability_value"
1.4390 +
1.4391 +@param n Name to use for policy object
1.4392 +@param sid The SID value to check for
1.4393 +@param c1 The first capability to check (enumerator of TCapability)
1.4394 +
1.4395 +@publishedAll
1.4396 +@released
1.4397 +*/
1.4398 +#define _LIT_SECURITY_POLICY_S1(n,sid,c1) \
1.4399 + _LIT_SECURITY_POLICY_S3(n,sid,c1,ECapability_None,ECapability_None)
1.4400 +
1.4401 +
1.4402 +/** Macro for compile-time initialisation of a security policy object
1.4403 +The policy will check for a secure ID.
1.4404 +
1.4405 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4406 +Taking the address of the object will return a const TSecurityPolicy*.
1.4407 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4408 +function call operator n().
1.4409 +
1.4410 +@param sid The SID value to check for
1.4411 +
1.4412 +@publishedAll
1.4413 +@released
1.4414 +*/
1.4415 +#define _INIT_SECURITY_POLICY_S0(sid) \
1.4416 + _INIT_SECURITY_POLICY_S3(sid,ECapability_None,ECapability_None,ECapability_None)
1.4417 +
1.4418 +
1.4419 +/** Macro for compile-time definition of a security policy object
1.4420 +The policy will check for a secure ID.
1.4421 +
1.4422 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4423 +Taking the address of the object will return a const TSecurityPolicy*.
1.4424 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4425 +function call operator n().
1.4426 +
1.4427 +@param n Name to use for policy object
1.4428 +@param sid The SID value to check for
1.4429 +
1.4430 +@publishedAll
1.4431 +@released
1.4432 +*/
1.4433 +#define _LIT_SECURITY_POLICY_S0(n,sid) \
1.4434 + _LIT_SECURITY_POLICY_S3(n,sid,ECapability_None,ECapability_None,ECapability_None)
1.4435 +
1.4436 +
1.4437 +/** Macro for compile-time initialisation of a security policy object
1.4438 +The policy will check for a vendor ID and three capabilities.
1.4439 +
1.4440 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4441 +Taking the address of the object will return a const TSecurityPolicy*.
1.4442 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4443 +function call operator n().
1.4444 +
1.4445 +If an invlid capability value is specified then, dependant on the compiler,
1.4446 +a compile time error or warning be produced which includes the label
1.4447 +"__invalid_capability_value"
1.4448 +
1.4449 +@param vid The VID value to check for
1.4450 +@param c1 The first capability to check (enumerator of TCapability)
1.4451 +@param c2 The second capability to check (enumerator of TCapability)
1.4452 +@param c3 The third capability to check (enumerator of TCapability)
1.4453 +
1.4454 +@publishedAll
1.4455 +@released
1.4456 +*/
1.4457 +#define _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3) \
1.4458 + { \
1.4459 + FOUR_TUINT8( \
1.4460 + (TUint8)TSecurityPolicy::ETypeV3, \
1.4461 + CAPABILITY_AS_TUINT8(c1), \
1.4462 + CAPABILITY_AS_TUINT8(c2), \
1.4463 + CAPABILITY_AS_TUINT8(c3) \
1.4464 + ), \
1.4465 + (TUint32)(vid) \
1.4466 + }
1.4467 +
1.4468 +
1.4469 +/** Macro for compile-time definition of a security policy object
1.4470 +The policy will check for a vendor ID and three capabilities.
1.4471 +
1.4472 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4473 +Taking the address of the object will return a const TSecurityPolicy*.
1.4474 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4475 +function call operator n().
1.4476 +
1.4477 +If an invlid capability value is specified then, dependant on the compiler,
1.4478 +a compile time error or warning be produced which includes the label
1.4479 +"__invalid_capability_value"
1.4480 +
1.4481 +@param n Name to use for policy object
1.4482 +@param vid The VID value to check for
1.4483 +@param c1 The first capability to check (enumerator of TCapability)
1.4484 +@param c2 The second capability to check (enumerator of TCapability)
1.4485 +@param c3 The third capability to check (enumerator of TCapability)
1.4486 +
1.4487 +@publishedAll
1.4488 +@released
1.4489 +*/
1.4490 +#define _LIT_SECURITY_POLICY_V3(n,vid,c1,c2,c3) \
1.4491 + const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3)
1.4492 +
1.4493 +
1.4494 +/** Macro for compile-time initialisation of a security policy object
1.4495 +The policy will check for a vendor ID and two capabilities.
1.4496 +
1.4497 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4498 +Taking the address of the object will return a const TSecurityPolicy*.
1.4499 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4500 +function call operator n().
1.4501 +
1.4502 +If an invlid capability value is specified then, dependant on the compiler,
1.4503 +a compile time error or warning be produced which includes the label
1.4504 +"__invalid_capability_value"
1.4505 +
1.4506 +@param vid The VID value to check for
1.4507 +@param c1 The first capability to check (enumerator of TCapability)
1.4508 +@param c2 The second capability to check (enumerator of TCapability)
1.4509 +
1.4510 +@publishedAll
1.4511 +@released
1.4512 +*/
1.4513 +#define _INIT_SECURITY_POLICY_V2(vid,c1,c2) \
1.4514 + _INIT_SECURITY_POLICY_V3(vid,c1,c2,ECapability_None)
1.4515 +
1.4516 +
1.4517 +/** Macro for compile-time definition of a security policy object
1.4518 +The policy will check for a vendor ID and two capabilities.
1.4519 +
1.4520 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4521 +Taking the address of the object will return a const TSecurityPolicy*.
1.4522 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4523 +function call operator n().
1.4524 +
1.4525 +If an invlid capability value is specified then, dependant on the compiler,
1.4526 +a compile time error or warning be produced which includes the label
1.4527 +"__invalid_capability_value"
1.4528 +
1.4529 +@param n Name to use for policy object
1.4530 +@param vid The VID value to check for
1.4531 +@param c1 The first capability to check (enumerator of TCapability)
1.4532 +@param c2 The second capability to check (enumerator of TCapability)
1.4533 +
1.4534 +@publishedAll
1.4535 +@released
1.4536 +*/
1.4537 +#define _LIT_SECURITY_POLICY_V2(n,vid,c1,c2) \
1.4538 + _LIT_SECURITY_POLICY_V3(n,vid,c1,c2,ECapability_None)
1.4539 +
1.4540 +
1.4541 +/** Macro for compile-time initialisation of a security policy object
1.4542 +The policy will check for a vendor ID and one capability.
1.4543 +
1.4544 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4545 +Taking the address of the object will return a const TSecurityPolicy*.
1.4546 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4547 +function call operator n().
1.4548 +
1.4549 +If an invlid capability value is specified then, dependant on the compiler,
1.4550 +a compile time error or warning be produced which includes the label
1.4551 +"__invalid_capability_value"
1.4552 +
1.4553 +@param vid The VID value to check for
1.4554 +@param c1 The first capability to check (enumerator of TCapability)
1.4555 +
1.4556 +@publishedAll
1.4557 +@released
1.4558 +*/
1.4559 +#define _INIT_SECURITY_POLICY_V1(vid,c1) \
1.4560 + _INIT_SECURITY_POLICY_V3(vid,c1,ECapability_None,ECapability_None)
1.4561 +
1.4562 +
1.4563 +/** Macro for compile-time definition of a security policy object
1.4564 +The policy will check for a vendor ID and one capability.
1.4565 +
1.4566 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4567 +Taking the address of the object will return a const TSecurityPolicy*.
1.4568 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4569 +function call operator n().
1.4570 +
1.4571 +If an invlid capability value is specified then, dependant on the compiler,
1.4572 +a compile time error or warning be produced which includes the label
1.4573 +"__invalid_capability_value"
1.4574 +
1.4575 +@param n Name to use for policy object
1.4576 +@param vid The VID value to check for
1.4577 +@param c1 The first capability to check (enumerator of TCapability)
1.4578 +
1.4579 +@publishedAll
1.4580 +@released
1.4581 +*/
1.4582 +#define _LIT_SECURITY_POLICY_V1(n,vid,c1) \
1.4583 + _LIT_SECURITY_POLICY_V3(n,vid,c1,ECapability_None,ECapability_None)
1.4584 +
1.4585 +
1.4586 +/** Macro for compile-time initialisation of a security policy object
1.4587 +The policy will check for a vendor ID.
1.4588 +
1.4589 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4590 +Taking the address of the object will return a const TSecurityPolicy*.
1.4591 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4592 +function call operator n().
1.4593 +
1.4594 +@param vid The VID value to check for
1.4595 +
1.4596 +@publishedAll
1.4597 +@released
1.4598 +*/
1.4599 +#define _INIT_SECURITY_POLICY_V0(vid) \
1.4600 + _INIT_SECURITY_POLICY_V3(vid,ECapability_None,ECapability_None,ECapability_None)
1.4601 +
1.4602 +
1.4603 +/** Macro for compile-time definition of a security policy object
1.4604 +The policy will check for a vendor ID.
1.4605 +
1.4606 +The object declared has an implicit conversion to const TSecurityPolicy&.
1.4607 +Taking the address of the object will return a const TSecurityPolicy*.
1.4608 +Explicit conversion to const TSecurityPolicy& may be effected by using the
1.4609 +function call operator n().
1.4610 +
1.4611 +@param n Name to use for policy object
1.4612 +@param vid The VID value to check for
1.4613 +
1.4614 +@publishedAll
1.4615 +@released
1.4616 +*/
1.4617 +#define _LIT_SECURITY_POLICY_V0(n,vid) \
1.4618 + _LIT_SECURITY_POLICY_V3(n,vid,ECapability_None,ECapability_None,ECapability_None)
1.4619 +
1.4620 +
1.4621 +
1.4622 +#ifdef __KERNEL_MODE__
1.4623 +class DThread;
1.4624 +class RMessageK;
1.4625 +#endif
1.4626 +class TPlatSecDiagnostic;
1.4627 +
1.4628 +/**
1.4629 +Class containing Platform Security related methods
1.4630 +@internalTechnology
1.4631 +*/
1.4632 +class PlatSec
1.4633 + {
1.4634 +#ifndef __KERNEL_MODE__
1.4635 +public:
1.4636 + /**
1.4637 + Tests whether a given Platform Security capability is enforced by the system.
1.4638 +
1.4639 + Capabilities may not be enforced for several reasons:
1.4640 + -# The capability has been explicitly disabled on this system
1.4641 + by use of the PlatSecDisabledCaps configuration parameter
1.4642 + -# Platform Security checks have been globally disabled
1.4643 + by use of the EPlatSecEnforcement configuration parameter
1.4644 + -# The capability value is unknown. I.e. Is not part of the set of supported
1.4645 + capabilities. See TCapabilitySet::SetAllSupported().
1.4646 +
1.4647 + @param aCapability The capability to test
1.4648 + @return A non-zero value if the capability is enforced, zero if it is not.
1.4649 +
1.4650 + @publishedAll
1.4651 + @released
1.4652 + */
1.4653 + IMPORT_C static TBool IsCapabilityEnforced(TCapability aCapability);
1.4654 +
1.4655 + /**
1.4656 + An enumeration used with PlatSecSetting()
1.4657 + @see PlatSecSetting()
1.4658 + @publishedAll
1.4659 + @test
1.4660 + */
1.4661 + enum TConfigSetting
1.4662 + {
1.4663 + EPlatSecEnforcement, /**< Used to request the value of the PlatSecEnforcement setting */
1.4664 + EPlatSecDiagnotics, /**< Used to request the value of the PlatSecDiagnotics setting */
1.4665 + EPlatSecProcessIsolation, /**< Used to request the value of the PlatSecProcessIsolation setting */
1.4666 + EPlatSecEnforceSysBin, /**< Used to request the value of the PlatSecEnforceSysBin setting */
1.4667 + EPlatSecLocked, /**< Used to request the value of the PlatSecLocked setting */
1.4668 + };
1.4669 +
1.4670 + /**
1.4671 + A test function to return the state of a given Platform Security configuration setting.
1.4672 + @param aSetting An enumerated value representing the required setting
1.4673 + @return A value representing the setting. 0 represents 'OFF', 1 represents 'ON'
1.4674 + Other values may be returned for some settings, these exceptions are documented
1.4675 + in the description for individual enumerations of TConfigSetting.
1.4676 + @see TConfigSetting
1.4677 + @publishedAll
1.4678 + @test
1.4679 + */
1.4680 + IMPORT_C static TInt ConfigSetting(TConfigSetting aSetting);
1.4681 +
1.4682 +#endif // Not __KERNEL_MODE__
1.4683 +
1.4684 + //
1.4685 + // All methods below here are internalTechnology
1.4686 + //
1.4687 +
1.4688 +#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
1.4689 +public:
1.4690 + /** @internalTechnology */
1.4691 + static inline TInt LoaderCapabilityViolation(const TDesC8& aImporterName, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
1.4692 +#ifdef __KERNEL_MODE__
1.4693 + /** @internalTechnology */
1.4694 + static inline TInt CapabilityCheckFail(const DProcess* aViolatingProcess, TCapability aCapability, const char* aContextText);
1.4695 + /** @internalTechnology */
1.4696 + static inline TInt CapabilityCheckFail(const DThread* aViolatingThread, TCapability aCapability, const char* aContextText);
1.4697 + /** @internalTechnology */
1.4698 + static inline TInt SecureIdCheckFail(const DProcess* aViolatingProcess, TSecureId aSid, const char* aContextText);
1.4699 + /** @internalTechnology */
1.4700 + static inline TInt PolicyCheckFail(const DProcess* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
1.4701 + /** @internalTechnology */
1.4702 + static inline TInt PolicyCheckFail(const DThread* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
1.4703 + /** @internalTechnology */
1.4704 + static inline TInt ProcessIsolationFail(const char* aContextText);
1.4705 + /** @internalTechnology */
1.4706 + static inline TInt ProcessIsolationIPCFail(RMessageK* aMessage, const char* aContextText);
1.4707 +#else // !__KERNEL_MODE__
1.4708 + /** @internalTechnology */
1.4709 + static inline TInt LoaderCapabilityViolation(RProcess aLoadingProcess, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
1.4710 + /** @internalTechnology */
1.4711 + static inline TInt CreatorCapabilityCheckFail(TCapability aCapability, const char* aContextText);
1.4712 + /** @internalTechnology */
1.4713 + static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps, const char* aContextText);
1.4714 + /** @internalTechnology */
1.4715 + static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability, const char* aContextText);
1.4716 + /** @internalTechnology */
1.4717 + static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps, const char* aContextText);
1.4718 + /** @internalTechnology */
1.4719 + static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing, const char* aContextText);
1.4720 + /** @internalTechnology */
1.4721 + static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability, const char* aContextText);
1.4722 + /** @internalTechnology */
1.4723 + static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps, const char* aContextText);
1.4724 + /** @internalTechnology */
1.4725 + static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps, const char* aContextText);
1.4726 + /** @internalTechnology */
1.4727 + static inline TInt PolicyCheckFail(RSessionBase aSession, const SSecurityInfo& aMissingCaps, const char* aContextText);
1.4728 + /** @internalTechnology */
1.4729 + static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps, const char* aContextText);
1.4730 + /** @internalTechnology */
1.4731 + static inline TInt CreatorCapabilityCheckFail(TCapability aCapability);
1.4732 + /** @internalTechnology */
1.4733 + static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps);
1.4734 + /** @internalTechnology */
1.4735 + static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability);
1.4736 + /** @internalTechnology */
1.4737 + static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps);
1.4738 + /** @internalTechnology */
1.4739 + static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing);
1.4740 + /** @internalTechnology */
1.4741 + static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability);
1.4742 + /** @internalTechnology */
1.4743 + static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps);
1.4744 + /** @internalTechnology */
1.4745 + static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps);
1.4746 + /** @internalTechnology */
1.4747 + static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps);
1.4748 +#endif //__KERNEL_MODE__
1.4749 +
1.4750 +private:
1.4751 + /** @internalTechnology */
1.4752 + UIMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
1.4753 +#else //__REMOVE_PLATSEC_DIAGNOSTICS__
1.4754 +#ifndef __KERNEL_MODE__
1.4755 +private:
1.4756 + /** @internalTechnology */
1.4757 + IMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
1.4758 +#endif // !__KERNEL_MODE__
1.4759 +#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
1.4760 +
1.4761 +public:
1.4762 + /** @internalTechnology */
1.4763 + UIMPORT_C static TInt EmitDiagnostic();
1.4764 + };
1.4765 +
1.4766 +
1.4767 +
1.4768 +/**
1.4769 +@internalTechnology
1.4770 + */
1.4771 +struct TEmulatorImageHeader
1.4772 + {
1.4773 + TUid iUids[KMaxCheckedUid];
1.4774 + TProcessPriority iPriority;
1.4775 + SSecurityInfo iS;
1.4776 + TUint32 iSpare1;
1.4777 + TUint32 iSpare2;
1.4778 + TUint32 iModuleVersion;
1.4779 + TUint32 iFlags;
1.4780 + };
1.4781 +
1.4782 +
1.4783 +
1.4784 +
1.4785 +/**
1.4786 +@publishedAll
1.4787 +@released
1.4788 +
1.4789 +Contains information about the code and data sections belonging to a process.
1.4790 +
1.4791 +@see RProcess::GetMemoryInfo
1.4792 +*/
1.4793 +class TProcessMemoryInfo
1.4794 + {
1.4795 +public:
1.4796 + /**
1.4797 + The code base address (.text).
1.4798 + */
1.4799 + TUint32 iCodeBase;
1.4800 +
1.4801 +
1.4802 + /**
1.4803 + The size of the code section (.text).
1.4804 + */
1.4805 + TUint32 iCodeSize;
1.4806 +
1.4807 +
1.4808 + /**
1.4809 + The base address of the constant data section (.radata).
1.4810 + */
1.4811 + TUint32 iConstDataBase;
1.4812 +
1.4813 +
1.4814 + /**
1.4815 + The size of the constant data section (.radata).
1.4816 + */
1.4817 +
1.4818 + TUint32 iConstDataSize;
1.4819 +
1.4820 +
1.4821 + /**
1.4822 + The base address of the initialised data section (.data).
1.4823 + */
1.4824 + TUint32 iInitialisedDataBase;
1.4825 +
1.4826 +
1.4827 + /**
1.4828 + The size of the initialised data section (.data).
1.4829 + */
1.4830 + TUint32 iInitialisedDataSize;
1.4831 +
1.4832 +
1.4833 + /**
1.4834 + The base address of the uninitialised data section (.bss).
1.4835 + */
1.4836 + TUint32 iUninitialisedDataBase;
1.4837 +
1.4838 +
1.4839 + /**
1.4840 + The size of the uninitialised data section (.bss).
1.4841 + */
1.4842 + TUint32 iUninitialisedDataSize;
1.4843 + };
1.4844 +
1.4845 +
1.4846 +
1.4847 +
1.4848 +/**
1.4849 +@publishedAll
1.4850 +@released
1.4851 +
1.4852 +Defines a more useful synonym for TProcessMemoryInfo.
1.4853 +*/
1.4854 +typedef TProcessMemoryInfo TModuleMemoryInfo; // more accurate name - remove old one later
1.4855 +
1.4856 +
1.4857 +
1.4858 +
1.4859 +#ifndef __KERNEL_MODE__
1.4860 +class CBase;
1.4861 +/**
1.4862 +@publishedAll
1.4863 +@released
1.4864 +
1.4865 +Generic array.
1.4866 +
1.4867 +This class defines a generic array which can be constructed by any of the
1.4868 +following templated concrete arrays:
1.4869 +
1.4870 +1. CArrayFixFlat<class T>
1.4871 +
1.4872 +2. CArrayFixSeg<class T>
1.4873 +
1.4874 +3. CArrayVarFlat<class T>
1.4875 +
1.4876 +4. CArrayVarSeg<class T>
1.4877 +
1.4878 +5. CArrayPakFlat<class T>
1.4879 +
1.4880 +6. RArray<class T>
1.4881 +
1.4882 +7. RPointerArray<class T>
1.4883 +
1.4884 +and also by the following template specialisation classes:
1.4885 +
1.4886 +1. RArray<TInt>
1.4887 +
1.4888 +2. RArray<TUint>
1.4889 +
1.4890 +It allows a degree of polymorphism amongst the array classes. It permits the
1.4891 +operator[] and the Count() member functions of an array to be invoked without
1.4892 +knowing which array class has been used to construct that array.
1.4893 +
1.4894 +TArray allows access to elements of an array but does not permit changes to
1.4895 +those elements.
1.4896 +
1.4897 +Use the Array() member function of an array to construct and return
1.4898 +a TArray<class T> object for that array.
1.4899 +
1.4900 +A TArray<class T> type object is not intended to be constructed explicitly
1.4901 +by user code.
1.4902 +
1.4903 +@see CArrayFixFlat
1.4904 +@see CArrayFixSeg
1.4905 +@see CArrayVarFlat
1.4906 +@see CArrayVarSeg
1.4907 +@see CArrayPakFlat
1.4908 +@see RArray
1.4909 +@see RPointerArray
1.4910 +@see RArray<TInt>
1.4911 +@see RArray<TUint>
1.4912 +*/
1.4913 +template <class T>
1.4914 +class TArray
1.4915 + {
1.4916 +public:
1.4917 + inline TArray(TInt (*aCount)(const CBase* aPtr),const TAny*(*anAt)(const CBase* aPtr,TInt anIndex),const CBase* aPtr);
1.4918 + inline TInt Count() const;
1.4919 + inline const T& operator[](TInt anIndex) const;
1.4920 +private:
1.4921 + const CBase* iPtr;
1.4922 + TInt (*iCount)(const CBase* aPtr);
1.4923 + const TAny*(*iAt)(const CBase* aPtr,TInt anIndex);
1.4924 + };
1.4925 +#endif
1.4926 +
1.4927 +
1.4928 +
1.4929 +
1.4930 +/**
1.4931 +@publishedAll
1.4932 +@released
1.4933 +
1.4934 +Defines a function type used by a TIdentityRelation object.
1.4935 +
1.4936 +A function of this type implements an algorithm for determining whether
1.4937 +two objects match.
1.4938 +
1.4939 +@see TIdentityRelation
1.4940 +*/
1.4941 +typedef TBool (*TGeneralIdentityRelation)(const TAny*, const TAny*);
1.4942 +
1.4943 +
1.4944 +
1.4945 +
1.4946 +/**
1.4947 +@publishedAll
1.4948 +@released
1.4949 +
1.4950 +Defines a function type used by a TLinearOrder object
1.4951 +
1.4952 +A function of this type implements an algorithm that determines
1.4953 +the order of two objects.
1.4954 +
1.4955 +@see TLinearOrder
1.4956 +*/
1.4957 +typedef TInt (*TGeneralLinearOrder)(const TAny*, const TAny*);
1.4958 +
1.4959 +
1.4960 +
1.4961 +
1.4962 +/**
1.4963 +@publishedAll
1.4964 +@released
1.4965 +
1.4966 +A templated class which packages a function that determines whether two
1.4967 +objects of a given class type match. During linear search operations the search
1.4968 +term is always passed as the first argument and the second argument is an
1.4969 +element of the array being searched.
1.4970 +
1.4971 +A TIdentityRelation<T> object is constructed and passed as a parameter to
1.4972 +member functions of the array classes RArray<T> and RPointerArray<T>.
1.4973 +
1.4974 +@see RArray
1.4975 +@see RPointerArray
1.4976 +*/
1.4977 +template <class T>
1.4978 +class TIdentityRelation
1.4979 + {
1.4980 +public:
1.4981 + inline TIdentityRelation( TBool (*anIdentity)(const T&, const T&) );
1.4982 + inline operator TGeneralIdentityRelation() const;
1.4983 +private:
1.4984 + TGeneralIdentityRelation iIdentity;
1.4985 + };
1.4986 +
1.4987 +
1.4988 +
1.4989 +/**
1.4990 +@publishedAll
1.4991 +@released
1.4992 +
1.4993 +A set of common identity relations for frequently occurring types.
1.4994 +
1.4995 +@see RArray
1.4996 +@see RPointerArray
1.4997 +@see RHashSet
1.4998 +@see RPtrHashSet
1.4999 +@see RHashMap
1.5000 +@see RPtrHashMap
1.5001 +*/
1.5002 +class DefaultIdentity
1.5003 + {
1.5004 +public:
1.5005 + IMPORT_C static TBool Integer(const TInt&, const TInt&);
1.5006 + IMPORT_C static TBool Des8(const TDesC8&, const TDesC8&);
1.5007 + IMPORT_C static TBool Des16(const TDesC16&, const TDesC16&);
1.5008 + IMPORT_C static TBool IntegerPtr(TInt* const&, TInt* const&);
1.5009 + IMPORT_C static TBool Des8Ptr(TDesC8* const&, TDesC8* const&);
1.5010 + IMPORT_C static TBool Des16Ptr(TDesC16* const&, TDesC16* const&);
1.5011 + };
1.5012 +
1.5013 +
1.5014 +
1.5015 +
1.5016 +/**
1.5017 +@publishedAll
1.5018 +@released
1.5019 +
1.5020 +A templated class which packages a function that determines the order of two
1.5021 +objects of a given class type. During binary search operations the search term
1.5022 +is always passed as the first argument and the second argument is an element
1.5023 +of the array being searched.
1.5024 +
1.5025 +A TLinearOrder<T> object is constructed and passed as a parameter to member
1.5026 +functions of the array classes RArray<T> and RPointerArray<T>.
1.5027 +
1.5028 +@see RArray
1.5029 +@see RPointerArray
1.5030 +*/
1.5031 +template <class T>
1.5032 +class TLinearOrder
1.5033 + {
1.5034 +public:
1.5035 + inline TLinearOrder( TInt(*anOrder)(const T&, const T&) );
1.5036 + inline operator TGeneralLinearOrder() const;
1.5037 +private:
1.5038 + TGeneralLinearOrder iOrder;
1.5039 + };
1.5040 +
1.5041 +
1.5042 +/*
1.5043 +@publishedAll
1.5044 +@released
1.5045 +
1.5046 +A set of values that tell array search functions which array element is to be
1.5047 +returned when there are duplicate elements in the array.
1.5048 +
1.5049 +These values are used by RArray, RPointerArray, RArray<TInt>,
1.5050 +and RArray<TUint> search functions.
1.5051 +
1.5052 +Examples of functions that take
1.5053 +these enum values are: RPointerArray::SpecificFindInOrderL(),
1.5054 +and RArray::SpecificFindInSignedKeyOrder().
1.5055 +
1.5056 +@see RArray
1.5057 +@see RPointerArray
1.5058 +@see RArray<TInt>
1.5059 +@see RArray<TUint>
1.5060 +*/
1.5061 +enum TArrayFindMode
1.5062 + {
1.5063 + /**
1.5064 + Indicates that any element in a block of duplicate elements can be
1.5065 + returned by a search function.
1.5066 +
1.5067 + Note that using this mode, there can be no guarantee that the element
1.5068 + returned by the search functions will be the same if the size of the array
1.5069 + changes between successive calls to those functions.
1.5070 + */
1.5071 + EArrayFindMode_Any = 0,
1.5072 +
1.5073 + /**
1.5074 + Indicates that the first element in a block of duplicate elements
1.5075 + is returned.
1.5076 + */
1.5077 + EArrayFindMode_First = 1,
1.5078 +
1.5079 + /**
1.5080 + Indicates that the first element after the last element in a block
1.5081 + of duplicate elements is returned.
1.5082 + */
1.5083 + EArrayFindMode_Last = 2,
1.5084 +
1.5085 + /**
1.5086 + @internalTechnology
1.5087 + */
1.5088 + EArrayFindMode_Limit = 3
1.5089 + };
1.5090 +
1.5091 +
1.5092 +/**
1.5093 +@internalComponent
1.5094 +
1.5095 +Base class used in the derivation of RPointerArray, RArray<TInt>,
1.5096 +and RArray<TUint>.
1.5097 +
1.5098 +The base class is inherited privately.
1.5099 +
1.5100 +The class is internal and is not intended for use.
1.5101 +*/
1.5102 +class RPointerArrayBase
1.5103 + {
1.5104 +protected:
1.5105 + IMPORT_C RPointerArrayBase();
1.5106 + IMPORT_C RPointerArrayBase(TInt aGranularity);
1.5107 + IMPORT_C RPointerArrayBase(TInt aMinGrowBy, TInt aFactor);
1.5108 + IMPORT_C void Close();
1.5109 + IMPORT_C TInt Count() const;
1.5110 + inline void ZeroCount() {iCount=0;}
1.5111 + inline TAny** Entries() {return iEntries;}
1.5112 + IMPORT_C TAny*& At(TInt anIndex) const;
1.5113 + IMPORT_C TInt Append(const TAny* anEntry);
1.5114 + IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
1.5115 + IMPORT_C void Remove(TInt anIndex);
1.5116 + IMPORT_C void Compress();
1.5117 + IMPORT_C void Reset();
1.5118 + IMPORT_C TInt Find(const TAny* anEntry) const;
1.5119 + IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
1.5120 + IMPORT_C TInt FindReverse(const TAny* aEntry) const;
1.5121 + IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
1.5122 + IMPORT_C TInt FindIsqSigned(TInt anEntry) const;
1.5123 + IMPORT_C TInt FindIsqUnsigned(TUint anEntry) const;
1.5124 + IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
1.5125 + IMPORT_C TInt FindIsqSigned(TInt anEntry, TInt aMode) const;
1.5126 + IMPORT_C TInt FindIsqUnsigned(TUint anEntry, TInt aMode) const;
1.5127 + IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
1.5128 + IMPORT_C TInt InsertIsqSigned(TInt anEntry, TBool aAllowRepeats);
1.5129 + IMPORT_C TInt InsertIsqUnsigned(TUint anEntry, TBool aAllowRepeats);
1.5130 + IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
1.5131 + IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex) const;
1.5132 + IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex) const;
1.5133 + IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
1.5134 + IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex, TInt aMode) const;
1.5135 + IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex, TInt aMode) const;
1.5136 + IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
1.5137 +#ifndef __KERNEL_MODE__
1.5138 + IMPORT_C RPointerArrayBase(TAny** aEntries, TInt aCount);
1.5139 + IMPORT_C void GranularCompress();
1.5140 + IMPORT_C TInt DoReserve(TInt aCount);
1.5141 + IMPORT_C void HeapSortSigned();
1.5142 + IMPORT_C void HeapSortUnsigned();
1.5143 + IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
1.5144 + IMPORT_C static TInt GetCount(const CBase* aPtr);
1.5145 + IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
1.5146 +#endif
1.5147 +private:
1.5148 + TInt Grow();
1.5149 +private:
1.5150 + TInt iCount;
1.5151 + TAny** iEntries;
1.5152 + TInt iAllocated;
1.5153 + TInt iGranularity; // positive means linear, negative means exponential growth
1.5154 + TInt iSpare1;
1.5155 + TInt iSpare2;
1.5156 + };
1.5157 +
1.5158 +
1.5159 +
1.5160 +
1.5161 +/**
1.5162 +@publishedAll
1.5163 +@released
1.5164 +
1.5165 +A simple and efficient array of pointers to objects.
1.5166 +
1.5167 +The elements of the array are pointers to instances of a class; this class
1.5168 +is specified as the template parameter T.
1.5169 +
1.5170 +The class offers standard array behaviour which includes insertion, appending
1.5171 +and sorting of pointers.
1.5172 +
1.5173 +Derivation from RPointerArrayBase is private.
1.5174 +*/
1.5175 +template <class T>
1.5176 +class RPointerArray : private RPointerArrayBase
1.5177 + {
1.5178 +public:
1.5179 + inline RPointerArray();
1.5180 + inline explicit RPointerArray(TInt aGranularity);
1.5181 + inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
1.5182 + inline void Close();
1.5183 + inline TInt Count() const;
1.5184 + inline T* const& operator[](TInt anIndex) const;
1.5185 + inline T*& operator[](TInt anIndex);
1.5186 + inline TInt Append(const T* anEntry);
1.5187 + inline TInt Insert(const T* anEntry, TInt aPos);
1.5188 + inline void Remove(TInt anIndex);
1.5189 + inline void Compress();
1.5190 + inline void Reset();
1.5191 + void ResetAndDestroy();
1.5192 + inline TInt Find(const T* anEntry) const;
1.5193 + inline TInt Find(const T* anEntry, TIdentityRelation<T> anIdentity) const;
1.5194 + template <class K>
1.5195 + inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
1.5196 + /**
1.5197 + Finds the first object pointer in the array which matches aKey using
1.5198 + the comparison algorithm provided by apfnCompare.
1.5199 +
1.5200 + The find operation always starts at the low index end of the array. There
1.5201 + is no assumption about the order of objects in the array.
1.5202 +
1.5203 + @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
1.5204 + @param apfnCompare A function defining the identity relation between the
1.5205 + object pointers in the array, and their keys of type K. The
1.5206 + function returns true if k and t match based on this relationship.
1.5207 +
1.5208 + @return The index of the first matching object pointer within the array.
1.5209 + KErrNotFound, if no suitable object pointer can be found.
1.5210 + */
1.5211 + { return RPointerArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
1.5212 + inline TInt FindReverse(const T* anEntry) const;
1.5213 + inline TInt FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const;
1.5214 + template <class K>
1.5215 + inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
1.5216 + /**
1.5217 + Finds the first object pointer in the array which matches aKey using
1.5218 + the comparison algorithm provided by apfnCompare.
1.5219 +
1.5220 + The find operation always starts at the high index end of the array. There
1.5221 + is no assumption about the order of objects in the array.
1.5222 +
1.5223 + @param aKey The key of type K to be compared with the elements of the array using apfnMatch.
1.5224 + @param apfnMatch A function defining the identity relation between the
1.5225 + object pointers in the array, and their keys of type K. The
1.5226 + function returns true if k and t match based on this relationship.
1.5227 +
1.5228 + @return The index of the first matching object pointer within the array.
1.5229 + KErrNotFound, if no suitable object pointer can be found.
1.5230 + */
1.5231 +
1.5232 + { return RPointerArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
1.5233 + inline TInt FindInAddressOrder(const T* anEntry) const;
1.5234 + inline TInt FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const;
1.5235 + inline TInt FindInAddressOrder(const T* anEntry, TInt& anIndex) const;
1.5236 + inline TInt FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
1.5237 + template <class K>
1.5238 + inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
1.5239 + /**
1.5240 + Finds the object pointer in the array whose object matches the specified
1.5241 + key, (Using the relationship defined within apfnCompare) using a binary search
1.5242 + technique and an ordering algorithm.
1.5243 +
1.5244 + The function assumes that existing object pointers in the array are ordered
1.5245 + so that the objects themselves are in object order as determined by an algorithm
1.5246 + supplied by the caller and packaged as a TLinearOrder<T>.
1.5247 +
1.5248 + @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
1.5249 + @param apfnCompare A function which defines the order that the array was sorted,
1.5250 + where in it aKey (via the defined relationship) should fit, and if the key is present.
1.5251 +
1.5252 + @return The index of the matching object pointer within the array.
1.5253 + KErrNotFound, if no suitable object pointer can be found.
1.5254 + */
1.5255 + { return RPointerArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
1.5256 + inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const;
1.5257 + inline TInt SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
1.5258 + inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const;
1.5259 + inline TInt SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
1.5260 + inline TInt InsertInAddressOrder(const T* anEntry);
1.5261 + inline TInt InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder);
1.5262 + inline TInt InsertInAddressOrderAllowRepeats(const T* anEntry);
1.5263 + inline TInt InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder);
1.5264 +#ifndef __KERNEL_MODE__
1.5265 + inline void AppendL(const T* anEntry);
1.5266 + inline void InsertL(const T* anEntry, TInt aPos);
1.5267 + inline TInt FindL(const T* anEntry) const;
1.5268 + inline TInt FindL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
1.5269 + inline TInt FindReverseL(const T* anEntry) const;
1.5270 + inline TInt FindReverseL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
1.5271 + inline TInt FindInAddressOrderL(const T* anEntry) const;
1.5272 + inline TInt FindInOrderL(const T* anEntry, TLinearOrder<T> anOrder) const;
1.5273 + inline void FindInAddressOrderL(const T* anEntry, TInt& anIndex) const;
1.5274 + inline void FindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
1.5275 + inline TInt SpecificFindInAddressOrderL(const T* anEntry, TInt aMode) const;
1.5276 + inline TInt SpecificFindInOrderL(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
1.5277 + inline void SpecificFindInAddressOrderL(const T* anEntry, TInt& anIndex, TInt aMode) const;
1.5278 + inline void SpecificFindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
1.5279 + inline void InsertInAddressOrderL(const T* anEntry);
1.5280 + inline void InsertInOrderL(const T* anEntry, TLinearOrder<T> anOrder);
1.5281 + inline void InsertInAddressOrderAllowRepeatsL(const T* anEntry);
1.5282 + inline void InsertInOrderAllowRepeatsL(const T* anEntry, TLinearOrder<T> anOrder);
1.5283 +
1.5284 + inline RPointerArray(T** aEntries, TInt aCount);
1.5285 + inline void GranularCompress();
1.5286 + inline TInt Reserve(TInt aCount);
1.5287 + inline void ReserveL(TInt aCount);
1.5288 + inline void SortIntoAddressOrder();
1.5289 + inline void Sort(TLinearOrder<T> anOrder);
1.5290 + inline TArray<T*> Array() const;
1.5291 +#endif
1.5292 + };
1.5293 +
1.5294 +
1.5295 +
1.5296 +/**
1.5297 +@publishedAll
1.5298 +@released
1.5299 +
1.5300 +Array of raw pointers.
1.5301 +
1.5302 +The array is a simple and efficient specialized array of TAny pointers offering
1.5303 +standard array behaviour.
1.5304 +
1.5305 +The derivation from RPointerArrayBase is private.
1.5306 +*/
1.5307 +TEMPLATE_SPECIALIZATION class RPointerArray<TAny> : private RPointerArrayBase
1.5308 + {
1.5309 +public:
1.5310 + inline RPointerArray();
1.5311 + inline explicit RPointerArray(TInt aGranularity);
1.5312 + inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
1.5313 + inline void Close();
1.5314 + inline TInt Count() const;
1.5315 + inline TAny* const& operator[](TInt anIndex) const;
1.5316 + inline TAny*& operator[](TInt anIndex);
1.5317 + inline TInt Append(const TAny* anEntry);
1.5318 + inline TInt Insert(const TAny* anEntry, TInt aPos);
1.5319 + inline void Remove(TInt anIndex);
1.5320 + inline void Compress();
1.5321 + inline void Reset();
1.5322 + inline TInt Find(const TAny* anEntry) const;
1.5323 + inline TInt FindReverse(const TAny* anEntry) const;
1.5324 + inline TInt FindInAddressOrder(const TAny* anEntry) const;
1.5325 + inline TInt FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const;
1.5326 + inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const;
1.5327 + inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
1.5328 + inline TInt InsertInAddressOrder(const TAny* anEntry);
1.5329 + inline TInt InsertInAddressOrderAllowRepeats(const TAny* anEntry);
1.5330 +#ifndef __KERNEL_MODE__
1.5331 + inline void AppendL(const TAny* anEntry);
1.5332 + inline void InsertL(const TAny* anEntry, TInt aPos);
1.5333 + inline TInt FindL(const TAny* anEntry) const;
1.5334 + inline TInt FindReverseL(const TAny* anEntry) const;
1.5335 + inline TInt FindInAddressOrderL(const TAny* anEntry) const;
1.5336 + inline void FindInAddressOrderL(const TAny* anEntry, TInt& anIndex) const;
1.5337 + inline TInt SpecificFindInAddressOrderL(const TAny* anEntry, TInt aMode) const;
1.5338 + inline void SpecificFindInAddressOrderL(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
1.5339 + inline void InsertInAddressOrderL(const TAny* anEntry);
1.5340 + inline void InsertInAddressOrderAllowRepeatsL(const TAny* anEntry);
1.5341 +
1.5342 + inline RPointerArray(TAny** aEntries, TInt aCount);
1.5343 + inline void GranularCompress();
1.5344 + inline void SortIntoAddressOrder();
1.5345 + inline TArray<TAny*> Array() const;
1.5346 +#endif
1.5347 + };
1.5348 +
1.5349 +
1.5350 +
1.5351 +/**
1.5352 +@internalComponent
1.5353 +
1.5354 +Base class used in the derivation of RArray.
1.5355 +
1.5356 +The base class is inherited privately.
1.5357 +
1.5358 +The class is internal and is not intended for use.
1.5359 +*/
1.5360 +class RArrayBase
1.5361 + {
1.5362 +protected:
1.5363 + IMPORT_C RArrayBase(TInt anEntrySize);
1.5364 + IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity);
1.5365 + IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity, TInt aKeyOffset);
1.5366 + IMPORT_C RArrayBase(TInt anEntrySize, TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
1.5367 + IMPORT_C RArrayBase(TInt aEntrySize,TAny* aEntries, TInt aCount);
1.5368 + IMPORT_C void Close();
1.5369 + IMPORT_C TInt Count() const;
1.5370 + IMPORT_C TAny* At(TInt anIndex) const;
1.5371 + IMPORT_C TInt Append(const TAny* anEntry);
1.5372 + IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
1.5373 + IMPORT_C void Remove(TInt anIndex);
1.5374 + IMPORT_C void Compress();
1.5375 + IMPORT_C void Reset();
1.5376 + IMPORT_C TInt Find(const TAny* anEntry) const;
1.5377 + IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
1.5378 + IMPORT_C TInt FindReverse(const TAny* aEntry) const;
1.5379 + IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
1.5380 + IMPORT_C TInt FindIsqSigned(const TAny* anEntry) const;
1.5381 + IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry) const;
1.5382 + IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
1.5383 + IMPORT_C TInt FindIsqSigned(const TAny* anEntry, TInt aMode) const;
1.5384 + IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry, TInt aMode) const;
1.5385 + IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
1.5386 + IMPORT_C TInt InsertIsqSigned(const TAny* anEntry, TBool aAllowRepeats);
1.5387 + IMPORT_C TInt InsertIsqUnsigned(const TAny* anEntry, TBool aAllowRepeats);
1.5388 + IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
1.5389 + IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex) const;
1.5390 + IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex) const;
1.5391 + IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
1.5392 + IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
1.5393 + IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
1.5394 + IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
1.5395 +#ifndef __KERNEL_MODE__
1.5396 + IMPORT_C void GranularCompress();
1.5397 + IMPORT_C TInt DoReserve(TInt aCount);
1.5398 + IMPORT_C void HeapSortSigned();
1.5399 + IMPORT_C void HeapSortUnsigned();
1.5400 + IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
1.5401 + IMPORT_C static TInt GetCount(const CBase* aPtr);
1.5402 + IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
1.5403 +#endif
1.5404 +private:
1.5405 + TInt Grow();
1.5406 +private:
1.5407 + TInt iCount;
1.5408 + TAny* iEntries;
1.5409 + TInt iEntrySize;
1.5410 + TInt iKeyOffset;
1.5411 + TInt iAllocated;
1.5412 + TInt iGranularity; // positive means linear, negative means exponential growth
1.5413 + TInt iSpare1;
1.5414 + TInt iSpare2;
1.5415 + };
1.5416 +
1.5417 +
1.5418 +
1.5419 +
1.5420 +/**
1.5421 +@publishedAll
1.5422 +@released
1.5423 +
1.5424 +A simple and efficient array of fixed length objects.
1.5425 +
1.5426 +The elements of the array are instances of a class; this class is specified
1.5427 +as the template parameter T.
1.5428 +
1.5429 +The array offers standard array behaviour which includes insertion, appending
1.5430 +and sorting of elements.
1.5431 +
1.5432 +Note:
1.5433 +
1.5434 +1. where possible, this class should be used in preference to
1.5435 + CArrayFixFlat<classT>.
1.5436 +
1.5437 +2. the derivation from RArrayBase is private.
1.5438 +
1.5439 +3. for performance reasons, RArray stores objects in the array as
1.5440 + word (4 byte) aligned quantities. This means that some member functions
1.5441 + do not work when RArray is instantiated for classes of less than 4 bytes
1.5442 + in size, or when the class's alignment requirement is not 4.
1.5443 + Be aware that it is possible to get an unhandled exception on hardware
1.5444 + that enforces strict alignment.
1.5445 +
1.5446 + The affected functions are:
1.5447 +
1.5448 + 3.1 the constructor: RArray(TInt, T*, TInt)
1.5449 +
1.5450 + 3.2 Append(const T&)
1.5451 +
1.5452 + 3.3 Insert(const T&, TInt)
1.5453 +
1.5454 + 3.4 the [] operator, and then using the pointer to iterate through
1.5455 + the array as you would with a C array.
1.5456 +*/
1.5457 +template <class T>
1.5458 +class RArray : private RArrayBase
1.5459 + {
1.5460 +public:
1.5461 + inline RArray();
1.5462 + inline explicit RArray(TInt aGranularity);
1.5463 + inline RArray(TInt aGranularity, TInt aKeyOffset);
1.5464 + inline RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
1.5465 + inline RArray(TInt aEntrySize,T* aEntries, TInt aCount);
1.5466 + inline void Close();
1.5467 + inline TInt Count() const;
1.5468 + inline const T& operator[](TInt anIndex) const;
1.5469 + inline T& operator[](TInt anIndex);
1.5470 + inline TInt Append(const T& anEntry);
1.5471 + inline TInt Insert(const T& anEntry, TInt aPos);
1.5472 + inline void Remove(TInt anIndex);
1.5473 + inline void Compress();
1.5474 + inline void Reset();
1.5475 + inline TInt Find(const T& anEntry) const;
1.5476 + inline TInt Find(const T& anEntry, TIdentityRelation<T> anIdentity) const;
1.5477 + template <class K>
1.5478 + inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
1.5479 + /**
1.5480 + Finds the first object in the array which matches aKey using
1.5481 + the comparison algorithm provided by apfnCompare.
1.5482 +
1.5483 + The find operation always starts at the low index end of the array. There
1.5484 + is no assumption about the order of objects in the array.
1.5485 +
1.5486 + @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
1.5487 + @param apfnCompare A function defining the identity relation between the
1.5488 + object in the array, and their keys of type K. The function
1.5489 + returns true if k and t match based on this relationship.
1.5490 +
1.5491 + @return The index of the first matching object within the array.
1.5492 + KErrNotFound, if no suitable object can be found.
1.5493 + */
1.5494 + { return RArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
1.5495 + inline TInt FindReverse(const T& anEntry) const;
1.5496 + inline TInt FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const;
1.5497 + template <class K>
1.5498 + inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
1.5499 + /**
1.5500 + Finds the first object in the array which matches aKey using the comparison
1.5501 + algorithm provided by apfnCompare.
1.5502 +
1.5503 + The find operation always starts at the high index end of the array. There
1.5504 + is no assumption about the order of objects in the array.
1.5505 +
1.5506 + @param aKey The key of type K to be compared with the elements of the array using apfnMatch.
1.5507 + @param apfnMatch A function defining the identity relation between the
1.5508 + object in the array, and their keys of type K. The function
1.5509 + returns true if k and t match based on this relationship.
1.5510 +
1.5511 + @return The index of the first matching object within the array.
1.5512 + KErrNotFound, if no suitable object can be found.
1.5513 + */
1.5514 + { return RArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
1.5515 + inline TInt FindInSignedKeyOrder(const T& anEntry) const;
1.5516 + inline TInt FindInUnsignedKeyOrder(const T& anEntry) const;
1.5517 + inline TInt FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const;
1.5518 + inline TInt FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const;
1.5519 + inline TInt FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const;
1.5520 + inline TInt FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
1.5521 + template <class K>
1.5522 + inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
1.5523 + /**
1.5524 + Finds the object in the array whose object matches the specified
1.5525 + key, (Using the relationship defined within apfnCompare) using a binary search
1.5526 + technique and an ordering algorithm.
1.5527 +
1.5528 + The function assumes that existing objects in the array are ordered so
1.5529 + that the objects themselves are in object order as determined by an algorithm
1.5530 + supplied by the caller and packaged as a TLinearOrder<T>.
1.5531 +
1.5532 + @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
1.5533 + @param apfnCompare A function which defines the order that the array was sorted,
1.5534 + where in it aKey (via the defined relationship) should fit, and if the key is present.
1.5535 +
1.5536 + @return The index of the matching object within the array.
1.5537 + KErrNotFound, if no suitable object can be found.
1.5538 + */
1.5539 +
1.5540 + { return RArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
1.5541 + inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const;
1.5542 + inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const;
1.5543 + inline TInt SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
1.5544 + inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
1.5545 + inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
1.5546 + inline TInt SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
1.5547 + inline TInt InsertInSignedKeyOrder(const T& anEntry);
1.5548 + inline TInt InsertInUnsignedKeyOrder(const T& anEntry);
1.5549 + inline TInt InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder);
1.5550 + inline TInt InsertInSignedKeyOrderAllowRepeats(const T& anEntry);
1.5551 + inline TInt InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry);
1.5552 + inline TInt InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder);
1.5553 +#ifndef __KERNEL_MODE__
1.5554 + inline void AppendL(const T& anEntry);
1.5555 + inline void InsertL(const T& anEntry, TInt aPos);
1.5556 + inline TInt FindL(const T& anEntry) const;
1.5557 + inline TInt FindL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
1.5558 + inline TInt FindReverseL(const T& anEntry) const;
1.5559 + inline TInt FindReverseL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
1.5560 + inline TInt FindInSignedKeyOrderL(const T& anEntry) const;
1.5561 + inline TInt FindInUnsignedKeyOrderL(const T& anEntry) const;
1.5562 + inline TInt FindInOrderL(const T& anEntry, TLinearOrder<T> anOrder) const;
1.5563 + inline void FindInSignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
1.5564 + inline void FindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
1.5565 + inline void FindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
1.5566 + inline TInt SpecificFindInSignedKeyOrderL(const T& anEntry, TInt aMode) const;
1.5567 + inline TInt SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt aMode) const;
1.5568 + inline TInt SpecificFindInOrderL(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
1.5569 + inline void SpecificFindInSignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
1.5570 + inline void SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
1.5571 + inline void SpecificFindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
1.5572 + inline void InsertInSignedKeyOrderL(const T& anEntry);
1.5573 + inline void InsertInUnsignedKeyOrderL(const T& anEntry);
1.5574 + inline void InsertInOrderL(const T& anEntry, TLinearOrder<T> anOrder);
1.5575 + inline void InsertInSignedKeyOrderAllowRepeatsL(const T& anEntry);
1.5576 + inline void InsertInUnsignedKeyOrderAllowRepeatsL(const T& anEntry);
1.5577 + inline void InsertInOrderAllowRepeatsL(const T& anEntry, TLinearOrder<T> anOrder);
1.5578 +
1.5579 + inline void GranularCompress();
1.5580 + inline TInt Reserve(TInt aCount);
1.5581 + inline void ReserveL(TInt aCount);
1.5582 + inline void SortSigned();
1.5583 + inline void SortUnsigned();
1.5584 + inline void Sort(TLinearOrder<T> anOrder);
1.5585 + inline TArray<T> Array() const;
1.5586 +#endif
1.5587 + };
1.5588 +
1.5589 +
1.5590 +
1.5591 +
1.5592 +/**
1.5593 +@publishedAll
1.5594 +@released
1.5595 +
1.5596 +A simple and efficient specialized array of signed integers offering standard
1.5597 +array behaviour.
1.5598 +
1.5599 +Note that derivation from RPointerArrayBase is private.
1.5600 +*/
1.5601 +TEMPLATE_SPECIALIZATION class RArray<TInt> : private RPointerArrayBase
1.5602 + {
1.5603 +public:
1.5604 + inline RArray();
1.5605 + inline explicit RArray(TInt aGranularity);
1.5606 + inline RArray(TInt aMinGrowBy, TInt aFactor);
1.5607 + inline void Close();
1.5608 + inline TInt Count() const;
1.5609 + inline const TInt& operator[](TInt anIndex) const;
1.5610 + inline TInt& operator[](TInt anIndex);
1.5611 + inline TInt Append(TInt anEntry);
1.5612 + inline TInt Insert(TInt anEntry, TInt aPos);
1.5613 + inline void Remove(TInt anIndex);
1.5614 + inline void Compress();
1.5615 + inline void Reset();
1.5616 + inline TInt Find(TInt anEntry) const;
1.5617 + inline TInt FindReverse(TInt anEntry) const;
1.5618 + inline TInt FindInOrder(TInt anEntry) const;
1.5619 + inline TInt FindInOrder(TInt anEntry, TInt& anIndex) const;
1.5620 + inline TInt SpecificFindInOrder(TInt anEntry, TInt aMode) const;
1.5621 + inline TInt SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const;
1.5622 + inline TInt InsertInOrder(TInt anEntry);
1.5623 + inline TInt InsertInOrderAllowRepeats(TInt anEntry);
1.5624 +#ifndef __KERNEL_MODE__
1.5625 + inline void AppendL(TInt anEntry);
1.5626 + inline void InsertL(TInt anEntry, TInt aPos);
1.5627 + inline TInt FindL(TInt anEntry) const;
1.5628 + inline TInt FindReverseL(TInt anEntry) const;
1.5629 + inline TInt FindInOrderL(TInt anEntry) const;
1.5630 + inline void FindInOrderL(TInt anEntry, TInt& anIndex) const;
1.5631 + inline TInt SpecificFindInOrderL(TInt anEntry, TInt aMode) const;
1.5632 + inline void SpecificFindInOrderL(TInt anEntry, TInt& anIndex, TInt aMode) const;
1.5633 + inline void InsertInOrderL(TInt anEntry);
1.5634 + inline void InsertInOrderAllowRepeatsL(TInt anEntry);
1.5635 +
1.5636 + inline RArray(TInt* aEntries, TInt aCount);
1.5637 + inline void GranularCompress();
1.5638 + inline TInt Reserve(TInt aCount);
1.5639 + inline void ReserveL(TInt aCount);
1.5640 + inline void Sort();
1.5641 + inline TArray<TInt> Array() const;
1.5642 +#endif
1.5643 + };
1.5644 +
1.5645 +
1.5646 +
1.5647 +
1.5648 +/**
1.5649 +@publishedAll
1.5650 +@released
1.5651 +
1.5652 +Array of unsigned integers.
1.5653 +
1.5654 +The array is a simple and efficient specialized array of unsigned integers
1.5655 +offering standard array behaviour.
1.5656 +
1.5657 +The derivation from RPointerArrayBase is private.
1.5658 +*/
1.5659 +TEMPLATE_SPECIALIZATION class RArray<TUint> : private RPointerArrayBase
1.5660 + {
1.5661 +public:
1.5662 + inline RArray();
1.5663 + inline explicit RArray(TInt aGranularity);
1.5664 + inline RArray(TInt aMinGrowBy, TInt aFactor);
1.5665 + inline void Close();
1.5666 + inline TInt Count() const;
1.5667 + inline const TUint& operator[](TInt anIndex) const;
1.5668 + inline TUint& operator[](TInt anIndex);
1.5669 + inline TInt Append(TUint anEntry);
1.5670 + inline TInt Insert(TUint anEntry, TInt aPos);
1.5671 + inline void Remove(TInt anIndex);
1.5672 + inline void Compress();
1.5673 + inline void Reset();
1.5674 + inline TInt Find(TUint anEntry) const;
1.5675 + inline TInt FindReverse(TUint anEntry) const;
1.5676 + inline TInt FindInOrder(TUint anEntry) const;
1.5677 + inline TInt FindInOrder(TUint anEntry, TInt& anIndex) const;
1.5678 + inline TInt SpecificFindInOrder(TUint anEntry, TInt aMode) const;
1.5679 + inline TInt SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const;
1.5680 + inline TInt InsertInOrder(TUint anEntry);
1.5681 + inline TInt InsertInOrderAllowRepeats(TUint anEntry);
1.5682 +#ifndef __KERNEL_MODE__
1.5683 + inline void AppendL(TUint anEntry);
1.5684 + inline void InsertL(TUint anEntry, TInt aPos);
1.5685 + inline TInt FindL(TUint anEntry) const;
1.5686 + inline TInt FindReverseL(TUint anEntry) const;
1.5687 + inline TInt FindInOrderL(TUint anEntry) const;
1.5688 + inline void FindInOrderL(TUint anEntry, TInt& anIndex) const;
1.5689 + inline TInt SpecificFindInOrderL(TUint anEntry, TInt aMode) const;
1.5690 + inline void SpecificFindInOrderL(TUint anEntry, TInt& anIndex, TInt aMode) const;
1.5691 + inline void InsertInOrderL(TUint anEntry);
1.5692 + inline void InsertInOrderAllowRepeatsL(TUint anEntry);
1.5693 +
1.5694 + inline RArray(TUint* aEntries, TInt aCount);
1.5695 + inline void GranularCompress();
1.5696 + inline TInt Reserve(TInt aCount);
1.5697 + inline void ReserveL(TInt aCount);
1.5698 + inline void Sort();
1.5699 + inline TArray<TUint> Array() const;
1.5700 +#endif
1.5701 + };
1.5702 +
1.5703 +#ifndef __LEAVE_EQUALS_THROW__
1.5704 +
1.5705 +class TTrapHandler;
1.5706 +
1.5707 +/**
1.5708 +@internalComponent
1.5709 +*/
1.5710 +class TTrap
1.5711 + {
1.5712 +public:
1.5713 +#ifndef __KERNEL_MODE__
1.5714 + IMPORT_C TInt Trap(TInt& aResult);
1.5715 + IMPORT_C static void UnTrap();
1.5716 +#endif
1.5717 +public:
1.5718 + enum {EMaxState=0x10};
1.5719 +public:
1.5720 + TInt iState[EMaxState];
1.5721 + TTrap* iNext;
1.5722 + TInt* iResult;
1.5723 + TTrapHandler* iHandler;
1.5724 + };
1.5725 +
1.5726 +
1.5727 +
1.5728 +/**
1.5729 +@publishedAll
1.5730 +@released
1.5731 +
1.5732 +Executes the set of C++ statements _s under a trap harness.
1.5733 +
1.5734 +Use this macro as a C++ statement.
1.5735 +
1.5736 +_r must be a TInt which has already been declared; if any of the
1.5737 +C++ statements _s leaves, then the leave code is returned in _r,
1.5738 +otherwise _r is set to KErrNone.
1.5739 +
1.5740 +_s can consist of multiple C++ statements; in theory, _s can consist
1.5741 +of any legal C++ code but in practice, such statements consist of simple
1.5742 +function calls, e.g. Foo() or an assignment of some value to the result of
1.5743 +a function call, e.g. functionValue=GetFoo().
1.5744 +
1.5745 +A cleanup stack is constructed for the set of C++ statements _s.
1.5746 +If any function in _s leaves, objects pushed to the cleanup stack are
1.5747 +cleaned-up. In addition, if any of the C++ statements in _s leaves,
1.5748 +then remaining C++ code in _s is not executed and any variables which
1.5749 +are assigned within that remaining code are not defined.
1.5750 +
1.5751 +@param _r An lvalue, convertible to TInt&, which will receive the result of
1.5752 + any User::Leave() executed within _s or, if no leave occurred,
1.5753 + it will be set to KErrNone. The value of _r on entry is not used.
1.5754 +
1.5755 +@param _s C++ statements which will be executed under a trap harness.
1.5756 +
1.5757 +@see TRAPD
1.5758 +*/
1.5759 +#define TRAP(_r,_s) {TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
1.5760 +
1.5761 +/**
1.5762 +@publishedAll
1.5763 +@released
1.5764 +
1.5765 +Executes the set of C++ statements _s under a trap harness.
1.5766 +
1.5767 +Use this macro in the same way as you would TRAP, except that the
1.5768 +variable _r is defined as part of the macro (and is therefore valid for the
1.5769 +rest of the block in which the macro occurs). Often, this saves a line of code.
1.5770 +
1.5771 +@param _r A name, which will be declared as a TInt, and will receive the result
1.5772 + of any User::Leave() executed within _s or, if no leave occurred, it
1.5773 + will be set to KErrNone. After the macro, _r remains in scope until
1.5774 + the end of its enclosing block.
1.5775 +
1.5776 +@param _s C++ statements which will be executed under a trap harness.
1.5777 +
1.5778 +@see TRAP
1.5779 +*/
1.5780 +#define TRAPD(_r,_s) TInt _r;{TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
1.5781 +
1.5782 +/**
1.5783 +@publishedAll
1.5784 +@released
1.5785 +
1.5786 +Executes the set of C++ statements _s under a trap harness.
1.5787 +Any leave code generated is ignored.
1.5788 +
1.5789 +Use this macro as a C++ statement.
1.5790 +
1.5791 +This macro is functionally equivalent to:
1.5792 +@code
1.5793 + TInt x;
1.5794 + TRAP(x,_s)
1.5795 +@endcode
1.5796 +or
1.5797 +@code
1.5798 + TRAPD(x,_s)
1.5799 +@endcode
1.5800 +where the value in 'x' is not used by any subsequent code.
1.5801 +
1.5802 +_s can consist of multiple C++ statements; in theory, _s can consist
1.5803 +of any legal C++ code but in practice, such statements consist of simple
1.5804 +function calls, e.g. Foo() or an assignment of some value to the result of
1.5805 +a function call, e.g. functionValue=GetFoo().
1.5806 +
1.5807 +A cleanup stack is constructed for the set of C++ statements _s.
1.5808 +If any function in _s leaves, objects pushed to the cleanup stack are
1.5809 +cleaned-up. In addition, if any of the C++ statements in _s leaves,
1.5810 +then remaining C++ code in _s is not executed and any variables which
1.5811 +are assigned within that remaining code are not defined.
1.5812 +
1.5813 +@param _s C++ statements which will be executed under a trap harness.
1.5814 +
1.5815 +@see TRAPD
1.5816 +@see TRAP
1.5817 +*/
1.5818 +#define TRAP_IGNORE(_s) {TInt _ignore;TTrap __t;if (__t.Trap(_ignore)==0){_s;TTrap::UnTrap();}}
1.5819 +
1.5820 +
1.5821 +#else //__LEAVE_EQUALS_THROW__
1.5822 +
1.5823 +#ifdef __WINS__
1.5824 +/** @internalComponent */
1.5825 +#define __WIN32SEHTRAP TWin32SEHTrap __trap; __trap.Trap();
1.5826 +/** @internalComponent */
1.5827 +#define __WIN32SEHUNTRAP __trap.UnTrap();
1.5828 +IMPORT_C void EmptyFunction();
1.5829 +#define __CALL_EMPTY_FUNCTION EmptyFunction();
1.5830 +#else // !__WINS__
1.5831 +#define __WIN32SEHTRAP
1.5832 +#define __WIN32SEHUNTRAP
1.5833 +#define __CALL_EMPTY_FUNCTION
1.5834 +#endif //__WINS__
1.5835 +
1.5836 +/**
1.5837 +This macro is used by the TRAP and TRAPD macros and provides a means
1.5838 +of inserting code into uses of these.
1.5839 +
1.5840 +This macro is invoked before any 'trapped' code is called, and it should be
1.5841 +redefined to do whatever task is required. E.g. this code:
1.5842 +
1.5843 +@code
1.5844 + #undef TRAP_INSTRUMENTATION_START
1.5845 + #define TRAP_INSTRUMENTATION_START DoMyLoging(__LINE__)
1.5846 +@endcode
1.5847 +
1.5848 +Will cause all subsequent uses of the TRAP macros to behave in an
1.5849 +equivalent way to:
1.5850 +
1.5851 +@code
1.5852 + DoMyLoging(__LINE__)
1.5853 + TRAP(r,SomeCodeL());
1.5854 +@endcode
1.5855 +
1.5856 +
1.5857 +@publishedPartner
1.5858 +@released
1.5859 +
1.5860 +@see TRAP
1.5861 +@see TRAPD
1.5862 +*/
1.5863 +#define TRAP_INSTRUMENTATION_START
1.5864 +
1.5865 +
1.5866 +
1.5867 +/**
1.5868 +This macro is used by the TRAP and TRAPD macros and provides a means
1.5869 +of inserting code into uses of these.
1.5870 +
1.5871 +This macro is invoked if the 'trapped' code did not Leave.
1.5872 +E.g. this code:
1.5873 +
1.5874 +@code
1.5875 + #undef TRAP_INSTRUMENTATION_NOLEAVE
1.5876 + #define TRAP_INSTRUMENTATION_NOLEAVE DoMyLoging(__LINE__)
1.5877 +@endcode
1.5878 +
1.5879 +Will cause all subsequent uses of the TRAP macros to behave in an
1.5880 +equivalent way to:
1.5881 +
1.5882 +@code
1.5883 + TRAP(r,SomeCodeL());
1.5884 + if(r==KErrNone) DoMyLoging(__LINE__);
1.5885 +@endcode
1.5886 +
1.5887 +
1.5888 +@param aLine The line number in the C++ source file where the TRAP or TRAPD
1.5889 + macro was used.
1.5890 +
1.5891 +@publishedPartner
1.5892 +@released
1.5893 +
1.5894 +@see TRAP
1.5895 +@see TRAPD
1.5896 +*/
1.5897 +#define TRAP_INSTRUMENTATION_NOLEAVE
1.5898 +
1.5899 +
1.5900 +/**
1.5901 +This macro is used by the TRAP and TRAPD macros and provides a means
1.5902 +of inserting code into uses of these.
1.5903 +
1.5904 +This macro is invoked if the 'trapped' code did Leave. E.g. this code:
1.5905 +
1.5906 +@code
1.5907 + #undef TRAP_INSTRUMENTATION_LEAVE
1.5908 + #define TRAP_INSTRUMENTATION_LEAVE(aResult) DoMyLoging(aResult,__LINE__)
1.5909 +@endcode
1.5910 +
1.5911 +Will cause all subsequent uses of the TRAP macros to behave in an
1.5912 +equivalent way to:
1.5913 +
1.5914 +@code
1.5915 + TRAP(r,SomeCodeL());
1.5916 + if(r!=KErrNone) DoMyLoging(r,__LINE__);
1.5917 +@endcode
1.5918 +
1.5919 +
1.5920 +@param aResult A reference to the result value used in the TRAP macro.
1.5921 +
1.5922 +
1.5923 +@publishedPartner
1.5924 +@released
1.5925 +
1.5926 +@see TRAP
1.5927 +@see TRAPD
1.5928 +*/
1.5929 +#define TRAP_INSTRUMENTATION_LEAVE(aResult)
1.5930 +
1.5931 +
1.5932 +
1.5933 +/**
1.5934 +This macro is used by the TRAP and TRAPD macros and provides a means
1.5935 +of inserting code into uses of these.
1.5936 +
1.5937 +This macro is invoked after the 'trapped' code is called, regardless of whether
1.5938 +or not it did Leave. It should be redefined to do whatever task is
1.5939 +required. E.g. this code:
1.5940 +
1.5941 +@code
1.5942 + #undef TRAP_INSTRUMENTATION_END
1.5943 + #define TRAP_INSTRUMENTATION_END DoMyLoging(__LINE__)
1.5944 +@endcode
1.5945 +
1.5946 +Will cause all subsequent uses of the TRAP macros to behave in an
1.5947 +equivalent way to:
1.5948 +
1.5949 +@code
1.5950 + TRAP(r,SomeCodeL());
1.5951 + DoMyLoging(__LINE__)
1.5952 +@endcode
1.5953 +
1.5954 +
1.5955 +@publishedPartner
1.5956 +@released
1.5957 +
1.5958 +@see TRAP
1.5959 +@see TRAPD
1.5960 +*/
1.5961 +#define TRAP_INSTRUMENTATION_END
1.5962 +
1.5963 +
1.5964 +
1.5965 +/**
1.5966 +@publishedAll
1.5967 +@released
1.5968 +
1.5969 +Executes the set of C++ statements _s under a trap harness.
1.5970 +
1.5971 +Use this macro as a C++ statement.
1.5972 +
1.5973 +_r must be a TInt which has already been declared; if any of the
1.5974 +C++ statements _s leaves, then the leave code is returned in _r,
1.5975 +otherwise _r is set to KErrNone.
1.5976 +
1.5977 +_s can consist of multiple C++ statements; in theory, _s can consist
1.5978 +of any legal C++ code but in practice, such statements consist of simple
1.5979 +function calls, e.g. Foo() or an assignment of some value to the result of
1.5980 +a function call, e.g. functionValue=GetFoo().
1.5981 +
1.5982 +A cleanup stack is constructed for the set of C++ statements _s.
1.5983 +If any function in _s leaves, objects pushed to the cleanup stack are
1.5984 +cleaned-up. In addition, if any of the C++ statements in _s leaves,
1.5985 +then remaining C++ code in _s is not executed and any variables which
1.5986 +are assigned within that remaining code are not defined.
1.5987 +
1.5988 +@param _r An lvalue, convertible to TInt&, which will receive the result of
1.5989 + any User::Leave() executed within _s or, if no leave occurred,
1.5990 + it will be set to KErrNone. The value of _r on entry is not used.
1.5991 +
1.5992 +@param _s C++ statements which will be executed under a trap harness.
1.5993 +
1.5994 +@see TRAPD
1.5995 +*/
1.5996 +
1.5997 +/*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
1.5998 +workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
1.5999 +trap handler to be invoked when multiple nested TRAP's were present and
1.6000 +User::Leave(..) was called. */
1.6001 +
1.6002 +#define TRAP(_r, _s) \
1.6003 + { \
1.6004 + TInt& __rref = _r; \
1.6005 + __rref = 0; \
1.6006 + { TRAP_INSTRUMENTATION_START; } \
1.6007 + try { \
1.6008 + __WIN32SEHTRAP \
1.6009 + TTrapHandler* ____t = User::MarkCleanupStack(); \
1.6010 + _s; \
1.6011 + User::UnMarkCleanupStack(____t); \
1.6012 + { TRAP_INSTRUMENTATION_NOLEAVE; } \
1.6013 + __WIN32SEHUNTRAP \
1.6014 + } \
1.6015 + catch (XLeaveException& l) \
1.6016 + { \
1.6017 + __rref = l.GetReason(); \
1.6018 + { TRAP_INSTRUMENTATION_LEAVE(__rref); } \
1.6019 + } \
1.6020 + catch (...) \
1.6021 + { \
1.6022 + User::Invariant(); \
1.6023 + } \
1.6024 + __CALL_EMPTY_FUNCTION \
1.6025 + { TRAP_INSTRUMENTATION_END; } \
1.6026 + }
1.6027 +
1.6028 +
1.6029 +/**
1.6030 +@publishedAll
1.6031 +@released
1.6032 +
1.6033 +Executes the set of C++ statements _s under a trap harness.
1.6034 +
1.6035 +Use this macro in the same way as you would TRAP, except that the
1.6036 +variable _r is defined as part of the macro (and is therefore valid for the
1.6037 +rest of the block in which the macro occurs). Often, this saves a line of code.
1.6038 +
1.6039 +@param _r A name, which will be declared as a TInt, and will receive the result
1.6040 + of any User::Leave() executed within _s or, if no leave occurred, it
1.6041 + will be set to KErrNone. After the macro, _r remains in scope until
1.6042 + the end of its enclosing block.
1.6043 +
1.6044 +@param _s C++ statements which will be executed under a trap harness.
1.6045 +
1.6046 +@see TRAP
1.6047 +*/
1.6048 +
1.6049 +/*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
1.6050 +workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
1.6051 +trap handler to be invoked when multiple nested TRAP's were present and
1.6052 +User::Leave(..) was called. */
1.6053 +
1.6054 +
1.6055 +#define TRAPD(_r, _s) \
1.6056 + TInt _r; \
1.6057 + { \
1.6058 + _r = 0; \
1.6059 + { TRAP_INSTRUMENTATION_START; } \
1.6060 + try { \
1.6061 + __WIN32SEHTRAP \
1.6062 + TTrapHandler* ____t = User::MarkCleanupStack(); \
1.6063 + _s; \
1.6064 + User::UnMarkCleanupStack(____t); \
1.6065 + { TRAP_INSTRUMENTATION_NOLEAVE; } \
1.6066 + __WIN32SEHUNTRAP \
1.6067 + } \
1.6068 + catch (XLeaveException& l) \
1.6069 + { \
1.6070 + _r = l.GetReason(); \
1.6071 + { TRAP_INSTRUMENTATION_LEAVE(_r); } \
1.6072 + } \
1.6073 + catch (...) \
1.6074 + { \
1.6075 + User::Invariant(); \
1.6076 + } \
1.6077 + __CALL_EMPTY_FUNCTION \
1.6078 + { TRAP_INSTRUMENTATION_END; } \
1.6079 + }
1.6080 +
1.6081 +/**
1.6082 +@publishedAll
1.6083 +@released
1.6084 +
1.6085 +Executes the set of C++ statements _s under a trap harness.
1.6086 +Any leave code generated is ignored.
1.6087 +
1.6088 +Use this macro as a C++ statement.
1.6089 +
1.6090 +This macro is functionally equivalent to:
1.6091 +@code
1.6092 + TInt x;
1.6093 + TRAP(x,_s)
1.6094 +@endcode
1.6095 +or
1.6096 +@code
1.6097 + TRAPD(x,_s)
1.6098 +@endcode
1.6099 +where the value in 'x' is not used by any subsequent code.
1.6100 +
1.6101 +Use this macro as a C++ statement.
1.6102 +
1.6103 +_s can consist of multiple C++ statements; in theory, _s can consist
1.6104 +of any legal C++ code but in practice, such statements consist of simple
1.6105 +function calls, e.g. Foo() or an assignment of some value to the result of
1.6106 +a function call, e.g. functionValue=GetFoo().
1.6107 +
1.6108 +A cleanup stack is constructed for the set of C++ statements _s.
1.6109 +If any function in _s leaves, objects pushed to the cleanup stack are
1.6110 +cleaned-up. In addition, if any of the C++ statements in _s leaves,
1.6111 +then remaining C++ code in _s is not executed and any variables which
1.6112 +are assigned within that remaining code are not defined.
1.6113 +
1.6114 +@param _s C++ statements which will be executed under a trap harness.
1.6115 +
1.6116 +@see TRAPD
1.6117 +@see TRAP
1.6118 +*/
1.6119 +
1.6120 +/*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
1.6121 +workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
1.6122 +trap handler to be invoked when multiple nested TRAP's were present and
1.6123 +User::Leave(..) was called. */
1.6124 +
1.6125 +#define TRAP_IGNORE(_s) \
1.6126 + { \
1.6127 + { TRAP_INSTRUMENTATION_START; } \
1.6128 + try { \
1.6129 + __WIN32SEHTRAP \
1.6130 + TTrapHandler* ____t = User::MarkCleanupStack(); \
1.6131 + _s; \
1.6132 + User::UnMarkCleanupStack(____t); \
1.6133 + { TRAP_INSTRUMENTATION_NOLEAVE; } \
1.6134 + __WIN32SEHUNTRAP \
1.6135 + } \
1.6136 + catch (XLeaveException& l) \
1.6137 + { \
1.6138 + l.GetReason(); \
1.6139 + { TRAP_INSTRUMENTATION_LEAVE(l.Reason()); } \
1.6140 + } \
1.6141 + catch (...) \
1.6142 + { \
1.6143 + User::Invariant(); \
1.6144 + } \
1.6145 + __CALL_EMPTY_FUNCTION \
1.6146 + { TRAP_INSTRUMENTATION_END; } \
1.6147 + }
1.6148 +
1.6149 +
1.6150 +#endif //__LEAVE_EQUALS_THROW__
1.6151 +
1.6152 +/**
1.6153 +@publishedAll
1.6154 +@released
1.6155 +*/
1.6156 +GLREF_C TAny* operator new(TUint aSize) __NO_THROW;
1.6157 +
1.6158 +/**
1.6159 +@publishedAll
1.6160 +@released
1.6161 +*/
1.6162 +GLREF_C TAny* operator new(TUint aSize,TUint anExtraSize) __NO_THROW;
1.6163 +
1.6164 +/**
1.6165 +@publishedAll
1.6166 +@released
1.6167 +*/
1.6168 +GLREF_C void operator delete(TAny* aPtr) __NO_THROW;
1.6169 +
1.6170 +#ifndef __PLACEMENT_VEC_NEW_INLINE
1.6171 +/**
1.6172 +@publishedAll
1.6173 +@released
1.6174 +*/
1.6175 +GLREF_C TAny* operator new[](TUint aSize) __NO_THROW;
1.6176 +
1.6177 +/**
1.6178 +@publishedAll
1.6179 +@released
1.6180 +*/
1.6181 +GLREF_C void operator delete[](TAny* aPtr) __NO_THROW;
1.6182 +#endif
1.6183 +
1.6184 +/**
1.6185 +@publishedAll
1.6186 +@released
1.6187 +*/
1.6188 +inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
1.6189 +
1.6190 +#ifndef __PLACEMENT_VEC_NEW_INLINE
1.6191 +/**
1.6192 +@publishedAll
1.6193 +@released
1.6194 +*/
1.6195 +inline TAny* operator new[](TUint aSize, TAny* aBase) __NO_THROW;
1.6196 +
1.6197 +#endif // !__PLACEMENT_VEC_NEW_INLINE
1.6198 +
1.6199 +/**
1.6200 +@publishedAll
1.6201 +@released
1.6202 +*/
1.6203 +inline void operator delete(TAny* aPtr, TAny* aBase) __NO_THROW;
1.6204 +
1.6205 +#ifndef __PLACEMENT_VEC_NEW_INLINE
1.6206 +/**
1.6207 +@publishedAll
1.6208 +@released
1.6209 +*/
1.6210 +inline void operator delete[](TAny* aPtr, TAny* aBase) __NO_THROW;
1.6211 +
1.6212 +#endif // !__PLACEMENT_VEC_NEW_INLINE
1.6213 +
1.6214 +#if !defined(__BOOL_NO_TRUE_TRAP__)
1.6215 +
1.6216 +/**
1.6217 +@publishedAll
1.6218 +@released
1.6219 +*/
1.6220 +TBool operator==(TTrue,volatile const TBool);
1.6221 +
1.6222 +/**
1.6223 +@publishedAll
1.6224 +@released
1.6225 +*/
1.6226 +TBool operator==(volatile const TBool,TTrue);
1.6227 +
1.6228 +/**
1.6229 +@publishedAll
1.6230 +@released
1.6231 +*/
1.6232 +TBool operator!=(TTrue,volatile const TBool);
1.6233 +
1.6234 +/**
1.6235 +@publishedAll
1.6236 +@released
1.6237 +*/
1.6238 +TBool operator!=(volatile const TBool,TTrue);
1.6239 +#endif
1.6240 +
1.6241 +
1.6242 +
1.6243 +
1.6244 +/**
1.6245 +@publishedAll
1.6246 +@released
1.6247 +
1.6248 +A Version 2 client/server class that clients use to package
1.6249 +the arguments to be sent to a server.
1.6250 +
1.6251 +The object can package up to 4 arguments together with information about each
1.6252 +argument's type, width and accessibility; it is also possible for
1.6253 +the package to contain zero arguments. In addition to the default constructor,
1.6254 +the class has four templated constructors, allowing an object of this type to
1.6255 +be constructed for 0, 1, 2, 3 or 4 arguments.
1.6256 +
1.6257 +Internally, the arguments are stored in a simple TInt array.
1.6258 +Consecutive arguments in a constructor's parameter list are put into
1.6259 +consecutive slots in the array. The Set() overloaded functions can be used
1.6260 +to set argument values into specific slots within this array.
1.6261 +*/
1.6262 +class TIpcArgs
1.6263 + {
1.6264 +public:
1.6265 + /**
1.6266 + @internalComponent
1.6267 +
1.6268 + Argument types; some of these may be ORed together to specify
1.6269 + type, accessibility, and width.
1.6270 + */
1.6271 + enum TArgType
1.6272 + {
1.6273 + EUnspecified = 0, /**< Type not specified.*/
1.6274 + EHandle = 1, /**< Handle type.*/
1.6275 + EFlagDes = 4, /**< Descriptor type.*/
1.6276 + EFlagConst = 2, /**< Read only type.*/
1.6277 + EFlag16Bit = 1, /**< 16 bit rather than 8 bit.*/
1.6278 + EDes8 = EFlagDes, /**< 8 bit read/write descriptor.*/
1.6279 + EDes16 = EFlagDes|EFlag16Bit, /**< 16 bit read/write descriptor.*/
1.6280 + EDesC8 = EFlagDes|EFlagConst, /**< 8 bit read only descriptor.*/
1.6281 + EDesC16 = EFlagDes|EFlagConst|EFlag16Bit, /**< 16 bit read only descriptor.*/
1.6282 + };
1.6283 +
1.6284 +
1.6285 + /**
1.6286 + @internalComponent
1.6287 +
1.6288 + Bit width of type information.
1.6289 + */
1.6290 + enum {
1.6291 + KBitsPerType=3 /** Number of bits of type information used for each of the 4 arguments. */
1.6292 + };
1.6293 +
1.6294 +
1.6295 + /**
1.6296 + Indicates a Null argument.
1.6297 + */
1.6298 + enum TNothing {
1.6299 + /**
1.6300 + An enum value that can be used to indicate an empty or
1.6301 + unused argument to a server. For example:
1.6302 +
1.6303 + @code
1.6304 + TIpcArgs args(arg1, TIpcArgs::ENothing, arg2);
1.6305 + @endcode
1.6306 +
1.6307 + This argument will have an undefined value when the server
1.6308 + receives the message.
1.6309 + */
1.6310 + ENothing
1.6311 + };
1.6312 +public:
1.6313 + /**
1.6314 + Default constructor.
1.6315 +
1.6316 + An argument package constructed using this constructor has no arguments;
1.6317 + however, arguments can subsequently be set into this argument package object
1.6318 + using the Set() member functions.
1.6319 + */
1.6320 + inline TIpcArgs()
1.6321 + :iFlags(0)
1.6322 + {}
1.6323 +
1.6324 +
1.6325 + /**
1.6326 + A templated constructor that constructs the argument package; it takes
1.6327 + 1 argument.
1.6328 +
1.6329 + @param a0 An argument of general class type T0 to be contained by
1.6330 + this object.
1.6331 + */
1.6332 + template <class T0>
1.6333 + inline explicit TIpcArgs(T0 a0)
1.6334 + {
1.6335 + Assign(iArgs[0],a0);
1.6336 + iFlags=(Type(a0)<<(0*KBitsPerType));
1.6337 + }
1.6338 +
1.6339 +
1.6340 + /**
1.6341 + A templated constructor that constructs the argument package; it takes
1.6342 + 2 arguments.
1.6343 +
1.6344 + @param a0 An argument of general class type T0 to be contained by
1.6345 + this object.
1.6346 + @param a1 An argument of general class type T1 to be contained by
1.6347 + this object.
1.6348 + */
1.6349 + template <class T0,class T1>
1.6350 + inline TIpcArgs(T0 a0,T1 a1)
1.6351 + {
1.6352 + Assign(iArgs[0],a0);
1.6353 + Assign(iArgs[1],a1);
1.6354 + iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType));
1.6355 + }
1.6356 +
1.6357 +
1.6358 + /**
1.6359 + A templated constructor that constructs the argument package; it takes
1.6360 + 3 arguments.
1.6361 +
1.6362 + @param a0 An argument of general class type T0 to be contained by
1.6363 + this object.
1.6364 + @param a1 An argument of general class type T1 to be contained by
1.6365 + this object.
1.6366 + @param a2 An argument of general class type T2 to be contained by
1.6367 + this object.
1.6368 + */
1.6369 + template <class T0,class T1,class T2>
1.6370 + inline TIpcArgs(T0 a0,T1 a1,T2 a2)
1.6371 + {
1.6372 + Assign(iArgs[0],a0);
1.6373 + Assign(iArgs[1],a1);
1.6374 + Assign(iArgs[2],a2);
1.6375 + iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType));
1.6376 + }
1.6377 +
1.6378 +
1.6379 + /**
1.6380 + A templated constructor that constructs the argument package; it takes
1.6381 + 4 arguments.
1.6382 +
1.6383 + @param a0 An argument of general class type T0 to be contained by
1.6384 + this object.
1.6385 + @param a1 An argument of general class type T1 to be contained by
1.6386 + this object.
1.6387 + @param a2 An argument of general class type T2 to be contained by
1.6388 + this object.
1.6389 + @param a3 An argument of general class type T3 to be contained by
1.6390 + this object.
1.6391 + */
1.6392 + template <class T0,class T1,class T2,class T3>
1.6393 + inline TIpcArgs(T0 a0,T1 a1,T2 a2,T3 a3)
1.6394 + {
1.6395 + Assign(iArgs[0],a0);
1.6396 + Assign(iArgs[1],a1);
1.6397 + Assign(iArgs[2],a2);
1.6398 + Assign(iArgs[3],a3);
1.6399 + iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType))|(Type(a3)<<(3*KBitsPerType));
1.6400 + }
1.6401 + //
1.6402 + inline void Set(TInt aIndex,TNothing);
1.6403 + inline void Set(TInt aIndex,TInt aValue);
1.6404 + inline void Set(TInt aIndex,const TAny* aValue);
1.6405 + inline void Set(TInt aIndex,RHandleBase aValue);
1.6406 + inline void Set(TInt aIndex,const TDesC8* aValue);
1.6407 +#ifndef __KERNEL_MODE__
1.6408 + inline void Set(TInt aIndex,const TDesC16* aValue);
1.6409 +#endif
1.6410 + inline void Set(TInt aIndex,TDes8* aValue);
1.6411 +#ifndef __KERNEL_MODE__
1.6412 + inline void Set(TInt aIndex,TDes16* aValue);
1.6413 +#endif
1.6414 +private:
1.6415 + inline static TArgType Type(TNothing);
1.6416 + inline static TArgType Type(TInt);
1.6417 + inline static TArgType Type(const TAny*);
1.6418 + inline static TArgType Type(RHandleBase aValue);
1.6419 + inline static TArgType Type(const TDesC8*);
1.6420 +#ifndef __KERNEL_MODE__
1.6421 + inline static TArgType Type(const TDesC16*);
1.6422 +#endif
1.6423 + inline static TArgType Type(TDes8*);
1.6424 +#ifndef __KERNEL_MODE__
1.6425 + inline static TArgType Type(TDes16*);
1.6426 +#endif
1.6427 + //
1.6428 + inline static void Assign(TInt&,TNothing);
1.6429 + inline static void Assign(TInt& aArg,TInt aValue);
1.6430 + inline static void Assign(TInt& aArg,const TAny* aValue);
1.6431 + inline static void Assign(TInt& aArg,RHandleBase aValue);
1.6432 + inline static void Assign(TInt& aArg,const TDesC8* aValue);
1.6433 +#ifndef __KERNEL_MODE__
1.6434 + inline static void Assign(TInt& aArg,const TDesC16* aValue);
1.6435 +#endif
1.6436 + inline static void Assign(TInt& aArg,TDes8* aValue);
1.6437 +#ifndef __KERNEL_MODE__
1.6438 + inline static void Assign(TInt& aArg,TDes16* aValue);
1.6439 +#endif
1.6440 +public:
1.6441 +
1.6442 + /**
1.6443 + The location where the message arguments are stored.
1.6444 +
1.6445 + There is no reason to access this data member directly and it should be
1.6446 + considered as internal.
1.6447 + */
1.6448 + TInt iArgs[KMaxMessageArguments];
1.6449 +
1.6450 + /**
1.6451 + The location where the flag bits describing the argument types are stored.
1.6452 +
1.6453 + The symbolic values describing the argument types are internal to Symbian,
1.6454 + and there is therefore no reason to access this data member directly.
1.6455 + It should be considered as internal.
1.6456 + */
1.6457 + TInt iFlags;
1.6458 + };
1.6459 +
1.6460 +// Structures for passing 64 bit integers and doubles across GCC/EABI boundaries
1.6461 +
1.6462 +/**
1.6463 +@internalComponent
1.6464 +*/
1.6465 +struct SInt64
1.6466 + {
1.6467 +public:
1.6468 + inline SInt64();
1.6469 + inline SInt64(Int64 a);
1.6470 + inline SInt64& operator=(Int64 a);
1.6471 + inline operator Int64() const;
1.6472 +public:
1.6473 + TUint32 iData[2]; // little endian
1.6474 + };
1.6475 +
1.6476 +/**
1.6477 +@internalComponent
1.6478 +*/
1.6479 +struct SUint64
1.6480 + {
1.6481 +public:
1.6482 + inline SUint64();
1.6483 + inline SUint64(Uint64 a);
1.6484 + inline SUint64& operator=(Uint64 a);
1.6485 + inline operator Uint64() const;
1.6486 +public:
1.6487 + TUint32 iData[2]; // little endian
1.6488 + };
1.6489 +
1.6490 +/**
1.6491 +@internalComponent
1.6492 +*/
1.6493 +struct SDouble
1.6494 + {
1.6495 +public:
1.6496 + inline SDouble();
1.6497 + inline SDouble(TReal a);
1.6498 + inline SDouble& operator=(TReal a);
1.6499 + inline operator TReal() const;
1.6500 +public:
1.6501 + TUint32 iData[2]; // always little endian
1.6502 + };
1.6503 +
1.6504 +/**
1.6505 +@publishedAll
1.6506 +@released
1.6507 +
1.6508 +Stores information about a thread's stack.
1.6509 +
1.6510 +Note, on the emulator, the memory between iLimit and the thread's current stack pointer
1.6511 +may not actually be committed.
1.6512 +
1.6513 +@see RThread::StackInfo()
1.6514 +*/
1.6515 +class TThreadStackInfo
1.6516 + {
1.6517 +public:
1.6518 + /**
1.6519 + The address which the stack pointer would contain if the stack were empty.
1.6520 + */
1.6521 + TLinAddr iBase;
1.6522 +
1.6523 + /**
1.6524 + The address which the stack pointer would contain if the stack were full,
1.6525 + (The lowest valid address).
1.6526 + */
1.6527 + TLinAddr iLimit;
1.6528 +
1.6529 + /**
1.6530 + The limit value for the stack if it were expanded to its maximum size.
1.6531 +
1.6532 + Currently expanding stacks is not supported so iExpandLimit==iLimit
1.6533 + */
1.6534 + TLinAddr iExpandLimit;
1.6535 + };
1.6536 +
1.6537 +
1.6538 +
1.6539 +
1.6540 +#ifdef __SUPPORT_CPP_EXCEPTIONS__
1.6541 +/**
1.6542 +@internalComponent
1.6543 +@released
1.6544 +
1.6545 +The class used to implement User::Leave in term of throw and TRAP in terms of catch.
1.6546 +
1.6547 +*/
1.6548 +class XLeaveException
1.6549 + {
1.6550 +public:
1.6551 + inline XLeaveException() {}
1.6552 + inline XLeaveException(TInt aReason) {iR = aReason;}
1.6553 + inline TInt Reason() const {return iR;}
1.6554 + IMPORT_C TInt GetReason() const;
1.6555 +private:
1.6556 +#if __ARMCC_VERSION >= 220000
1.6557 + // From rvct 2.2 onwards we want the class impedimenta to be shared, so create a key function.
1.6558 + // Unfortunately we can't make this the key function the dtor since this would make it impossible for existing 2.1
1.6559 + // derived binaries to be 'BC' with 2.2 binaries (in the general case (which I wont attempt to describe coz its
1.6560 + // 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
1.6561 + // for catch handlers to work :-( (see the old code).
1.6562 + virtual void ForceKeyFunction();
1.6563 +#endif
1.6564 +private:
1.6565 +#if __ARMCC_VERSION < 220000
1.6566 + TAny* iVtable; // reserve space for vtable
1.6567 +#endif
1.6568 + TInt iR;
1.6569 + };
1.6570 +
1.6571 +// The standard header file <exception> defines the following guard macro for EDG and CW, VC++, GCC respectively.
1.6572 +// The guard below is ugly. It will surely come back and bite us unless we resolve the whole issue of standard headers
1.6573 +// when we move to supporting Standard C++.
1.6574 +#if !defined(_EXCEPTION) && !defined(_EXCEPTION_) && !defined(__EXCEPTION__)
1.6575 +// Declare standard C++ functions relating to exceptions here
1.6576 +namespace std {
1.6577 + bool uncaught_exception(void);
1.6578 + void terminate(void);
1.6579 + void unexpected(void);
1.6580 + typedef void (*terminate_handler)();
1.6581 + terminate_handler set_terminate(terminate_handler h) throw();
1.6582 + typedef void (*unexpected_handler)();
1.6583 + unexpected_handler set_unexpected(unexpected_handler h) throw();
1.6584 +}
1.6585 +
1.6586 +#endif
1.6587 +#endif //__SUPPORT_CPP_EXCEPTIONS__
1.6588 +
1.6589 +#ifdef __WINS__
1.6590 +
1.6591 +#ifndef __WIN32_SEH_TYPES_KNOWN__
1.6592 +class __UnknownWindowsType1;
1.6593 +class __UnknownWindowsType2;
1.6594 +#endif
1.6595 +
1.6596 +class TWin32SEHTrap;
1.6597 +
1.6598 +/**
1.6599 + * Typedef for the SEH handler function
1.6600 + * @internalComponent
1.6601 + */
1.6602 +typedef TUint32 (TWin32SEHExceptionHandler)(__UnknownWindowsType1* aExceptionRecord, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
1.6603 +
1.6604 +/**
1.6605 + * @internalComponent
1.6606 + */
1.6607 +class TWin32SEHTrap
1.6608 + {
1.6609 +private:
1.6610 + // Prevent copy/assign
1.6611 + TWin32SEHTrap(TWin32SEHTrap const &);
1.6612 + TWin32SEHTrap& operator=(TWin32SEHTrap const &);
1.6613 +
1.6614 +#ifdef __KERNEL_MODE__
1.6615 +//
1.6616 +// Kernel-side functions for nkern exception handler
1.6617 +//
1.6618 +public:
1.6619 + /** Find final exception handler in SEH chain */
1.6620 + static TWin32SEHTrap* IterateForFinal();
1.6621 +
1.6622 + /** Access exception handler */
1.6623 + TWin32SEHExceptionHandler* ExceptionHandler();
1.6624 +
1.6625 +private:
1.6626 +
1.6627 +#else // !__KERNEL_MODE__
1.6628 +//
1.6629 +// User-side functions for use in TRAP(...)
1.6630 +//
1.6631 +public:
1.6632 + UIMPORT_C TWin32SEHTrap();
1.6633 +
1.6634 +public:
1.6635 + /** Add object to SEH chain */
1.6636 + UIMPORT_C void Trap();
1.6637 +
1.6638 + /** Remove object from SEH chain */
1.6639 + UIMPORT_C void UnTrap();
1.6640 +
1.6641 +#ifndef __IN_SEH_CPP__
1.6642 +private:
1.6643 +#endif
1.6644 + /** Handle Win32 exceptions */
1.6645 + static TUint32 ExceptionHandler(__UnknownWindowsType1* aException, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
1.6646 +
1.6647 +#endif //__KERNEL_MODE__
1.6648 +
1.6649 + //
1.6650 + // NB: This is really an _EXCEPTION_REGISTRATION_RECORD
1.6651 + //
1.6652 + TWin32SEHTrap* iPrevExceptionRegistrationRecord; /** Link to previous SEH record */
1.6653 + TWin32SEHExceptionHandler* iExceptionHandler; /** SEH handler function */
1.6654 +
1.6655 +private:
1.6656 + TUint32 iPadding[254]; // discourage the compiler from putting this in reused function parameter space
1.6657 + };
1.6658 +
1.6659 +#else // !__WINS__
1.6660 +
1.6661 +#ifdef __X86__
1.6662 +/**
1.6663 + * @internalComponent
1.6664 + */
1.6665 +class TWin32SEHTrap
1.6666 + {
1.6667 +public:
1.6668 + UIMPORT_C TWin32SEHTrap();
1.6669 + UIMPORT_C void Trap();
1.6670 + UIMPORT_C void UnTrap();
1.6671 + };
1.6672 +#endif //__X86__
1.6673 +#endif //__WINS__
1.6674 +
1.6675 +#include <e32cmn.inl>
1.6676 +
1.6677 +#endif //__E32CMN_H__