williamr@2: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // e32\include\e32std.inl williamr@2: // williamr@2: // williamr@2: williamr@2: // Global leaving operator new williamr@2: inline TAny* operator new(TUint aSize, TLeave) williamr@2: {return User::AllocL(aSize);} williamr@2: inline TAny* operator new(TUint aSize, TLeave, TUint aExtraSize) williamr@2: {return User::AllocL(aSize + aExtraSize);} williamr@2: #if !defined(__VC32__) || defined (__MSVCDOTNET__) williamr@2: inline TAny* operator new[](TUint aSize, TLeave) williamr@2: {return User::AllocL(aSize);} williamr@2: #endif williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // class Mem williamr@2: inline TUint8* Mem::Copy(TAny* aTrg, const TAny* aSrc, TInt aLength) williamr@2: /** williamr@2: Copies data from a source location to a target location and returns a pointer williamr@2: to the end of the copied data. williamr@2: williamr@2: The source and target areas can overlap. williamr@2: williamr@2: The copy operation is optimised so that if both source and target locations williamr@2: are aligned on a word boundary, the operation performs the copy on a word williamr@2: by word basis. williamr@2: williamr@2: @param aTrg A pointer to the target location for the copy operation. williamr@2: @param aSrc A pointer to the source location for the copy operation. williamr@2: @param aLength The number of bytes to be copied. This value must not williamr@2: be negative. williamr@2: williamr@2: @return A pointer to a location aLength bytes beyond aTrg (i.e. the location williamr@2: aTrg+aLength). williamr@2: williamr@2: @panic USER 90 In debug builds only, if aLength is negative. williamr@2: */ williamr@2: { return (TUint8*)memmove(aTrg, aSrc, aLength) + aLength; } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TUint8* Mem::Move(TAny* aTrg, const TAny* aSrc, TInt aLength) williamr@2: /** williamr@2: Moves a block of data from a source location to a target location and returns williamr@2: a pointer to the end of the moved data. williamr@2: williamr@2: The source and target areas can overlap. williamr@2: williamr@2: Both source and target locations must be aligned on a word boundary. williamr@2: The specified length must also be a multiple of 4. williamr@2: williamr@2: @param aTrg A pointer to the target location for the move operation. This williamr@2: pointer must be word aligned. williamr@2: @param aSrc A pointer to the source location for the move operation. This williamr@2: pointer must be word aligned. williamr@2: @param aLength The number of bytes to be copied. This value must be a multiple williamr@2: of 4. williamr@2: williamr@2: @return A pointer to a location aLength bytes beyond aTrg (i.e. the location williamr@2: aTrg+aLength). williamr@2: williamr@2: @panic USER 93 In debug builds only, if aTrg is not word aligned. williamr@2: @panic USER 92 In debug builds only, if aSrc is not word aligned. williamr@2: @panic USER 91 In debug builds only, if aLength is not a multiple of 4. williamr@2: */ williamr@2: { return (TUint8*)wordmove(aTrg, aSrc, aLength) + aLength; } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline void Mem::Fill(TAny* aTrg, TInt aLength, TChar aChar) williamr@2: /** williamr@2: Fills a specified block of data with a specified character, replacing williamr@2: any existing content. williamr@2: williamr@2: The function assumes that the fill character is a non-Unicode character. williamr@2: williamr@2: @param aTrg A pointer to the location where filling is to start. williamr@2: @param aLength The number of bytes to be filled. This value must not williamr@2: be negative. williamr@2: @param aChar The fill character. williamr@2: williamr@2: @panic USER 95 In debug builds only, if aLength is negative. williamr@2: */ williamr@2: { memset(aTrg, (TInt)(aChar.operator TUint()), aLength); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline void Mem::FillZ(TAny* aTrg,TInt aLength) williamr@2: /** williamr@2: Fills a specified block of data with binary zeroes (i.e. 0x00), replacing any williamr@2: existing content. williamr@2: williamr@2: @param aTrg A pointer to the location where filling is to start. williamr@2: @param aLength The number of bytes to be filled. This value must not williamr@2: be negative. williamr@2: williamr@2: @panic USER 95 In debug builds only, if aLength is negative. williamr@2: */ williamr@2: { memclr(aTrg, aLength); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __GCC32__ williamr@2: inline TInt Mem::Compare(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL) williamr@2: /** williamr@2: Compares a block of data at one specified location with a block of data at williamr@2: another specified location. williamr@2: williamr@2: The comparison proceeds on a byte for byte basis, the result of the comparison williamr@2: is based on the difference of the first bytes to disagree. williamr@2: williamr@2: The data at the two locations are equal if they have the same length and content. williamr@2: Where the lengths are different and the shorter section of data is the same williamr@2: as the first part of the longer section of data, the shorter is considered williamr@2: to be less than the longer. williamr@2: williamr@2: @param aLeft A pointer to the first (or left) block of 8 bit data williamr@2: to be compared. williamr@2: @param aLeftL The length of the first (or left) block of data to be compared, williamr@2: i.e. the number of bytes. williamr@2: @param aRight A pointer to the second (or right) block of 8 bit data to be williamr@2: compared. williamr@2: @param aRightL The length of the second (or right) block of data to be compared williamr@2: i.e. the number of bytes. williamr@2: williamr@2: @return Positive, if the first (or left) block of data is greater than the williamr@2: second (or right) block of data. williamr@2: Negative, if the first (or left) block of data is less than the williamr@2: second (or right) block of data. williamr@2: Zero, if both the first (or left) and second (or right) blocks of data williamr@2: have the same length and the same content. williamr@2: */ williamr@2: { return memcompare(aLeft, aLeftL, aRight, aRightL); } williamr@2: #endif williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // class RHeap williamr@2: inline TInt RHeap::SetBrk(TInt aBrk) williamr@2: { return ((RChunk*)&iChunkHandle)->Adjust(aBrk); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // class TChar williamr@2: #ifndef __KERNEL_MODE__ williamr@2: inline void TChar::SetChar(TUint aChar) williamr@2: {iChar=aChar;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline void TChar::Fold() williamr@2: /** williamr@2: Converts the character to a form which can be used in tolerant comparisons williamr@2: without control over the operations performed. williamr@2: williamr@2: Tolerant comparisons are those which ignore character differences like case williamr@2: and accents. williamr@2: williamr@2: This function can be used when searching for a string in a text file or a williamr@2: file in a directory. Folding performs the following conversions: converts williamr@2: to lowercase, strips accents, converts all digits representing the values williamr@2: 0..9 to the ordinary digit characters '0'..'9', converts all spaces (standard, williamr@2: non-break, fixed-width, ideographic, etc.) to the ordinary space character williamr@2: (0x0020), converts Japanese characters in the hiragana syllabary to katakana, williamr@2: and converts East Asian halfwidth and fullwidth variants to their ordinary williamr@2: forms. You can choose to perform any subset of these operations by using the williamr@2: other function overload. williamr@2: williamr@2: @see User::Fold williamr@2: */ williamr@2: {iChar=User::Fold(iChar);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline void TChar::LowerCase() williamr@2: /** williamr@2: Converts the character to its lowercase form. williamr@2: williamr@2: Characters lacking a lowercase form are unchanged. williamr@2: williamr@2: @see User::LowerCase williamr@2: */ williamr@2: {iChar=User::LowerCase(iChar);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline void TChar::UpperCase() williamr@2: /** williamr@2: Converts the character to its uppercase form. williamr@2: williamr@2: Characters lacking an uppercase form are unchanged. williamr@2: williamr@2: @see User::UpperCase williamr@2: */ williamr@2: {iChar=User::UpperCase(iChar);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifdef _UNICODE williamr@2: inline void TChar::Fold(TInt aFlags) williamr@2: /** williamr@2: Converts the character to a form which can be used in tolerant comparisons williamr@2: allowing selection of the specific fold operations to be performed. williamr@2: williamr@2: @param aFlags Flags which define the operations to be performed. The values williamr@2: are defined in the enum beginning with EFoldCase. williamr@2: williamr@2: @see TChar::EFoldCase williamr@2: @see User::Fold williamr@2: */ williamr@2: {iChar=User::Fold(iChar,aFlags);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline void TChar::TitleCase() williamr@2: /** williamr@2: Converts the character to its titlecase form. williamr@2: williamr@2: The titlecase form of a character is identical to its uppercase form unless williamr@2: a specific titlecase form exists. Characters lacking a titlecase form are williamr@2: unchanged. williamr@2: */ williamr@2: {iChar=User::TitleCase(iChar);} williamr@2: #endif williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TChar::Eos() const williamr@2: /** williamr@2: Tests whether the character is the C/C++ end-of-string character - 0. williamr@2: williamr@2: @return True, if the character is 0; false, otherwise. williamr@2: */ williamr@2: {return(iChar==0);} williamr@2: #endif // _UNICODE williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TCallBack williamr@2: inline TCallBack::TCallBack() williamr@2: /** williamr@2: Default constructor. williamr@2: williamr@2: Sets the function pointer to Null. williamr@2: */ williamr@2: {iFunction=NULL;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCallBack::TCallBack(TInt (*aFunction)(TAny *aPtr)) williamr@2: : iFunction(aFunction),iPtr(NULL) williamr@2: /** williamr@2: Constructs the callback object with the specified callback function. williamr@2: williamr@2: @param aFunction A pointer to the callback function. It takes an argument of williamr@2: type TAny* and returns a TInt. williamr@2: It must be either a static member of a class or a function williamr@2: which is not a member of any class. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCallBack::TCallBack(TInt (*aFunction)(TAny *aPtr),TAny *aPtr) williamr@2: : iFunction(aFunction),iPtr(aPtr) williamr@2: /** williamr@2: Constructs the callback object with the specified callback function and williamr@2: a pointer to any object. williamr@2: williamr@2: @param aFunction A pointer to the callback function. It takes an argument of williamr@2: type TAny* and returns a TInt. williamr@2: It must be either a static member of a class or a function williamr@2: which is not a member of any class. williamr@2: @param aPtr A pointer which is always passed to the callback function. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Calls the callback function. williamr@2: williamr@2: @return The value returned by the callback function. The meaning of this value williamr@2: depends entirely on the context in which the callback function williamr@2: is called. williamr@2: For example, when used with the CIdle class, a false (zero) value williamr@2: indicates that the callback function should not be called again. williamr@2: As another example, when used with the CPeriodic class, the return williamr@2: value is ignored and is irrelevant in that context. williamr@2: williamr@2: @see CIdle williamr@2: @see CPeriodic williamr@2: */ williamr@2: inline TInt TCallBack::CallBack() const williamr@2: { return (iFunction ? (*iFunction)(iPtr) : 0); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TSglQue williamr@2: template williamr@2: inline TSglQue::TSglQue() williamr@2: /** williamr@2: Constructs an empty list header and sets the offset value of the link object williamr@2: to zero. williamr@2: williamr@2: In practice, never assume that the offset of the link object from the start williamr@2: of a list element is zero, even if the link object is declared as the first williamr@2: data member in the list element class. williamr@2: williamr@2: If this default constructor is used, then call the SetOffset() function of williamr@2: the base class to ensure that the offset value is set correctly. williamr@2: williamr@2: @see TSglQueBase::SetOffset williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TSglQue::TSglQue(TInt aOffset) williamr@2: : TSglQueBase(aOffset) williamr@2: /** williamr@2: Constructs an empty list header and sets the offset of the link object to the williamr@2: specified value. williamr@2: williamr@2: @param aOffset The offset of the link object from the start of a list element. williamr@2: The macro _FOFF can be used to calculate this value. williamr@2: williamr@2: @panic USER 75, if aOffset is not divisible by four. williamr@2: williamr@2: @see _FOFF williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TSglQue::AddFirst(T &aRef) williamr@2: /** williamr@2: Inserts the specified list element at the front of the singly linked list. williamr@2: williamr@2: If the list is not empty, the specified element becomes the first in the list. williamr@2: What was previously the first element becomes the second in the list. williamr@2: williamr@2: @param aRef The list element to be inserted at the front of the singly linked williamr@2: list. williamr@2: */ williamr@2: {DoAddFirst(&aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TSglQue::AddLast(T &aRef) williamr@2: /** williamr@2: Inserts the specified list element at the back of the singly linked list. williamr@2: williamr@2: If the list is not empty, the specified element becomes the last in the list. williamr@2: What was previously the last element becomes the next to last element in the williamr@2: list. williamr@2: williamr@2: @param aRef The list element to be inserted at the back of the singly linked williamr@2: list. williamr@2: */ williamr@2: {DoAddLast(&aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TSglQue::IsFirst(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the specified element is the first in the singly linked list. williamr@2: williamr@2: @param aPtr A pointer to the element whose position in the list is to be williamr@2: checked. williamr@2: williamr@2: @return True, if the element is the first in the list; false, otherwise. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)iHead);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TSglQue::IsLast(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the specified element is the last in the singly linked list. williamr@2: williamr@2: @param aPtr A pointer to the element whose position in the list is williamr@2: to be checked. williamr@2: williamr@2: @return True, if the element is the last in the list; false, otherwise. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)iLast);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TSglQue::First() const williamr@2: /** williamr@2: Gets a pointer to the first list element in the singly linked list. williamr@2: williamr@2: @return A pointer to the first list element in the singly linked list. If williamr@2: the list is empty, this pointer is not necessarily NULL and must not williamr@2: be assumed to point to a valid object. williamr@2: */ williamr@2: {return(PtrSub((T *)iHead,iOffset));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TSglQue::Last() const williamr@2: /** williamr@2: Gets a pointer to the last list element in the singly linked list. williamr@2: williamr@2: @return A pointer to the last list element in the singly linked list. If the williamr@2: list is empty, this pointer is not necessarily NULL and must not be williamr@2: assumed to point to a valid object. williamr@2: */ williamr@2: {return(PtrSub((T *)iLast,iOffset));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TSglQue::Remove(T &aRef) williamr@2: /** williamr@2: Removes the specified element from the singly linked list. williamr@2: williamr@2: The singly linked list must not be empty. williamr@2: williamr@2: @param aRef A list element to be removed from the singly linked list. williamr@2: williamr@2: @panic USER 76, if the element to be removed is not in the list williamr@2: */ williamr@2: {DoRemove(&aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TDblQue williamr@2: template williamr@2: inline TDblQue::TDblQue() williamr@2: /** williamr@2: Constructs an empty list header and sets the offset value of the link object williamr@2: to zero. williamr@2: williamr@2: In practice, never assume that the offset of the link object from the start williamr@2: of a list element is zero, even if the link object is declared as the first williamr@2: data member in the list element class. williamr@2: williamr@2: If this default constructor is used, then call the SetOffset() function of williamr@2: the base class to ensure that the offset value is set correctly. williamr@2: williamr@2: @see TDblQueBase::SetOffset() williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TDblQue::TDblQue(TInt aOffset) williamr@2: : TDblQueBase(aOffset) williamr@2: /** williamr@2: Constructs an empty list header and sets the offset of the link object to the williamr@2: specified value. williamr@2: williamr@2: @param aOffset The offset of the link object from the start of a list element. williamr@2: The macro _FOFF can be used to calculate this value. williamr@2: williamr@2: @panic USER 78. if aOffset is not divisble by 4. williamr@2: williamr@2: @see _FOFF williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TDblQue::AddFirst(T &aRef) williamr@2: /** williamr@2: Inserts the specified list element at the front of the doubly linked list. williamr@2: williamr@2: If the list is not empty, the specified element becomes the first in the list. williamr@2: What was previously the first element becomes the second in the list. williamr@2: williamr@2: @param aRef The list element to be inserted at the front of the doubly linked williamr@2: list. williamr@2: */ williamr@2: {DoAddFirst(&aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TDblQue::AddLast(T &aRef) williamr@2: /** williamr@2: Inserts the specified list element at the back of the doubly linked list. williamr@2: williamr@2: If the list is not empty, the specified element becomes the last in the list. williamr@2: What was previously the last element becomes the next to last element in the williamr@2: list. williamr@2: williamr@2: @param aRef The list element to be inserted at the back of the doubly linked williamr@2: list. williamr@2: */ williamr@2: {DoAddLast(&aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TDblQue::IsHead(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the end of a list has been reached. williamr@2: williamr@2: A doubly linked list is circular; in following the chain of elements in a williamr@2: list (e.g. using the iterator operator++ or operator--), the chain eventually williamr@2: reaches the end of the list and aPtr corresponds to the header (although it williamr@2: will not point to a valid T object). williamr@2: williamr@2: @param aPtr The pointer value to be checked. williamr@2: williamr@2: @return True, if the end of the list has been reached. False, if the end of williamr@2: the list has not been reached; aPtr points to an element in the list. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)&iHead);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TDblQue::IsFirst(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the specified element is the first in the doubly linked list. williamr@2: williamr@2: @param aPtr A pointer to the element whose position in the list is to be checked. williamr@2: williamr@2: @return True, if the element is the first in the list; false, otherwise. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)iHead.iNext);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TDblQue::IsLast(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the specified element is the last in the doubly linked list. williamr@2: williamr@2: @param aPtr A pointer to the element whose position in the list is to be checked. williamr@2: williamr@2: @return True, if the element is the last in the list; false, otherwise. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)iHead.iPrev);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TDblQue::First() const williamr@2: /** williamr@2: Gets a pointer to the first list element in the doubly linked list. williamr@2: williamr@2: @return A pointer to the first list element in the doubly linked list. If williamr@2: the list is empty, this pointer is not necessarily NULL and must not williamr@2: be assumed to point to a valid object. williamr@2: */ williamr@2: { williamr@2: #if defined (_DEBUG) williamr@2: __DbgTestEmpty(); williamr@2: #endif williamr@2: return(PtrSub((T *)iHead.iNext,iOffset)); williamr@2: } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TDblQue::Last() const williamr@2: /** williamr@2: Gets a pointer to the last list element in the doubly linked list. williamr@2: williamr@2: @return A pointer to the last list element in the doubly linked list. If the williamr@2: list is empty, this pointer is not necessarily NULL and must not be assumed williamr@2: to point to a valid object. williamr@2: */ williamr@2: { williamr@2: #if defined (_DEBUG) williamr@2: __DbgTestEmpty(); williamr@2: #endif williamr@2: return(PtrSub((T *)iHead.iPrev,iOffset)); williamr@2: } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TPriQue williamr@2: template williamr@2: inline TPriQue::TPriQue() williamr@2: /** williamr@2: Default constructor. williamr@2: williamr@2: Constructs an empty list header and sets the offset value of the link williamr@2: object to zero. williamr@2: williamr@2: In practice, never assume that the offset of the link object from the start williamr@2: of a list element is zero, even if the link object is declared as the first williamr@2: data member in the list element class. williamr@2: williamr@2: If this default constructor is used, then call the SetOffset() function of williamr@2: the base class to ensure that the offset value is set correctly. williamr@2: williamr@2: @see TDblQueBase::SetOffset williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TPriQue::TPriQue(TInt aOffset) williamr@2: : TDblQueBase(aOffset) williamr@2: /** williamr@2: Constructs an empty list header and sets the offset of the link object williamr@2: to the specified value. williamr@2: williamr@2: @param aOffset The offset of the link object from the start of a list element. williamr@2: The macro _FOFF can be used to calculate this value. williamr@2: williamr@2: @panic USER 78 if aOffset is not divisible by four. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TPriQue::Add(T &aRef) williamr@2: /** williamr@2: Inserts the specified list element in descending priority order. williamr@2: williamr@2: If there is an existing list element with the same priority, then the new williamr@2: element is added after the existing element. williamr@2: williamr@2: @param aRef The list element to be inserted. williamr@2: */ williamr@2: {DoAddPriority(&aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TPriQue::IsHead(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the end of a list has been reached. williamr@2: williamr@2: A doubly linked list is circular; in following the chain of elements in a list williamr@2: (e.g. using the iterator operator++ or operator--), the chain eventually williamr@2: reaches the end of the list and aPtr corresponds to the header (although it williamr@2: will not point to a valid T object). williamr@2: williamr@2: @param aPtr The pointer value to be checked. williamr@2: williamr@2: @return True, if the end of the list has been reached. False, if the end of the williamr@2: list has not been reached; aPtr points to an element in the list. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)&iHead);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TPriQue::IsFirst(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the specified element is the first in the linked list. williamr@2: williamr@2: @param aPtr A pointer to the element whose position in the list is to williamr@2: be checked. williamr@2: williamr@2: @return True, if the element is the first in the list; false, otherwise. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)iHead.iNext);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TPriQue::IsLast(const T *aPtr) const williamr@2: /** williamr@2: Tests whether the specified element is the last in the linked list. williamr@2: williamr@2: @param aPtr A pointer to the element whose position in the list is to williamr@2: be checked. williamr@2: williamr@2: @return True, if the element is the last in the list; false, otherwise. williamr@2: */ williamr@2: {return(PtrAdd(aPtr,iOffset)==(T *)iHead.iPrev);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TPriQue::First() const williamr@2: /** williamr@2: Gets a pointer to the first list element in the linked list. williamr@2: williamr@2: @return A pointer to the first list element in the linked list. williamr@2: If the list is empty, this pointer is not necessarily NULL and must williamr@2: not be assumed to point to a valid object. williamr@2: */ williamr@2: {return(PtrSub((T *)iHead.iNext,iOffset));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TPriQue::Last() const williamr@2: /** williamr@2: Gets a pointer to the last list element in the linked list. williamr@2: williamr@2: @return A pointer to the last list element in the linked list. williamr@2: If the list is empty, this pointer is not necessarily NULL and must williamr@2: not be assumed to point to a valid object. williamr@2: */ williamr@2: {return(PtrSub((T *)iHead.iPrev,iOffset));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TDeltaQue williamr@2: template williamr@2: inline TDeltaQue::TDeltaQue() williamr@2: /** williamr@2: Constructs an empty list header and sets the offset value of the link object williamr@2: to zero. williamr@2: williamr@2: In practice, never assume that the offset of the link object from the start williamr@2: of a list element is zero, even if the link object is declared as the first williamr@2: data member in the list element class. williamr@2: williamr@2: If this default constructor is used, then call the TDblQueBase::SetOffset() williamr@2: function in the base class to ensure that the offset value is set correctly. williamr@2: williamr@2: TDeltaQueBase::iFirstDelta is set to NULL. williamr@2: williamr@2: @see TDblQueBase::SetOffset williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TDeltaQue::TDeltaQue(TInt aOffset) williamr@2: : TDeltaQueBase(aOffset) williamr@2: /** williamr@2: Constructs an empty list header and sets the offset of the link object to the williamr@2: specified value. williamr@2: williamr@2: TDeltaQueBase::iFirstDelta is set to NULL. williamr@2: williamr@2: @param aOffset The offset of the link object from the start of a list element. williamr@2: The macro _FOFF can be used to calculate this value. williamr@2: williamr@2: @panic USER 78, if aOffset is not divisible by four. williamr@2: williamr@2: @see _FOFF williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TDeltaQue::Add(T &aRef,TInt aDelta) williamr@2: /** williamr@2: Adds the specified list element, having the specified 'distance' from the williamr@2: nominal zero point, into the list. williamr@2: williamr@2: The element is added into the list, the adjacent delta values adjusted, and williamr@2: a suitable delta value assigned to the new element, so that the new element williamr@2: is at the specified 'distance' from the nominal zero point. williamr@2: williamr@2: @param aRef The list element to be inserted. williamr@2: @param aDelta The 'distance' from the nominal zero point. williamr@2: */ williamr@2: {DoAddDelta(&aRef,aDelta);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TDeltaQue::Remove(T &aRef) williamr@2: /** williamr@2: Removes the specified list element from the linked list. williamr@2: williamr@2: The delta value of the element following the removed element is adjusted williamr@2: so that its 'distance' from the nominal zero point remains the same. williamr@2: williamr@2: @param aRef The list element to be removed. williamr@2: */ williamr@2: {DoRemove(&aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TDeltaQue::RemoveFirst() williamr@2: /** williamr@2: Removes the first list element from the linked list if its delta value is zero williamr@2: or negative. williamr@2: williamr@2: @return A pointer to the element removed from the linked list. This is NULL, williamr@2: if the first element has a positive delta value. williamr@2: */ williamr@2: {return((T *) DoRemoveFirst());} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TSglQueIter williamr@2: template williamr@2: inline TSglQueIter::TSglQueIter(TSglQueBase &aQue) williamr@2: : TSglQueIterBase(aQue) williamr@2: /** williamr@2: Constructs the iterator for the specified singly linked list. williamr@2: williamr@2: The iterator can be constructed whether or not the list contains any elements. williamr@2: williamr@2: If the list does contain elements, the iterator pointer is set to the first one. williamr@2: williamr@2: If the list has no elements, the iterator pointer is not set and the conversion williamr@2: operator T*() and the post increment operator ++ subsequently return NULL. williamr@2: Once elements have been added to the list, use either the williamr@2: TSglQueIter::Set() function or the TSglQueIterBase::SetToFirst() function to set the williamr@2: iterator pointer. williamr@2: williamr@2: @param aQue A reference to a singly linked list header. williamr@2: williamr@2: @see TSglQueIter::Set williamr@2: @see TSglQueIterBase::SetToFirst williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TSglQueIter::Set(T &aLink) williamr@2: /** williamr@2: Sets the iterator to point to a specific element in the list. williamr@2: williamr@2: This function can be used to alter the pointer at any time during the iterator's williamr@2: existence. The referenced element must be in the list, otherwise the result williamr@2: is undefined. williamr@2: williamr@2: @param aLink A reference to the element from where iteration is to continue. williamr@2: */ williamr@2: {DoSet(&aLink);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TSglQueIter::operator T *() williamr@2: /** williamr@2: Gets a pointer to the iterator’s current element. williamr@2: williamr@2: The operator is normally used implicitly; e.g. some member functions of the williamr@2: list header class TSglQue require a pointer to an element (of type class T) williamr@2: as a parameter, but in practice an iterator is often passed instead. williamr@2: This operator performs the necessary conversion. williamr@2: */ williamr@2: {return((T *)DoCurrent());} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TSglQueIter::operator++(TInt) williamr@2: /** williamr@2: Gets a pointer to the iterator's current element and then sets the iterator williamr@2: to point to the next element. williamr@2: williamr@2: Repeated use of this operator allows successive elements to be accessed. williamr@2: williamr@2: @return A pointer to the current list element, if the iterator points to an williamr@2: element. NULL, if the iterator does not point to an element; i.e. the williamr@2: iterator pointer has reached the end of the list. williamr@2: */ williamr@2: {return((T *)DoPostInc());} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TDblQueIter williamr@2: template williamr@2: inline TDblQueIter::TDblQueIter(TDblQueBase &aQue) williamr@2: : TDblQueIterBase(aQue) williamr@2: /** williamr@2: Constructs the iterator for the specified doubly linked list williamr@2: williamr@2: The iterator can be constructed whether or not the list contains any elements. williamr@2: williamr@2: If the list does contain elements, the iterator pointer is set to the first one. williamr@2: williamr@2: If the list has no elements, the iterator pointer is not set and the conversion williamr@2: operator T*(), the post increment operator++() and the post decrement operator williamr@2: --() subsequently return NULL. Once elements have been added to the list, use williamr@2: either the TDblQueIter::Set() function, the TDblQueIterBase::SetToFirst() williamr@2: function or the TDblQueIterBase::SetToLast() function to set the iterator williamr@2: pointer. williamr@2: williamr@2: @param aQue A reference to a doubly linked list header. williamr@2: williamr@2: @see TDblQueIter::Set williamr@2: @see TDblQueIterBase::SetToFirst williamr@2: @see TDblQueIterBase::SetToLast williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TDblQueIter::Set(T &aLink) williamr@2: /** williamr@2: Sets the iterator to point to a specific element in the list. williamr@2: williamr@2: This function can be used to alter the pointer at any time during williamr@2: the iterator's existence. The referenced element must be in the list, williamr@2: otherwise the result is undefined. williamr@2: williamr@2: @param aLink A reference to the element from where iteration is to continue. williamr@2: */ williamr@2: {DoSet(&aLink);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TDblQueIter::operator T *() williamr@2: /** williamr@2: Gets a pointer to the iterator’s current element. williamr@2: williamr@2: The operator is normally used implicitly; e.g. some member functions of the williamr@2: list header class TDblQue require a pointer to an element (of type class T) williamr@2: as a parameter but in practice, an iterator is often passed instead. williamr@2: This operator performs the necessary conversion. williamr@2: williamr@2: @return A pointer to the current element, if the iterator points to an element williamr@2: in the list. NULL, if the iterator does not point to an element; williamr@2: i.e. the iterator pointer has previously reached the end of the list williamr@2: (see operator++) or the start of the list (see operator--) or williamr@2: the list is empty. williamr@2: */ williamr@2: {return((T *) DoCurrent());} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TDblQueIter::operator++(TInt) williamr@2: /** williamr@2: Gets a pointer to the iterator's current element and then sets the iterator williamr@2: to point to the next element. williamr@2: williamr@2: Repeated use of this operator allows successive williamr@2: elements to be accessed in the forwards direction. williamr@2: williamr@2: @return A pointer to the current list element, if the iterator points to an williamr@2: element. NULL, if the iterator does not point to an element; williamr@2: i.e. the iterator pointer has reached the end of the list. williamr@2: */ williamr@2: {return((T *) DoPostInc());} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T *TDblQueIter::operator--(TInt) williamr@2: /** williamr@2: Gets a pointer to the iterator's current element and then sets the iterator williamr@2: to point to the previous element. williamr@2: williamr@2: Repeated use of this operator allows successive williamr@2: elements to be accessed in the backwards direction. williamr@2: williamr@2: @return A pointer to the current element, if the iterator points to an element. williamr@2: NULL, if the iterator does not point to an element; i.e. the iterator williamr@2: pointer has reached the beginning of the list. williamr@2: */ williamr@2: {return((T *) DoPostDec());} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TKey williamr@2: inline void TKey::SetPtr(const TAny *aPtr) williamr@2: /** williamr@2: Sets the pointer to a sample element whose key is to be used for comparison. williamr@2: williamr@2: The element can be in an existing array or it can be located anywhere in williamr@2: addressable memory. williamr@2: williamr@2: The At() member function supplied by a derived class must return a pointer williamr@2: to this sample element's key when passed an index value of KIndexPtr. williamr@2: williamr@2: SetPtr() must be called before calling User::BinarySearch() because this algorithm williamr@2: uses the key of this sample element as the basis for searching the array. williamr@2: williamr@2: @param aPtr A pointer to a sample element. williamr@2: */ williamr@2: {iPtr=aPtr;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TCharF williamr@2: inline TCharF::TCharF(TUint aChar) williamr@2: : TChar(User::Fold(aChar)) williamr@2: /** williamr@2: Constructs this 'fold character' object and initialises it with the specified williamr@2: value. williamr@2: williamr@2: @param aChar The initialisation value. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharF::TCharF(const TChar& aChar) williamr@2: : TChar(User::Fold(aChar)) williamr@2: /** williamr@2: Constructs this 'fold character' object and initialises it with the value of williamr@2: the TChar object aChar. williamr@2: williamr@2: @param aChar The character object to use as the initialisation value. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharF& TCharF::operator=(TUint aChar) williamr@2: /** williamr@2: Assigns an unsigned integer value to the 'fold character' object. williamr@2: williamr@2: @param aChar The value to assign. williamr@2: williamr@2: @return A reference to this 'fold character' object. williamr@2: */ williamr@2: {SetChar(User::Fold(aChar));return(*this);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharF& TCharF::operator=(const TChar& aChar) williamr@2: /** williamr@2: Assigns the specified character object to this 'fold character' object. williamr@2: williamr@2: @param aChar The character object to assign. williamr@2: williamr@2: @return A reference to this 'fold character' object. williamr@2: */ williamr@2: {SetChar(User::Fold(aChar));return(*this);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TCharLC williamr@2: inline TCharLC::TCharLC(TUint aChar) williamr@2: : TChar(User::LowerCase(aChar)) williamr@2: /** williamr@2: Constructs this 'character to lower case' object and initialises it with the williamr@2: specified value. williamr@2: williamr@2: @param aChar The initialisation value. williamr@2: williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharLC::TCharLC(const TChar& aChar) williamr@2: : TChar(User::LowerCase(aChar)) williamr@2: /** williamr@2: Constructs this 'character to lower case' object and initialises it with the williamr@2: value of the TChar object aChar. williamr@2: williamr@2: @param aChar The character object to use as the initialisation value. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharLC& TCharLC::operator=(TUint aChar) williamr@2: /** williamr@2: Assigns an unsigned integer value to the 'character to lower case' object. williamr@2: williamr@2: @param aChar The value to assign. williamr@2: williamr@2: @return A reference to this 'character to lower case' object. williamr@2: */ williamr@2: {SetChar(User::LowerCase(aChar));return(*this);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharLC& TCharLC::operator=(const TChar& aChar) williamr@2: /** williamr@2: Assigns the specified character object to this 'character to lower case' williamr@2: object. williamr@2: williamr@2: @param aChar The character object to assign. williamr@2: williamr@2: @return A reference to this 'character to lower case' object. williamr@2: */ williamr@2: {SetChar(User::LowerCase(aChar));return(*this);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TCharUC williamr@2: inline TCharUC::TCharUC(TUint aChar) williamr@2: : TChar(User::UpperCase(aChar)) williamr@2: /** williamr@2: Constructs this 'character to upper case' object and initialises it with the williamr@2: specified value. williamr@2: williamr@2: @param aChar The initialisation value. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharUC::TCharUC(const TChar& aChar) williamr@2: : TChar(User::UpperCase(aChar)) williamr@2: /** williamr@2: Constructs this 'character to upper case' object and initialises it with the williamr@2: value of the TChar object aChar. williamr@2: williamr@2: @param aChar The character object to use as the initialisation value. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharUC& TCharUC::operator=(TUint aChar) williamr@2: /** williamr@2: Assigns an unsigned integer value to the 'character to upper case' object. williamr@2: williamr@2: @param aChar The value to assign. williamr@2: williamr@2: @return A reference to this 'character to upper case' object. williamr@2: */ williamr@2: {SetChar(User::UpperCase(aChar));return(*this);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TCharUC& TCharUC::operator=(const TChar& aChar) williamr@2: /** williamr@2: Assigns the specified character object to this 'character to upper case' williamr@2: object. williamr@2: williamr@2: @param aChar The character object to assign. williamr@2: williamr@2: @return A reference to this 'character to upper case' object. williamr@2: */ williamr@2: {SetChar(User::UpperCase(aChar));return(*this);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TDateTime williamr@2: inline TDateTime::TDateTime() williamr@2: : iYear(1980), williamr@2: iMonth(EJanuary), williamr@2: iDay(1), williamr@2: iHour(0), williamr@2: iMinute(0), williamr@2: iSecond(0), williamr@2: iMicroSecond(0) williamr@2: /** williamr@2: Constructs an uninitialised TDateTime object. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt TDateTime::Year() const williamr@2: /** williamr@2: Gets the year component of the date/time. williamr@2: williamr@2: A negative value indicates a BC date. williamr@2: williamr@2: @return The year williamr@2: */ williamr@2: {return(iYear);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TMonth TDateTime::Month() const williamr@2: /** williamr@2: Gets the month component of the date/time. williamr@2: williamr@2: @return The month. EJanuary to EDecember. Offset from zero, so add one before williamr@2: displaying the month number. williamr@2: */ williamr@2: {return(iMonth);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt TDateTime::Day() const williamr@2: /** williamr@2: Gets the day component of the date/time. williamr@2: williamr@2: @return The day. Offset from zero, so add one before displaying the day number. williamr@2: */ williamr@2: {return(iDay);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt TDateTime::Hour() const williamr@2: /** williamr@2: Gets the hour component of the date/time. williamr@2: williamr@2: @return The hour. williamr@2: */ williamr@2: {return(iHour);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt TDateTime::Minute() const williamr@2: /** williamr@2: Gets the minute component of the date/time. williamr@2: williamr@2: @return The minute. williamr@2: */ williamr@2: {return(iMinute);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt TDateTime::Second() const williamr@2: /** williamr@2: Gets the second component of the date/time. williamr@2: williamr@2: @return The second. williamr@2: */ williamr@2: {return(iSecond);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt TDateTime::MicroSecond() const williamr@2: /** williamr@2: Gets the microsecond component of the date/time. williamr@2: williamr@2: @return The microsecond. williamr@2: */ williamr@2: {return(iMicroSecond);} williamr@2: williamr@2: // Class TTimeIntervalMicroSeconds williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TTimeIntervalMicroSeconds::TTimeIntervalMicroSeconds() williamr@2: /** williamr@2: Default constructor. williamr@2: williamr@2: Constructs an uninitialised object. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TTimeIntervalMicroSeconds::TTimeIntervalMicroSeconds(const TInt64& aInterval) williamr@2: : iInterval(aInterval) williamr@2: /** williamr@2: Constructs the object with the specified 64-bit interval value. williamr@2: williamr@2: @param aInterval The 64-bit interval value with which the object is to be williamr@2: initialised. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TTimeIntervalMicroSeconds& TTimeIntervalMicroSeconds::operator=(const TInt64& aInterval) williamr@2: /** williamr@2: Assigns a 64-bit integer value to this object. williamr@2: williamr@2: @param aInterval The 64-bit integer interval value to be assigned. williamr@2: williamr@2: @return A reference to this object. williamr@2: */ williamr@2: {iInterval=aInterval;return(*this);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalMicroSeconds::operator==(const TTimeIntervalMicroSeconds& aInterval) const williamr@2: /** williamr@2: Tests whether this TTimeIntervalMicroSeconds object is equal to the williamr@2: specified TTimeIntervalMicroSeconds object. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if the two time intervals are equal. False otherwise. williamr@2: */ williamr@2: {return(iInterval==aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalMicroSeconds::operator!=(const TTimeIntervalMicroSeconds& aInterval) const williamr@2: /** williamr@2: Tests whether this TTimeIntervalMicroSeconds object is not equal to the williamr@2: specified TTimeIntervalMicroSeconds object. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if the two time intervals are not equal. False otherwise. williamr@2: */ williamr@2: {return(iInterval!=aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalMicroSeconds::operator>=(const TTimeIntervalMicroSeconds& aInterval) const williamr@2: /** williamr@2: Tests whether this TTimeIntervalMicroSeconds object is greater than or equal to the williamr@2: specified TTimeIntervalMicroSeconds object. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is greater than or equal to the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval>=aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalMicroSeconds::operator<=(const TTimeIntervalMicroSeconds& aInterval) const williamr@2: /** williamr@2: Tests whether this TTimeIntervalMicroSeconds object is less than or equal to the williamr@2: specified TTimeIntervalMicroSeconds object. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is less than or equal to the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval<=aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalMicroSeconds::operator>(const TTimeIntervalMicroSeconds& aInterval) const williamr@2: /** williamr@2: Tests whether this TTimeIntervalMicroSeconds object is greater than the williamr@2: specified TTimeIntervalMicroSeconds object. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is greater than the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval>aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalMicroSeconds::operator<(const TTimeIntervalMicroSeconds& aInterval) const williamr@2: /** williamr@2: Tests whether this TTimeIntervalMicroSeconds object is less than the williamr@2: specified TTimeIntervalMicroSeconds object. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is less than the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval=(TTimeIntervalBase aInterval) const williamr@2: /** williamr@2: Tests whether this time interval is greater than or equal to the williamr@2: specified time interval. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is greater than or equal to the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval>=aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalBase::operator<=(TTimeIntervalBase aInterval) const williamr@2: /** williamr@2: Tests whether this time interval is less than or equal to the williamr@2: specified time interval. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is less than or equal to the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval<=aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalBase::operator>(TTimeIntervalBase aInterval) const williamr@2: /** williamr@2: Tests whether this time interval is greater than the specified time interval. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is greater than the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval>aInterval.iInterval);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTimeIntervalBase::operator<(TTimeIntervalBase aInterval) const williamr@2: /** williamr@2: Tests whether this time interval is less than the specified time interval. williamr@2: williamr@2: @param aInterval The time interval to be compared with this time interval. williamr@2: williamr@2: @return True if this time interval is less than the specified williamr@2: time interval. False otherwise. williamr@2: */ williamr@2: {return(iInterval=(TTime aTime) const williamr@2: /** williamr@2: Tests whether this date/time is later than or the same as the williamr@2: specified date/time. williamr@2: williamr@2: @param aTime The date/time to be compared with this date/time. williamr@2: williamr@2: @return True if this date/time is later than or the same as the williamr@2: specified date/time. False otherwise. williamr@2: */ williamr@2: {return(iTime>=aTime.iTime);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTime::operator<=(TTime aTime) const williamr@2: /** williamr@2: Tests whether this date/time is earlier than or the same as the williamr@2: specified date/time. williamr@2: williamr@2: @param aTime The date/time to be compared with this date/time. williamr@2: williamr@2: @return True if this date/time is earlier than or the same as the williamr@2: specified date/time. False otherwise. williamr@2: */ williamr@2: {return(iTime<=aTime.iTime);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTime::operator>(TTime aTime) const williamr@2: /** williamr@2: Tests whether this date/time is later than the specified date/time. williamr@2: williamr@2: @param aTime The date/time to be compared with this date/time. williamr@2: williamr@2: @return True if this date/time is later than the specified date/time. williamr@2: False otherwise. williamr@2: */ williamr@2: {return(iTime>aTime.iTime);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TTime::operator<(TTime aTime) const williamr@2: /** williamr@2: Tests whether this date/time is earlier than the specified date/time. williamr@2: williamr@2: @param aTime The date/time to be compared with this date/time. williamr@2: williamr@2: @return True if this date/time is earlier than the specified date/time. williamr@2: False otherwise. williamr@2: */ williamr@2: {return(iTime=0 && aIndex=0 && aIndex(iLanguageDowngrade[aIndex]); williamr@2: } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline void TLocale::SetLanguageDowngrade(TInt aIndex, TLanguage aLanguage) williamr@2: /** williamr@2: Sets a language in the customisable part of the language downgrade path. williamr@2: williamr@2: @param aIndex An index into the customisable part of the path at which to williamr@2: add the language, a value between zero and two. williamr@2: @param aLanguage The language to add. ELangNone is considered to be the last williamr@2: language in the path, no more will be searched, so can be used williamr@2: to specify that no language downgrade is required. williamr@2: williamr@2: @see BaflUtils::NearestLanguageFile williamr@2: @see BaflUtils::GetDowngradePath williamr@2: */ williamr@2: { williamr@2: __ASSERT_DEBUG(0 <= aIndex && aIndex < 3, User::Invariant()); williamr@2: iLanguageDowngrade[aIndex] = static_cast(aLanguage); williamr@2: } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Gets the number mode stored in the locale. williamr@2: williamr@2: @return The number mode for the locale. williamr@2: */ williamr@2: inline TDigitType TLocale::DigitType() const williamr@2: { return iDigitType; } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sets the number mode for the locale. williamr@2: williamr@2: @param aDigitType The number mode to be set. williamr@2: */ williamr@2: inline void TLocale::SetDigitType(TDigitType aDigitType) williamr@2: { iDigitType=aDigitType; } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sets the device time state. williamr@2: williamr@2: @param aState The device time state. williamr@2: williamr@2: @deprecated Use the timezone server to coordinate automatic time adjustment. williamr@2: */ williamr@2: inline void TLocale::SetDeviceTime(TDeviceTimeState aState) williamr@2: { williamr@2: iDeviceTimeState=aState; williamr@2: } williamr@2: williamr@2: williamr@2: inline TLocale* TExtendedLocale::GetLocale() williamr@2: { return &iLocale; } williamr@2: williamr@2: williamr@2: /** williamr@2: Gets the device time state. williamr@2: williamr@2: @return The device time state. williamr@2: williamr@2: @deprecated Use the timezone server to coordinate automatic time adjustment. williamr@2: */ williamr@2: inline TLocale::TDeviceTimeState TLocale::DeviceTime() const williamr@2: { williamr@2: return iDeviceTimeState; williamr@2: } williamr@2: williamr@2: williamr@2: // Class TFindSemaphore williamr@2: inline TFindSemaphore::TFindSemaphore() williamr@2: : TFindHandleBase() williamr@2: /** williamr@2: Constructs the object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, is the single williamr@2: character "*". williamr@2: williamr@2: A new match pattern can be set after construction by calling the Find() member williamr@2: function of the TFindHandleBase base class. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TFindSemaphore::TFindSemaphore(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: /** williamr@2: Constructs this object with the specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction by williamr@2: calling TFindHandleBase::Find(). williamr@2: williamr@2: Note that after construction, the object contains a copy of the supplied williamr@2: match pattern; the source descriptor can, therefore, be safely discarded. williamr@2: williamr@2: @param aMatch A reference to the descriptor containing the match pattern. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TFindMutex williamr@2: inline TFindMutex::TFindMutex() williamr@2: : TFindHandleBase() williamr@2: /** williamr@2: Constructs this object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, is the single williamr@2: character "*". williamr@2: williamr@2: A new match pattern can be set after construction by calling the Find() member williamr@2: function of the TFindHandleBase base class. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TFindMutex::TFindMutex(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: /** williamr@2: Constructs this object with the specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction by calling the Find() member williamr@2: function of the TFindHandleBase base class. williamr@2: williamr@2: After construction, the object contains a copy of the supplied match pattern; williamr@2: the source descriptor can, therefore, be safely discarded. williamr@2: williamr@2: @param aMatch The match pattern. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TFindChunk williamr@2: inline TFindChunk::TFindChunk() williamr@2: : TFindHandleBase() williamr@2: /** williamr@2: Constructs this object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, is williamr@2: the single character "*". williamr@2: williamr@2: A new match pattern can be set after construction by williamr@2: calling TFindHandleBase::Find(). williamr@2: williamr@2: @see TFindHandleBase williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TFindChunk::TFindChunk(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: /** williamr@2: Constructs the object with the specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction by williamr@2: calling TFindHandleBase::Find(). williamr@2: williamr@2: @param aMatch The match pattern. williamr@2: williamr@2: @see TFindHandleBase williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TFindThread williamr@2: inline TFindThread::TFindThread() williamr@2: : TFindHandleBase() williamr@2: /** williamr@2: Constructs this object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, williamr@2: is the single character *. williamr@2: williamr@2: A new match pattern can be set after construction williamr@2: by calling TFindHandleBase::Find(). williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TFindThread::TFindThread(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: /** williamr@2: Constructs this object with the specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction williamr@2: by calling the TFindHandleBase::Find(). williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TFindProcess williamr@2: inline TFindProcess::TFindProcess() williamr@2: : TFindHandleBase() williamr@2: /** williamr@2: Constructs this object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, williamr@2: is the single character *. williamr@2: williamr@2: A new match pattern can be set after construction williamr@2: by calling TFindHandleBase::Find(). williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TFindProcess::TFindProcess(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: /** williamr@2: Constructs this object with the specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction williamr@2: by calling the TFindHandleBase::Find(). williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TFindLogicalDevice williamr@2: /** williamr@2: Constructs the LDD factory object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, is the single williamr@2: character "*". williamr@2: williamr@2: A new match pattern can be set after construction by calling the Find() member williamr@2: function of the TFindHandleBase base class. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: inline TFindLogicalDevice::TFindLogicalDevice() williamr@2: : TFindHandleBase() williamr@2: {} williamr@2: williamr@2: /** williamr@2: Constructs the LDD factory object with a specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction by calling williamr@2: TFindHandleBase::Find(). williamr@2: williamr@2: @param aMatch The match pattern. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: inline TFindLogicalDevice::TFindLogicalDevice(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: {} williamr@2: williamr@2: // Class TFindPhysicalDevice williamr@2: /** williamr@2: Constructs the PDD factory object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, is the single williamr@2: character "*". williamr@2: williamr@2: A new match pattern can be set after construction by calling the Find() member williamr@2: function of the TFindHandleBase base class. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: inline TFindPhysicalDevice::TFindPhysicalDevice() williamr@2: : TFindHandleBase() williamr@2: {} williamr@2: williamr@2: /** williamr@2: Constructs the PDD factory object with a specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction by calling williamr@2: TFindHandleBase::Find(). williamr@2: williamr@2: @param aMatch The match pattern. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: inline TFindPhysicalDevice::TFindPhysicalDevice(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TFindServer williamr@2: inline TFindServer::TFindServer() williamr@2: : TFindHandleBase() williamr@2: /** williamr@2: Constructs the object with a default match pattern. williamr@2: williamr@2: The default match pattern, as implemented by the base class, is the single williamr@2: character "*". williamr@2: williamr@2: A new match pattern can be set after construction by calling the Find() member williamr@2: function of the TFindHandleBase base class. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TFindServer::TFindServer(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: /** williamr@2: Constructs the object with a specified match pattern. williamr@2: williamr@2: A new match pattern can be set after construction by calling williamr@2: TFindHandleBase::Find(). williamr@2: williamr@2: @param aMatch The match pattern. williamr@2: williamr@2: @see TFindHandleBase::Find williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TFindLibrary williamr@2: inline TFindLibrary::TFindLibrary() williamr@2: : TFindHandleBase() williamr@2: /** williamr@2: Constructs this object with a default match pattern. williamr@2: williamr@2: The default match pattern is the single character ‘*’ and is implemented by williamr@2: the base class TFindHandleBase. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TFindLibrary::TFindLibrary(const TDesC &aMatch) williamr@2: : TFindHandleBase(aMatch) williamr@2: /** williamr@2: Constructs this object with the specified match pattern. williamr@2: williamr@2: @param aMatch The descriptor containing the match pattern. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RDevice williamr@2: /** williamr@2: Opens a handle to an LDD factory object found using a TFindLogicalDevice object. williamr@2: williamr@2: A TFindLogicalDevice object is used to find all LDD factory objects whose full names match williamr@2: a specified pattern. williamr@2: williamr@2: @param aFind A reference to the object which is used to find the LDD factory object. williamr@2: @param aType An enumeration whose enumerators define the ownership of this williamr@2: LDD factory object handle. If not explicitly specified, EOwnerProcess is williamr@2: taken as default. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the other system wide error williamr@2: codes. williamr@2: */ williamr@2: inline TInt RDevice::Open(const TFindLogicalDevice& aFind,TOwnerType aType) williamr@2: {return(RHandleBase::Open(aFind,aType));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RCriticalSection williamr@2: inline TBool RCriticalSection::IsBlocked() const williamr@2: /** williamr@2: Tests whether the critical section is occupied by another thread. williamr@2: williamr@2: @return True, if the critical section is occupied by another thread. False, williamr@2: otherwise. williamr@2: */ williamr@2: {return(iBlocked!=1);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RMutex williamr@2: inline TInt RMutex::Open(const TFindMutex& aFind,TOwnerType aType) williamr@2: /** williamr@2: Opens a handle to the global mutex found using a TFindMutex object. williamr@2: williamr@2: A TFindMutex object is used to find all global mutexes whose full names match williamr@2: a specified pattern. williamr@2: williamr@2: By default, any thread in the process can use this instance of RMutex to access williamr@2: the mutex. However, specifying EOwnerThread as the second parameter to this williamr@2: function, means that only the opening thread can use this instance of RMutex williamr@2: to access the mutex; any other thread in this process that wants to access williamr@2: the mutex must either duplicate the handle or use OpenGlobal() again. williamr@2: williamr@2: @param aFind A reference to the object which is used to find the mutex. williamr@2: @param aType An enumeration whose enumerators define the ownership of this williamr@2: mutex handle. If not explicitly specified, EOwnerProcess is williamr@2: taken as default. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the other system wide error williamr@2: codes. williamr@2: */ williamr@2: {return(RHandleBase::Open(aFind,aType));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RChunk williamr@2: inline TInt RChunk::Open(const TFindChunk& aFind,TOwnerType aType) williamr@2: /** williamr@2: Opens a handle to the global chunk found using a TFindChunk object. williamr@2: williamr@2: A TFindChunk object is used to find all chunks whose full names match williamr@2: a specified pattern. williamr@2: williamr@2: By default, ownership of this chunk handle is vested in the current process, williamr@2: but can be vested in the current thread by passing EOwnerThread as the second williamr@2: parameter to this function. williamr@2: williamr@2: @param aFind A reference to the TFindChunk object used to find the chunk. williamr@2: @param aType An enumeration whose enumerators define the ownership of this williamr@2: chunk handle. If not explicitly specified, EOwnerProcess is williamr@2: taken as default. williamr@2: williamr@2: @return KErrNone if successful, otherwise another of the system error codes. williamr@2: */ williamr@2: {return(RHandleBase::Open(aFind,aType));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool RChunk::IsReadable() const williamr@2: /** williamr@2: Tests whether the chunk is mapped into its process address space. williamr@2: williamr@2: @return True, if the chunk is readable; false, otherwise. williamr@2: */ williamr@2: {return (Attributes()&RHandleBase::EDirectReadAccess); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool RChunk::IsWritable() const williamr@2: /** williamr@2: Tests whether the chunk mapped into its process address space and is writable. williamr@2: williamr@2: @return True, if the chunk is writable; false, otherwise. williamr@2: */ williamr@2: {return (Attributes()&RHandleBase::EDirectWriteAccess); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TObjectId williamr@2: inline TObjectId::TObjectId() williamr@2: /** williamr@2: Default constructor. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TObjectId::TObjectId(TUint64 aId) williamr@2: : iId(aId) williamr@2: /** williamr@2: Constructor taking an unsigned integer value. williamr@2: williamr@2: @param aId The value of the object id. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TUint64 TObjectId::Id() const williamr@2: /** williamr@2: Return the ID as a 64 bit integer williamr@2: */ williamr@2: { return iId; } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TObjectId::operator TUint() const williamr@2: /** williamr@2: Conversion operator invoked by the compiler when a TObjectId type is passed williamr@2: to a function that is prototyped to take a TUint type. williamr@2: williamr@2: @see TUint williamr@2: */ williamr@2: { return TUint(iId); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TObjectId::operator==(TObjectId aId) const williamr@2: /** williamr@2: Tests whether this thread Id is equal to the specified Id. williamr@2: williamr@2: @param aId The thread Id to be compared with this thread Id. williamr@2: williamr@2: @return True, if the thread Ids are equal; false otherwise. williamr@2: */ williamr@2: {return iId==aId.iId;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TBool TObjectId::operator!=(TObjectId aId) const williamr@2: /** williamr@2: Tests whether this thread Id is unequal to the specified thread Id. williamr@2: williamr@2: @param aId The thread Id to be compared with this thread Id. williamr@2: williamr@2: @return True, if the thread Ids are unequal; false otherwise. williamr@2: */ williamr@2: {return iId!=aId.iId;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TThreadId williamr@2: inline TThreadId::TThreadId() williamr@2: : TObjectId() williamr@2: /** williamr@2: Default constructor. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TThreadId::TThreadId(TUint64 aId) williamr@2: : TObjectId(aId) williamr@2: /** williamr@2: Constructor taking an unsigned integer value. williamr@2: williamr@2: @param aId The value of the thread id. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RThread williamr@2: inline RThread::RThread() williamr@2: : RHandleBase(KCurrentThreadHandle) williamr@2: /** williamr@2: Default constructor. williamr@2: williamr@2: The constructor exists to initialise private data within this handle; it does williamr@2: not create the thread object. williamr@2: williamr@2: Specifically, it sets the handle-number to the value KCurrentThreadHandle. williamr@2: In effect, the constructor creates a default thread handle. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt RThread::Open(const TFindThread& aFind,TOwnerType aType) williamr@2: /** williamr@2: Opens a handle to the thread found by pattern matching a name. williamr@2: williamr@2: A TFindThread object is used to find all threads whose full names match a williamr@2: specified pattern. williamr@2: williamr@2: By default, ownership of this thread handle is vested in the current process, williamr@2: but can be vested in the current thread by passing EOwnerThread as the second williamr@2: parameter to this function. williamr@2: williamr@2: @param aFind A reference to the TFindThread object used to find the thread. williamr@2: @param aType An enumeration whose enumerators define the ownership of this williamr@2: thread handle. If not explicitly specified, EOwnerProcess is williamr@2: taken as default. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the other system-wide error codes. williamr@2: */ williamr@2: {return(RHandleBase::Open(aFind,aType));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: inline TBool RThread::HasCapability(TCapability aCapability, const char* aDiagnostic) const williamr@2: { williamr@2: return DoHasCapability(aCapability, aDiagnostic); williamr@2: } williamr@2: williamr@2: inline TBool RThread::HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2, aDiagnostic); williamr@2: } williamr@2: williamr@2: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: // Only available to NULL arguments williamr@2: inline TBool RThread::HasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability); williamr@2: } williamr@2: williamr@2: inline TBool RThread::HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2); williamr@2: } williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: // For things using KSuppressPlatSecDiagnostic williamr@2: inline TBool RThread::HasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline TBool RThread::HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: // Class TProcessId williamr@2: inline TProcessId::TProcessId() williamr@2: : TObjectId() williamr@2: /** williamr@2: Default constructor. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TProcessId::TProcessId(TUint64 aId) williamr@2: : TObjectId(aId) williamr@2: /** williamr@2: Constructor taking an unsigned integer value. williamr@2: williamr@2: @param aId The value of the process id. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RProcess williamr@2: inline RProcess::RProcess() williamr@2: : RHandleBase(KCurrentProcessHandle) williamr@2: /** williamr@2: Default constructor. williamr@2: williamr@2: The constructor exists to initialise private data within this handle; it does williamr@2: not create the process object. williamr@2: williamr@2: Specifically, it sets the handle-number to the value KCurrentProcessHandle. williamr@2: In effect, the constructor creates a default process handle. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline RProcess::RProcess(TInt aHandle) williamr@2: : RHandleBase(aHandle) williamr@2: /** williamr@2: Constructor taking a handle number. williamr@2: williamr@2: @param aHandle The handle number to be used to construct this RProcess handle. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt RProcess::Open(const TFindProcess& aFind,TOwnerType aType) williamr@2: /** williamr@2: Opens a handle to the process found by pattern matching a name. williamr@2: williamr@2: A TFindProcess object is used to find all processes whose full names match williamr@2: a specified pattern. williamr@2: williamr@2: By default, ownership of this process handle is vested in the current process, williamr@2: but can be vested in the current thread by passing EOwnerThread as the second williamr@2: parameter to this function. williamr@2: williamr@2: @param aFind A reference to the TFindProcess object used to find the process. williamr@2: @param aType An enumeration whose enumerators define the ownership of this williamr@2: process handle. If not explicitly specified, EOwnerProcess is taken williamr@2: as default. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the other system-wide error codes. williamr@2: */ williamr@2: {return(RHandleBase::Open(aFind,aType));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: inline TBool RProcess::HasCapability(TCapability aCapability, const char* aDiagnostic) const williamr@2: { williamr@2: return DoHasCapability(aCapability, aDiagnostic); williamr@2: } williamr@2: williamr@2: inline TBool RProcess::HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2, aDiagnostic); williamr@2: } williamr@2: williamr@2: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: // Only available to NULL arguments williamr@2: inline TBool RProcess::HasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability); williamr@2: } williamr@2: williamr@2: inline TBool RProcess::HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2); williamr@2: } williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: // For things using KSuppressPlatSecDiagnostic williamr@2: inline TBool RProcess::HasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline TBool RProcess::HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RSessionBase williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a session with a server, specifying no message slots. williamr@2: williamr@2: It should be called as part of session initialisation in the derived class. williamr@2: williamr@2: Message slots are not pre-allocated for the session but are taken from williamr@2: a system-wide pool allowing up to 255 asynchronous messages to be outstanding. williamr@2: This raises a risk of failure due to lack of memory and, therefore, this mode williamr@2: of operation is not viable for sessions that make guarantees about the failure williamr@2: modes of asynchonous services. williamr@2: williamr@2: @param aServer The name of the server with which a session is to williamr@2: be established. williamr@2: @param aVersion The lowest version of the server with which this client williamr@2: is compatible williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the other system-wide error williamr@2: codes. williamr@2: */ williamr@2: inline TInt RSessionBase::CreateSession(const TDesC& aServer,const TVersion& aVersion) williamr@2: {return CreateSession(aServer,aVersion,-1,EIpcSession_Unsharable,NULL,0);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a session with a server, specifying no message slots. williamr@2: williamr@2: It should be called as part of session initialisation in the derived class. williamr@2: williamr@2: Message slots are not pre-allocated for the session but are taken from williamr@2: a system-wide pool allowing up to 255 asynchronous messages to be outstanding. williamr@2: This raises a risk of failure due to lack of memory and, therefore, this mode williamr@2: of operation is not viable for sessions that make guarantees about the failure williamr@2: modes of asynchonous services. williamr@2: williamr@2: @param aServer A handle to a server with which a session is to be established. williamr@2: @param aVersion The lowest version of the server with which this client williamr@2: is compatible williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the other system-wide error williamr@2: codes. williamr@2: */ williamr@2: inline TInt RSessionBase::CreateSession(RServer2 aServer,const TVersion& aVersion) williamr@2: {return CreateSession(aServer,aVersion,-1,EIpcSession_Unsharable,NULL,0);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Issues a blind request to the server with the specified function number, williamr@2: and arguments. williamr@2: williamr@2: A blind request is one where the server does not issue a response williamr@2: to the client. williamr@2: williamr@2: @param aFunction The function number identifying the request. williamr@2: @param aArgs A set of up to 4 arguments and their types to be passed williamr@2: to the server. williamr@2: williamr@2: @return KErrNone, if the send operation is successful; williamr@2: KErrServerTerminated, if the server no longer present; williamr@2: KErrServerBusy, if there are no message slots available; williamr@2: KErrNoMemory, if there is insufficient memory available. williamr@2: williamr@2: @panic USER 72 if the function number is negative. williamr@2: */ williamr@2: inline TInt RSessionBase::Send(TInt aFunction,const TIpcArgs& aArgs) const williamr@2: {return DoSend(aFunction,&aArgs);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Issues an asynchronous request to the server with the specified function williamr@2: number and arguments. williamr@2: williamr@2: The completion status of the request is returned via the request williamr@2: status object, aStatus. williamr@2: williamr@2: @param aFunction The function number identifying the request. williamr@2: @param aArgs A set of up to 4 arguments and their types to be passed williamr@2: to the server. williamr@2: @param aStatus The request status object used to contain the completion status williamr@2: of the request. williamr@2: williamr@2: @panic USER 72 if the function number is negative. williamr@2: */ williamr@2: inline void RSessionBase::SendReceive(TInt aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const williamr@2: {DoSendReceive(aFunction,&aArgs,aStatus);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Issues a synchronous request to the server with the specified function number williamr@2: and arguments. williamr@2: williamr@2: @param aFunction The function number identifying the request. williamr@2: @param aArgs A set of up to 4 arguments and their types to be passed williamr@2: to the server. williamr@2: williamr@2: @return KErrNone, if the send operation is successful; williamr@2: KErrServerTerminated, if the server no longer present; williamr@2: KErrServerBusy, if there are no message slots available; williamr@2: KErrNoMemory, if there is insufficient memory available. williamr@2: williamr@2: @panic USER 72 if the function number is negative. williamr@2: */ williamr@2: inline TInt RSessionBase::SendReceive(TInt aFunction,const TIpcArgs& aArgs) const williamr@2: {return DoSendReceive(aFunction,&aArgs);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Issues a blind request to the server with the specified function number, williamr@2: but with no arguments. williamr@2: williamr@2: A blind request is one where the server does not issue a response williamr@2: to the client. williamr@2: williamr@2: @param aFunction The function number identifying the request. williamr@2: williamr@2: @return KErrNone, if the send operation is successful; williamr@2: KErrServerTerminated, if the server no longer present; williamr@2: KErrServerBusy, if there are no message slots available; williamr@2: KErrNoMemory, if there is insufficient memory available. williamr@2: williamr@2: @panic USER 72 if the function number is negative. williamr@2: */ williamr@2: inline TInt RSessionBase::Send(TInt aFunction) const williamr@2: {return DoSend(aFunction,NULL);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Issues an asynchronous request to the server with the specified function williamr@2: number, but with no arguments. williamr@2: williamr@2: The completion status of the request is returned via the request williamr@2: status object, aStatus. williamr@2: williamr@2: @param aFunction The function number identifying the request. williamr@2: @param aStatus The request status object used to contain the completion williamr@2: status of the request. williamr@2: williamr@2: @panic USER 72 if the function number is negative. williamr@2: */ williamr@2: inline void RSessionBase::SendReceive(TInt aFunction,TRequestStatus& aStatus) const williamr@2: { DoSendReceive(aFunction,NULL,aStatus);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sets the handle-number of this handle to the specified williamr@2: value. williamr@2: williamr@2: The function can take a (zero or positive) handle-number, williamr@2: or a (negative) error number. williamr@2: williamr@2: If aHandleOrError represents a handle-number, then the handle-number of this handle williamr@2: is set to that value. williamr@2: If aHandleOrError represents an error number, then the handle-number of this handle is set to zero williamr@2: and the negative value is returned. williamr@2: williamr@2: @param aHandleOrError A handle-number, if zero or positive; an error value, if negative. williamr@2: williamr@2: @return KErrNone, if aHandle is a handle-number; the value of aHandleOrError, otherwise. williamr@2: */ williamr@2: inline TInt RSessionBase::SetReturnedHandle(TInt aHandleOrError) williamr@2: { return RHandleBase::SetReturnedHandle(aHandleOrError);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt RSessionBase::SetReturnedHandle(TInt aHandleOrError,RHandleBase& aHandle) williamr@2: { return RHandleBase::SetReturnedHandle(aHandleOrError,aHandle);} williamr@2: /** williamr@2: Issues a synchronous request to the server with the specified function number, williamr@2: but with no arguments. williamr@2: williamr@2: @param aFunction The function number identifying the request. williamr@2: williamr@2: @return KErrNone, if the send operation is successful; williamr@2: KErrServerTerminated, if the server no longer present; williamr@2: KErrServerBusy, if there are no message slots available; williamr@2: KErrNoMemory, if there is insufficient memory available. williamr@2: williamr@2: @panic USER 72 if the function number is negative. williamr@2: */ williamr@2: inline TInt RSessionBase::SendReceive(TInt aFunction) const williamr@2: {return DoSendReceive(aFunction,NULL);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RSubSessionBase williamr@2: inline RSubSessionBase::RSubSessionBase() williamr@2: : iSubSessionHandle(0) williamr@2: /** williamr@2: Default constructor williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt RSubSessionBase::SubSessionHandle() const williamr@2: /** williamr@2: Gets the sub-session handle number. williamr@2: williamr@2: This number is automatically passed to the server when making requests and is williamr@2: used to identify the appropriate server-side sub-session. williamr@2: williamr@2: @return The sub-session handle number. williamr@2: */ williamr@2: {return iSubSessionHandle;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a new sub-session within an existing session. williamr@2: williamr@2: @param aSession The session to which this sub-session will belong. williamr@2: @param aFunction The opcode specifying the requested service; the server should interpret this as a request to create a sub-session. williamr@2: @param aArgs The message arguments. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the system-wide error codes. williamr@2: */ williamr@2: inline TInt RSubSessionBase::CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs) williamr@2: { return DoCreateSubSession(aSession,aFunction,&aArgs); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a new sub-session within an existing session. williamr@2: williamr@2: This variant sends no message arguments to the server. williamr@2: williamr@2: @param aSession The session to which this sub-session will belong. williamr@2: @param aFunction The opcode specifying the requested service; the server should interpret this as a request to create a sub-session. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the system-wide error codes. williamr@2: */ williamr@2: inline TInt RSubSessionBase::CreateSubSession(const RSessionBase& aSession,TInt aFunction) williamr@2: { return DoCreateSubSession(aSession,aFunction,NULL); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sends a blind message to the server - no reply is expected. williamr@2: williamr@2: A set of message arguments is passed that can be used to specify client williamr@2: addresses, which the server can use to read from and write to the client williamr@2: address space. williamr@2: williamr@2: Note that this function can fail if there are no available message-slots, either williamr@2: in the system wide pool (if this is being used), or in the session reserved pool williamr@2: (if this is being used). If the client request is synchronous, then always use williamr@2: the synchronous variant of SendReceive(); this is guaranteed to reach the server. williamr@2: williamr@2: @param aFunction The opcode specifying the requested service. williamr@2: @param aArgs The message arguments. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the system-wide error codes. williamr@2: */ williamr@2: inline TInt RSubSessionBase::Send(TInt aFunction,const TIpcArgs& aArgs) const williamr@2: {return DoSend(aFunction,&aArgs);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sends a message to the server and waits asynchronously for the reply. williamr@2: williamr@2: An opcode specifies the service required. williamr@2: A set of message arguments is passed that can be used to specify client addresses, williamr@2: which the server can use to read from and write to the client address space. williamr@2: williamr@2: Note that this function can fail if there are no available message-slots, williamr@2: either in the system wide pool (if this is being used), or in the session williamr@2: reserved pool (if this is being used). If the client request is synchronous, williamr@2: then always use the synchronous variant of SendReceive(); williamr@2: this is guaranteed to reach the server. williamr@2: williamr@2: @param aFunction The opcode specifying the requested service. williamr@2: @param aArgs The message arguments. williamr@2: @param aStatus A request status which indicates the completion status of the asynchronous request. williamr@2: */ williamr@2: inline void RSubSessionBase::SendReceive(TInt aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const williamr@2: {DoSendReceive(aFunction,&aArgs,aStatus);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sends a message to the server and waits synchronously for a reply. williamr@2: williamr@2: An opcode specifies the service required. williamr@2: A set of message arguments is passed that can be used to specify client addresses, williamr@2: which the server can use to read from and write to the client address space. williamr@2: williamr@2: Note that this function will only fail if the server itself fails or environmental williamr@2: errors occur in the server. All requests made using this function are guaranteed to williamr@2: reach the server. This means that all synchronous client requests (typically those williamr@2: that return void) should be routed through this synchronous variant of SendReceive(). williamr@2: williamr@2: @param aFunction The opcode specifying the requested service. williamr@2: @param aArgs The message arguments. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the system-wide error codes. williamr@2: */ williamr@2: inline TInt RSubSessionBase::SendReceive(TInt aFunction,const TIpcArgs& aArgs) const williamr@2: {return DoSendReceive(aFunction,&aArgs);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sends a blind message to the server - no reply is expected. williamr@2: williamr@2: This variant sends no message arguments to the server. williamr@2: williamr@2: @param aFunction The opcode specifying the requested service. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the system-wide error codes. williamr@2: */ williamr@2: inline TInt RSubSessionBase::Send(TInt aFunction) const williamr@2: {return DoSend(aFunction,NULL);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sends a message to the server and waits asynchronously for the reply. williamr@2: williamr@2: An opcode specifies the service required. williamr@2: This variant sends no message arguments to the server. williamr@2: williamr@2: @param aFunction The opcode specifying the requested service. williamr@2: @param aStatus A request status which indicates the completion status of the asynchronous request. williamr@2: */ williamr@2: inline void RSubSessionBase::SendReceive(TInt aFunction,TRequestStatus& aStatus) const williamr@2: { DoSendReceive(aFunction,NULL,aStatus);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sends a message to the server and waits synchronously for a reply. williamr@2: williamr@2: An opcode specifies the service required. williamr@2: This variant sends no message arguments to the server. williamr@2: williamr@2: @param aFunction The opcode specifying the requested service. williamr@2: williamr@2: @return KErrNone if successful, otherwise one of the system-wide error codes. williamr@2: */ williamr@2: inline TInt RSubSessionBase::SendReceive(TInt aFunction) const williamr@2: {return DoSendReceive(aFunction,NULL);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RRefBase williamr@2: williamr@2: /** williamr@2: Default constructor. williamr@2: */ williamr@2: inline RRefBase::RRefBase() williamr@2: : iPtr(NULL) williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Copy constructor. williamr@2: williamr@2: @param aRef A reference to the object to be copied. williamr@2: */ williamr@2: inline RRefBase::RRefBase(const RRefBase &aRef) williamr@2: {Copy(aRef);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RRef williamr@2: williamr@2: williamr@2: /** williamr@2: Default constructor. williamr@2: */ williamr@2: template williamr@2: inline RRef::RRef() williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Copy constructor. williamr@2: williamr@2: The constructor frees any existing contained object, and takes ownership of williamr@2: the object owned by anObject. williamr@2: williamr@2: @param anObject A reference to another 'reference' object. williamr@2: On return from this constructor, anObject may be safely williamr@2: orphaned if it lives on the program stack. williamr@2: */ williamr@2: template williamr@2: inline RRef::RRef(const RRef &anObject) williamr@2: {Copy(anObject);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Assignment operator. williamr@2: williamr@2: The constructor frees any existing contained object, and takes ownership of williamr@2: the object owned by anObject. williamr@2: williamr@2: @param anObject A reference to another 'reference' object. williamr@2: On return from this constructor, anObject may be safely williamr@2: orphaned if it lives on the program stack. williamr@2: */ williamr@2: template williamr@2: inline void RRef::operator=(const RRef &anObject) williamr@2: {Copy(anObject);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Gets a pointer to the contained object. williamr@2: williamr@2: @return A pointer to the contained object williamr@2: */ williamr@2: template williamr@2: inline T *RRef::operator->() williamr@2: {return((T *)iPtr);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Gets a pointer to the contained object. williamr@2: williamr@2: @return A pointer to the contained object williamr@2: */ williamr@2: template williamr@2: inline RRef::operator T*() williamr@2: {return((T *)iPtr);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a copy of the specified object, which is to be contained by williamr@2: this reference object. williamr@2: williamr@2: The amount of memory set aside to contain the object is defined by the size williamr@2: of the object williamr@2: williamr@2: @param anObject The object to be packaged up by this reference object. williamr@2: */ williamr@2: template williamr@2: void RRef::Alloc(const T &anObject) williamr@2: {DoAlloc(&anObject,sizeof(T));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a copy of the specified object, which is to be contained by williamr@2: this reference object. williamr@2: williamr@2: The amount of memory set aside to contain the object is defined by aSize. williamr@2: williamr@2: @param anObject The object to be packaged up by this reference object. williamr@2: @param aSize The amount of memory to be set aside to contain the object. williamr@2: You must make sure that this is big enough. williamr@2: */ williamr@2: template williamr@2: void RRef::Alloc(const T &anObject,TInt aSize) williamr@2: {DoAlloc(&anObject,aSize);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a copy of the specified object, which is to be contained by williamr@2: this reference object, and leaves on failure. williamr@2: williamr@2: The amount of memory set aside to contain the object is defined by the size williamr@2: of the object williamr@2: williamr@2: @param anObject The object to be packaged up by this reference object. williamr@2: */ williamr@2: template williamr@2: void RRef::AllocL(const T &anObject) williamr@2: {DoAllocL(&anObject,sizeof(T));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a copy of the specified object, which is to be contained by williamr@2: this reference object, and leaves on failure. williamr@2: williamr@2: The amount of memory set aside to contain the object is defined by aSize. williamr@2: williamr@2: @param anObject The object to be packaged up by this reference object. williamr@2: @param aSize The amount of memory to be set aside to contain the object. williamr@2: You must make sure that this is big enough. williamr@2: */ williamr@2: template williamr@2: void RRef::AllocL(const T &anObject,TInt aSize) williamr@2: {DoAllocL(&anObject,aSize);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TRegion williamr@2: inline TBool TRegion::CheckError() const williamr@2: /** williamr@2: Tests whether the region's error flag is set. williamr@2: williamr@2: The error flag may be set: williamr@2: williamr@2: 1. when an attempt to allocate more memory for the region fails williamr@2: williamr@2: 2. if an attempt is made to expand a fixed size region beyond its allocated williamr@2: size williamr@2: williamr@2: 3. if ForceError() has been called. williamr@2: williamr@2: Use Clear() to unset the error flag, clear the region and free all allocated williamr@2: memory. williamr@2: williamr@2: @return True, if the error flag is set; false, otherwise. williamr@2: williamr@2: @see TRegion::ForceError williamr@2: @see TRegion::Clear williamr@2: */ williamr@2: {return(iError);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TInt TRegion::Count() const williamr@2: /** williamr@2: Gets the number of rectangles in this region. williamr@2: williamr@2: @return The number of rectangles. williamr@2: */ williamr@2: {return(iCount);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline const TRect *TRegion::RectangleList() const williamr@2: /** williamr@2: Gets a pointer to the array of rectangles defining this region. williamr@2: williamr@2: @return Pointer to the array of rectangles. Note that array is a standard williamr@2: C++ array, i.e. a concatenated set of TRect objects. Use Count() to williamr@2: get the number of rectangles. williamr@2: williamr@2: @see TRegion::Count williamr@2: */ williamr@2: {return(((TRegion *)this)->RectangleListW());} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline TRegion::TRegion() williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class RRegion williamr@2: inline TInt RRegion::CheckSpare() const williamr@2: /** williamr@2: Gets the number of free memory slots in the region. williamr@2: williamr@2: This is the number of slots which have been allocated, minus the number in williamr@2: use. williamr@2: williamr@2: @return The number of free memory slots in the region. williamr@2: */ williamr@2: {return(iAllocedRects-iCount);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TRegionFix williamr@2: template williamr@2: inline TRegionFix::TRegionFix() : TRegion(-S) williamr@2: /** williamr@2: Constructs a default fixed size region. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TRegionFix::TRegionFix(const TRect &aRect) : TRegion(-S) williamr@2: /** williamr@2: Constructs a fixed size region with a TRect. williamr@2: williamr@2: @param aRect Rectangle to be added to the newly constructed region. williamr@2: */ williamr@2: {AddRect(aRect);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TRegionFix::TRegionFix(const TRegionFix &aRegion) williamr@2: /** williamr@2: Copy constructor. williamr@2: williamr@2: @param aRegion The TRegionFix object to be copied. williamr@2: */ williamr@2: {*this=aRegion;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline RRegionBuf::RRegionBuf() : RRegion(-S&(~ERRegionBuf),S) williamr@2: /** williamr@2: Constructs a default object. williamr@2: williamr@2: The granularity is the value of the template parameter. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline RRegionBuf::RRegionBuf(const RRegion &aRegion) williamr@2: /** williamr@2: Constructs this object from the specified RRegion. williamr@2: williamr@2: @param aRegion The region to assign to this RRegionBuf. williamr@2: */ williamr@2: {*this=aRegion;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline RRegionBuf::RRegionBuf(const TRect &aRect) : RRegion(-S&(~ERRegionBuf),S) williamr@2: /** williamr@2: Constructs an RRegionBuf with a TRect. williamr@2: williamr@2: Its granularity is initialised to the value contained in the template argument. williamr@2: The resulting region consists of the specified single rectangle. williamr@2: williamr@2: @param aRect The single rectangle with which to initialise the region. williamr@2: */ williamr@2: {AddRect(aRect);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline RRegionBuf::RRegionBuf(const RRegionBuf &aRegion) williamr@2: /** williamr@2: Copy constructs from an existing RRegionBuf object. williamr@2: williamr@2: @param aRegion The RRegionBuf to be copied. williamr@2: */ williamr@2: {*this=aRegion;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // enum TTimerLockSpec williamr@2: inline TTimerLockSpec &operator++(TTimerLockSpec &aLock) williamr@2: { williamr@2: return aLock=((aLock==ETwelveOClock) ? EOneOClock : (TTimerLockSpec)((TInt)aLock+1)); williamr@2: } williamr@2: inline TTimerLockSpec operator++(TTimerLockSpec &aLock, TInt) williamr@2: { williamr@2: TTimerLockSpec l=aLock; williamr@2: aLock=((aLock==ETwelveOClock) ? EOneOClock : (TTimerLockSpec)((TInt)aLock+1)); williamr@2: return l; williamr@2: } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Class TCheckedUid williamr@2: inline const TUidType& TCheckedUid::UidType() const williamr@2: /** williamr@2: Gets the Uid type contained in this object. williamr@2: williamr@2: @return The Uid type. williamr@2: */ williamr@2: {return(iType);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // Array deletion support, uses CBase deletion (virtual d'tor) for all C-classes williamr@2: template williamr@2: /** @internalComponent williamr@2: */ williamr@2: void _DeleteArray(T** aBegin,T** aEnd) williamr@2: {for (;;) if (aBegin williamr@2: /** @internalComponent williamr@2: */ williamr@2: struct _ArrayUtil williamr@2: { williamr@2: static inline void Delete(T* aBegin,T* aEnd,CBase*) williamr@2: {::_DeleteArray((CBase**)aBegin,(CBase**)aEnd);} williamr@2: static inline void Delete(T* aBegin,T* aEnd,TAny*) williamr@2: {::_DeleteArray(aBegin,aEnd);} williamr@2: static inline void Delete(T* aArray,TInt aCount) williamr@2: {Delete(aArray,aArray+aCount,*aArray);} williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __TOOLS__ williamr@2: // Template class TFixedArray williamr@2: IMPORT_C void PanicTFixedArray(); williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TFixedArray::TFixedArray() williamr@2: /** williamr@2: Default constructor. williamr@2: williamr@2: Constructs an uninitialised C++ array. williamr@2: */ williamr@2: {} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TFixedArray::Copy(const T* aList,TInt aLength) williamr@2: /** williamr@2: Copies the specified set of contiguous objects into the C++ array. williamr@2: williamr@2: The copy operation starts at the beginning of the array, replacing williamr@2: any existing data. williamr@2: williamr@2: @param aList A pointer to a set of contiguous objects. williamr@2: @param aLength The number of contiguous objects to be copied. This value must williamr@2: not be negative and must not be greater than the size of the williamr@2: array as defined by the integer template parameter. williamr@2: williamr@2: @panic USER 133, in a debug build only, if aLength is negative or is greater williamr@2: than the size of the array as defined by the integer template parameter. williamr@2: */ williamr@2: {__ASSERT_DEBUG(TUint(aLength)<=TUint(S),PanicTFixedArray());Mem::Copy(iRep,aList,aLength*sizeof(T));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TFixedArray::TFixedArray(const T* aList,TInt aLength) williamr@2: /** williamr@2: Constructs a C++ array initialised with the specified objects. williamr@2: williamr@2: @param aList A pointer to a set of contiguous objects. williamr@2: @param aLength The number of contiguous objects to be copied. This value must williamr@2: not be negative and must not be greater than the size of the williamr@2: array as defined by the integer template parameter. williamr@2: williamr@2: @panic USER 133, in a debug build only, if aLength is negative or is greater williamr@2: than the size of the array as defined by the integer template parameter. williamr@2: */ williamr@2: {Copy(aList,aLength);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TFixedArray::Reset() williamr@2: /** williamr@2: Fills every element of the array with binary zeroes. williamr@2: */ williamr@2: {Mem::FillZ(iRep,sizeof(iRep));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TInt TFixedArray::Count() const williamr@2: /** williamr@2: Gets the size of the array. williamr@2: williamr@2: For any instance of this class, the array size williamr@2: is fixed and has the same value as the integer template parameter. williamr@2: williamr@2: @return The size of the array. williamr@2: */ williamr@2: {return S;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TInt TFixedArray::Length() const williamr@2: /** williamr@2: Gets the size of an array element, in bytes. williamr@2: williamr@2: @return The size of an array element, in bytes. williamr@2: */ williamr@2: {return sizeof(T);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TBool TFixedArray::InRange(TInt aIndex) williamr@2: {return TUint(aIndex) williamr@2: inline T& TFixedArray::operator[](TInt aIndex) williamr@2: /** williamr@2: Gets a reference to the specified element within the C++ array. williamr@2: williamr@2: @param aIndex The position of the element within the array. This is an offset value; williamr@2: a zero value refers to the first element in the array. This value must be williamr@2: greater than or equal to zero and less than the size of the array. williamr@2: williamr@2: @return A reference to an element of the array. williamr@2: williamr@2: @panic USER 133, in a debug build only, if aIndex is negative or greater than or equal to the size williamr@2: of the array as defined by the integer template parameter. williamr@2: */ williamr@2: {__ASSERT_DEBUG(InRange(aIndex),PanicTFixedArray());return iRep[aIndex];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline const T& TFixedArray::operator[](TInt aIndex) const williamr@2: /** williamr@2: Gets a const reference to the specified element within the C++ array. williamr@2: williamr@2: @param aIndex The position of the element within the array. This is an offset value; williamr@2: a zero value refers to the first element in the array. This value must be williamr@2: greater than or equal to zero and less than the size of the array. williamr@2: williamr@2: @return A const reference to an element of the array; the element cannot be williamr@2: changed through this reference. williamr@2: williamr@2: @panic USER 133, in a debug build only, if aIndex is negative or greater than or equal to the size williamr@2: of the array as defined by the integer template parameter. williamr@2: */ williamr@2: {return CONST_CAST(ThisClass&,*this)[aIndex];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T& TFixedArray::At(TInt aIndex) williamr@2: /** williamr@2: Gets a reference to the specified element within the C++ array. williamr@2: williamr@2: @param aIndex The position of the element within the array. This is an offset value; williamr@2: a zero value refers to the first element in the array. This value must be williamr@2: greater than or equal to zero and less than the size of the array. williamr@2: williamr@2: @return A reference to an element of the array. williamr@2: williamr@2: @panic USER 133, if aIndex is negative or greater than or equal to the size williamr@2: of the array as defined by the integer template parameter. williamr@2: */ williamr@2: {__ASSERT_ALWAYS(InRange(aIndex),PanicTFixedArray());return iRep[aIndex];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline const T& TFixedArray::At(TInt aIndex) const williamr@2: /** williamr@2: Gets a const reference to the specified element within the C++ array. williamr@2: williamr@2: @param aIndex The position of the element within the array. This is an offset value; williamr@2: a zero value refers to the first element in the array. This value must be williamr@2: greater than or equal to zero and less than the size of the array. williamr@2: williamr@2: @return A const reference to an element of the array; the element cannot be williamr@2: changed through this reference. williamr@2: williamr@2: @panic USER 133, in a debug build only, if aIndex is negative or greater than or equal to the size williamr@2: of the array as defined by the integer template parameter. williamr@2: */ williamr@2: {return CONST_CAST(ThisClass&,*this).At(aIndex);} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T* TFixedArray::Begin() williamr@2: /** williamr@2: Gets a pointer to the first element of the array. williamr@2: williamr@2: @return A pointer to the first element of the array. williamr@2: */ williamr@2: {return &iRep[0];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline T* TFixedArray::End() williamr@2: /** williamr@2: Gets a pointer to the first byte following the end of the array. williamr@2: williamr@2: @return A pointer to the first byte following the end of the array. williamr@2: */ williamr@2: {return &iRep[S];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline const T* TFixedArray::Begin() const williamr@2: /** williamr@2: Gets a pointer to the first element of the array. williamr@2: williamr@2: @return A pointer to a const element of the array. williamr@2: */ williamr@2: {return &iRep[0];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline const T* TFixedArray::End() const williamr@2: /** williamr@2: Gets a pointer to the first byte following the end of the array. williamr@2: williamr@2: @return A pointer to the const first byte following the end of the array. williamr@2: */ williamr@2: {return &iRep[S];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TInt TFixedArray::CountFunctionR(const CBase*) williamr@2: {return S;} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline const TAny* TFixedArray::AtFunctionR(const CBase* aThis,TInt aIndex) williamr@2: {return &REINTERPRET_CAST(const ThisClass&,*aThis)[aIndex];} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline TArray TFixedArray::Array() const williamr@2: /** williamr@2: Creates and returns a generic array for this C++ array. williamr@2: williamr@2: @return A generic array for this C++ array. williamr@2: */ williamr@2: {return TArray(CountFunctionR,AtFunctionR,REINTERPRET_CAST(const CBase*,this));} williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: template williamr@2: inline void TFixedArray::DeleteAll() williamr@2: /** williamr@2: Invokes the delete operator on every member of the array. williamr@2: williamr@2: The function can only be used for arrays of pointers to CBase derived objects. williamr@2: williamr@2: If the array is to be used after a call to this function, it is good practice williamr@2: to call TFixedArray::Reset() to set all array elements to williamr@2: NULL. williamr@2: */ williamr@2: {_ArrayUtil::Delete(iRep,S);} williamr@2: #endif williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // class User williamr@2: williamr@2: inline RHeap* User::SwitchHeap(RAllocator* aHeap) williamr@2: /** williamr@2: Changes the current thread's heap. williamr@2: williamr@2: @param aHeap A pointer to the new heap handle. williamr@2: williamr@2: @return A pointer to the old heap handle. williamr@2: */ williamr@2: { return (RHeap*)SwitchAllocator(aHeap); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: inline RHeap& User::Heap() williamr@2: /** williamr@2: Gets a reference to the handle to the current thread's heap. williamr@2: williamr@2: @return A reference to the handle to the current thread's heap. williamr@2: */ williamr@2: { return (RHeap&)Allocator(); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: inline TBool User::CreatorHasCapability(TCapability aCapability, const char* aDiagnostic) williamr@2: { williamr@2: return DoCreatorHasCapability(aCapability, aDiagnostic); williamr@2: } williamr@2: williamr@2: inline TBool User::CreatorHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) williamr@2: { williamr@2: return DoCreatorHasCapability(aCapability1, aCapability2, aDiagnostic); williamr@2: } williamr@2: williamr@2: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: // Only available to NULL arguments williamr@2: inline TBool User::CreatorHasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/) williamr@2: { williamr@2: return DoCreatorHasCapability(aCapability); williamr@2: } williamr@2: williamr@2: inline TBool User::CreatorHasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/) williamr@2: { williamr@2: return DoCreatorHasCapability(aCapability1, aCapability2); williamr@2: } williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: // For things using KSuppressPlatSecDiagnostic williamr@2: inline TBool User::CreatorHasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) williamr@2: { williamr@2: return DoCreatorHasCapability(aCapability, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline TBool User::CreatorHasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) williamr@2: { williamr@2: return DoCreatorHasCapability(aCapability1, aCapability2, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: /** Sets this TSecurityInfo to the security attributes of this process. */ williamr@2: inline void TSecurityInfo::SetToCurrentInfo() williamr@2: { new (this) TSecurityInfo(RProcess()); } williamr@2: williamr@2: /** Constructs a TSecurityInfo using the security attributes of aProcess */ williamr@2: inline void TSecurityInfo::Set(RProcess aProcess) williamr@2: { new (this) TSecurityInfo(aProcess); } williamr@2: williamr@2: /** Constructs a TSecurityInfo using the security attributes of the process williamr@2: owning aThread williamr@2: */ williamr@2: inline void TSecurityInfo::Set(RThread aThread) williamr@2: { new (this) TSecurityInfo(aThread); } williamr@2: williamr@2: /** Constructs a TSecurityInfo using the security attributes of the process williamr@2: which sent the message aMsgPtr */ williamr@2: inline void TSecurityInfo::Set(RMessagePtr2 aMsgPtr) williamr@2: { new (this) TSecurityInfo(aMsgPtr); } williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: /** Checks this policy against the platform security attributes of aProcess. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aProcess The RProcess object to check against this TSecurityPolicy. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of aProcess, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) const williamr@2: { williamr@2: return DoCheckPolicy(aProcess, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of the process williamr@2: owning aThread. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aThread The thread whose owning process' platform security attributes williamr@2: are to be checked against this TSecurityPolicy. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security parameters of the owning process of aThread, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const williamr@2: { williamr@2: return DoCheckPolicy(aThread, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of the process which sent williamr@2: the given message. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aMsgPtr The RMessagePtr2 object to check against this TSecurityPolicy. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of aMsg, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const williamr@2: { williamr@2: return DoCheckPolicy(aMsgPtr, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of the process which sent williamr@2: the given message. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aMsgPtr The RMessagePtr2 object to check against this TSecurityPolicy. williamr@2: @param aMissing A TSecurityInfo object which this method fills with any capabilities or IDs williamr@2: it finds to be missing. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of aMsg, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: williamr@2: @internalComponent williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) const williamr@2: { williamr@2: return DoCheckPolicy(aMsgPtr, aMissing, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of this process' creator. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of this process' creator, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicyCreator(const char* aDiagnostic) const williamr@2: { williamr@2: return DoCheckPolicyCreator(aDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aProcess, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aThread, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aMsgPtr, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) williamr@2: @internalComponent williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aMsgPtr, aMissing, aDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicyCreator(const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicyCreator(const char* aDiagnostic) const williamr@2: { williamr@2: return (&(*this))->CheckPolicyCreator(aDiagnostic); williamr@2: } williamr@2: williamr@2: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: /** Checks this policy against the platform security attributes of aProcess. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aProcess The RProcess object to check against this TSecurityPolicy. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of aProcess, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RProcess aProcess, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoCheckPolicy(aProcess); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of the process williamr@2: owning aThread. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aThread The thread whose owning process' platform security attributes williamr@2: are to be checked against this TSecurityPolicy. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security parameters of the owning process of aThread, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RThread aThread, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoCheckPolicy(aThread); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of the process which sent williamr@2: the given message. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aMsgPtr The RMessagePtr2 object to check against this TSecurityPolicy. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of aMsg, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoCheckPolicy(aMsgPtr); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of the process which sent williamr@2: the given message. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aMsgPtr The RMessagePtr2 object to check against this TSecurityPolicy. williamr@2: @param aMissing A TSecurityInfo object which this method fills with any capabilities or IDs williamr@2: it finds to be missing. williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of aMsg, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: williamr@2: @internalComponent williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoCheckPolicy(aMsgPtr, aMissing); williamr@2: } williamr@2: williamr@2: /** Checks this policy against the platform security attributes of this process' creator. williamr@2: williamr@2: When a check fails the action taken is determined by the system wide Platform Security williamr@2: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. williamr@2: If PlatSecEnforcement is OFF, then this function will return ETrue even though the williamr@2: check failed. williamr@2: williamr@2: @param aDiagnostic A string that will be emitted along with any diagnostic message williamr@2: that may be issued if the policy check fails. williamr@2: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro williamr@2: which enables it to be easily removed from the system. williamr@2: @return ETrue if all the requirements of this TSecurityPolicy are met by the williamr@2: platform security attributes of this process' creator, EFalse otherwise. williamr@2: @panic USER 190 if 'this' is an invalid SSecurityInfo object williamr@2: */ williamr@2: inline TBool TSecurityPolicy::CheckPolicyCreator(OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoCheckPolicyCreator(); williamr@2: } williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RProcess aProcess, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoCheckPolicy(aProcess, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RThread aThread, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoCheckPolicy(aThread, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoCheckPolicy(aMsgPtr, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline TBool TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoCheckPolicy(aMsgPtr, aMissing, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline TBool TSecurityPolicy::CheckPolicyCreator(OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoCheckPolicyCreator(KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RProcess aProcess, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aProcess); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RThread aThread, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aThread); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aMsgPtr); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) williamr@2: @internalComponent williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aMsgPtr, aMissing); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicyCreator(const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicyCreator(OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicyCreator(); williamr@2: } williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RProcess aProcess, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aProcess, KSuppressPlatSecDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RThread aThread, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aThread, KSuppressPlatSecDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aMsgPtr, KSuppressPlatSecDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) williamr@2: @internalComponent williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicy(aMsgPtr, aMissing, KSuppressPlatSecDiagnostic); williamr@2: } williamr@2: williamr@2: /** williamr@2: @see TSecurityPolicy::CheckPolicyCreator(const char* aDiagnostic) williamr@2: */ williamr@2: inline TBool TStaticSecurityPolicy::CheckPolicyCreator(OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return (&(*this))->CheckPolicyCreator(KSuppressPlatSecDiagnostic); williamr@2: } williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: williamr@2: #endif //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef __KERNEL_MODE__ williamr@2: williamr@2: /** williamr@2: Appends an object pointer onto the array. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be appended. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::AppendL(const T* anEntry) williamr@2: { User::LeaveIfError(Append(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object pointer into the array at the specified position. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if williamr@2: the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be inserted. williamr@2: @param aPos The position within the array where the object pointer is to be williamr@2: inserted. The position is relative to zero, i.e. zero implies williamr@2: that a pointer is inserted at the beginning of the array. williamr@2: williamr@2: @panic USER 131, if aPos is negative, or is greater than the number of object williamr@2: pointers currently in the array. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::InsertL(const T* anEntry, TInt aPos) williamr@2: { User::LeaveIfError(Insert(anEntry,aPos)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the first object pointer in the array which matches the specified object williamr@2: pointer, using a sequential search. williamr@2: williamr@2: Matching is based on the comparison of pointers. williamr@2: williamr@2: The find operation always starts at the low index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @return The index of the first matching object pointer within the array. williamr@2: @leave KErrNotFound, if no matching object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::FindL(const T* anEntry) const williamr@2: { return User::LeaveIfError(Find(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the first object pointer in the array whose object matches the specified williamr@2: object, using a sequential search and a matching algorithm. williamr@2: williamr@2: The algorithm for determining whether two class T objects match is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: The find operation always starts at the low index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anIdentity A package encapsulating the function which determines whether williamr@2: two class T objects match. williamr@2: williamr@2: @return The index of the first matching object pointer within the array. williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::FindL(const T* anEntry, TIdentityRelation anIdentity) const williamr@2: { return User::LeaveIfError(Find(anEntry, anIdentity));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the last object pointer in the array which matches the specified object williamr@2: pointer, using a sequential search. williamr@2: williamr@2: Matching is based on the comparison of pointers. williamr@2: williamr@2: The find operation always starts at the high index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @return The index of the last matching object pointer within the array. williamr@2: @leave KErrNotFound, if no matching object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::FindReverseL(const T* anEntry) const williamr@2: { return User::LeaveIfError(FindReverse(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the last object pointer in the array whose object matches the specified williamr@2: object, using a sequential search and a matching algorithm. williamr@2: williamr@2: The algorithm for determining whether two class T objects match is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: The find operation always starts at the high index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anIdentity A package encapsulating the function which determines whether williamr@2: two class T objects match. williamr@2: williamr@2: @return The index of the last matching object pointer within the array. williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::FindReverseL(const T* anEntry, TIdentityRelation anIdentity) const williamr@2: { return User::LeaveIfError(FindReverse(anEntry, anIdentity));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array that matches the specified object williamr@2: pointer, using a binary search technique. williamr@2: williamr@2: The function assumes that object pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: williamr@2: @return The index of the matching object pointer within the array williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::FindInAddressOrderL(const T* anEntry) const williamr@2: { return User::LeaveIfError(FindInAddressOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array whose object matches the specified williamr@2: object, using a binary search technique and an ordering algorithm. williamr@2: williamr@2: The function assumes that existing object pointers in the array are ordered williamr@2: so that the objects themselves are in object order as determined by an algorithm williamr@2: supplied by the caller and packaged as a TLinearOrder. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: williamr@2: @return The index of the matching object pointer within the array. williamr@2: williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::FindInOrderL(const T* anEntry, TLinearOrder anOrder) const williamr@2: { return User::LeaveIfError(FindInOrder(anEntry, anOrder));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array that matches the specified object williamr@2: pointer, using a binary search technique. williamr@2: williamr@2: The function assumes that object pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anIndex A reference to a TInt into which the williamr@2: function puts an index value: If the function does not leave, williamr@2: this is the index of the matching object pointer within the williamr@2: array. If the function leaves with KErrNotFound, this is the williamr@2: index of the first object pointer within the array which williamr@2: logically follows after anEntry. williamr@2: williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::FindInAddressOrderL(const T* anEntry, TInt& anIndex) const williamr@2: { User::LeaveIfError(FindInAddressOrder(anEntry, anIndex)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array whose object matches the specified williamr@2: object, using a binary search technique and an ordering algorithm. williamr@2: williamr@2: The function assumes that existing object pointers in the array are ordered williamr@2: so that the objects themselves are in object order as determined by an williamr@2: algorithm supplied by the caller and packaged as a TLinearOrder. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anIndex A TInt supplied by the caller. On return, contains an williamr@2: index value: williamr@2: If the function does not leave, this is the index of the williamr@2: matching object pointer within the array. williamr@2: If the function leaves with KErrNotFound, this is the index of williamr@2: the first object pointer in the array whose object is bigger williamr@2: than the entry being searched for - if no objects pointed to in williamr@2: the array are bigger, then the index value is the same as the williamr@2: total number of object pointers in the array. williamr@2: williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::FindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder anOrder) const williamr@2: { User::LeaveIfError(FindInOrder(anEntry, anIndex, anOrder)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array that matches the specified object williamr@2: pointer, using a binary search technique. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, the last williamr@2: or any matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that object pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param aMode Specifies whether to find the first match, the last match or williamr@2: any match, as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return If there is a matching element, the array index of a matching element - what williamr@2: the index refers to depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows the williamr@2: last matching element - if the last matching element is also the last element of the array, williamr@2: then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::SpecificFindInAddressOrderL(const T* anEntry, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInAddressOrder(anEntry, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array whose object matches the specified williamr@2: object, using a binary search technique and an ordering algorithm. williamr@2: williamr@2: In the case that there is more than one matching element finds the first, last williamr@2: or any match as specified by the value of aMode. williamr@2: williamr@2: The function assumes that existing object pointers in the array are ordered williamr@2: so that the objects themselves are in object order as determined by an algorithm williamr@2: supplied by the caller and packaged as a TLinearOrder type. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, williamr@2: as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return If there is a matching element, the array index of a matching williamr@2: element - what the index refers to depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element of the array, then williamr@2: the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline TInt RPointerArray::SpecificFindInOrderL(const T* anEntry, TLinearOrder anOrder, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInOrder(anEntry, anOrder, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array that matches the specified object williamr@2: pointer, using a binary search technique. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, the last or williamr@2: any matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that object pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an index williamr@2: value depending on whether a match is found and on the value of aMode. williamr@2: If there is no matching element in the array, then this is the index williamr@2: of the first element in the array that is bigger than the element being williamr@2: searched for - if no elements in the array are bigger, then the index williamr@2: value is the same as the total number of elements in the array. williamr@2: If there is a matching element, then what the index refers to depends williamr@2: on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, as defined by williamr@2: one of the TArrayFindMode enum values. williamr@2: williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::SpecificFindInAddressOrderL(const T* anEntry, TInt& anIndex, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInAddressOrder(anEntry, anIndex, aMode)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object pointer in the array whose object matches the specified williamr@2: object, using a binary search technique and an ordering algorithm. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, the last or any williamr@2: matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that existing object pointers in the array are ordered williamr@2: so that the objects themselves are in object order as determined by an williamr@2: algorithm supplied by the caller and packaged as a TLinearOrder. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be found. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an index williamr@2: value depending on whether a match is found and on the value of aMode. williamr@2: If there is no matching element in the array, then this is williamr@2: the index of the first element in the array that is bigger than williamr@2: the element being searched for - if no elements in the array are bigger, williamr@2: then the index value is the same as the total number of elements in the array. williamr@2: If there is a matching element, then what the index refers to depends williamr@2: on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element of williamr@2: the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, as defined by williamr@2: one of the TArrayFindModeenum values. williamr@2: williamr@2: @leave KErrNotFound, if no suitable object pointer can be found. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::SpecificFindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder anOrder, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInOrder(anEntry, anIndex, anOrder, aMode)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object pointer into the array in address order. williamr@2: williamr@2: No duplicate entries are permitted. williamr@2: The function assumes that existing object pointers within the array are in williamr@2: address order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be inserted. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::InsertInAddressOrderL(const T* anEntry) williamr@2: { User::LeaveIfError(InsertInAddressOrder(anEntry)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object pointer into the array so that the object itself is in object williamr@2: order. williamr@2: williamr@2: The algorithm for determining the order of two class T objects is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: No duplicate entries are permitted. williamr@2: williamr@2: The function assumes that the array is ordered so that the referenced objects williamr@2: are in object order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: Note that the array remains unchanged following an attempt to insert a duplicate williamr@2: entry. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be inserted. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::InsertInOrderL(const T* anEntry, TLinearOrder anOrder) williamr@2: { User::LeaveIfError(InsertInOrder(anEntry, anOrder)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object pointer into the array in address order, allowing duplicates. williamr@2: williamr@2: If the new object pointer is a duplicate of an existing object pointer in williamr@2: the array, then the new pointer is inserted after the existing one. If more williamr@2: than one duplicate object pointer already exists in the array, then any new williamr@2: duplicate pointer is inserted after the last one. williamr@2: williamr@2: The function assumes that existing object pointers within the array are in williamr@2: address order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be inserted. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::InsertInAddressOrderAllowRepeatsL(const T* anEntry) williamr@2: { User::LeaveIfError(InsertInAddressOrderAllowRepeats(anEntry)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object pointer into the array so that the object itself is in object williamr@2: order, allowing duplicates williamr@2: williamr@2: The algorithm for determining the order of two class T objects is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: If the specified object is a duplicate of an existing object, then the new williamr@2: pointer is inserted after the pointer to the existing object. If more than williamr@2: one duplicate object already exists, then the new pointer is inserted after williamr@2: the pointer to the last one. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The object pointer to be inserted. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::InsertInOrderAllowRepeatsL(const T* anEntry, TLinearOrder anOrder) williamr@2: { User::LeaveIfError(InsertInOrderAllowRepeats(anEntry, anOrder)); } williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Reserves space for the specified number of elements. williamr@2: williamr@2: After a call to this function, the memory allocated to the array is sufficient williamr@2: to hold the number of object pointers specified. Adding new object pointers to the array williamr@2: does not result in a re-allocation of memory until the the total number of williamr@2: pointers exceeds the specified count. williamr@2: williamr@2: @param aCount The number of object pointers for which space should be reserved williamr@2: @leave KErrNoMemory If the requested amount of memory could not be allocated williamr@2: */ williamr@2: template williamr@2: inline void RPointerArray::ReserveL(TInt aCount) williamr@2: { User::LeaveIfError(RPointerArrayBase::DoReserve(aCount)); } williamr@2: williamr@2: williamr@2: williamr@2: // Specialization for RPointerArray williamr@2: williamr@2: /** williamr@2: Appends an pointer onto the array. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be appended. williamr@2: */ williamr@2: inline void RPointerArray::AppendL(const TAny* anEntry) williamr@2: { User::LeaveIfError(Append(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an pointer into the array at the specified position. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if williamr@2: the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be inserted. williamr@2: @param aPos The position within the array where the pointer is to be williamr@2: inserted. The position is relative to zero, i.e. zero implies williamr@2: that a pointer is inserted at the beginning of the array. williamr@2: williamr@2: @panic USER 131, if aPos is negative, or is greater than the number of object williamr@2: pointers currently in the array. williamr@2: */ williamr@2: inline void RPointerArray::InsertL(const TAny* anEntry, TInt aPos) williamr@2: { User::LeaveIfError(Insert(anEntry,aPos)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the first pointer in the array which matches the specified pointer, using williamr@2: a sequential search. williamr@2: williamr@2: Matching is based on the comparison of pointers. williamr@2: williamr@2: The find operation always starts at the low index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be found. williamr@2: @return The index of the first matching pointer within the array. williamr@2: @leave KErrNotFound, if no matching pointer can be found. williamr@2: */ williamr@2: inline TInt RPointerArray::FindL(const TAny* anEntry) const williamr@2: { return User::LeaveIfError(Find(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the last pointer in the array which matches the specified pointer, using williamr@2: a sequential search. williamr@2: williamr@2: Matching is based on the comparison of pointers. williamr@2: williamr@2: The find operation always starts at the high index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be found. williamr@2: @return The index of the last matching pointer within the array. williamr@2: @leave KErrNotFound, if no matching pointer can be found. williamr@2: */ williamr@2: inline TInt RPointerArray::FindReverseL(const TAny* anEntry) const williamr@2: { return User::LeaveIfError(FindReverse(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the pointer in the array that matches the specified pointer, using a williamr@2: binary search technique. williamr@2: williamr@2: The function assumes that pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be found. williamr@2: williamr@2: @return The index of the matching pointer within the array williamr@2: @leave KErrNotFound, if no suitable pointer can be found. williamr@2: */ williamr@2: inline TInt RPointerArray::FindInAddressOrderL(const TAny* anEntry) const williamr@2: { return User::LeaveIfError(FindInAddressOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the pointer in the array that matches the specified pointer, using a williamr@2: binary search technique. williamr@2: williamr@2: The function assumes that pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be found. williamr@2: @param anIndex A reference to a TInt into which the williamr@2: function puts an index value: If the function does not leave, williamr@2: this is the index of the matching pointer within the array. If the williamr@2: function leaves with KErrNotFound, this is the index of the last williamr@2: pointer within the array which logically precedes williamr@2: anEntry. williamr@2: williamr@2: @leave KErrNotFound, if no suitable pointer can be found. williamr@2: */ williamr@2: inline void RPointerArray::FindInAddressOrderL(const TAny* anEntry, TInt& anIndex) const williamr@2: { User::LeaveIfError(FindInAddressOrder(anEntry, anIndex)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the pointer in the array that matches the specified pointer, using a williamr@2: binary search technique. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, the last williamr@2: or any matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be found. williamr@2: @param aMode Specifies whether to find the first match, the last match or williamr@2: any match, as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return If there is a matching element, the array index of a matching element - what williamr@2: the index refers to depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows the williamr@2: last matching element - if the last matching element is also the last element of the array, williamr@2: then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: inline TInt RPointerArray::SpecificFindInAddressOrderL(const TAny* anEntry, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInAddressOrder(anEntry, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the pointer in the array that matches the specified pointer, using a williamr@2: binary search technique. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, the last or williamr@2: any matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that pointers in the array are in address order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be found. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an index williamr@2: value depending on whether a match is found and on the value of aMode. williamr@2: If there is no matching element in the array, then this is the index williamr@2: of the first element in the array that is bigger than the element being williamr@2: searched for - if no elements in the array are bigger, then the index williamr@2: value is the same as the total number of elements in the array. williamr@2: If there is a matching element, then what the index refers to depends williamr@2: on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, as defined by williamr@2: one of the TArrayFindMode enum values. williamr@2: williamr@2: @leave KErrNotFound, if no suitable pointer can be found. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: inline void RPointerArray::SpecificFindInAddressOrderL(const TAny* anEntry, TInt& anIndex, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInAddressOrder(anEntry, anIndex, aMode)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an pointer into the array in address order. williamr@2: williamr@2: No duplicate entries are permitted. The function assumes that existing pointers williamr@2: within the array are in address order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be inserted. williamr@2: */ williamr@2: inline void RPointerArray::InsertInAddressOrderL(const TAny* anEntry) williamr@2: { User::LeaveIfError(InsertInAddressOrder(anEntry)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an pointer into the array in address order, allowing duplicates. williamr@2: williamr@2: If the new pointer is a duplicate of an existing pointer in the array, then the williamr@2: new pointer is inserted after the existing one. If more than one duplicate williamr@2: pointer already exists in the array, then any new duplicate pointer is inserted williamr@2: after the last one. williamr@2: williamr@2: The function assumes that existing pointers within the array are in address williamr@2: order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The pointer to be inserted. williamr@2: */ williamr@2: inline void RPointerArray::InsertInAddressOrderAllowRepeatsL(const TAny* anEntry) williamr@2: { User::LeaveIfError(InsertInAddressOrderAllowRepeats(anEntry)); } williamr@2: williamr@2: williamr@2: /** williamr@2: Apends an object onto the array. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to the object of type class T to be appended. williamr@2: */ williamr@2: template williamr@2: inline void RArray::AppendL(const T& anEntry) williamr@2: { User::LeaveIfError(Append(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object into the array at a specified position. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The class T object to be inserted. williamr@2: @param aPos The position within the array where the object is to williamr@2: be inserted. The position is relative to zero, i.e. zero williamr@2: implies that an object is inserted at the beginning of williamr@2: the array. williamr@2: williamr@2: @panic USER 131, if aPos is negative or is greater than the number of objects williamr@2: currently in the array. williamr@2: */ williamr@2: template williamr@2: inline void RArray::InsertL(const T& anEntry, TInt aPos) williamr@2: { User::LeaveIfError(Insert(anEntry, aPos));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the first object in the array which matches the specified object using williamr@2: a sequential search. williamr@2: williamr@2: Matching is based on the comparison of a TInt value at the key offset position williamr@2: within the objects. williamr@2: williamr@2: The find operation always starts at the low index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: williamr@2: @return The index of the first matching object within the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::FindL(const T& anEntry) const williamr@2: { return User::LeaveIfError(Find(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the first object in the array which matches the specified object using williamr@2: a sequential search and a matching algorithm. williamr@2: williamr@2: The algorithm for determining whether two class T type objects match is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: The find operation always starts at the low index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used williamr@2: for matching. williamr@2: @param anIdentity A package encapsulating the function which determines whether williamr@2: two class T type objects match. williamr@2: williamr@2: @return The index of the first matching object within the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::FindL(const T& anEntry, TIdentityRelation anIdentity) const williamr@2: { return User::LeaveIfError(Find(anEntry, anIdentity));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the last object in the array which matches the specified object using williamr@2: a sequential search. williamr@2: williamr@2: Matching is based on the comparison of a TInt value at the key offset position williamr@2: within the objects. williamr@2: williamr@2: The find operation always starts at the high index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: williamr@2: @return The index of the last matching object within the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::FindReverseL(const T& anEntry) const williamr@2: { return User::LeaveIfError(FindReverse(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the last object in the array which matches the specified object using williamr@2: a sequential search and a matching algorithm. williamr@2: williamr@2: The algorithm for determining whether two class T type objects match is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: The find operation always starts at the high index end of the array. There williamr@2: is no assumption about the order of objects in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used williamr@2: for matching. williamr@2: @param anIdentity A package encapsulating the function which determines whether williamr@2: two class T type objects match. williamr@2: williamr@2: @return The index of the last matching object within the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::FindReverseL(const T& anEntry, TIdentityRelation anIdentity) const williamr@2: { return User::LeaveIfError(FindReverse(anEntry, anIdentity));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The function assumes that existing objects within the array are in signed williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: williamr@2: @return The index of the matching object within the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::FindInSignedKeyOrderL(const T& anEntry) const williamr@2: { return User::LeaveIfError(FindInSignedKeyOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The function assumes that existing objects within the array are in unsigned williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: williamr@2: @return The index of the matching object within the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::FindInUnsignedKeyOrderL(const T& anEntry) const williamr@2: { return User::LeaveIfError(FindInUnsignedKeyOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique and an ordering algorithm. williamr@2: williamr@2: The function assumes that existing objects within the array are in object williamr@2: order as determined by an algorithm supplied by the caller and packaged as williamr@2: a TLinearOrder. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: williamr@2: @return The index of the matching object within the array. williamr@2: @leave KErrNotFound if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::FindInOrderL(const T& anEntry, TLinearOrder anOrder) const williamr@2: { return User::LeaveIfError(FindInOrder(anEntry, anOrder));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The function assumes that existing objects within the array are in signed williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anIndex On return contains an index value of the matching object within the array. williamr@2: If the function leaves with KErrNotFound,this is the index of the williamr@2: first element in the array whose key is bigger than the key of the williamr@2: element being sought. If there are no elements in the array with williamr@2: a bigger key, then the index value is the same as the total williamr@2: number of elements in the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline void RArray::FindInSignedKeyOrderL(const T& anEntry, TInt& anIndex) const williamr@2: { User::LeaveIfError(FindInSignedKeyOrder(anEntry, anIndex));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The function assumes that existing objects within the array are in unsigned williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anIndex On return contains an index value of the matching object within the array. williamr@2: If the function leaves with KErrNotFound, this is the index of the williamr@2: first element in the array whose key is bigger than the key of the williamr@2: element being sought. If there are no elements in the array with williamr@2: a bigger key, then the index value is the same as the total williamr@2: number of elements in the array. williamr@2: @leave KErrNotFound, if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline void RArray::FindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex) const williamr@2: { User::LeaveIfError(FindInUnsignedKeyOrder(anEntry, anIndex));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique and an ordering algorithm. williamr@2: williamr@2: The function assumes that existing objects within the array are in object williamr@2: order as determined by an algorithm supplied by the caller and packaged as williamr@2: a TLinearOrder. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anIndex On return contains the index value of the matching object within the array williamr@2: If the function leaves with KErrNotFound, this is the index of williamr@2: the first element in the array that is bigger than the element williamr@2: being searched for - if no elements in the array are bigger, williamr@2: then the index value is the same as the total number of elements williamr@2: in the array. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: williamr@2: @leave KErrNotFound if no matching object can be found. williamr@2: */ williamr@2: template williamr@2: inline void RArray::FindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder anOrder) const williamr@2: { User::LeaveIfError(FindInOrder(anEntry, anIndex, anOrder));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The element ordering is determined by a signed 32-bit word williamr@2: (the key) embedded in each array element. In the case that there is more than williamr@2: one matching element, finds the first, last or any match as specified. williamr@2: williamr@2: The function assumes that existing objects within the array are in signed williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param aMode Specifies whether to find the first match, the last match or williamr@2: any match, as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return The array index of a matching element - what the index refers to williamr@2: depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element of williamr@2: the array, then the index value is the same as the total number of elements in the array. williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::SpecificFindInSignedKeyOrderL(const T& anEntry, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInSignedKeyOrder(anEntry, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The element ordering is determined by an unsigned 32-bit word williamr@2: (the key) embedded in each array element. In the case that there is more than williamr@2: one matching element, finds the first, last or any match as specified. williamr@2: williamr@2: The function assumes that existing objects within the array are in unsigned williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param aMode Specifies whether to find the first match, the last match or any williamr@2: match, as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return The array index of a matching element - what the index refers to williamr@2: depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInUnsignedKeyOrder(anEntry, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique and an ordering algorithm. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, the last or williamr@2: any matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that existing objects within the array are in object williamr@2: order as determined by an algorithm supplied by the caller and packaged as williamr@2: a TLinearOrder type. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, williamr@2: as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return The array index of a matching element - what the index refers to williamr@2: depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline TInt RArray::SpecificFindInOrderL(const T& anEntry, TLinearOrder anOrder, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInOrder(anEntry, anOrder, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The element ordering is determined by a signed 32-bit word williamr@2: (the key) embedded in each array element. In the case that there is more than williamr@2: one matching element, finds the first, last or any match as specified. williamr@2: williamr@2: The function assumes that existing objects within the array are in signed williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an williamr@2: index value depending on whether a match is found and on the williamr@2: value of aMode. If there is no matching element in the array, williamr@2: then this is the index of the first element in the array that williamr@2: is bigger than the element being searched for - if no elements williamr@2: in the array are bigger, then the index value is the same as williamr@2: the total number of elements in the array. williamr@2: If there is a matching element, then what the index refers to williamr@2: depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements williamr@2: in the array. williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, williamr@2: as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline void RArray::SpecificFindInSignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInSignedKeyOrder(anEntry, anIndex, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique. williamr@2: williamr@2: The element ordering is determined by an unsigned 32-bit word williamr@2: (the key) embedded in each array element. In the case that there is more than williamr@2: one matching element, finds the first, last or any match as specified. williamr@2: williamr@2: The function assumes that existing objects within the array are in unsigned williamr@2: key order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an williamr@2: index value depending on whether a match is found and on the williamr@2: value of aMode. If there is no matching element in the array, williamr@2: then this is the index of the first element in the array that williamr@2: is bigger than the element being searched for - if no elements williamr@2: in the array are bigger, then the index value is the same as williamr@2: the total number of elements in the array. If there is a matching williamr@2: element, then what the index refers to depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, williamr@2: as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline void RArray::SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInUnsignedKeyOrder(anEntry, anIndex, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the object in the array which matches the specified object using a binary williamr@2: search technique and a specified ordering algorithm. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, the last or williamr@2: any matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that existing objects within the array are in object williamr@2: order as determined by an algorithm supplied by the caller and packaged as williamr@2: a TLinearOrder type. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to an object of type class T to be used for matching. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an williamr@2: index value depending on whether a match is found and on the value williamr@2: of aMode. If there is no matching element in the array, then this is williamr@2: the index of the first element in the array that is bigger than the williamr@2: element being searched for - if no elements in the array are bigger, williamr@2: then the index value is the same as the total number of elements williamr@2: in the array. If there is a matching element, then what the index williamr@2: refers to depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, williamr@2: as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: template williamr@2: inline void RArray::SpecificFindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder anOrder, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInOrder(anEntry, anIndex, anOrder, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object into the array in ascending signed key order. williamr@2: williamr@2: The order of two class T type objects is based on comparing a TInt value williamr@2: located at the key offset position within the class T object. williamr@2: williamr@2: No duplicate entries are permitted. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: Note that the array remains unchanged following an attempt to insert a duplicate entry. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to the object of type class T to be inserted. williamr@2: */ williamr@2: template williamr@2: inline void RArray::InsertInSignedKeyOrderL(const T& anEntry) williamr@2: { User::LeaveIfError(InsertInSignedKeyOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object into the array in ascending unsigned key order, not allowing williamr@2: duplicate entries. williamr@2: williamr@2: The order of two class T type objects is based on comparing a TUint value williamr@2: located at the key offset position within the class T object. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: Note that the array remains unchanged following an attempt to insert a duplicate entry. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to the object of type class T to be inserted. williamr@2: */ williamr@2: template williamr@2: inline void RArray::InsertInUnsignedKeyOrderL(const T& anEntry) williamr@2: { User::LeaveIfError(InsertInUnsignedKeyOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object of into the array in object order. williamr@2: williamr@2: The algorithm for determining the order of two class T type objects is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: No duplicate entries are permitted. williamr@2: williamr@2: The function assumes that existing objects within the array are in object williamr@2: order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: Note that the array remains unchanged following an attempt to insert a duplicate entry. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to the object of type class T to be inserted. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: */ williamr@2: template williamr@2: inline void RArray::InsertInOrderL(const T& anEntry, TLinearOrder anOrder) williamr@2: { User::LeaveIfError(InsertInOrder(anEntry, anOrder));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object into the array in ascending signed key order, williamr@2: allowing duplicates. williamr@2: williamr@2: The order of two class T type objects is based on comparing a TInt value williamr@2: located at the key offset position within the class T object. williamr@2: williamr@2: If anEntry is a duplicate of an existing object in the array, then the new williamr@2: object is inserted after the existing object. If more than one duplicate object williamr@2: already exists in the array, then any new duplicate object is inserted after williamr@2: the last one. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to the object of type class T to be inserted. williamr@2: */ williamr@2: template williamr@2: inline void RArray::InsertInSignedKeyOrderAllowRepeatsL(const T& anEntry) williamr@2: { User::LeaveIfError(InsertInSignedKeyOrderAllowRepeats(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object into the array in ascending unsigned key order, allowing williamr@2: duplicates. williamr@2: williamr@2: The order of two class T type objects is based on comparing a TUint value williamr@2: located at the key offset position within the class T object. williamr@2: williamr@2: If anEntry is a duplicate of an existing object in the array, then the new williamr@2: object is inserted after the existing object. If more than one duplicate object williamr@2: already exists in the array, then any new duplicate object is inserted after williamr@2: the last one. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to the object of type class T to be inserted. williamr@2: */ williamr@2: template williamr@2: inline void RArray::InsertInUnsignedKeyOrderAllowRepeatsL(const T& anEntry) williamr@2: { User::LeaveIfError(InsertInUnsignedKeyOrderAllowRepeats(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an object into the array in object order, allowing duplicates. williamr@2: williamr@2: The algorithm for determining the order of two class T type objects is provided williamr@2: by a function supplied by the caller. williamr@2: williamr@2: If anEntry is a duplicate of an existing object in the array, then the new williamr@2: object is inserted after the existing object. If more than one duplicate object williamr@2: already exists in the array, then anEntry is inserted after the last one. williamr@2: williamr@2: The function assumes that existing objects within the array are in object williamr@2: order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry A reference to the object of type class T to be inserted. williamr@2: @param anOrder A package encapsulating the function which determines the order williamr@2: of two class T objects. williamr@2: */ williamr@2: template williamr@2: inline void RArray::InsertInOrderAllowRepeatsL(const T& anEntry, TLinearOrder anOrder) williamr@2: { User::LeaveIfError(InsertInOrderAllowRepeats(anEntry, anOrder));} williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Reserves space for the specified number of elements. williamr@2: williamr@2: After a call to this function, the memory allocated to the array is sufficient williamr@2: to hold the number of objects specified. Adding new objects to the array williamr@2: does not result in a re-allocation of memory until the the total number of williamr@2: objects exceeds the specified count. williamr@2: williamr@2: @param aCount The number of objects for which space should be reserved williamr@2: @leave KErrNoMemory If the requested amount of memory could not be allocated williamr@2: */ williamr@2: template williamr@2: inline void RArray::ReserveL(TInt aCount) williamr@2: { User::LeaveIfError(RArrayBase::DoReserve(aCount)); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Appends a signed integer onto the array. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be appended. williamr@2: */ williamr@2: inline void RArray::AppendL(TInt anEntry) williamr@2: { User::LeaveIfError(Append(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts a signed integer into the array at the specified position. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be inserted. williamr@2: @param aPos The position within the array where the signed integer is to be williamr@2: inserted. The position is relative to zero, i.e. zero implies williamr@2: that an entry is inserted at the beginning of the array. williamr@2: williamr@2: @panic USER 131, if aPos is negative, or is greater than the number of entries williamr@2: currently in the array. williamr@2: */ williamr@2: inline void RArray::InsertL(TInt anEntry, TInt aPos) williamr@2: { User::LeaveIfError(Insert(anEntry, aPos));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the first signed integer in the array which matches the specified signed williamr@2: integer using a sequential search. williamr@2: williamr@2: The find operation always starts at the low index end of the array. There williamr@2: is no assumption about the order of entries in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be found. williamr@2: williamr@2: @return The index of the first matching signed integer within the array. williamr@2: @leave KErrNotFound, if no matching entry can be found. williamr@2: */ williamr@2: inline TInt RArray::FindL(TInt anEntry) const williamr@2: { return User::LeaveIfError(Find(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the last signed integer in the array which matches the specified signed williamr@2: integer using a sequential search. williamr@2: williamr@2: The find operation always starts at the high index end of the array. There williamr@2: is no assumption about the order of entries in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be found. williamr@2: williamr@2: @return The index of the last matching signed integer within the array. williamr@2: @leave KErrNotFound, if no matching entry can be found. williamr@2: */ williamr@2: inline TInt RArray::FindReverseL(TInt anEntry) const williamr@2: { return User::LeaveIfError(FindReverse(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the signed integer in the array that matches the specified signed integer williamr@2: using a binary search technique. williamr@2: williamr@2: The function assumes that the array is in signed integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be found. williamr@2: williamr@2: @return The index of the matching signed integer within the array. williamr@2: @leave KErrNotFound, if no match can be found. williamr@2: */ williamr@2: inline TInt RArray::FindInOrderL(TInt anEntry) const williamr@2: { return User::LeaveIfError(FindInOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the signed integer in the array that matches the specified signed integer williamr@2: using a binary search technique. williamr@2: williamr@2: The function assumes that the array is in signed integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be found. williamr@2: @param anIndex A reference to a signed integer into which the williamr@2: function puts an index value: If the function returns , williamr@2: this is the index of the matching signed integer within the williamr@2: array. If the function leaves with KErrNotFound, this is the williamr@2: index of the first signed integer within the array that is williamr@2: bigger than the signed integer being searched for - if no williamr@2: signed integers within the array are bigger, then the index williamr@2: value is the same as the total number of signed integers williamr@2: within the array. williamr@2: @leave KErrNotFound if no match can be found. williamr@2: */ williamr@2: inline void RArray::FindInOrderL(TInt anEntry, TInt& anIndex) const williamr@2: { User::LeaveIfError(FindInOrder(anEntry, anIndex));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the signed integer in the array that matches the specified signed integer williamr@2: using a binary search technique. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, last or any williamr@2: matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that the array is in signed integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be found. williamr@2: @param aMode Specifies whether to find the first match, the last match or williamr@2: any match, as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return The array index of a matching element - what the index refers to williamr@2: depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: inline TInt RArray::SpecificFindInOrderL(TInt anEntry, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInOrder(anEntry, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the signed integer in the array that matches the specified signed integer williamr@2: using a binary search technique. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, last or any williamr@2: matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that the array is in signed integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be found. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an williamr@2: index value depending on whether a match is found and on the value of aMode. williamr@2: If there is no matching element in the array, then this is williamr@2: the index of the first element in the array that is bigger williamr@2: than the element being searched for - if no elements in the williamr@2: array are bigger, then the index value is the same as the total williamr@2: number of elements in the array. If there is a matching element, williamr@2: then what the index refers to depends on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, as defined williamr@2: by one of the TArrayFindMode enum values. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: inline void RArray::SpecificFindInOrderL(TInt anEntry, TInt& anIndex, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInOrder(anEntry, anIndex, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts a signed integer into the array in signed integer order. williamr@2: williamr@2: No duplicate entries are permitted. williamr@2: williamr@2: The function assumes that existing entries within the array are in signed williamr@2: integer order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: Note that the array remains unchanged following an attempt to insert a duplicate entry. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be inserted. williamr@2: */ williamr@2: inline void RArray::InsertInOrderL(TInt anEntry) williamr@2: { User::LeaveIfError(InsertInOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts a signed integer into the array in signed integer order, williamr@2: allowing duplicates. williamr@2: williamr@2: If anEntry is a duplicate of an existing entry in the array, then the new williamr@2: signed integer is inserted after the existing one. If more than one duplicate williamr@2: entry already exists in the array, then any new duplicate signed integer is williamr@2: inserted after the last one. williamr@2: williamr@2: The function assumes that existing entries within the array are in signed williamr@2: integer order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The signed integer to be inserted. williamr@2: */ williamr@2: inline void RArray::InsertInOrderAllowRepeatsL(TInt anEntry) williamr@2: { User::LeaveIfError(InsertInOrderAllowRepeats(anEntry));} williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Reserves space for the specified number of elements. williamr@2: williamr@2: After a call to this function, the memory allocated to the array is sufficient williamr@2: to hold the number of integers specified. Adding new integers to the array williamr@2: does not result in a re-allocation of memory until the the total number of williamr@2: integers exceeds the specified count. williamr@2: williamr@2: @param aCount The number of integers for which space should be reserved williamr@2: @leave KErrNoMemory If the requested amount of memory could not be allocated williamr@2: */ williamr@2: inline void RArray::ReserveL(TInt aCount) williamr@2: { User::LeaveIfError(RPointerArrayBase::DoReserve(aCount)); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Appends an unsigned integer onto the array. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be appended. williamr@2: */ williamr@2: inline void RArray::AppendL(TUint anEntry) williamr@2: { User::LeaveIfError(Append(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an unsigned integer into the array at the specified position. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be inserted. williamr@2: @param aPos The position within the array where the unsigned integer is to williamr@2: be inserted. The position is relative to zero, i.e. zero williamr@2: implies that an entry is inserted at the beginning of williamr@2: the array. williamr@2: williamr@2: @panic USER 131, if aPos is negative, or is greater than the number of entries williamr@2: currently in the array. williamr@2: */ williamr@2: inline void RArray::InsertL(TUint anEntry, TInt aPos) williamr@2: { User::LeaveIfError(Insert(anEntry, aPos));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the first unsigned integer in the array which matches the specified williamr@2: value, using a sequential search. williamr@2: williamr@2: The find operation always starts at the low index end of the array. There williamr@2: is no assumption about the order of entries in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be found. williamr@2: @return The index of the first matching unsigned integer within the array. williamr@2: @leave KErrNotFound, if no matching entry can be found. williamr@2: */ williamr@2: inline TInt RArray::FindL(TUint anEntry) const williamr@2: { return User::LeaveIfError(Find(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the last unsigned integer in the array which matches the specified williamr@2: value, using a sequential search. williamr@2: williamr@2: The find operation always starts at the high index end of the array. There williamr@2: is no assumption about the order of entries in the array. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be found. williamr@2: @return The index of the last matching unsigned integer within the array. williamr@2: @leave KErrNotFound, if no matching entry can be found. williamr@2: */ williamr@2: inline TInt RArray::FindReverseL(TUint anEntry) const williamr@2: { return User::LeaveIfError(FindReverse(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the unsigned integer in the array which matches the specified value, williamr@2: using a binary search technique. williamr@2: williamr@2: The functions assume that existing entries within the array are in unsigned williamr@2: integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be found. williamr@2: williamr@2: @return The index of the matching unsigned integer within the array; williamr@2: @leave KErrNotFound, if no matching entry can be found. williamr@2: */ williamr@2: inline TInt RArray::FindInOrderL(TUint anEntry) const williamr@2: { return User::LeaveIfError(FindInOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the unsigned integer in the array which matches the specified value, williamr@2: using a binary search technique. williamr@2: williamr@2: If the index cannot be found, the function returns the index of the last williamr@2: unsigned integer within the array which logically precedes anEntry. williamr@2: The functions assume that existing entries within the array are in unsigned williamr@2: integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be found. williamr@2: @param anIndex A TInt supplied by the caller. On return, contains an index williamr@2: value of the matching unsigned integer within the array. williamr@2: If the function leaves with KErrNotFound, this is the index of the williamr@2: first unsigned integer within the array that is bigger than the williamr@2: unsigned integer being searched for - if no unsigned integers within williamr@2: the array are bigger, then the index value is the same as the williamr@2: total number of unsigned integers within the array. williamr@2: williamr@2: @leave KErrNotFound, if no matching entry can be found. williamr@2: */ williamr@2: inline void RArray::FindInOrderL(TUint anEntry, TInt& anIndex) const williamr@2: { User::LeaveIfError(FindInOrder(anEntry, anIndex));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the unsigned integer in the array that matches the specified unsigned integer williamr@2: using a binary search technique. williamr@2: williamr@2: In the case that there is more than one matching element, finds the first, last or any williamr@2: match as specified. williamr@2: williamr@2: The function assumes that the array is in unsigned integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be found. williamr@2: @param aMode Specifies whether to find the first match, the last match or williamr@2: any match, as defined by one of the TArrayFindMode enum values. williamr@2: williamr@2: @return The array index of a matching element - what the index refers to depends williamr@2: on the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element williamr@2: of the array, then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: inline TInt RArray::SpecificFindInOrderL(TUint anEntry, TInt aMode) const williamr@2: { return User::LeaveIfError(SpecificFindInOrder(anEntry, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Finds the unsigned integer in the array that matches the specified unsigned integer williamr@2: using a binary search technique. williamr@2: williamr@2: Where there is more than one matching element, it finds the first, last or williamr@2: any matching element as specified by the value of aMode. williamr@2: williamr@2: The function assumes that the array is in unsigned integer order. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be found. williamr@2: @param anIndex A TInt type supplied by the caller. On return, it contains an index williamr@2: value depending on whether a match is found and on the value of aMode. williamr@2: If there is no matching element in the array, then this is the williamr@2: index of the first element in the array that is bigger than the element williamr@2: being searched for - if no elements in the array are bigger, then williamr@2: the index value is the same as the total number of elements in the array. williamr@2: If there is a matching element, then what the index refers to depends on williamr@2: the value of aMode: williamr@2: if this is EArrayFindMode_First, then the index refers to the first matching element; williamr@2: if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; williamr@2: if this is EArrayFindMode_Last, then the index refers to first element that follows williamr@2: the last matching element - if the last matching element is also the last element of the array, williamr@2: then the index value is the same as the total number of elements in the array. williamr@2: williamr@2: @param aMode Specifies whether to find the first match, the last match or any match, as defined by williamr@2: one of the TArrayFindMode enum values. williamr@2: @leave KErrNotFound if no matching entry exists. williamr@2: williamr@2: @see TArrayFindMode williamr@2: */ williamr@2: inline void RArray::SpecificFindInOrderL(TUint anEntry, TInt& anIndex, TInt aMode) const williamr@2: { User::LeaveIfError(SpecificFindInOrder(anEntry, anIndex, aMode));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an unsigned integer into the array in unsigned integer order. williamr@2: williamr@2: No duplicate entries are permitted. williamr@2: williamr@2: The function assumes that existing entries within the array are in unsigned williamr@2: integer order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: Note that the array remains unchanged following an attempt to insert a duplicate entry. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be inserted. williamr@2: */ williamr@2: inline void RArray::InsertInOrderL(TUint anEntry) williamr@2: { User::LeaveIfError(InsertInOrder(anEntry));} williamr@2: williamr@2: williamr@2: /** williamr@2: Inserts an unsigned integer into the array in unsigned integer order, allowing williamr@2: duplicates. williamr@2: williamr@2: If the new integer is a duplicate of an existing entry in the array, then williamr@2: the new unsigned integer is inserted after the existing one. If more than williamr@2: one duplicate entry already exists in the array, then any new duplicate williamr@2: unsigned integer is inserted after the last one. williamr@2: williamr@2: The function assumes that existing entries within the array are in unsigned williamr@2: integer order. williamr@2: williamr@2: The function leaves with one of the system wide error codes, if the operation fails. williamr@2: williamr@2: NOTE: This function is NOT AVAILABLE to code running on the kernel side. williamr@2: williamr@2: @param anEntry The unsigned integer to be inserted. williamr@2: */ williamr@2: inline void RArray::InsertInOrderAllowRepeatsL(TUint anEntry) williamr@2: { User::LeaveIfError(InsertInOrderAllowRepeats(anEntry));} williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Reserves space for the specified number of elements. williamr@2: williamr@2: After a call to this function, the memory allocated to the array is sufficient williamr@2: to hold the number of integers specified. Adding new integers to the array williamr@2: does not result in a re-allocation of memory until the the total number of williamr@2: integers exceeds the specified count. williamr@2: williamr@2: @param aCount The number of integers for which space should be reserved williamr@2: @leave KErrNoMemory If the requested amount of memory could not be allocated williamr@2: */ williamr@2: inline void RArray::ReserveL(TInt aCount) williamr@2: { User::LeaveIfError(RPointerArrayBase::DoReserve(aCount)); } williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Sets the priority of the client's process. williamr@2: williamr@2: @param aPriority The priority value. williamr@2: */ williamr@2: inline void RMessagePtr2::SetProcessPriorityL(TProcessPriority aPriority) const williamr@2: { User::LeaveIfError(SetProcessPriority(aPriority));} williamr@2: williamr@2: williamr@2: /** williamr@2: Opens a handle on the client thread. williamr@2: williamr@2: @param aClient On successful return, the handle to the client thread. williamr@2: @param aOwnerType An enumeration whose enumerators define the ownership of williamr@2: the handle. If not explicitly specified, williamr@2: EOwnerProcess is taken as default. williamr@2: */ williamr@2: inline void RMessagePtr2::ClientL(RThread& aClient, TOwnerType aOwnerType) const williamr@2: { User::LeaveIfError(Client(aClient, aOwnerType));} williamr@2: williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: inline TBool RMessagePtr2::HasCapability(TCapability aCapability, const char* aDiagnostic) const williamr@2: { williamr@2: return DoHasCapability(aCapability, aDiagnostic); williamr@2: } williamr@2: williamr@2: inline void RMessagePtr2::HasCapabilityL(TCapability aCapability, const char* aDiagnosticMessage) const williamr@2: { williamr@2: if (!HasCapability(aCapability, aDiagnosticMessage)) williamr@2: { williamr@2: User::Leave(KErrPermissionDenied); williamr@2: } williamr@2: } williamr@2: williamr@2: inline TBool RMessagePtr2::HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2, aDiagnostic); williamr@2: } williamr@2: williamr@2: inline void RMessagePtr2::HasCapabilityL(TCapability aCapability1, TCapability aCapability2, const char* aDiagnosticMessage) const williamr@2: { williamr@2: if (!HasCapability(aCapability1, aCapability2, aDiagnosticMessage)) williamr@2: { williamr@2: User::Leave(KErrPermissionDenied); williamr@2: } williamr@2: } williamr@2: williamr@2: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: // Only available to NULL arguments williamr@2: inline TBool RMessagePtr2::HasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability); williamr@2: } williamr@2: williamr@2: inline void RMessagePtr2::HasCapabilityL(TCapability aCapability, OnlyCreateWithNull /*aDiagnosticMessage*/) const williamr@2: { williamr@2: if (!DoHasCapability(aCapability)) williamr@2: { williamr@2: User::Leave(KErrPermissionDenied); williamr@2: } williamr@2: } williamr@2: williamr@2: inline TBool RMessagePtr2::HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2); williamr@2: } williamr@2: williamr@2: inline void RMessagePtr2::HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnosticMessage*/) const williamr@2: { williamr@2: if (!DoHasCapability(aCapability1, aCapability2)) williamr@2: { williamr@2: User::Leave(KErrPermissionDenied); williamr@2: } williamr@2: } williamr@2: williamr@2: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: // For things using KSuppressPlatSecDiagnostic williamr@2: inline TBool RMessagePtr2::HasCapability(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline void RMessagePtr2::HasCapabilityL(TCapability aCapability, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: if (!DoHasCapability(aCapability, KSuppressPlatSecDiagnosticMagicValue)) williamr@2: { williamr@2: User::Leave(KErrPermissionDenied); williamr@2: } williamr@2: } williamr@2: williamr@2: inline TBool RMessagePtr2::HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: return DoHasCapability(aCapability1, aCapability2, KSuppressPlatSecDiagnosticMagicValue); williamr@2: } williamr@2: williamr@2: inline void RMessagePtr2::HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull /*aDiagnostic*/, OnlyCreateWithNull /*aSuppress*/) const williamr@2: { williamr@2: if (!DoHasCapability(aCapability1, aCapability2, KSuppressPlatSecDiagnosticMagicValue)) williamr@2: { williamr@2: User::Leave(KErrPermissionDenied); williamr@2: } williamr@2: } williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ williamr@2: williamr@2: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ williamr@2: williamr@2: inline TInt RThread::RenameMe(const TDesC& aName) williamr@2: { return User::RenameThread(aName); } williamr@2: inline TInt RProcess::RenameMe(const TDesC& aName) williamr@2: { return User::RenameProcess(aName); } williamr@2: williamr@2: williamr@2: #endif // !__KERNEL_MODE__ williamr@2: williamr@2: #ifdef __SUPPORT_CPP_EXCEPTIONS__ williamr@2: // The standard header file defines the following guard macro for EDG and CW, VC++, GCC respectively. williamr@2: // The guard below is ugly. It will surely come back and bite us unless we resolve the whole issue of standard headers williamr@2: // when we move to supporting Standard C++. williamr@2: #if !defined(_EXCEPTION) && !defined(_EXCEPTION_) && !defined(__EXCEPTION__) williamr@2: williamr@2: #if defined(__VC32__) && !defined(_CRTIMP_PURE) williamr@2: williamr@2: // Declare MS EH runtime functions williamr@2: bool __uncaught_exception(void); williamr@2: williamr@2: #if _MSC_VER >= 1200 williamr@2: __declspec(noreturn) void terminate(void); williamr@2: __declspec(noreturn) void unexpected(void); williamr@2: #else williamr@2: void terminate(void); williamr@2: void unexpected(void); williamr@2: #endif williamr@2: williamr@2: typedef void (*terminate_handler)(); williamr@2: terminate_handler set_terminate(terminate_handler h) throw(); williamr@2: typedef void (*unexpected_handler)(); williamr@2: unexpected_handler set_unexpected(unexpected_handler h) throw(); williamr@2: williamr@2: namespace std { williamr@2: #ifdef __MSVCDOTNET__ williamr@2: inline bool uncaught_exception(void) { return ::__uncaught_exception(); } williamr@2: #else // !__MSVCDOTNET__ williamr@2: // MS KB242192: BUG: uncaught_exception() Always Returns False williamr@2: inline bool uncaught_exception(void) { return false; } williamr@2: #endif //__MSVCDOTNET__ williamr@2: inline void terminate(void) { ::terminate(); } williamr@2: inline void unexpected(void) { ::unexpected(); } williamr@2: inline terminate_handler set_terminate(terminate_handler h) throw() { return ::set_terminate(h); } williamr@2: inline unexpected_handler set_unexpected(unexpected_handler h) throw() { return ::set_unexpected(h); } williamr@2: } williamr@2: williamr@2: #endif // extract from MSVC headers williamr@2: williamr@2: #ifdef __CW32__ williamr@2: williamr@2: extern "C" bool __uncaught_exception(void); williamr@2: williamr@2: namespace std { williamr@2: #if __MWERKS__ > 0x3200 williamr@2: inline bool uncaught_exception(void) { return ::__uncaught_exception(); } williamr@2: #else williamr@2: // no uncaught_exception() implementation on CW 2.4.7 williamr@2: inline bool uncaught_exception(void) { return false; } williamr@2: #endif williamr@2: } williamr@2: williamr@2: #endif // extract from CW headers williamr@2: williamr@2: #endif // header guard williamr@2: williamr@2: #endif //__SUPPORT_CPP_EXCEPTIONS__