1.1 --- a/epoc32/include/e32cmn.inl Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/e32cmn.inl Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,7192 @@
1.4 -e32cmn.inl
1.5 +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// e32\include\e32cmn.inl
1.19 +//
1.20 +//
1.21 +
1.22 +#ifndef __PLACEMENT_NEW_INLINE
1.23 +#define __PLACEMENT_NEW_INLINE
1.24 +// Global placement operator new
1.25 +inline TAny* operator new(TUint /*aSize*/, TAny* aBase) __NO_THROW
1.26 + {return aBase;}
1.27 +
1.28 +// Global placement operator delete
1.29 +inline void operator delete(TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW
1.30 + {}
1.31 +#endif //__PLACEMENT_NEW_INLINE
1.32 +
1.33 +#ifndef __PLACEMENT_VEC_NEW_INLINE
1.34 +#define __PLACEMENT_VEC_NEW_INLINE
1.35 +// Global placement operator new[]
1.36 +inline TAny* operator new[](TUint /*aSize*/, TAny* aBase) __NO_THROW
1.37 + {return aBase;}
1.38 +
1.39 +// Global placement operator delete[]
1.40 +inline void operator delete[](TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW
1.41 + {}
1.42 +#endif //__PLACEMENT_VEC_NEW_INLINE
1.43 +
1.44 +
1.45 +// class RAllocator
1.46 +inline RAllocator::RAllocator()
1.47 + {
1.48 + iAccessCount=1;
1.49 + iHandleCount=0;
1.50 + iHandles=0;
1.51 + iFlags=0;
1.52 + iCellCount=0;
1.53 + iTotalAllocSize=0;
1.54 + }
1.55 +inline void RAllocator::__DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum)
1.56 + {__DbgMarkCheck(aCountAll, aCount, TPtrC8(aFileName), aLineNum);}
1.57 +
1.58 +// Class RHeap
1.59 +inline RHeap::RHeap()
1.60 + {}
1.61 +
1.62 +/**
1.63 +@return The maximum length to which the heap can grow.
1.64 +
1.65 +@publishedAll
1.66 +@released
1.67 +*/
1.68 +inline TInt RHeap::MaxLength() const
1.69 + {return iMaxLength;}
1.70 +
1.71 +inline void RHeap::operator delete(TAny*, TAny*)
1.72 +/**
1.73 +Called if constructor issued by operator new(TUint aSize, TAny* aBase) throws exception.
1.74 +This is dummy as corresponding new operator does not allocate memory.
1.75 +*/
1.76 + {}
1.77 +
1.78 +
1.79 +inline TUint8* RHeap::Base() const
1.80 +/**
1.81 +Gets a pointer to the start of the heap.
1.82 +
1.83 +Note that because of the small space overhead incurred by all allocated cells,
1.84 +no cell will have the same address as that returned by this function.
1.85 +
1.86 +@return A pointer to the base of the heap.
1.87 +*/
1.88 + {return iBase;}
1.89 +
1.90 +
1.91 +
1.92 +
1.93 +inline TInt RHeap::Size() const
1.94 +/**
1.95 +Gets the current size of the heap.
1.96 +
1.97 +This is the total number of bytes committed by the host chunk.
1.98 +It is the requested size rounded up by page size minus the size of RHeap object(116 bytes)
1.99 +minus the cell alignment overhead as shown:
1.100 +
1.101 +Size = (Rounded committed size - Size of RHeap - Cell Alignment Overhead).
1.102 +
1.103 +The cell alignment overhead varies between release builds and debug builds.
1.104 +
1.105 +Note that this value is always greater than the total space available across all allocated cells.
1.106 +
1.107 +@return The size of the heap.
1.108 +
1.109 +@see Rheap::Available( )
1.110 +*/
1.111 + {return iTop-iBase;}
1.112 +
1.113 +
1.114 +
1.115 +
1.116 +inline TInt RHeap::Align(TInt a) const
1.117 +/**
1.118 +@internalComponent
1.119 +*/
1.120 + {return _ALIGN_UP(a, iAlign);}
1.121 +
1.122 +
1.123 +
1.124 +
1.125 +inline const TAny* RHeap::Align(const TAny* a) const
1.126 +/**
1.127 +@internalComponent
1.128 +*/
1.129 + {return (const TAny*)_ALIGN_UP((TLinAddr)a, iAlign);}
1.130 +
1.131 +
1.132 +
1.133 +
1.134 +inline TBool RHeap::IsLastCell(const SCell* aCell) const
1.135 +/**
1.136 +@internalComponent
1.137 +*/
1.138 + {return (((TUint8*)aCell) + aCell->len) == iTop;}
1.139 +
1.140 +
1.141 +
1.142 +
1.143 +#ifndef __KERNEL_MODE__
1.144 +inline void RHeap::Lock() const
1.145 +/**
1.146 +@internalComponent
1.147 +*/
1.148 + {((RFastLock&)iLock).Wait();}
1.149 +
1.150 +
1.151 +
1.152 +
1.153 +inline void RHeap::Unlock() const
1.154 +/**
1.155 +@internalComponent
1.156 +*/
1.157 + {((RFastLock&)iLock).Signal();}
1.158 +
1.159 +
1.160 +inline TInt RHeap::ChunkHandle() const
1.161 +/**
1.162 +@internalComponent
1.163 +*/
1.164 + {
1.165 + return iChunkHandle;
1.166 + }
1.167 +#endif
1.168 +
1.169 +
1.170 +
1.171 +
1.172 +// Class TRefByValue
1.173 +template <class T>
1.174 +inline TRefByValue<T>::TRefByValue(T &aRef)
1.175 + : iRef(aRef)
1.176 +/**
1.177 +Constructs this value reference for the specified referenced object.
1.178 +
1.179 +@param aRef The referenced object.
1.180 +*/
1.181 + {}
1.182 +
1.183 +
1.184 +
1.185 +
1.186 +template <class T>
1.187 +inline TRefByValue<T>::operator T &()
1.188 +/**
1.189 +Gets a reference to the object encapsulated inside this value reference.
1.190 +*/
1.191 + {return(iRef);}
1.192 +
1.193 +
1.194 +
1.195 +
1.196 +/**
1.197 +Creates the logical channel.
1.198 +
1.199 +@param aDevice The name of the logical device for which the channel
1.200 + is to be constructed. This is the name by which
1.201 + the LDD factory object, i.e. the instance of
1.202 + the DLogicalDevice derived class, is known.
1.203 +@param aVer The required version of the logical device. The driver
1.204 + normally checks this against the version of the logical
1.205 + channel, returning KErrNotSupported if the logical channel
1.206 + is not compatible.
1.207 +@param aUnit A unit of the device. This argument only has meaning if
1.208 + the flag KDeviceAllowUnit is set in the iParseMask data
1.209 + member of the LDD factory object.
1.210 +@param aDriver A pointer to a descriptor containing the name of
1.211 + a physical device. This is the name by which the PDD
1.212 + factory object, i.e. the instance of the DPhysicalDevice
1.213 + derived class, is known.
1.214 + This is NULL, if no explicit name is to be supplied, or
1.215 + the logical device does not require an accompanying physical
1.216 + device.
1.217 +@param aInfo A pointer to an explicit 8-bit descriptor containing extra
1.218 + information for the physical device. This argument only has
1.219 + meaning if the KDeviceAllowInfo flag is set in the iParseMask
1.220 + data member of the LDD factory object.
1.221 +@param aType An enumeration whose enumerators define the ownership of
1.222 + this handle. If not explicitly specified, EOwnerProcess is
1.223 + taken as default.
1.224 +@param aTransferable If false, the channel is created as an object which is
1.225 + local/private to the current process.
1.226 + If true, the channel is an object which may be shared with
1.227 + other processes using the IPC mechanisms for handle passing.
1.228 +
1.229 +@return KErrNone, if successful; otherwise one of the other system wide
1.230 + error codes.
1.231 +*/
1.232 +inline TInt RBusLogicalChannel::DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* aInfo, TOwnerType aType, TBool aTransferable)
1.233 + { return DoCreate(aDevice, aVer, aUnit, aDriver, aInfo, (TInt)aType | (aTransferable?KCreateProtectedObject:0) ); }
1.234 +
1.235 +
1.236 +
1.237 +
1.238 +// Class TChar
1.239 +inline TChar::TChar()
1.240 +/**
1.241 +Default constructor.
1.242 +
1.243 +Constructs this character object with an undefined value.
1.244 +*/
1.245 + {}
1.246 +
1.247 +
1.248 +
1.249 +
1.250 +inline TChar::TChar(TUint aChar)
1.251 + : iChar(aChar)
1.252 +/**
1.253 +Constructs this character object and initialises it with the specified value.
1.254 +
1.255 +@param aChar The initialisation value.
1.256 +*/
1.257 + {}
1.258 +
1.259 +
1.260 +
1.261 +
1.262 +inline TChar& TChar::operator-=(TUint aChar)
1.263 +/**
1.264 +Subtracts an unsigned integer value from this character object.
1.265 +
1.266 +This character object is changed by the operation.
1.267 +
1.268 +@param aChar The value to be subtracted.
1.269 +
1.270 +@return A reference to this character object.
1.271 +*/
1.272 + {iChar-=aChar;return(*this);}
1.273 +
1.274 +
1.275 +
1.276 +
1.277 +inline TChar& TChar::operator+=(TUint aChar)
1.278 +/**
1.279 +Adds an unsigned integer value to this character object.
1.280 +
1.281 +This character object is changed by the operation.
1.282 +
1.283 +@param aChar The value to be added.
1.284 +
1.285 +@return A reference to this character object.
1.286 +*/
1.287 + {iChar+=aChar;return(*this);}
1.288 +
1.289 +
1.290 +
1.291 +
1.292 +inline TChar TChar::operator-(TUint aChar)
1.293 +/**
1.294 +Gets the result of subtracting an unsigned integer value from this character
1.295 +object.
1.296 +
1.297 +This character object is not changed.
1.298 +
1.299 +@param aChar The value to be subtracted.
1.300 +
1.301 +@return A character object whose value is the result of the subtraction
1.302 + operation.
1.303 +*/
1.304 + {return(iChar-aChar);}
1.305 +
1.306 +
1.307 +
1.308 +
1.309 +inline TChar TChar::operator+(TUint aChar)
1.310 +/**
1.311 +Gets the result of adding an unsigned integer value to this character object.
1.312 +
1.313 +This character object is not changed.
1.314 +
1.315 +@param aChar The value to be added.
1.316 +
1.317 +@return A character object whose value is the result of the addition operation.
1.318 +*/
1.319 + {return(iChar+aChar);}
1.320 +
1.321 +
1.322 +
1.323 +
1.324 +inline TChar::operator TUint() const
1.325 +/**
1.326 +Gets the value of the character as an unsigned integer.
1.327 +
1.328 +The operator casts a TChar to a TUint, returning the TUint value wrapped by
1.329 +this character object.
1.330 +*/
1.331 + {return(iChar);}
1.332 +
1.333 +
1.334 +
1.335 +
1.336 +// Class TDesC8
1.337 +inline TBool TDesC8::operator<(const TDesC8 &aDes) const
1.338 +/**
1.339 +Determines whether this descriptor's data is less than the specified
1.340 +descriptor's data.
1.341 +
1.342 +The comparison is implemented using the Compare() member function.
1.343 +
1.344 +@param aDes The 8-bit non-modifable descriptor whose data is to be compared
1.345 + with this descriptor's data.
1.346 +
1.347 +@return True if greater than or equal, false otherwise.
1.348 +
1.349 +@see TDesC8::Compare
1.350 +*/
1.351 + {return(Compare(aDes)<0);}
1.352 +
1.353 +
1.354 +
1.355 +
1.356 +inline TBool TDesC8::operator<=(const TDesC8 &aDes) const
1.357 +/**
1.358 +Determines whether this descriptor's data is less than or equal to the
1.359 +specified descriptor's data.
1.360 +
1.361 +The comparison is implemented using the Compare() member function.
1.362 +
1.363 +@param aDes The 8-bit non-modifable descriptor whose data is to be compared
1.364 + with this descriptor's data.
1.365 +
1.366 +@return True if less than or equal, false otherwise.
1.367 +
1.368 +@see TDesC8::Compare
1.369 +*/
1.370 + {return(Compare(aDes)<=0);}
1.371 +
1.372 +
1.373 +
1.374 +
1.375 +inline TBool TDesC8::operator>(const TDesC8 &aDes) const
1.376 +/**
1.377 +Determines whether this descriptor's data is greater than the specified
1.378 +descriptor's data.
1.379 +
1.380 +The comparison is implemented using the Compare() member function.
1.381 +
1.382 +@param aDes The 8-bit non-modifable descriptor whose data is to be compared
1.383 + with this descriptor's data.
1.384 +
1.385 +@return True if greater than, false otherwise.
1.386 +
1.387 +@see TDesC8::Compare
1.388 +*/
1.389 + {return(Compare(aDes)>0);}
1.390 +
1.391 +
1.392 +
1.393 +
1.394 +inline TBool TDesC8::operator>=(const TDesC8 &aDes) const
1.395 +/**
1.396 +Determines whether this descriptor's data is greater than or equal to the
1.397 +specified descriptor's data.
1.398 +
1.399 +The comparison is implemented using the Compare() member function.
1.400 +
1.401 +@param aDes The 8-bit non-modifable descriptor whose data is to be compared
1.402 + with this descriptor's data.
1.403 +
1.404 +@return True if greater than, false otherwise.
1.405 +
1.406 +@see TDesC8::Compare
1.407 +*/
1.408 + {return(Compare(aDes)>=0);}
1.409 +
1.410 +
1.411 +
1.412 +
1.413 +inline TBool TDesC8::operator==(const TDesC8 &aDes) const
1.414 +/**
1.415 +Determines whether this descriptor's data is equal to the specified
1.416 +descriptor's data.
1.417 +
1.418 +The comparison is implemented using the Compare() member function.
1.419 +
1.420 +@param aDes The 8-bit non-modifable descriptor whose data is to be compared
1.421 + with this descriptor's data.
1.422 +
1.423 +@return True if equal, false otherwise.
1.424 +
1.425 +@see TDesC8::Compare
1.426 +*/
1.427 + {return(Compare(aDes)==0);}
1.428 +
1.429 +
1.430 +
1.431 +
1.432 +inline TBool TDesC8::operator!=(const TDesC8 &aDes) const
1.433 +/**
1.434 +Determines whether this descriptor's data is not equal to the specified
1.435 +descriptor's data.
1.436 +
1.437 +The comparison is implemented using the Compare() member function.
1.438 +
1.439 +@param aDes The 8-bit non-modifable descriptor whose data is to be compared
1.440 + with this descriptor's data.
1.441 +
1.442 +@return True if not equal, false otherwise.
1.443 +
1.444 +@see TDesC8::Compare
1.445 +*/
1.446 + {return(Compare(aDes)!=0);}
1.447 +
1.448 +
1.449 +
1.450 +
1.451 +inline const TUint8 &TDesC8::operator[](TInt anIndex) const
1.452 +/**
1.453 +Gets a reference to a single data item within this descriptor's data.
1.454 +
1.455 +@param anIndex The position of the individual data item within the descriptor's
1.456 + data. This is an offset value; a zero value refers to the
1.457 + leftmost data position.
1.458 +
1.459 +@return A reference to the data item.
1.460 +
1.461 +@panic USER 21, if anIndex is negative or greater than or equal to the current
1.462 + length of the descriptor.
1.463 +*/
1.464 + {return(AtC(anIndex));}
1.465 +
1.466 +
1.467 +
1.468 +
1.469 +inline TInt TDesC8::Length() const
1.470 +/**
1.471 +Gets the length of the data.
1.472 +
1.473 +This is the number of 8-bit values or data items represented by the descriptor.
1.474 +
1.475 +@return The length of the data represented by the descriptor.
1.476 +*/
1.477 + {return(iLength&KMaskDesLength8);}
1.478 +
1.479 +
1.480 +
1.481 +
1.482 +inline TInt TDesC8::Size() const
1.483 +/**
1.484 +Gets the size of the data.
1.485 +
1.486 +This is the number of bytes occupied by the data represented by the descriptor.
1.487 +
1.488 +@return The size of the data represented by the descriptor.
1.489 +*/
1.490 + {return(Length());}
1.491 +
1.492 +
1.493 +
1.494 +
1.495 +inline void TDesC8::DoSetLength(TInt aLength)
1.496 + {iLength=(iLength&(~KMaskDesLength8))|aLength;}
1.497 +
1.498 +
1.499 +
1.500 +
1.501 +// Class TPtrC8
1.502 +inline void TPtrC8::Set(const TUint8 *aBuf,TInt aLength)
1.503 +/**
1.504 +Sets the 8-bit non-modifiable pointer descriptor to point to the specified
1.505 +location in memory, whether in RAM or ROM.
1.506 +
1.507 +The length of the descriptor is set to the specified length.
1.508 +
1.509 +@param aBuf A pointer to the location that the descriptor is to represent.
1.510 +@param aLength The length of the descriptor. This value must be non-negative.
1.511 +
1.512 +@panic USER 29, if aLength is negative.
1.513 +*/
1.514 + {new(this) TPtrC8(aBuf,aLength);}
1.515 +
1.516 +
1.517 +
1.518 +
1.519 +inline void TPtrC8::Set(const TDesC8 &aDes)
1.520 +/**
1.521 +Sets the 8-bit non-modifiable pointer descriptor from the specified descriptor.
1.522 +
1.523 +It is set to point to the same data and is given the same length.
1.524 +
1.525 +@param aDes A reference to an 8-bit non-modifiable descriptor.
1.526 +*/
1.527 + {new(this) TPtrC8(aDes);}
1.528 +
1.529 +
1.530 +
1.531 +
1.532 +inline void TPtrC8::Set(const TPtrC8& aPtr)
1.533 +/**
1.534 +Sets the 8-bit non-modifiable pointer descriptor from the specified
1.535 +non-modifiable pointer descriptor.
1.536 +
1.537 +It is set to point to the same data and is given the same length.
1.538 +
1.539 +@param aPtr A reference to an 8-bit non-modifiable pointer descriptor.
1.540 +*/
1.541 + {new(this) TPtrC8(aPtr);}
1.542 +
1.543 +
1.544 +
1.545 +
1.546 +
1.547 +// class TBufCBase8
1.548 +inline TPtr8 TBufCBase8::DoDes(TInt aMaxLength)
1.549 + {return TPtr8(*this,aMaxLength);}
1.550 +
1.551 +
1.552 +
1.553 +
1.554 +// Template class TBufC8
1.555 +template <TInt S>
1.556 +inline TBufC8<S>::TBufC8()
1.557 + : TBufCBase8()
1.558 +/**
1.559 +Constructs an empty 8-bit non-modifiable buffer descriptor.
1.560 +
1.561 +It contains no data.
1.562 +
1.563 +The integer template parameter determines the size of the data area which
1.564 +is created as part of the buffer descriptor object.
1.565 +
1.566 +Data can, subsequently, be assigned into this buffer descriptor using the
1.567 +assignment operators.
1.568 +
1.569 +@see TBufC8::operator=
1.570 +*/
1.571 + {}
1.572 +
1.573 +
1.574 +
1.575 +
1.576 +template <TInt S>
1.577 +inline TBufC8<S>::TBufC8(const TUint8 *aString)
1.578 + : TBufCBase8(aString,S)
1.579 +/**
1.580 +Constructs the 8-bit non-modifiable buffer descriptor from a zero terminated
1.581 +string.
1.582 +
1.583 +The integer template parameter determines the size of the data area which
1.584 +is created as part of this object.
1.585 +
1.586 +The string, excluding the zero terminator, is copied into this buffer descriptor's
1.587 +data area. The length of this buffer descriptor is set to the length of the
1.588 +string, excluding the zero terminator.
1.589 +
1.590 +@param aString A pointer to a zero terminated string.
1.591 +
1.592 +@panic USER 20, if the length of the string, excluding the zero terminator, is
1.593 + greater than the value of the integer template parameter.
1.594 +*/
1.595 + {}
1.596 +
1.597 +
1.598 +
1.599 +
1.600 +template <TInt S>
1.601 +inline TBufC8<S>::TBufC8(const TDesC8 &aDes)
1.602 + : TBufCBase8(aDes,S)
1.603 +/**
1.604 +Constructs the 8-bit non-modifiable buffer descriptor from any
1.605 +existing descriptor.
1.606 +
1.607 +The integer template parameter determines the size of the data area which
1.608 +is created as part of this object.
1.609 +
1.610 +Data is copied from the source descriptor into this buffer descriptor and
1.611 +the length of this buffer descriptor is set to the length of the
1.612 +source descriptor.
1.613 +
1.614 +@param aDes The source 8-bit non-modifiable descriptor.
1.615 +
1.616 +@panic USER 20, if the length of the source descriptor is
1.617 + greater than the value of the integer template parameter.
1.618 +*/
1.619 + {}
1.620 +
1.621 +
1.622 +
1.623 +
1.624 +template <TInt S>
1.625 +inline TBufC8<S> &TBufC8<S>::operator=(const TUint8 *aString)
1.626 +/**
1.627 +Copies data into this descriptor, replacing any existing data.
1.628 +
1.629 +The length of this descriptor is set to reflect the new data.
1.630 +
1.631 +@param aString A pointer to a zero-terminated string.
1.632 +
1.633 +@return A reference to this descriptor.
1.634 +
1.635 +@panic USER 23, if the length of the string, excluding the zero terminator, is
1.636 + greater than the maximum length of this (target) descriptor.
1.637 +*/
1.638 + {Copy(aString,S);return(*this);}
1.639 +
1.640 +
1.641 +
1.642 +
1.643 +template <TInt S>
1.644 +inline TBufC8<S> &TBufC8<S>::operator=(const TDesC8 &aDes)
1.645 +/**
1.646 +Copies data into this descriptor, replacing any existing data.
1.647 +
1.648 +The length of this descriptor is set to reflect the new data.
1.649 +
1.650 +@param aDes An 8-bit non-modifiable descriptor.
1.651 +
1.652 +@return A reference to this descriptor.
1.653 +
1.654 +@panic USER 23, if the length of the descriptor aDes is
1.655 + greater than the maximum length of this (target) descriptor.
1.656 +*/
1.657 + {Copy(aDes,S);return(*this);}
1.658 +
1.659 +
1.660 +
1.661 +
1.662 +template <TInt S>
1.663 +inline TPtr8 TBufC8<S>::Des()
1.664 +/**
1.665 +Creates and returns an 8-bit modifiable pointer descriptor for the data
1.666 +represented by this 8-bit non-modifiable buffer descriptor.
1.667 +
1.668 +The content of a non-modifiable buffer descriptor normally cannot be altered,
1.669 +other than by complete replacement of the data. Creating a modifiable pointer
1.670 +descriptor provides a way of changing the data.
1.671 +
1.672 +The modifiable pointer descriptor is set to point to this non-modifiable buffer
1.673 +descriptor's data.
1.674 +
1.675 +The length of the modifiable pointer descriptor is set to the length of this
1.676 +non-modifiable buffer descriptor.
1.677 +
1.678 +The maximum length of the modifiable pointer descriptor is set to the value
1.679 +of the integer template parameter.
1.680 +
1.681 +When data is modified through this new pointer descriptor, the lengths of
1.682 +both it and this constant buffer descriptor are changed.
1.683 +
1.684 +@return An 8-bit modifiable pointer descriptor representing the data in this
1.685 + 8-bit non-modifiable buffer descriptor.
1.686 +*/
1.687 + {return DoDes(S);}
1.688 +
1.689 +
1.690 +
1.691 +
1.692 +#ifndef __KERNEL_MODE__
1.693 +// Class HBufC8
1.694 +inline HBufC8 &HBufC8::operator=(const HBufC8 &aLcb)
1.695 +/**
1.696 +Copies data into this 8-bit heap descriptor replacing any existing data.
1.697 +
1.698 +The length of this descriptor is set to reflect the new data.
1.699 +
1.700 +Note that the maximum length of this (target) descriptor is the length
1.701 +of the descriptor buffer in the allocated host heap cell; this may be greater
1.702 +than the maximum length specified when this descriptor was created or
1.703 +last re-allocated.
1.704 +
1.705 +@param aLcb The source 8-bit heap descriptor.
1.706 +
1.707 +@return A reference to this 8-bit heap descriptor.
1.708 +
1.709 +@panic USER 23, if the length of the descriptor aLcb is greater than the
1.710 + maximum length of this (target) descriptor
1.711 +*/
1.712 + {return *this=static_cast<const TDesC8&>(aLcb);}
1.713 +
1.714 +
1.715 +
1.716 +
1.717 +// Class RBuf8
1.718 +inline RBuf8& RBuf8::operator=(const TUint8* aString)
1.719 +/**
1.720 +Copies data into this descriptor replacing any existing data.
1.721 +
1.722 +The length of this descriptor is set to reflect the new data.
1.723 +
1.724 +@param aString A pointer to a zero-terminated string.
1.725 +
1.726 +@return A reference to this, the target descriptor.
1.727 +
1.728 +@panic USER 11, if the length of the string, excluding the zero terminator, is
1.729 + greater than the maximum length of this (target) descriptor.
1.730 +*/
1.731 + {Copy(aString);return(*this);}
1.732 +
1.733 +
1.734 +
1.735 +
1.736 +inline RBuf8& RBuf8::operator=(const TDesC8& aDes)
1.737 +/**
1.738 +Copies data into this descriptor replacing any existing data.
1.739 +
1.740 +The length of this descriptor is set to reflect the new data.
1.741 +
1.742 +@param aDes An 8-bit non-modifiable descriptor.
1.743 +
1.744 +@return A reference to this, the target descriptor.
1.745 +
1.746 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.747 + maximum length of this (target) descriptor.
1.748 +*/
1.749 + {Copy(aDes);return(*this);}
1.750 +
1.751 +
1.752 +
1.753 +
1.754 +inline RBuf8& RBuf8::operator=(const RBuf8& aDes)
1.755 +/**
1.756 +Copies data into this descriptor replacing any existing data.
1.757 +
1.758 +The length of this descriptor is set to reflect the new data.
1.759 +
1.760 +@param aDes A 8-bit buffer descriptor.
1.761 +
1.762 +@return A reference to this, the target descriptor.
1.763 +
1.764 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.765 + maximum length of this (target) descriptor.
1.766 +*/
1.767 + {Copy(aDes);return(*this);}
1.768 +
1.769 +
1.770 +
1.771 +
1.772 +/**
1.773 +Creates an 8-bit resizable buffer descriptor that has been initialised with
1.774 +data from the specified read stream; leaves on failure.
1.775 +
1.776 +Data is assigned to the new descriptor from the specified stream.
1.777 +This variant assumes that the stream contains the length of the data followed
1.778 +by the data itself.
1.779 +
1.780 +The function is implemented by calling the HBufC8::NewL(RReadStream&,TInt)
1.781 +variant and then assigning the resulting heap descriptor using
1.782 +the RBuf8::Assign(HBufC8*) variant. The comments that describe
1.783 +the HBufC8::NewL() variant also apply to this RBuf8::CreateL() function.
1.784 +
1.785 +The function may leave with one of the system-wide error codes, specifically
1.786 +KErrOverflow, if the length of the data as read from the stream is greater than
1.787 +the upper limit as specified by the aMaxLength parameter.
1.788 +
1.789 +@param aStream The stream from which the data length and the data to be
1.790 + assigned to the new descriptor, are taken.
1.791 +@param aMaxLength The upper limit on the length of data that the descriptor is
1.792 + to represent. The value of this parameter must be non-negative
1.793 + otherwise the underlying function will panic.
1.794 +*/
1.795 +inline void RBuf8::CreateL(RReadStream &aStream,TInt aMaxLength)
1.796 + {
1.797 + Assign(HBufC8::NewL(aStream,aMaxLength));
1.798 + }
1.799 +#endif
1.800 +
1.801 +
1.802 +
1.803 +
1.804 +// Class TDes8
1.805 +inline TDes8 &TDes8::operator=(const TUint8 *aString)
1.806 +/**
1.807 +Copies data into this descriptor replacing any existing data.
1.808 +
1.809 +The length of this descriptor is set to reflect the new data.
1.810 +
1.811 +@param aString A pointer to a zero-terminated string.
1.812 +
1.813 +@return A reference to this, the target descriptor.
1.814 +
1.815 +@panic USER 23, if the length of the string, excluding the zero terminator, is
1.816 + greater than the maximum length of this (target) descriptor.
1.817 +*/
1.818 + {Copy(aString);return(*this);}
1.819 +
1.820 +
1.821 +
1.822 +
1.823 +inline TDes8 &TDes8::operator=(const TDesC8 &aDes)
1.824 +/**
1.825 +Copies data into this descriptor replacing any existing data.
1.826 +
1.827 +The length of this descriptor is set to reflect the new data.
1.828 +
1.829 +@param aDes An 8-bit non-modifiable descriptor.
1.830 +
1.831 +@return A reference to this, the target descriptor.
1.832 +
1.833 +@panic USER 23, if the length of the descriptor aDes is greater than the
1.834 + maximum length of this (target) descriptor.
1.835 +*/
1.836 + {Copy(aDes);return(*this);}
1.837 +
1.838 +
1.839 +
1.840 +
1.841 +inline TDes8 &TDes8::operator=(const TDes8 &aDes)
1.842 +/**
1.843 +Copies data into this descriptor replacing any existing data.
1.844 +
1.845 +The length of this descriptor is set to reflect the new data.
1.846 +
1.847 +@param aDes An 8-bit modifiable descriptor.
1.848 +
1.849 +@return A reference to this, the target descriptor.
1.850 +
1.851 +@panic USER 23, if the length of the descriptor aDes is greater than the
1.852 + maximum length of this (target) descriptor.
1.853 +*/
1.854 + {Copy(aDes);return(*this);}
1.855 +
1.856 +
1.857 +
1.858 +
1.859 +inline TDes8 &TDes8::operator+=(const TDesC8 &aDes)
1.860 +/**
1.861 +Appends data onto the end of this descriptor's data and returns a reference
1.862 +to this descriptor.
1.863 +
1.864 +The length of this descriptor is incremented to reflect the new content.
1.865 +
1.866 +@param aDes An-8 bit non-modifiable descriptor whose data is to be appended.
1.867 +
1.868 +@return A reference to this descriptor.
1.869 +
1.870 +@panic USER 23, if the resulting length of this descriptor is greater than its
1.871 + maximum length.
1.872 +*/
1.873 + {Append(aDes);return(*this);}
1.874 +
1.875 +
1.876 +
1.877 +
1.878 +inline const TUint8 &TDes8::operator[](TInt anIndex) const
1.879 +/**
1.880 +Gets a const reference to a single data item within this descriptor's data.
1.881 +
1.882 +@param anIndex The position of the data item within this descriptor's data.
1.883 + This is an offset value; a zero value refers to the leftmost
1.884 + data position.
1.885 +
1.886 +@return A const reference to the data item at the specified position.
1.887 +
1.888 +@panic USER 21, if anIndex is negative or is greater than or equal to the
1.889 + current length of this descriptor.
1.890 +*/
1.891 + {return(AtC(anIndex));}
1.892 +
1.893 +
1.894 +
1.895 +
1.896 +inline TUint8 &TDes8::operator[](TInt anIndex)
1.897 +/**
1.898 +Gets a non-const reference to a single data item within this descriptor's
1.899 +data.
1.900 +
1.901 +@param anIndex The position of the data item within this descriptor's data.
1.902 + This is an offset value; a zero value refers to the leftmost
1.903 + data position.
1.904 +
1.905 +@return A non-const reference to the data item at the specified position.
1.906 +
1.907 +@panic USER 21, if anIndex is negative or is greater than or equal to the
1.908 + current length of this descriptor.
1.909 +*/
1.910 + {return((TUint8 &)AtC(anIndex));}
1.911 +
1.912 +
1.913 +
1.914 +
1.915 +inline TInt TDes8::MaxLength() const
1.916 +/**
1.917 +Gets the maximum length of the descriptor.
1.918 +
1.919 +This is the upper limit for the number of 8-bit values or data items that
1.920 +the descriptor can represent.
1.921 +
1.922 +@return The maximum length of data that the descriptor can represent.
1.923 +*/
1.924 + {return(iMaxLength);}
1.925 +
1.926 +
1.927 +
1.928 +
1.929 +inline TInt TDes8::MaxSize() const
1.930 +/**
1.931 +Gets the maximum size of the descriptor.
1.932 +
1.933 +This is the upper limit for the number of bytes which the data represented by
1.934 +the descriptor can occupy.
1.935 +
1.936 +@return The maximum size of the descriptor data.
1.937 +*/
1.938 + {return(iMaxLength);}
1.939 +
1.940 +
1.941 +
1.942 +
1.943 +inline TUint8 * TDes8::WPtr() const
1.944 + {return((TUint8 *)Ptr());}
1.945 +
1.946 +
1.947 +
1.948 +
1.949 +// Class TPtr8
1.950 +inline TPtr8 &TPtr8::operator=(const TUint8 *aString)
1.951 +/**
1.952 +Copies data into this 8-bit modifiable pointer descriptor replacing any
1.953 +existing data.
1.954 +
1.955 +The length of this descriptor is set to reflect the new data.
1.956 +
1.957 +@param aString A pointer to a zero-terminated string.
1.958 +
1.959 +@return A reference to this 8-bit modifiable pointer descriptor.
1.960 +
1.961 +@panic USER 23, if the length of the string, excluding the zero terminator, is
1.962 + greater than the maximum length of this descriptor.
1.963 +*/
1.964 + {Copy(aString);return(*this);}
1.965 +
1.966 +
1.967 +
1.968 +
1.969 +inline TPtr8 &TPtr8::operator=(const TDesC8 &aDes)
1.970 +/**
1.971 +Copies data into this 8-bit modifiable pointer descriptor replacing any
1.972 +existing data.
1.973 +
1.974 +The length of this descriptor is set to reflect the new data.
1.975 +
1.976 +@param aDes An 8-bit modifiable pointer descriptor whose data is to be copied
1.977 + into this descriptor.
1.978 +
1.979 +@return A reference to this 8-bit modifiable pointer descriptor.
1.980 +
1.981 +@panic USER 23, if the length of aDes is greater than the maximum
1.982 + length of this descriptor.
1.983 +*/
1.984 + {Copy(aDes);return(*this);}
1.985 +
1.986 +
1.987 +
1.988 +
1.989 +inline TPtr8 &TPtr8::operator=(const TPtr8 &aDes)
1.990 +/**
1.991 +Copies data into this 8-bit modifiable pointer descriptor replacing any
1.992 +existing data.
1.993 +
1.994 +The length of this descriptor is set to reflect the new data.
1.995 +
1.996 +@param aDes An 8-bit modifiable pointer descriptor whose data is to be copied
1.997 + into this descriptor.
1.998 +
1.999 +@return A reference to this 8-bit modifiable pointer descriptor.
1.1000 +
1.1001 +@panic USER 23, if the length of aDes is greater than the maximum
1.1002 + length of this descriptor.
1.1003 +*/
1.1004 + {Copy(aDes);return(*this);}
1.1005 +
1.1006 +
1.1007 +
1.1008 +
1.1009 +inline void TPtr8::Set(TUint8 *aBuf,TInt aLength,TInt aMaxLength)
1.1010 +/**
1.1011 +Sets the 8-bit modifiable pointer descriptor to point to the specified location
1.1012 +in memory, whether in RAM or ROM.
1.1013 +
1.1014 +The length of the descriptor and its maximum length are set to the specified
1.1015 +values.
1.1016 +
1.1017 +@param aBuf A pointer to the location that the descriptor is to represent.
1.1018 +@param aLength The length of the descriptor.
1.1019 +@param aMaxLength The maximum length of the descriptor.
1.1020 +
1.1021 +@panic USER 20, if aLength is negative or is greater than the maximum length of
1.1022 + this descriptor.
1.1023 +@panic USER 30, if aMaxLength is negative.
1.1024 +*/
1.1025 + {new(this) TPtr8(aBuf,aLength,aMaxLength);}
1.1026 +
1.1027 +
1.1028 +
1.1029 +
1.1030 +inline void TPtr8::Set(const TPtr8 &aPtr)
1.1031 +/**
1.1032 +Sets the 8-bit modifiable pointer descriptor from an existing 8-bit modifiable
1.1033 +pointer descriptor.
1.1034 +
1.1035 +It is set to point to the same data, is given the same length and the same
1.1036 +maximum length as the source pointer descriptor.
1.1037 +
1.1038 +@param aPtr The source 8-bit modifiable pointer descriptor.
1.1039 +*/
1.1040 + {new(this) TPtr8(aPtr);}
1.1041 +
1.1042 +
1.1043 +
1.1044 +
1.1045 +// Template class TBuf8
1.1046 +template <TInt S>
1.1047 +inline TBuf8<S>::TBuf8()
1.1048 + : TBufBase8(S)
1.1049 +/**
1.1050 +Constructs an empty 8-bit modifiable buffer descriptor.
1.1051 +
1.1052 +It contains no data.
1.1053 +
1.1054 +The integer template parameter determines the size of the data area that is created
1.1055 +as part of the object, and defines the descriptor's maximum length.
1.1056 +*/
1.1057 + {}
1.1058 +
1.1059 +
1.1060 +
1.1061 +
1.1062 +template <TInt S>
1.1063 +inline TBuf8<S>::TBuf8(TInt aLength)
1.1064 + : TBufBase8(aLength,S)
1.1065 +/**
1.1066 +Constructs an empty 8-bit modifiable buffer descriptor and sets the its length
1.1067 +to the specified value.
1.1068 +
1.1069 +No data is assigned to the descriptor.
1.1070 +
1.1071 +The integer template parameter determines the size of the data area that is created
1.1072 +as part of the object, and defines the descriptor's maximum length.
1.1073 +
1.1074 +@param aLength The length of this modifiable buffer descriptor.
1.1075 +
1.1076 +@panic USER 20, if aLength is negative or is greater than the
1.1077 + value of the integer template parameter.
1.1078 +*/
1.1079 + {}
1.1080 +
1.1081 +
1.1082 +
1.1083 +
1.1084 +template <TInt S>
1.1085 +inline TBuf8<S>::TBuf8(const TUint8 *aString)
1.1086 + : TBufBase8(aString,S)
1.1087 +/**
1.1088 +Constructs the 8-bit modifiable buffer descriptor from a
1.1089 +zero terminated string.
1.1090 +
1.1091 +The integer template parameter determines the size of the data area that
1.1092 +is created as part of the object, and defines the descriptor's maximum length.
1.1093 +
1.1094 +The string, excluding the zero terminator, is copied into this buffer
1.1095 +descriptor's data area. The length of this buffer descriptor is set to the
1.1096 +length of the string, excluding the zero terminator.
1.1097 +
1.1098 +@param aString A pointer to a zero terminated string.
1.1099 +
1.1100 +@panic USER 23, if the length of the string, excluding the zero terminator,
1.1101 + is greater than the value of the integer template parameter.
1.1102 +*/
1.1103 + {}
1.1104 +
1.1105 +
1.1106 +
1.1107 +
1.1108 +template <TInt S>
1.1109 +inline TBuf8<S>::TBuf8(const TDesC8 &aDes)
1.1110 + : TBufBase8(aDes,S)
1.1111 +/**
1.1112 +Constructs the 8-bit modifiable buffer descriptor from any existing
1.1113 +8-bit descriptor.
1.1114 +
1.1115 +The integer template parameter determines the size of the data area created
1.1116 +as part of this object and defines the descriptor's maximum length.
1.1117 +
1.1118 +Data is copied from the source descriptor into this modifiable buffer
1.1119 +descriptor and the length of this modifiable buffer descriptor is set to
1.1120 +the length of the source descriptor.
1.1121 +
1.1122 +@param aDes The source 8-bit non-modifiable descriptor.
1.1123 +
1.1124 +@panic USER 23, if the length of the source descriptor is greater than the
1.1125 + value of the integer template parameter.
1.1126 +*/
1.1127 + {}
1.1128 +
1.1129 +
1.1130 +
1.1131 +
1.1132 +template <TInt S>
1.1133 +inline TBuf8<S> &TBuf8<S>::operator=(const TUint8 *aString)
1.1134 +/**
1.1135 +Copies data into this 8-bit modifiable buffer descriptor, replacing any
1.1136 +existing data.
1.1137 +
1.1138 +The length of this descriptor is set to reflect the new data.
1.1139 +
1.1140 +@param aString A pointer to a zero-terminated string.
1.1141 +
1.1142 +@return A reference to this 8-bit modifiable buffer descriptor.
1.1143 +
1.1144 +@panic USER 23, if the length of the string, excluding the zero terminator,
1.1145 + is greater than the maximum length of this (target) descriptor.
1.1146 +*/
1.1147 + {Copy(aString);return(*this);}
1.1148 +
1.1149 +
1.1150 +
1.1151 +
1.1152 +template <TInt S>
1.1153 +inline TBuf8<S> &TBuf8<S>::operator=(const TDesC8 &aDes)
1.1154 +/**
1.1155 +Copies data into this 8-bit modifiable buffer descriptor, replacing any
1.1156 +existing data.
1.1157 +
1.1158 +The length of this descriptor is set to reflect the new data.
1.1159 +
1.1160 +@param aDes An 8 bit non-modifiable descriptor.
1.1161 +
1.1162 +@return A reference to this 8-bit modifiable buffer descriptor.
1.1163 +
1.1164 +@panic USER 23, if the length of the descriptor aDes is greater than the
1.1165 + maximum length of this (target) descriptor.
1.1166 +*/
1.1167 + {Copy(aDes);return(*this);}
1.1168 +
1.1169 +
1.1170 +
1.1171 +
1.1172 +template <TInt S>
1.1173 +inline TBuf8<S>& TBuf8<S>::operator=(const TBuf8<S>& aBuf)
1.1174 +/**
1.1175 +Copies data into this 8-bit modifiable buffer descriptor replacing any
1.1176 +existing data.
1.1177 +
1.1178 +The length of this descriptor is set to reflect the new data.
1.1179 +
1.1180 +@param aBuf The source 8-bit modifiable buffer descriptor with the same
1.1181 + template value.
1.1182 +
1.1183 +@return A reference to this 8-bit modifiable buffer descriptor.
1.1184 +*/
1.1185 + {Copy(aBuf);return *this;}
1.1186 +
1.1187 +
1.1188 +
1.1189 +
1.1190 +// Template class TAlignedBuf8
1.1191 +template <TInt S>
1.1192 +inline TAlignedBuf8<S>::TAlignedBuf8()
1.1193 + : TBufBase8(S)
1.1194 +/**
1.1195 +Constructs an empty 8-bit modifiable buffer descriptor.
1.1196 +
1.1197 +It contains no data.
1.1198 +
1.1199 +The integer template parameter determines the size of the data area that is created
1.1200 +as part of the object, and defines the descriptor's maximum length.
1.1201 +*/
1.1202 + {}
1.1203 +
1.1204 +
1.1205 +
1.1206 +
1.1207 +template <TInt S>
1.1208 +inline TAlignedBuf8<S>::TAlignedBuf8(TInt aLength)
1.1209 + : TBufBase8(aLength,S)
1.1210 +/**
1.1211 +Constructs an empty 8-bit modifiable buffer descriptor and sets the its length
1.1212 +to the specified value.
1.1213 +
1.1214 +No data is assigned to the descriptor.
1.1215 +
1.1216 +The integer template parameter determines the size of the data area that is created
1.1217 +as part of the object, and defines the descriptor's maximum length.
1.1218 +
1.1219 +@param aLength The length of this modifiable buffer descriptor.
1.1220 +
1.1221 +@panic USER 20, if aLength is negative or is greater than the
1.1222 + value of the integer template parameter.
1.1223 +*/
1.1224 + {}
1.1225 +
1.1226 +
1.1227 +
1.1228 +
1.1229 +template <TInt S>
1.1230 +inline TAlignedBuf8<S>::TAlignedBuf8(const TUint8 *aString)
1.1231 + : TBufBase8(aString,S)
1.1232 +/**
1.1233 +Constructs the 8-bit modifiable buffer descriptor from a
1.1234 +zero terminated string.
1.1235 +
1.1236 +The integer template parameter determines the size of the data area that
1.1237 +is created as part of the object, and defines the descriptor's maximum length.
1.1238 +
1.1239 +The string, excluding the zero terminator, is copied into this buffer
1.1240 +descriptor's data area. The length of this buffer descriptor is set to the
1.1241 +length of the string, excluding the zero terminator.
1.1242 +
1.1243 +@param aString A pointer to a zero terminated string.
1.1244 +
1.1245 +@panic USER 23, if the length of the string, excluding the zero terminator,
1.1246 + is greater than the value of the integer template parameter.
1.1247 +*/
1.1248 + {}
1.1249 +
1.1250 +
1.1251 +
1.1252 +
1.1253 +template <TInt S>
1.1254 +inline TAlignedBuf8<S>::TAlignedBuf8(const TDesC8 &aDes)
1.1255 + : TBufBase8(aDes,S)
1.1256 +/**
1.1257 +Constructs the 8-bit modifiable buffer descriptor from any existing
1.1258 +8-bit descriptor.
1.1259 +
1.1260 +The integer template parameter determines the size of the data area created
1.1261 +as part of this object and defines the descriptor's maximum length.
1.1262 +
1.1263 +Data is copied from the source descriptor into this modifiable buffer
1.1264 +descriptor and the length of this modifiable buffer descriptor is set to
1.1265 +the length of the source descriptor.
1.1266 +
1.1267 +@param aDes The source 8-bit non-modifiable descriptor.
1.1268 +
1.1269 +@panic USER 23, if the length of the source descriptor is greater than the
1.1270 + value of the integer template parameter.
1.1271 +*/
1.1272 + {}
1.1273 +
1.1274 +
1.1275 +
1.1276 +
1.1277 +template <TInt S>
1.1278 +inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TUint8 *aString)
1.1279 +/**
1.1280 +Copies data into this 8-bit modifiable buffer descriptor, replacing any
1.1281 +existing data.
1.1282 +
1.1283 +The length of this descriptor is set to reflect the new data.
1.1284 +
1.1285 +@param aString A pointer to a zero-terminated string.
1.1286 +
1.1287 +@return A reference to this 8-bit modifiable buffer descriptor.
1.1288 +
1.1289 +@panic USER 23, if the length of the string, excluding the zero terminator,
1.1290 + is greater than the maximum length of this (target) descriptor.
1.1291 +*/
1.1292 + {Copy(aString);return(*this);}
1.1293 +
1.1294 +
1.1295 +
1.1296 +
1.1297 +template <TInt S>
1.1298 +inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TDesC8 &aDes)
1.1299 +/**
1.1300 +Copies data into this 8-bit modifiable buffer descriptor, replacing any
1.1301 +existing data.
1.1302 +
1.1303 +The length of this descriptor is set to reflect the new data.
1.1304 +
1.1305 +@param aDes An 8 bit non-modifiable descriptor.
1.1306 +
1.1307 +@return A reference to this 8-bit modifiable buffer descriptor.
1.1308 +
1.1309 +@panic USER 23, if the length of the descriptor aDes is greater than the
1.1310 + maximum length of this (target) descriptor.
1.1311 +*/
1.1312 + {Copy(aDes);return(*this);}
1.1313 +
1.1314 +
1.1315 +
1.1316 +
1.1317 +template <TInt S>
1.1318 +inline TAlignedBuf8<S>& TAlignedBuf8<S>::operator=(const TAlignedBuf8<S>& aBuf)
1.1319 +/**
1.1320 +Copies data into this 8-bit modifiable buffer descriptor replacing any
1.1321 +existing data.
1.1322 +
1.1323 +The length of this descriptor is set to reflect the new data.
1.1324 +
1.1325 +@param aBuf The source 8-bit modifiable buffer descriptor with the same
1.1326 + template value.
1.1327 +
1.1328 +@return A reference to this 8-bit modifiable buffer descriptor.
1.1329 +*/
1.1330 + {Copy(aBuf);return *this;}
1.1331 +
1.1332 +
1.1333 +
1.1334 +
1.1335 +// Template class TLitC8
1.1336 +template <TInt S>
1.1337 +inline const TDesC8* TLitC8<S>::operator&() const
1.1338 +/**
1.1339 +Returns a const TDesC8 type pointer.
1.1340 +
1.1341 +@return A descriptor type pointer to this literal.
1.1342 +*/
1.1343 + {return REINTERPRET_CAST(const TDesC8*,this);}
1.1344 +
1.1345 +
1.1346 +
1.1347 +
1.1348 +template <TInt S>
1.1349 +inline const TDesC8& TLitC8<S>::operator()() const
1.1350 +/**
1.1351 +Returns a const TDesC8 type reference.
1.1352 +
1.1353 +@return A descriptor type reference to this literal
1.1354 +*/
1.1355 + {return *operator&();}
1.1356 +
1.1357 +
1.1358 +
1.1359 +
1.1360 +template <TInt S>
1.1361 +inline TLitC8<S>::operator const TDesC8&() const
1.1362 +/**
1.1363 +Invoked by the compiler when a TLitC8<TInt> type is passed to a function
1.1364 +which is prototyped to take a const TDesC8& type.
1.1365 +*/
1.1366 + {return *operator&();}
1.1367 +
1.1368 +
1.1369 +
1.1370 +template <TInt S>
1.1371 +inline TLitC8<S>::operator const __TRefDesC8() const
1.1372 +/**
1.1373 +Invoked by the compiler when a TLitC8<TInt> type is passed to a function
1.1374 +which is prototyped to take a const TRefByValue<const TDesC8> type.
1.1375 +
1.1376 +@see __TRefDesC8
1.1377 +*/
1.1378 + {return *operator&();}
1.1379 +
1.1380 +
1.1381 +
1.1382 +
1.1383 +#ifndef __KERNEL_MODE__
1.1384 +// Class TDesC16
1.1385 +inline TBool TDesC16::operator<(const TDesC16 &aDes) const
1.1386 +/**
1.1387 +Determines whether this descriptor's data is less than the specified descriptor's
1.1388 +data.
1.1389 +
1.1390 +The comparison is implemented using the Compare() member function.
1.1391 +
1.1392 +@param aDes The 16-bit non-modifable descriptor whose data is to be compared
1.1393 + with this descriptor's data.
1.1394 +
1.1395 +@return True if less than, false otherwise.
1.1396 +
1.1397 +@see TDesC16::Compare
1.1398 +*/
1.1399 + {return(Compare(aDes)<0);}
1.1400 +
1.1401 +
1.1402 +
1.1403 +
1.1404 +inline TBool TDesC16::operator<=(const TDesC16 &aDes) const
1.1405 +/**
1.1406 +Determines whether this descriptor's data is less than or equal
1.1407 +to the specified descriptor's data.
1.1408 +
1.1409 +The comparison is implemented using the Compare() member function.
1.1410 +
1.1411 +@param aDes The 16-bit non- modifiable descriptor whose data is to be compared
1.1412 + with this descriptor's data.
1.1413 +
1.1414 +@return True if less than or equal, false otherwise.
1.1415 +
1.1416 +@see TDesC16::Compare
1.1417 +*/
1.1418 + {return(Compare(aDes)<=0);}
1.1419 +
1.1420 +
1.1421 +
1.1422 +
1.1423 +inline TBool TDesC16::operator>(const TDesC16 &aDes) const
1.1424 +/**
1.1425 +Determines whether this descriptor's data is greater than the specified
1.1426 +descriptor's data.
1.1427 +
1.1428 +The comparison is implemented using the Compare() member function.
1.1429 +
1.1430 +@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1.1431 + with this descriptor's data.
1.1432 +
1.1433 +@return True if greater than, false otherwise.
1.1434 +
1.1435 +@see TDesC16::Compare
1.1436 +*/
1.1437 + {return(Compare(aDes)>0);}
1.1438 +
1.1439 +
1.1440 +
1.1441 +
1.1442 +inline TBool TDesC16::operator>=(const TDesC16 &aDes) const
1.1443 +/**
1.1444 +Determines whether this descriptor's data is greater than or equal to the
1.1445 +specified descriptor's data.
1.1446 +
1.1447 +The comparison is implemented using the Compare() member function.
1.1448 +
1.1449 +@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1.1450 + with this descriptor's data.
1.1451 +
1.1452 +@return True if greater than or equal, false otherwise.
1.1453 +
1.1454 +@see TDesC16::Compare
1.1455 +*/
1.1456 + {return(Compare(aDes)>=0);}
1.1457 +
1.1458 +
1.1459 +
1.1460 +
1.1461 +inline TBool TDesC16::operator==(const TDesC16 &aDes) const
1.1462 +/**
1.1463 +Determines whether this descriptor's data is equal to the specified
1.1464 +descriptor's data.
1.1465 +
1.1466 +The comparison is implemented using the Compare() member function.
1.1467 +
1.1468 +@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1.1469 + with this descriptor's data.
1.1470 +
1.1471 +@return True if equal, false otherwise.
1.1472 +
1.1473 +@see TDesC16::Compare
1.1474 +*/
1.1475 + {return(Compare(aDes)==0);}
1.1476 +
1.1477 +
1.1478 +
1.1479 +
1.1480 +inline TBool TDesC16::operator!=(const TDesC16 &aDes) const
1.1481 +/**
1.1482 +Determines whether this descriptor's data is not equal to the specified
1.1483 +descriptor's data.
1.1484 +
1.1485 +The comparison is implemented using the Compare() member function.
1.1486 +
1.1487 +@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1.1488 + with this descriptor's data.
1.1489 +
1.1490 +@return True if not equal, false otherwise.
1.1491 +
1.1492 +@see TDesC16::Compare
1.1493 +*/
1.1494 + {return(Compare(aDes)!=0);}
1.1495 +
1.1496 +
1.1497 +
1.1498 +
1.1499 +inline const TUint16 &TDesC16::operator[](TInt anIndex) const
1.1500 +/**
1.1501 +Gets a reference to a single data item within this descriptor's data.
1.1502 +
1.1503 +@param anIndex The position of the individual data item within the descriptor's
1.1504 + data. This is an offset value; a zero value refers to the
1.1505 + leftmost data position.
1.1506 +
1.1507 +@return A reference to the data item.
1.1508 +
1.1509 +@panic USER 9, if anIndex is negative or greater than or equal to the current
1.1510 + length of the descriptor.
1.1511 +*/
1.1512 + {return(AtC(anIndex));}
1.1513 +
1.1514 +
1.1515 +
1.1516 +
1.1517 +inline TInt TDesC16::Length() const
1.1518 +/**
1.1519 +Gets the length of the data.
1.1520 +
1.1521 +This is the number of 16-bit values or data items represented by the descriptor.
1.1522 +
1.1523 +@return The length of the data represented by the descriptor.
1.1524 +*/
1.1525 + {return(iLength&KMaskDesLength16);}
1.1526 +
1.1527 +
1.1528 +
1.1529 +
1.1530 +inline TInt TDesC16::Size() const
1.1531 +/**
1.1532 +Gets the size of the data.
1.1533 +
1.1534 +This is the number of bytes occupied by the data represented by the descriptor.
1.1535 +
1.1536 +@return The size of the data represented by the descriptor. This is always
1.1537 + twice the length.
1.1538 + */
1.1539 + {return(Length()<<1);}
1.1540 +
1.1541 +
1.1542 +
1.1543 +
1.1544 +inline void TDesC16::DoSetLength(TInt aLength)
1.1545 + {iLength=(iLength&(~KMaskDesLength16))|aLength;}
1.1546 +
1.1547 +
1.1548 +
1.1549 +
1.1550 +// Class TPtrC16
1.1551 +inline void TPtrC16::Set(const TUint16 *aBuf,TInt aLength)
1.1552 +/**
1.1553 +Sets the 16-bit non-modifiable pointer descriptor to point to the specified
1.1554 +location in memory, whether in RAM or ROM.
1.1555 +
1.1556 +The length of the descriptor is set to the specified length.
1.1557 +
1.1558 +@param aBuf A pointer to the location that the descriptor is to represent.
1.1559 +@param aLength The length of the descriptor. This value must be non-negative
1.1560 +
1.1561 +@panic USER 17, if aLength is negative.
1.1562 +*/
1.1563 + {new(this) TPtrC16(aBuf,aLength);}
1.1564 +
1.1565 +
1.1566 +
1.1567 +
1.1568 +inline void TPtrC16::Set(const TDesC16 &aDes)
1.1569 +/**
1.1570 +Sets the 16-bit non-modifiable pointer descriptor from the specified descriptor.
1.1571 +
1.1572 +It is set to point to the same data and is given the same length.
1.1573 +
1.1574 +@param aDes A reference to a 16-bit non-modifiable descriptor
1.1575 +*/
1.1576 + {new(this) TPtrC16(aDes);}
1.1577 +
1.1578 +
1.1579 +
1.1580 +
1.1581 +inline void TPtrC16::Set(const TPtrC16& aPtr)
1.1582 + {new(this) TPtrC16(aPtr);}
1.1583 +
1.1584 +
1.1585 +
1.1586 +
1.1587 +// class TBufCBase16
1.1588 +inline TPtr16 TBufCBase16::DoDes(TInt aMaxLength)
1.1589 + {return TPtr16(*this,aMaxLength);}
1.1590 +
1.1591 +
1.1592 +
1.1593 +
1.1594 +// Template class TBufC16
1.1595 +template <TInt S>
1.1596 +inline TBufC16<S>::TBufC16()
1.1597 + : TBufCBase16()
1.1598 +/**
1.1599 +Constructs an empty 16-bit non-modifiable buffer descriptor.
1.1600 +
1.1601 +It contains no data.
1.1602 +
1.1603 +The integer template parameter determines the size of the data area which
1.1604 +is created as part of the buffer descriptor object.
1.1605 +
1.1606 +Data can, subsequently, be assigned into this buffer descriptor using the
1.1607 +assignment operators.
1.1608 +
1.1609 +@see TBufC16::operator=
1.1610 +*/
1.1611 + {}
1.1612 +
1.1613 +
1.1614 +
1.1615 +
1.1616 +template <TInt S>
1.1617 +inline TBufC16<S>::TBufC16(const TUint16 *aString)
1.1618 + : TBufCBase16(aString,S)
1.1619 +/**
1.1620 +Constructs the 16-bit non-modifiable buffer descriptor from a zero terminated
1.1621 +string.
1.1622 +
1.1623 +The integer template parameter determines the size of the data area which
1.1624 +is created as part of this object.
1.1625 +
1.1626 +The string, excluding the zero terminator, is copied into this buffer descriptor's
1.1627 +data area. The length of this buffer descriptor is set to the length of the
1.1628 +string, excluding the zero terminator.
1.1629 +
1.1630 +@panic USER 8, if the length of the string, excluding the zero terminator, is
1.1631 + greater than the value of the integer template parameter.
1.1632 +
1.1633 +@param aString A pointer to a zero terminated string.
1.1634 +*/
1.1635 + {}
1.1636 +
1.1637 +
1.1638 +
1.1639 +
1.1640 +template <TInt S>
1.1641 +inline TBufC16<S>::TBufC16(const TDesC16 &aDes)
1.1642 + : TBufCBase16(aDes,S)
1.1643 +/**
1.1644 +Constructs the 16-bit non-modifiable buffer descriptor from any
1.1645 +existing descriptor.
1.1646 +
1.1647 +The integer template parameter determines the size of the data area which
1.1648 +is created as part of this object.
1.1649 +
1.1650 +Data is copied from the source descriptor into this buffer descriptor and
1.1651 +the length of this buffer descriptor is set to the length of the
1.1652 +source descriptor.
1.1653 +
1.1654 +@param aDes The source 16-bit non-modifiable descriptor.
1.1655 +
1.1656 +@panic USER 8, if the length of the source descriptor is
1.1657 + greater than the value of the integer template parameter.
1.1658 +*/
1.1659 + {}
1.1660 +
1.1661 +
1.1662 +
1.1663 +
1.1664 +template <TInt S>
1.1665 +inline TBufC16<S> &TBufC16<S>::operator=(const TUint16 *aString)
1.1666 +/**
1.1667 +Copies data into this descriptor replacing any existing data.
1.1668 +
1.1669 +The length of this descriptor is set to reflect the new data.
1.1670 +
1.1671 +@param aString A pointer to a zero-terminated string.
1.1672 +
1.1673 +@return A reference to this descriptor.
1.1674 +
1.1675 +@panic USER 11, if the length of the string, excluding the zero terminator, is
1.1676 + greater than the maximum length of this (target) descriptor.
1.1677 +*/
1.1678 + {Copy(aString,S);return(*this);}
1.1679 +
1.1680 +
1.1681 +
1.1682 +
1.1683 +template <TInt S>
1.1684 +inline TBufC16<S> &TBufC16<S>::operator=(const TDesC16 &aDes)
1.1685 +/**
1.1686 +Copies data into this descriptor, replacing any existing data.
1.1687 +
1.1688 +The length of this descriptor is set to reflect the new data.
1.1689 +
1.1690 +@param aDes A 16-bit non-modifiable descriptor.
1.1691 +
1.1692 +@panic USER 11, if the length of the descriptor aDes is
1.1693 + greater than the maximum length of this (target) descriptor.
1.1694 +
1.1695 +@return A reference to this descriptor.
1.1696 +*/
1.1697 + {Copy(aDes,S);return(*this);}
1.1698 +
1.1699 +
1.1700 +
1.1701 +
1.1702 +template <TInt S>
1.1703 +inline TPtr16 TBufC16<S>::Des()
1.1704 +/**
1.1705 +Creates and returns a 16-bit modifiable pointer descriptor for the data
1.1706 +represented by this 16-bit non-modifiable buffer descriptor.
1.1707 +
1.1708 +The content of a non-modifiable buffer descriptor normally cannot be altered,
1.1709 +other than by complete replacement of the data. Creating a modifiable pointer
1.1710 +descriptor provides a way of changing the data.
1.1711 +
1.1712 +The modifiable pointer descriptor is set to point to this non-modifiable buffer
1.1713 +descriptor's data.
1.1714 +
1.1715 +The length of the modifiable pointer descriptor is set to the length of this
1.1716 +non-modifiable buffer descriptor.
1.1717 +
1.1718 +The maximum length of the modifiable pointer descriptor is set to the value
1.1719 +of the integer template parameter.
1.1720 +
1.1721 +When data is modified through this new pointer descriptor, the lengths of
1.1722 +both it and this constant buffer descriptor are changed.
1.1723 +
1.1724 +@return A 16-bit modifiable pointer descriptor representing the data in this
1.1725 + 16-bit non-modifiable buffer descriptor.
1.1726 +*/
1.1727 + {return(DoDes(S));}
1.1728 +
1.1729 +
1.1730 +
1.1731 +
1.1732 +#ifndef __KERNEL_MODE__
1.1733 +// Class HBufC16
1.1734 +inline HBufC16 &HBufC16::operator=(const HBufC16 &aLcb)
1.1735 +/**
1.1736 +Copies data into this 16-bit heap descriptor replacing any existing data.
1.1737 +
1.1738 +The length of this descriptor is set to reflect the new data.
1.1739 +
1.1740 +Note that the maximum length of this (target) descriptor is the length
1.1741 +of the descriptor buffer in the allocated host heap cell; this may be greater
1.1742 +than the maximum length specified when this descriptor was created or
1.1743 +last re-allocated.
1.1744 +
1.1745 +@param aLcb The source 16-bit heap descriptor.
1.1746 +
1.1747 +@return A reference to this 16-bit heap descriptor.
1.1748 +
1.1749 +@panic USER 11, if the length of the descriptor aLcb is greater than the
1.1750 + maximum length of this (target) descriptor
1.1751 +*/
1.1752 + {return *this=static_cast<const TDesC16&>(aLcb);}
1.1753 +#endif
1.1754 +
1.1755 +
1.1756 +
1.1757 +
1.1758 +// Class TDes16
1.1759 +inline TDes16 &TDes16::operator=(const TUint16 *aString)
1.1760 +/**
1.1761 +Copies data into this descriptor replacing any existing data.
1.1762 +
1.1763 +The length of this descriptor is set to reflect the new data.
1.1764 +
1.1765 +@param aString A pointer to a zero-terminated string.
1.1766 +
1.1767 +@return A reference to this, the target descriptor.
1.1768 +
1.1769 +@panic USER 11, if the length of the string, excluding the zero terminator, is
1.1770 + greater than the maximum length of this (target) descriptor.
1.1771 +*/
1.1772 + {Copy(aString);return(*this);}
1.1773 +
1.1774 +
1.1775 +
1.1776 +
1.1777 +inline TDes16 &TDes16::operator=(const TDesC16 &aDes)
1.1778 +/**
1.1779 +Copies data into this descriptor replacing any existing data.
1.1780 +
1.1781 +The length of this descriptor is set to reflect the new data.
1.1782 +
1.1783 +@param aDes A 16-bit non-modifiable descriptor.
1.1784 +
1.1785 +@return A reference to this, the target descriptor.
1.1786 +
1.1787 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.1788 + maximum length of this (target) descriptor.
1.1789 +*/
1.1790 + {Copy(aDes);return(*this);}
1.1791 +
1.1792 +
1.1793 +
1.1794 +
1.1795 +inline TDes16 &TDes16::operator=(const TDes16 &aDes)
1.1796 +/**
1.1797 +Copies data into this descriptor replacing any existing data.
1.1798 +
1.1799 +The length of this descriptor is set to reflect the new data.
1.1800 +
1.1801 +@param aDes A 16-bit modifiable descriptor.
1.1802 +
1.1803 +@return A reference to this, the target descriptor.
1.1804 +
1.1805 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.1806 + maximum length of this (target) descriptor.
1.1807 +*/
1.1808 + {Copy(aDes);return(*this);}
1.1809 +
1.1810 +
1.1811 +
1.1812 +
1.1813 +inline TDes16 &TDes16::operator+=(const TDesC16 &aDes)
1.1814 +/**
1.1815 +Appends data onto the end of this descriptor's data and returns a reference
1.1816 +to this descriptor.
1.1817 +
1.1818 +The length of this descriptor is incremented to reflect the new content.
1.1819 +
1.1820 +@param aDes A 16-bit non-modifiable descriptor whose data is to be appended.
1.1821 +
1.1822 +@return A reference to this descriptor.
1.1823 +
1.1824 +@panic USER 11, if the resulting length of this descriptor is greater than its
1.1825 + maximum length.
1.1826 +*/
1.1827 + {Append(aDes);return(*this);}
1.1828 +
1.1829 +
1.1830 +
1.1831 +
1.1832 +inline const TUint16 &TDes16::operator[](TInt anIndex) const
1.1833 +/**
1.1834 +Gets a const reference to a single data item within this descriptor's data.
1.1835 +
1.1836 +@param anIndex The position the data item within this descriptor's data. This
1.1837 +is an offset value; a zero value refers to the leftmost data position.
1.1838 +
1.1839 +@return A const reference to the data item at the specified position.
1.1840 +
1.1841 +@panic USER 9, if anIndex is negative or is greater than or equal to the
1.1842 + current length of this descriptor.
1.1843 +*/
1.1844 + {return(AtC(anIndex));}
1.1845 +
1.1846 +
1.1847 +
1.1848 +
1.1849 +inline TUint16 &TDes16::operator[](TInt anIndex)
1.1850 +/**
1.1851 +Gets a non-const reference to a single data item within this descriptor's
1.1852 +data.
1.1853 +
1.1854 +@param anIndex The position of the data item within this descriptor's data.
1.1855 + This is an offset value; a zero value refers to the leftmost
1.1856 + data position.
1.1857 +
1.1858 +@return A non-const reference to the data item at the specified position.
1.1859 +
1.1860 +@panic USER 9, if anIndex is negative or is greater than or equal to the
1.1861 + current length of this descriptor.
1.1862 +*/
1.1863 + {return((TUint16 &)AtC(anIndex));}
1.1864 +
1.1865 +
1.1866 +
1.1867 +
1.1868 +inline TInt TDes16::MaxLength() const
1.1869 +/**
1.1870 +Gets the maximum length of the descriptor.
1.1871 +
1.1872 +This is the upper limit for the number of 16-bit values or data items that
1.1873 +the descriptor can represent.
1.1874 +
1.1875 +@return The maximum length of data that the descriptor can represent.
1.1876 +*/
1.1877 + {return(iMaxLength);}
1.1878 +
1.1879 +
1.1880 +
1.1881 +
1.1882 +inline TInt TDes16::MaxSize() const
1.1883 +/**
1.1884 +Gets the maximum size of the descriptor.
1.1885 +
1.1886 +This is the upper limit for the number of bytes which the data represented by
1.1887 +the descriptor can occupy.
1.1888 +
1.1889 +@return The maximum size of the descriptor data.
1.1890 +*/
1.1891 + {return(iMaxLength<<1);}
1.1892 +
1.1893 +
1.1894 +
1.1895 +
1.1896 +inline TUint16 * TDes16::WPtr() const
1.1897 + {return((TUint16 *)Ptr());}
1.1898 +
1.1899 +
1.1900 +
1.1901 +
1.1902 +// Class TPtr16
1.1903 +inline TPtr16 &TPtr16::operator=(const TUint16 *aString)
1.1904 +/**
1.1905 +Copies data into this 16-bit modifiable pointer descriptor replacing
1.1906 +any existing data.
1.1907 +
1.1908 +The length of this descriptor is set to reflect the new data.
1.1909 +
1.1910 +@param aString A pointer to a zero-terminated string.
1.1911 +
1.1912 +@return A reference to this 16-bit modifiable pointer descriptor.
1.1913 +
1.1914 +@panic USER 11, if the length of the string, excluding the zero terminator, is
1.1915 + greater than the maximum length of this descriptor.
1.1916 +*/
1.1917 + {Copy(aString);return(*this);}
1.1918 +
1.1919 +
1.1920 +
1.1921 +
1.1922 +inline TPtr16 &TPtr16::operator=(const TDesC16 &aDes)
1.1923 +/**
1.1924 +Copies data into this 16-bit modifiable pointer descriptor replacing any
1.1925 +existing data.
1.1926 +
1.1927 +The length of this descriptor is set to reflect the new data.
1.1928 +
1.1929 +@param aDes A 16-bit non-modifiable descriptor whose data is to be copied
1.1930 + into this descriptor.
1.1931 +
1.1932 +@return A reference to this 16-bit modifiable pointer descriptor.
1.1933 +
1.1934 +@panic USER 11, if the length of aDes is greater than the maximum
1.1935 + length of this descriptor.
1.1936 +*/
1.1937 + {Copy(aDes);return(*this);}
1.1938 +
1.1939 +
1.1940 +
1.1941 +
1.1942 +inline TPtr16 &TPtr16::operator=(const TPtr16 &aDes)
1.1943 +/**
1.1944 +Copies data into this 16-bit modifiable pointer descriptor replacing any
1.1945 +existing data.
1.1946 +
1.1947 +The length of this descriptor is set to reflect the new data.
1.1948 +
1.1949 +@param aDes A 16-bit modifiable pointer descriptor whose data is to be copied
1.1950 + into this descriptor.
1.1951 +
1.1952 +@return A reference to this 16-bit modifiable pointer descriptor.
1.1953 +
1.1954 +@panic USER 11, if the length of aDes is greater than the maximum
1.1955 + length of this descriptor.
1.1956 +*/
1.1957 + {Copy(aDes);return(*this);}
1.1958 +
1.1959 +
1.1960 +
1.1961 +
1.1962 +inline void TPtr16::Set(TUint16 *aBuf,TInt aLength,TInt aMaxLength)
1.1963 +/**
1.1964 +Sets the 16-bit modifiable pointer descriptor to point to the specified location
1.1965 +in memory, whether in RAM or ROM.
1.1966 +
1.1967 +The length of the descriptor and its maximum length are set to the specified
1.1968 +values.
1.1969 +
1.1970 +@param aBuf A pointer to the location that the descriptor is to represent.
1.1971 +@param aLength The length of the descriptor.
1.1972 +@param aMaxLength The maximum length of the descriptor.
1.1973 +
1.1974 +@panic USER 8, if aLength is negative or is greater than the maximum length of
1.1975 + this descriptor.
1.1976 +@panic USER 18, if aMaxLength is negative.
1.1977 +*/
1.1978 + {new(this) TPtr16(aBuf,aLength,aMaxLength);}
1.1979 +
1.1980 +
1.1981 +
1.1982 +
1.1983 +inline void TPtr16::Set(const TPtr16 &aPtr)
1.1984 +/**
1.1985 +Sets the 16-bit modifiable pointer descriptor from an existing
1.1986 +16-bit modifiable pointer descriptor.
1.1987 +
1.1988 +It is set to point to the same data, is given the same length and the same
1.1989 +maximum length as the source pointer descriptor.
1.1990 +
1.1991 +@param aPtr The source 16-bit modifiable pointer descriptor.
1.1992 +*/
1.1993 + {new(this) TPtr16(aPtr);}
1.1994 +
1.1995 +
1.1996 +
1.1997 +
1.1998 +// Template class TBuf16
1.1999 +template <TInt S>
1.2000 +inline TBuf16<S>::TBuf16()
1.2001 + : TBufBase16(S)
1.2002 +/**
1.2003 +Constructs an empty 16-bit modifiable buffer descriptor.
1.2004 +
1.2005 +It contains no data.
1.2006 +
1.2007 +The integer template parameter determines the size of the data area created
1.2008 +as part of the object and defines the descriptor's maximum length.
1.2009 +*/
1.2010 + {}
1.2011 +
1.2012 +
1.2013 +
1.2014 +
1.2015 +template <TInt S>
1.2016 +inline TBuf16<S>::TBuf16(TInt aLength)
1.2017 + : TBufBase16(aLength,S)
1.2018 +/**
1.2019 +Constructs an empty 16-bit modifiable buffer descriptor and sets the its length
1.2020 +to the specified value.
1.2021 +
1.2022 +No data is assigned to the descriptor.
1.2023 +
1.2024 +The integer template parameter defines the size of the data area created as
1.2025 +part of the object and defines the descriptor's maximum length.
1.2026 +
1.2027 +@param aLength The length of this modifiable buffer descriptor.
1.2028 +
1.2029 +@panic USER 8, if aLength is negative or is greater than the
1.2030 + value of the integer template parameter.
1.2031 +*/
1.2032 + {}
1.2033 +
1.2034 +
1.2035 +
1.2036 +
1.2037 +template <TInt S>
1.2038 +inline TBuf16<S>::TBuf16(const TUint16 *aString)
1.2039 + : TBufBase16(aString,S)
1.2040 +/**
1.2041 +Constructs the 16-bit modifiable buffer descriptor from
1.2042 +a zero terminated string.
1.2043 +
1.2044 +The integer template parameter determines the size of the data area that is
1.2045 +created as part of this object, and defines the descriptor's maximum length.
1.2046 +
1.2047 +The string, excluding the zero terminator, is copied into this buffer
1.2048 +descriptor's data area. The length of this buffer descriptor is set to the
1.2049 +length of the string, excluding the zero terminator.
1.2050 +
1.2051 +@param aString A pointer to a zero terminated string.
1.2052 +
1.2053 +@panic USER 11, if the length of the string, excluding the zero terminator,
1.2054 + is greater than the value of the integer template parameter.
1.2055 +*/
1.2056 + {}
1.2057 +
1.2058 +
1.2059 +
1.2060 +
1.2061 +template <TInt S>
1.2062 +inline TBuf16<S>::TBuf16(const TDesC16 &aDes)
1.2063 + : TBufBase16(aDes,S)
1.2064 +/**
1.2065 +Constructs the 16-bit modifiable buffer descriptor from any existing
1.2066 +16-bit descriptor.
1.2067 +
1.2068 +The integer template parameter determines the size of the data area created
1.2069 +as part of this object and defines the descriptor's maximum length.
1.2070 +
1.2071 +Data is copied from the source descriptor into this modifiable buffer descriptor
1.2072 +and the length of this modifiable buffer descriptor is set to the length of
1.2073 +the source descriptor.
1.2074 +
1.2075 +@param aDes The source 16-bit non-modifiable descriptor.
1.2076 +
1.2077 +@panic USER 11, if the length of the source descriptor is greater than the
1.2078 + value of the integer template parameter.
1.2079 +*/
1.2080 + {}
1.2081 +
1.2082 +
1.2083 +
1.2084 +
1.2085 +template <TInt S>
1.2086 +inline TBuf16<S> &TBuf16<S>::operator=(const TUint16 *aString)
1.2087 +/**
1.2088 +Copies data into this 16-bit modifiable buffer descriptor, replacing any
1.2089 +existing data.
1.2090 +
1.2091 +The length of this descriptor is set to reflect the new data.
1.2092 +
1.2093 +@param aString A pointer to a zero-terminated string.
1.2094 +
1.2095 +@return A reference to this descriptor.
1.2096 +
1.2097 +@panic USER 11, if the length of the string, excluding the zero terminator,
1.2098 + is greater than the maximum length of this (target) descriptor.
1.2099 +*/
1.2100 + {Copy(aString);return(*this);}
1.2101 +
1.2102 +
1.2103 +
1.2104 +
1.2105 +template <TInt S>
1.2106 +inline TBuf16<S> &TBuf16<S>::operator=(const TDesC16 &aDes)
1.2107 +/**
1.2108 +Copies data into this 16-bit modifiable descriptor, replacing any
1.2109 +existing data.
1.2110 +
1.2111 +The length of this descriptor is set to reflect the new data.
1.2112 +
1.2113 +@param aDes A 16-bit non-modifiable descriptor.
1.2114 +
1.2115 +@return A reference to this descriptor.
1.2116 +
1.2117 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.2118 + maximum length of this (target) descriptor.
1.2119 +*/
1.2120 + {Copy(aDes);return(*this);}
1.2121 +
1.2122 +
1.2123 +
1.2124 +
1.2125 +template <TInt S>
1.2126 +inline TBuf16<S>& TBuf16<S>::operator=(const TBuf16<S>& aBuf)
1.2127 +/**
1.2128 +Copies data into this 16-bit modifiable buffer descriptor replacing any
1.2129 +existing data.
1.2130 +
1.2131 +The length of this descriptor is set to reflect the new data.
1.2132 +
1.2133 +@param aBuf The source 16-bit modifiable buffer descriptor with the same
1.2134 + template value.
1.2135 +
1.2136 +@return A reference to this 16-bit modifiable buffer descriptor.
1.2137 +
1.2138 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.2139 + maximum length of this (target) descriptor.
1.2140 +*/
1.2141 + {Copy(aBuf);return *this;}
1.2142 +
1.2143 +
1.2144 +// Class RBuf16
1.2145 +inline RBuf16& RBuf16::operator=(const TUint16* aString)
1.2146 +/**
1.2147 +Copies data into this descriptor replacing any existing data.
1.2148 +
1.2149 +The length of this descriptor is set to reflect the new data.
1.2150 +
1.2151 +@param aString A pointer to a zero-terminated string.
1.2152 +
1.2153 +@return A reference to this, the target descriptor.
1.2154 +
1.2155 +@panic USER 11, if the length of the string, excluding the zero terminator, is
1.2156 + greater than the maximum length of this (target) descriptor.
1.2157 +*/
1.2158 + {Copy(aString);return(*this);}
1.2159 +
1.2160 +
1.2161 +
1.2162 +
1.2163 +inline RBuf16& RBuf16::operator=(const TDesC16& aDes)
1.2164 +/**
1.2165 +Copies data into this descriptor replacing any existing data.
1.2166 +
1.2167 +The length of this descriptor is set to reflect the new data.
1.2168 +
1.2169 +@param aDes A 16-bit non-modifiable descriptor.
1.2170 +
1.2171 +@return A reference to this, the target descriptor.
1.2172 +
1.2173 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.2174 + maximum length of this (target) descriptor.
1.2175 +*/
1.2176 + {Copy(aDes);return(*this);}
1.2177 +
1.2178 +
1.2179 +
1.2180 +
1.2181 +inline RBuf16& RBuf16::operator=(const RBuf16& aDes)
1.2182 +/**
1.2183 +Copies data into this descriptor replacing any existing data.
1.2184 +
1.2185 +The length of this descriptor is set to reflect the new data.
1.2186 +
1.2187 +@param aDes A 16-bit buffer descriptor.
1.2188 +
1.2189 +@return A reference to this, the target descriptor.
1.2190 +
1.2191 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.2192 + maximum length of this (target) descriptor.
1.2193 +*/
1.2194 + {Copy(aDes);return(*this);}
1.2195 +
1.2196 +
1.2197 +
1.2198 +
1.2199 +/**
1.2200 +Creates a 16-bit resizable buffer descriptor that has been initialised with
1.2201 +data from the specified read stream; leaves on failure.
1.2202 +
1.2203 +Data is assigned to the new descriptor from the specified stream.
1.2204 +This variant assumes that the stream contains the length of the data followed
1.2205 +by the data itself.
1.2206 +
1.2207 +The function is implemented by calling the HBufC16::NewL(RReadStream&,TInt)
1.2208 +variant and then assigning the resulting heap descriptor using
1.2209 +the RBuf16::Assign(HBufC16*) variant. The comments that describe
1.2210 +the HBufC16::NewL() variant also apply to this RBuf16::CreateL() function.
1.2211 +
1.2212 +The function may leave with one of the system-wide error codes, specifically
1.2213 +KErrOverflow, if the length of the data as read from the stream is greater than
1.2214 +the upper limit as specified by the aMaxLength parameter.
1.2215 +
1.2216 +@param aStream The stream from which the data length and the data to be
1.2217 + assigned to the new descriptor, are taken.
1.2218 +@param aMaxLength The upper limit on the length of data that the descriptor is
1.2219 + to represent. The value of this parameter must be non-negative
1.2220 + otherwise the underlying function will panic.
1.2221 +*/
1.2222 +inline void RBuf16::CreateL(RReadStream &aStream,TInt aMaxLength)
1.2223 + {
1.2224 + Assign(HBufC16::NewL(aStream,aMaxLength));
1.2225 + }
1.2226 +
1.2227 +
1.2228 +// Template class TLitC16
1.2229 +template <TInt S>
1.2230 +inline const TDesC16* TLitC16<S>::operator&() const
1.2231 +/**
1.2232 +Returns a const TDesC16 type pointer.
1.2233 +
1.2234 +@return A descriptor type pointer to this literal.
1.2235 +*/
1.2236 + {return REINTERPRET_CAST(const TDesC16*,this);}
1.2237 +
1.2238 +
1.2239 +
1.2240 +
1.2241 +template <TInt S>
1.2242 +inline const TDesC16& TLitC16<S>::operator()() const
1.2243 +/**
1.2244 +Returns a const TDesC16 type reference.
1.2245 +
1.2246 +@return A descriptor type reference to this literal
1.2247 +*/
1.2248 + {return *operator&();}
1.2249 +
1.2250 +
1.2251 +
1.2252 +
1.2253 +template <TInt S>
1.2254 +inline TLitC16<S>::operator const TDesC16&() const
1.2255 +/**
1.2256 +Invoked by the compiler when a TLitC16<TInt> type is passed to a function
1.2257 +which is prototyped to take a const TDesC16& type.
1.2258 +*/
1.2259 + {return *operator&();}
1.2260 +
1.2261 +
1.2262 +
1.2263 +
1.2264 +template <TInt S>
1.2265 +inline TLitC16<S>::operator const __TRefDesC16() const
1.2266 +/**
1.2267 +Invoked by the compiler when a TLitC16<TInt> type is passed to a function
1.2268 +which is prototyped to take a const TRefByValue<const TDesC16> type.
1.2269 +
1.2270 +@see __TRefDesC16
1.2271 +*/
1.2272 + {return *operator&();}
1.2273 +#endif //__KERNEL_MODE__
1.2274 +
1.2275 +
1.2276 +
1.2277 +
1.2278 +// Template class TBufC
1.2279 +#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1.2280 +template <TInt S>
1.2281 +inline TBufC<S>::TBufC()
1.2282 + : TBufCBase16()
1.2283 +/**
1.2284 +Constructs an empty build independent non-modifiable buffer descriptor.
1.2285 +
1.2286 +It contains no data.
1.2287 +
1.2288 +The integer template parameter determines the size of the data area which
1.2289 +is created as part of the buffer descriptor object.
1.2290 +
1.2291 +Data can, subsequently, be assigned into this buffer descriptor using the
1.2292 +assignment operators.
1.2293 +
1.2294 +@see TBufC::operator=
1.2295 +*/
1.2296 + {}
1.2297 +
1.2298 +
1.2299 +
1.2300 +
1.2301 +template <TInt S>
1.2302 +inline TBufC<S>::TBufC(const TText *aString)
1.2303 + : TBufCBase16(aString,S)
1.2304 +/**
1.2305 +Constructs a build independent non-modifiable
1.2306 +buffer descriptor from a zero terminated string.
1.2307 +
1.2308 +The integer template parameter determines the size of the data area which
1.2309 +is created as part of this object.
1.2310 +
1.2311 +The string, excluding the zero terminator, is copied into this buffer descriptor's
1.2312 +data area. The length of this buffer descriptor is set to the length of the
1.2313 +string, excluding the zero terminator.
1.2314 +
1.2315 +@param aString A pointer to a zero terminated string.
1.2316 +
1.2317 +@panic USER 8, if the length of the string, excluding the zero terminator, is
1.2318 + greater than the value of the integer template parameter for
1.2319 + the 16-bit build variant.
1.2320 +
1.2321 +@panic USER 20, if the length of the string, excluding the zero terminator, is
1.2322 + greater than the value of the integer template parameter for
1.2323 + the 8-bit build variant.
1.2324 +*/
1.2325 + {}
1.2326 +
1.2327 +
1.2328 +
1.2329 +
1.2330 +template <TInt S>
1.2331 +inline TBufC<S>::TBufC(const TDesC &aDes)
1.2332 + : TBufCBase16(aDes,S)
1.2333 +/**
1.2334 +Constructs a build-independent non-modifiable buffer descriptor from any
1.2335 +existing build independent descriptor.
1.2336 +
1.2337 +The integer template parameter determines the size of the data area which
1.2338 +is created as part of this object.
1.2339 +
1.2340 +Data is copied from the source descriptor into this buffer descriptor and
1.2341 +the length of this buffer descriptor is set to the length of the source descriptor.
1.2342 +
1.2343 +The length of the source descriptor must not be greater than the value of
1.2344 +the integer template parameter, otherwise the constructor raises a USER 20
1.2345 +panic for an 8 bit build variant or a USER 8 panic for a 16 bit (Unicode)
1.2346 +build variant.
1.2347 +
1.2348 +@param aDes The source build independent non-modifiable descriptor.
1.2349 +
1.2350 +@panic USER 8, if the length of the source descriptor is
1.2351 + greater than the value of the integer template parameter for
1.2352 + the 16-bit build variant.
1.2353 +
1.2354 +@panic USER 20, if the length of the source descriptor is
1.2355 + greater than the value of the integer template parameter for
1.2356 + the 8-bit build variant.
1.2357 +*/
1.2358 + {}
1.2359 +#else
1.2360 +template <TInt S>
1.2361 +inline TBufC<S>::TBufC()
1.2362 + : TBufCBase8()
1.2363 + {}
1.2364 +template <TInt S>
1.2365 +inline TBufC<S>::TBufC(const TText *aString)
1.2366 + : TBufCBase8(aString,S)
1.2367 + {}
1.2368 +template <TInt S>
1.2369 +inline TBufC<S>::TBufC(const TDesC &aDes)
1.2370 + : TBufCBase8(aDes,S)
1.2371 + {}
1.2372 +#endif
1.2373 +template <TInt S>
1.2374 +inline TBufC<S> &TBufC<S>::operator=(const TText *aString)
1.2375 +/**
1.2376 +Copies data into this descriptor, replacing any existing data.
1.2377 +
1.2378 +The length of this descriptor is set to reflect the new data.
1.2379 +
1.2380 +@param aString A pointer to a zero-terminated string.
1.2381 +
1.2382 +@return A reference to this descriptor.
1.2383 +
1.2384 +@panic USER 11, if the length of the string, excluding the zero terminator,
1.2385 + is greater than the maximum length of this (target) descriptor
1.2386 + for the 16-bit build variant.
1.2387 +
1.2388 +@panic USER 23, if the length of the string, excluding the zero terminator,
1.2389 + is greater than the maximum length of this (target) descriptor
1.2390 + for the 8-bit build variant.
1.2391 +*/
1.2392 + {Copy(aString,S);return(*this);}
1.2393 +
1.2394 +
1.2395 +
1.2396 +
1.2397 +template <TInt S>
1.2398 +inline TBufC<S> &TBufC<S>::operator=(const TDesC &aDes)
1.2399 +/**
1.2400 +Copies data into this descriptor, replacing any existing data.
1.2401 +
1.2402 +The length of this descriptor is set to reflect the new data.
1.2403 +
1.2404 +@param aDes A build independent non-modifiable descriptor.
1.2405 +
1.2406 +@return A reference to this descriptor.
1.2407 +
1.2408 +@panic USER 11, if the length of the descriptor aDes is greater than the
1.2409 + maximum length of this (target) descriptor for the 16-bit
1.2410 + build variant.
1.2411 +
1.2412 +@panic USER 23, if the length of the descriptor aDes is greater than the
1.2413 + maximum length of this (target) descriptor for the 8-bit
1.2414 + build variant.
1.2415 +*/
1.2416 + {Copy(aDes,S);return(*this);}
1.2417 +
1.2418 +
1.2419 +
1.2420 +
1.2421 +template <TInt S>
1.2422 +inline TPtr TBufC<S>::Des()
1.2423 +/**
1.2424 +Creates and returns a build-independent modifiable pointer descriptor for
1.2425 +the data represented by this build-independent non-modifiable buffer
1.2426 +descriptor.
1.2427 +
1.2428 +The content of a non-modifiable buffer descriptor normally cannot be altered,
1.2429 +other than by complete replacement of the data. Creating a modifiable pointer
1.2430 +descriptor provides a way of changing the data.
1.2431 +
1.2432 +The modifiable pointer descriptor is set to point to this non-modifiable buffer
1.2433 +descriptor's data.
1.2434 +
1.2435 +The length of the modifiable pointer descriptor is set to the length of this
1.2436 +non-modifiable buffer descriptor.
1.2437 +
1.2438 +The maximum length of the modifiable pointer descriptor is set to the value
1.2439 +of the integer template parameter.
1.2440 +
1.2441 +When data is modified through this new pointer descriptor, the lengths of
1.2442 +both it and this constant buffer descriptor are changed.
1.2443 +
1.2444 +@return A build independent modifiable pointer descriptor representing the
1.2445 + data in this build independent non-modifiable buffer descriptor.
1.2446 +*/
1.2447 + {return(DoDes(S));}
1.2448 +
1.2449 +
1.2450 +
1.2451 +
1.2452 +// Template class TBuf
1.2453 +#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1.2454 +template <TInt S>
1.2455 +inline TBuf<S>::TBuf()
1.2456 + : TBufBase16(S)
1.2457 +/**
1.2458 +Creates a build-independent modifiable buffer descriptor which
1.2459 +contains no data.
1.2460 +
1.2461 +The integer template parameter determines the size of the data area that is created
1.2462 +as part of the object, and defines the descriptor's maximum length.
1.2463 +*/
1.2464 + {}
1.2465 +
1.2466 +
1.2467 +
1.2468 +
1.2469 +template <TInt S>
1.2470 +inline TBuf<S>::TBuf(TInt aLength)
1.2471 + : TBufBase16(aLength,S)
1.2472 +/**
1.2473 +Constructs an empty build independent modifiable buffer descriptor and
1.2474 +sets its length to the specified value.
1.2475 +
1.2476 +No data is assigned to the descriptor.
1.2477 +
1.2478 +The integer template parameter determines the size of the data area created
1.2479 +as part of the object and defines the descriptor's maximum length.
1.2480 +
1.2481 +@param aLength The length of this modifiable buffer descriptor.
1.2482 +
1.2483 +@panic USER 8, if aLength is negative and is greater than the value of the
1.2484 + integer template parameter for a 16-bit build variant.
1.2485 +
1.2486 +@panic USER 20, if aLength is negative and is greater than the value of the
1.2487 + integer template parameter for a 8-bit build variant.
1.2488 +*/
1.2489 + {}
1.2490 +
1.2491 +
1.2492 +
1.2493 +
1.2494 +template <TInt S>
1.2495 +inline TBuf<S>::TBuf(const TText *aString)
1.2496 + : TBufBase16(aString,S)
1.2497 +/**
1.2498 +Constructs the build-independent modifiable buffer descriptor from
1.2499 +a zero terminated string.
1.2500 +
1.2501 +The integer template parameter determines the size of the data area which
1.2502 +is created as part of this object.
1.2503 +
1.2504 +The string, excluding the zero terminator, is copied into this buffer
1.2505 +descriptor's data area. The length of this buffer descriptor is set to
1.2506 +the length of the string, excluding the zero terminator.
1.2507 +
1.2508 +@param aString A pointer to a zero terminated string.
1.2509 +
1.2510 +@panic USER 11, if the length of the string, excluding the zero terminator,
1.2511 + is greater than the value of the integer template parameter
1.2512 + for a 16-bit build variant.
1.2513 +@panic USER 23, if the length of the string, excluding the zero terminator,
1.2514 + is greater than the value of the integer template parameter
1.2515 + for a 8-bit build variant.
1.2516 +*/
1.2517 + {}
1.2518 +
1.2519 +
1.2520 +
1.2521 +
1.2522 +template <TInt S>
1.2523 +inline TBuf<S>::TBuf(const TDesC &aDes)
1.2524 + : TBufBase16(aDes,S)
1.2525 +/**
1.2526 +Constructs the build-independent modifiable buffer descriptor from any
1.2527 +existing build-independent descriptor.
1.2528 +
1.2529 +The integer template parameter determines the size of the data area created
1.2530 +as part of this object, and defines the descriptor's maximum length.
1.2531 +
1.2532 +Data is copied from the source descriptor into this modifiable buffer descriptor
1.2533 +and the length of this modifiable buffer descriptor is set to the length of
1.2534 +the source descriptor.
1.2535 +
1.2536 +@param aDes The source build independent non-modifiable descriptor.
1.2537 +
1.2538 +@panic USER 11, if the length of the source descriptor is greater than the
1.2539 + value of the integer template parameter for a 16-bit
1.2540 + build variant.
1.2541 +@panic USER 23, if the length of the source descriptor is greater than the
1.2542 + value of the integer template parameter for an 8-bit
1.2543 + build variant.
1.2544 +
1.2545 +*/
1.2546 + {}
1.2547 +#else
1.2548 +template <TInt S>
1.2549 +inline TBuf<S>::TBuf()
1.2550 + : TBufBase8(S)
1.2551 + {}
1.2552 +template <TInt S>
1.2553 +inline TBuf<S>::TBuf(TInt aLength)
1.2554 + : TBufBase8(aLength,S)
1.2555 + {}
1.2556 +template <TInt S>
1.2557 +inline TBuf<S>::TBuf(const TText *aString)
1.2558 + : TBufBase8(aString,S)
1.2559 + {}
1.2560 +template <TInt S>
1.2561 +inline TBuf<S>::TBuf(const TDesC &aDes)
1.2562 + : TBufBase8(aDes,S)
1.2563 + {}
1.2564 +#endif
1.2565 +template <TInt S>
1.2566 +inline TBuf<S> &TBuf<S>::operator=(const TText *aString)
1.2567 + {Copy(aString);return(*this);}
1.2568 +template <TInt S>
1.2569 +inline TBuf<S> &TBuf<S>::operator=(const TDesC &aDes)
1.2570 + {Copy(aDes);return(*this);}
1.2571 +template <TInt S>
1.2572 +inline TBuf<S> &TBuf<S>::operator=(const TBuf<S> &aBuf)
1.2573 + {Copy(aBuf);return(*this);}
1.2574 +
1.2575 +
1.2576 +
1.2577 +
1.2578 +// Template class TLitC
1.2579 +template <TInt S>
1.2580 +inline const TDesC* TLitC<S>::operator&() const
1.2581 +/**
1.2582 +Returns a const TDesC type pointer.
1.2583 +
1.2584 +@return A descriptor type pointer to this literal.
1.2585 +*/
1.2586 + {return REINTERPRET_CAST(const TDesC*,this);}
1.2587 +
1.2588 +
1.2589 +
1.2590 +
1.2591 +template <TInt S>
1.2592 +inline const TDesC& TLitC<S>::operator()() const
1.2593 +/**
1.2594 +Returns a const TDesC type reference.
1.2595 +
1.2596 +@return A descriptor type reference to this literal
1.2597 +*/
1.2598 + {return *operator&();}
1.2599 +
1.2600 +
1.2601 +
1.2602 +
1.2603 +template <TInt S>
1.2604 +inline TLitC<S>::operator const TDesC&() const
1.2605 +/**
1.2606 +Invoked by the compiler when a TLitC<TInt> type is passed to a function
1.2607 +which is prototyped to take a const TDesC& type.
1.2608 +*/
1.2609 + {return *operator&();}
1.2610 +
1.2611 +
1.2612 +
1.2613 +
1.2614 +template <TInt S>
1.2615 +inline TLitC<S>::operator const __TRefDesC() const
1.2616 +/**
1.2617 +Invoked by the compiler when a TLitC<TInt> type is passed to a function
1.2618 +which is prototyped to take a const TRefByValue<const TDesC> type.
1.2619 +
1.2620 +@see __TRefDesC.
1.2621 +*/
1.2622 + {return *operator&();}
1.2623 +
1.2624 +
1.2625 +
1.2626 +
1.2627 +// Template class TPckgC
1.2628 +template <class T>
1.2629 +inline TPckgC<T>::TPckgC(const T &aRef)
1.2630 + : TPtrC8((const TUint8 *)&aRef,sizeof(T))
1.2631 +/**
1.2632 +Constructs a packaged non-modifiable pointer descriptor to represent
1.2633 +the specified object whose type is defined by the template parameter.
1.2634 +
1.2635 +@param aRef The object to be represented by this packaged non-modifiable
1.2636 + pointer descriptor.
1.2637 +*/
1.2638 + {}
1.2639 +
1.2640 +
1.2641 +
1.2642 +
1.2643 +template <class T>
1.2644 +inline const T &TPckgC<T>::operator()() const
1.2645 +/**
1.2646 +Gets a reference to the object represented by this packaged non-modifiable
1.2647 +pointer descriptor.
1.2648 +
1.2649 +@return The packaged object
1.2650 +*/
1.2651 + {return(*((const T *)iPtr));}
1.2652 +
1.2653 +
1.2654 +
1.2655 +
1.2656 +// Template class TPckg
1.2657 +template <class T>
1.2658 +inline TPckg<T>::TPckg(const T &aRef)
1.2659 + : TPtr8((TUint8 *)&aRef,sizeof(T),sizeof(T))
1.2660 +/**
1.2661 +Constructs a packaged modifiable pointer descriptor to represent the specified
1.2662 +object whose type is defined by the template parameter.
1.2663 +
1.2664 +@param aRef The object to be represented by this packaged modifiable pointer
1.2665 + descriptor.
1.2666 +*/
1.2667 + {}
1.2668 +
1.2669 +
1.2670 +
1.2671 +
1.2672 +template <class T>
1.2673 +inline T &TPckg<T>::operator()()
1.2674 +/**
1.2675 +Gets a reference to the object represented by this packaged
1.2676 +modifiable pointer descriptor.
1.2677 +
1.2678 +@return The packaged object.
1.2679 +*/
1.2680 + {return(*((T *)iPtr));}
1.2681 +
1.2682 +
1.2683 +
1.2684 +
1.2685 +// Template class TPckgBuf
1.2686 +template <class T>
1.2687 +inline TPckgBuf<T>::TPckgBuf()
1.2688 + : TAlignedBuf8<sizeof(T)>(sizeof(T))
1.2689 +/**
1.2690 +Constructs a packaged modifiable buffer descriptor for an object whose type
1.2691 +is defined by the template parameter.
1.2692 +
1.2693 +The length of the packaged descriptor is set to the length of the templated
1.2694 +class but no data is assigned into the descriptor.
1.2695 +*/
1.2696 + {new(&this->iBuf[0]) T;}
1.2697 +
1.2698 +
1.2699 +
1.2700 +
1.2701 +template <class T>
1.2702 +inline TPckgBuf<T>::TPckgBuf(const T &aRef)
1.2703 + : TAlignedBuf8<sizeof(T)>(sizeof(T))
1.2704 +/**
1.2705 +Constructs a packaged modifiable buffer descriptor for an object whose type
1.2706 +is defined by the template parameter and copies the supplied object into the
1.2707 +descriptor.
1.2708 +
1.2709 +The length of the packaged descriptor is set to the length of the templated
1.2710 +class.
1.2711 +
1.2712 +@param aRef The source object to be copied into the packaged modifiable buffer
1.2713 + descriptor.
1.2714 +*/
1.2715 + {new(&this->iBuf[0]) T(aRef);}
1.2716 +
1.2717 +
1.2718 +
1.2719 +
1.2720 +template <class T>
1.2721 +inline TPckgBuf<T> &TPckgBuf<T>::operator=(const TPckgBuf<T> &aRef)
1.2722 +/**
1.2723 +Copies data from the specified packaged modifiable buffer descriptor into this
1.2724 +packaged modifiable buffer descriptor, replacing any existing data.
1.2725 +
1.2726 +@param aRef The source packaged modifiable buffer descriptor.
1.2727 +@return A reference to this packaged modifiable descriptor.
1.2728 +*/
1.2729 + {this->Copy(aRef);return(*this);}
1.2730 +
1.2731 +
1.2732 +
1.2733 +
1.2734 +template <class T>
1.2735 +inline T &TPckgBuf<T>::operator=(const T &aRef)
1.2736 +/**
1.2737 +Copies data from the specified object into this packaged modifiable buffer
1.2738 +descriptor, replacing any existing data.
1.2739 +
1.2740 +@param aRef The source object.
1.2741 +@return A reference to the copy of the source object in the packaged modifiable
1.2742 + buffer descriptor.
1.2743 +*/
1.2744 + {this->Copy((TUint8 *)&aRef,sizeof(T));return(*((T *)&this->iBuf[0]));}
1.2745 +
1.2746 +
1.2747 +
1.2748 +
1.2749 +template <class T>
1.2750 +inline T &TPckgBuf<T>::operator()()
1.2751 +/**
1.2752 +Gets a reference to the object contained by this packaged modifiable
1.2753 +buffer descriptor.
1.2754 +
1.2755 +@return The packaged object.
1.2756 +*/
1.2757 + {return(*((T *)&this->iBuf[0]));}
1.2758 +
1.2759 +
1.2760 +
1.2761 +
1.2762 +template <class T>
1.2763 +inline const T &TPckgBuf<T>::operator()() const
1.2764 +/**
1.2765 +Gets a const reference to the object contained by this packaged modifiable
1.2766 +buffer descriptor.
1.2767 +
1.2768 +@return The (const) packaged object.
1.2769 +*/
1.2770 + {return(*((T *)&this->iBuf[0]));}
1.2771 +
1.2772 +
1.2773 +
1.2774 +
1.2775 +// Class TRequestStatus
1.2776 +inline TRequestStatus::TRequestStatus()
1.2777 +/**
1.2778 +Default constructor.
1.2779 +*/
1.2780 +: iFlags(0)
1.2781 + {}
1.2782 +
1.2783 +
1.2784 +
1.2785 +
1.2786 +inline TRequestStatus::TRequestStatus(TInt aVal)
1.2787 +/**
1.2788 +Constructs an asynchronous request status object and assigns a completion value
1.2789 +to it.
1.2790 +
1.2791 +@param aVal The completion value to be assigned to the constructed request
1.2792 + status object.
1.2793 +*/
1.2794 + : iStatus(aVal),
1.2795 + iFlags(aVal==KRequestPending ? TRequestStatus::ERequestPending : 0)
1.2796 +
1.2797 + {}
1.2798 +
1.2799 +
1.2800 +
1.2801 +
1.2802 +inline TInt TRequestStatus::operator=(TInt aVal)
1.2803 +/**
1.2804 +Assigns the specified completion code to the request status object.
1.2805 +
1.2806 +@param aVal The value to be assigned.
1.2807 +
1.2808 +@return The value assigned.
1.2809 +*/
1.2810 + {
1.2811 + if(aVal==KRequestPending)
1.2812 + iFlags|=TRequestStatus::ERequestPending;
1.2813 + else
1.2814 + iFlags&=~TRequestStatus::ERequestPending;
1.2815 + return (iStatus=aVal);
1.2816 + }
1.2817 +
1.2818 +
1.2819 +
1.2820 +
1.2821 +inline TBool TRequestStatus::operator==(TInt aVal) const
1.2822 +/**
1.2823 +Tests whether the request status object's completion code is the same as
1.2824 +the specified value.
1.2825 +
1.2826 +@param aVal The value to be compared.
1.2827 +
1.2828 +@return True, if the values are equal; false otherwise.
1.2829 +*/
1.2830 + {return(iStatus==aVal);}
1.2831 +
1.2832 +
1.2833 +
1.2834 +
1.2835 +inline TBool TRequestStatus::operator!=(TInt aVal) const
1.2836 +/**
1.2837 +Tests whether the request status object's completion code is not equal to
1.2838 +the specified value.
1.2839 +
1.2840 +@param aVal The value to be compared.
1.2841 +
1.2842 +@return True, if the values are unequal; false otherwise.
1.2843 +*/
1.2844 + {return(iStatus!=aVal);}
1.2845 +
1.2846 +
1.2847 +
1.2848 +
1.2849 +inline TBool TRequestStatus::operator>=(TInt aVal) const
1.2850 +/**
1.2851 +Tests whether the request status object's completion code is greater than
1.2852 +or equal to the specified value.
1.2853 +
1.2854 +@param aVal The value to be compared.
1.2855 +
1.2856 +@return True, if the request status object's value is greater than or equal
1.2857 + to the specified value; false, otherwise.
1.2858 +*/
1.2859 + {return(iStatus>=aVal);}
1.2860 +
1.2861 +
1.2862 +
1.2863 +
1.2864 +inline TBool TRequestStatus::operator<=(TInt aVal) const
1.2865 +/**
1.2866 +Tests whether the request status object's completion code is less than or
1.2867 +equal to the specified value.
1.2868 +
1.2869 +@param aVal The value to be compared.
1.2870 +
1.2871 +@return True, if the request status object's value is less than or equal
1.2872 + to the specified value; false, otherwise.
1.2873 +*/
1.2874 + {return(iStatus<=aVal);}
1.2875 +
1.2876 +
1.2877 +
1.2878 +
1.2879 +inline TBool TRequestStatus::operator>(TInt aVal) const
1.2880 +/**
1.2881 +Tests whether the request status object's completion code is greater than
1.2882 +the specified value.
1.2883 +
1.2884 +@param aVal The value to be compared.
1.2885 +
1.2886 +@return True, if the request status object's value is greater than
1.2887 + the specified value; false, otherwise.
1.2888 +*/
1.2889 + {return(iStatus>aVal);}
1.2890 +
1.2891 +
1.2892 +
1.2893 +
1.2894 +inline TBool TRequestStatus::operator<(TInt aVal) const
1.2895 +/**
1.2896 +Tests whether the request status object's completion code is less than the
1.2897 +specified value.
1.2898 +
1.2899 +@param aVal The value to be compared.
1.2900 +
1.2901 +@return True, if the request status object's value is less than the specified
1.2902 + value; false, otherwise.
1.2903 +*/
1.2904 + {return(iStatus<aVal);}
1.2905 +
1.2906 +
1.2907 +
1.2908 +
1.2909 +inline TInt TRequestStatus::Int() const
1.2910 +/**
1.2911 +Gets this request status object's completion code value.
1.2912 +
1.2913 +@return The completion code.
1.2914 +*/
1.2915 + {return(iStatus);}
1.2916 +
1.2917 +
1.2918 +
1.2919 +
1.2920 +// Class TPoint
1.2921 +#ifndef __KERNEL_MODE__
1.2922 +inline TPoint::TPoint()
1.2923 + : iX(0),iY(0)
1.2924 +/**
1.2925 +Constructs default point, initialising its iX and iY members to zero.
1.2926 +*/
1.2927 + {}
1.2928 +
1.2929 +
1.2930 +
1.2931 +
1.2932 +inline TPoint::TPoint(TInt aX,TInt aY)
1.2933 + : iX(aX),iY(aY)
1.2934 +/**
1.2935 +Constructs a point with the specified x and y co-ordinates.
1.2936 +
1.2937 +@param aX The x co-ordinate value.
1.2938 +@param aY The y co-ordinate value.
1.2939 +*/
1.2940 + {}
1.2941 +
1.2942 +
1.2943 +
1.2944 +
1.2945 +// Class TSize
1.2946 +inline TSize::TSize()
1.2947 + : iWidth(0),iHeight(0)
1.2948 +/**
1.2949 +Constructs the size object with its iWidth and iHeight members set to zero.
1.2950 +*/
1.2951 + {}
1.2952 +
1.2953 +
1.2954 +
1.2955 +
1.2956 +inline TSize::TSize(TInt aWidth,TInt aHeight)
1.2957 + : iWidth(aWidth),iHeight(aHeight)
1.2958 +/**
1.2959 +Constructs the size object with the specified width and height values.
1.2960 +
1.2961 +@param aWidth The width value.
1.2962 +@param aHeight The height value .
1.2963 +*/
1.2964 + {}
1.2965 +#endif
1.2966 +
1.2967 +
1.2968 +
1.2969 +
1.2970 +// Class TFindHandle
1.2971 +inline TFindHandle::TFindHandle()
1.2972 + : iHandle(0), iSpare1(0), iObjectIdLow(0), iObjectIdHigh(0)
1.2973 + {}
1.2974 +
1.2975 +
1.2976 +
1.2977 +
1.2978 +inline TInt TFindHandle::Handle() const
1.2979 +/**
1.2980 +@publishedAll
1.2981 +@released
1.2982 +
1.2983 +Gets the find-handle number associated with the Kernel object.
1.2984 +
1.2985 +The find-handle number identifies the kernel object with respect to
1.2986 +its container.
1.2987 +
1.2988 +Note that setting the find-handle number into a TFindHandle object is not
1.2989 +implemented by this class; it is implemented by derived classes, typically by
1.2990 +their Next() member functions. The class TFindSemaphore is a good example.
1.2991 +
1.2992 +@return The find-handle number.
1.2993 +*/
1.2994 + {return iHandle;}
1.2995 +
1.2996 +
1.2997 +
1.2998 +
1.2999 +#ifdef __KERNEL_MODE__
1.3000 +const TInt KFindHandleUniqueIdShift=16; ///< @internalComponent
1.3001 +const TInt KFindHandleUniqueIdMask=0x7fff; ///< @internalComponent
1.3002 +const TInt KFindHandleIndexMask=0x7fff; ///< @internalComponent
1.3003 +
1.3004 +
1.3005 +
1.3006 +
1.3007 +/**
1.3008 +Gets the index into its container at which the kernel object was last seen.
1.3009 +
1.3010 +@return The object's index in its container.
1.3011 +*/
1.3012 +inline TInt TFindHandle::Index() const
1.3013 + {return(iHandle&KFindHandleIndexMask);}
1.3014 +
1.3015 +
1.3016 +
1.3017 +
1.3018 +/**
1.3019 +Gets the unique ID of the kernel container this object resides in.
1.3020 +
1.3021 +@return The ID of this object's container.
1.3022 +*/
1.3023 +inline TInt TFindHandle::UniqueID() const
1.3024 + {return((iHandle>>KFindHandleUniqueIdShift)&KFindHandleUniqueIdMask);}
1.3025 +
1.3026 +
1.3027 +
1.3028 +
1.3029 +/**
1.3030 +Gets the unique ID of the kernel object itself.
1.3031 +
1.3032 +@return The ID of the object.
1.3033 +*/
1.3034 +inline TUint64 TFindHandle::ObjectID() const
1.3035 + {return MAKE_TUINT64(iObjectIdHigh, iObjectIdLow);}
1.3036 +
1.3037 +
1.3038 +
1.3039 +
1.3040 +/**
1.3041 +Sets the find handle to refer to a specific object.
1.3042 +
1.3043 +@oaram aIndex The current index of the object in its container.
1.3044 +@param aUniqueId The unique ID of the container object.
1.3045 +@param aObjectId The unique ID of the object iteself.
1.3046 +*/
1.3047 +inline void TFindHandle::Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId)
1.3048 + {
1.3049 + iHandle=(TInt)((aUniqueId<<KFindHandleUniqueIdShift)|aIndex);
1.3050 + iObjectIdLow=I64LOW(aObjectId);
1.3051 + iObjectIdHigh=I64HIGH(aObjectId);
1.3052 + }
1.3053 +
1.3054 +
1.3055 +#else
1.3056 +
1.3057 +
1.3058 +/**
1.3059 +Resets the find handle to its initial state.
1.3060 +*/
1.3061 +inline void TFindHandle::Reset()
1.3062 + {
1.3063 + iHandle=iSpare1=iObjectIdLow=iObjectIdHigh=0;
1.3064 + }
1.3065 +#endif
1.3066 +
1.3067 +
1.3068 +
1.3069 +
1.3070 +// Class RHandleBase
1.3071 +inline RHandleBase::RHandleBase()
1.3072 + : iHandle(0)
1.3073 +/**
1.3074 +Default constructor.
1.3075 +*/
1.3076 + {}
1.3077 +
1.3078 +
1.3079 +
1.3080 +
1.3081 +#ifndef __KERNEL_MODE__
1.3082 +inline RHandleBase::RHandleBase(TInt aHandle)
1.3083 + : iHandle(aHandle)
1.3084 +/**
1.3085 +Copy constructor.
1.3086 +
1.3087 +It constructs this handle from an existing one. Specifically, the handle-number
1.3088 +encapsulated by the specified handle is copied to this handle.
1.3089 +
1.3090 +@param aHandle The existing handle to be copied.
1.3091 +*/
1.3092 + {}
1.3093 +#endif
1.3094 +
1.3095 +
1.3096 +
1.3097 +
1.3098 +inline void RHandleBase::SetHandle(TInt aHandle)
1.3099 +/**
1.3100 +Sets the handle-number of this handle to the specified
1.3101 +value.
1.3102 +
1.3103 +@param aHandle The handle-number to be set.
1.3104 +*/
1.3105 + { iHandle=aHandle; }
1.3106 +
1.3107 +
1.3108 +
1.3109 +
1.3110 +inline TInt RHandleBase::Handle() const
1.3111 +/**
1.3112 +Retrieves the handle-number of the object associated with this handle.
1.3113 +
1.3114 +@return The handle number
1.3115 +*/
1.3116 + {return(iHandle);}
1.3117 +
1.3118 +
1.3119 +
1.3120 +
1.3121 +inline TInt RHandleBase::SetReturnedHandle(TInt aHandleOrError)
1.3122 +/**
1.3123 +Sets the handle-number of this handle to the specified
1.3124 +value.
1.3125 +
1.3126 +The function can take a (zero or positive) handle-number,
1.3127 +or a (negative) error number.
1.3128 +
1.3129 +If aHandleOrError represents a handle-number, then the handle-number of this handle
1.3130 +is set to that value.
1.3131 +If aHandleOrError represents an error number, then the handle-number of this handle is set to zero
1.3132 +and the negative value is returned.
1.3133 +
1.3134 +@param aHandleOrError A handle-number, if zero or positive; an error value, if negative.
1.3135 +
1.3136 +@return KErrNone, if aHandle is a handle-number; the value of aHandleOrError, otherwise.
1.3137 +*/
1.3138 + {
1.3139 + if(aHandleOrError>=0)
1.3140 + {
1.3141 + iHandle = aHandleOrError;
1.3142 + return KErrNone;
1.3143 + }
1.3144 + iHandle = 0;
1.3145 + return aHandleOrError;
1.3146 + }
1.3147 +
1.3148 +
1.3149 +
1.3150 +
1.3151 +// Class RSemaphore
1.3152 +#ifndef __KERNEL_MODE__
1.3153 +inline TInt RSemaphore::Open(const TFindSemaphore& aFind,TOwnerType aType)
1.3154 +/**
1.3155 +Opens a handle to the global semaphore found using a TFindSemaphore object.
1.3156 +
1.3157 +A TFindSemaphore object is used to find all global semaphores whose full names
1.3158 +match a specified pattern.
1.3159 +
1.3160 +By default, any thread in the process can use this instance of RSemaphore
1.3161 +to access the semaphore. However, specifying EOwnerThread as the second parameter
1.3162 +to this function, means that only the opening thread can use this instance
1.3163 +of RSemaphore to access the semaphore; any other thread in this process that
1.3164 +wants to access the semaphore must either duplicate the handle or use OpenGlobal()
1.3165 +again.
1.3166 +
1.3167 +@param aFind A reference to the TFindSemaphore object used to find the semaphore.
1.3168 +@param aType An enumeration whose enumerators define the ownership of this
1.3169 + semaphore handle. If not explicitly specified, EOwnerProcess is
1.3170 + taken as default.
1.3171 +
1.3172 +@return KErrNone if successful otherwise another of the system wide error codes.
1.3173 +*/
1.3174 + {return(RHandleBase::Open((const TFindHandleBase&)aFind,aType));}
1.3175 +#endif
1.3176 +
1.3177 +
1.3178 +
1.3179 +
1.3180 +// Class RFastLock
1.3181 +
1.3182 +
1.3183 +/**
1.3184 +Default constructor.
1.3185 +*/
1.3186 +inline RFastLock::RFastLock()
1.3187 + : iCount(0)
1.3188 + {}
1.3189 +
1.3190 +
1.3191 +
1.3192 +
1.3193 +// Class RMessagePtr2
1.3194 +
1.3195 +
1.3196 +/**
1.3197 +Default constructor
1.3198 +*/
1.3199 +inline RMessagePtr2::RMessagePtr2()
1.3200 + : iHandle(0)
1.3201 + {}
1.3202 +
1.3203 +
1.3204 +
1.3205 +
1.3206 +/**
1.3207 +Tests whether this message handle is empty.
1.3208 +
1.3209 +@return True, if this message handle is empty, false, otherwise.
1.3210 +*/
1.3211 +inline TBool RMessagePtr2::IsNull() const
1.3212 + {return iHandle==0;}
1.3213 +
1.3214 +
1.3215 +
1.3216 +
1.3217 +/**
1.3218 +Gets the message handle value.
1.3219 +
1.3220 +@return The message handle value.
1.3221 +*/
1.3222 +inline TInt RMessagePtr2::Handle() const
1.3223 + {return iHandle;}
1.3224 +inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight)
1.3225 + {return aLeft.Handle()==aRight.Handle();}
1.3226 +inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight)
1.3227 + {return aLeft.Handle()!=aRight.Handle();}
1.3228 +
1.3229 +
1.3230 +
1.3231 +
1.3232 +
1.3233 +// Class RMessage
1.3234 +
1.3235 +
1.3236 +/**
1.3237 +Default constructor
1.3238 +*/
1.3239 +inline RMessage2::RMessage2()
1.3240 + {}
1.3241 +
1.3242 +
1.3243 +
1.3244 +
1.3245 +/**
1.3246 +Gets the the number of the function requested by the client.
1.3247 +
1.3248 +@return The function number.
1.3249 +*/
1.3250 +inline TInt RMessage2::Function() const
1.3251 + {return(iFunction);}
1.3252 +
1.3253 +
1.3254 +
1.3255 +
1.3256 +/**
1.3257 +Gets the first message argument as an integer value.
1.3258 +
1.3259 +@return The first message argument.
1.3260 +*/
1.3261 +inline TInt RMessage2::Int0() const
1.3262 + {return(iArgs[0]);}
1.3263 +
1.3264 +
1.3265 +
1.3266 +
1.3267 +/**
1.3268 +Gets the second message argument as an integer value.
1.3269 +
1.3270 +@return The second message argument.
1.3271 +*/
1.3272 +inline TInt RMessage2::Int1() const
1.3273 + {return(iArgs[1]);}
1.3274 +
1.3275 +
1.3276 +
1.3277 +
1.3278 +/**
1.3279 +Gets the third message argument as an integer value.
1.3280 +
1.3281 +@return The third message argument.
1.3282 +*/
1.3283 +inline TInt RMessage2::Int2() const
1.3284 + {return(iArgs[2]);}
1.3285 +
1.3286 +
1.3287 +
1.3288 +/**
1.3289 +Gets the fourth message argument as an integer value.
1.3290 +
1.3291 +@return The fourth message argument.
1.3292 +*/
1.3293 +inline TInt RMessage2::Int3() const
1.3294 + {return(iArgs[3]);}
1.3295 +
1.3296 +
1.3297 +
1.3298 +/**
1.3299 +Gets the first message argument as a pointer type.
1.3300 +
1.3301 +@return The first message argument.
1.3302 +*/
1.3303 +inline const TAny *RMessage2::Ptr0() const
1.3304 + {return((const TAny *)iArgs[0]);}
1.3305 +
1.3306 +
1.3307 +
1.3308 +
1.3309 +/**
1.3310 +Gets the second message argument as a pointer type.
1.3311 +
1.3312 +@return The second message argument.
1.3313 +*/
1.3314 +inline const TAny *RMessage2::Ptr1() const
1.3315 + {return((const TAny *)iArgs[1]);}
1.3316 +
1.3317 +
1.3318 +
1.3319 +
1.3320 +/**
1.3321 +Gets the third message argument as a pointer type.
1.3322 +
1.3323 +@return The third message argument.
1.3324 +*/
1.3325 +inline const TAny *RMessage2::Ptr2() const
1.3326 + {return((const TAny *)iArgs[2]);}
1.3327 +
1.3328 +
1.3329 +
1.3330 +
1.3331 +/**
1.3332 +Gets the fourth message argument as a pointer type.
1.3333 +
1.3334 +@return The fourth message argument.
1.3335 +*/
1.3336 +inline const TAny *RMessage2::Ptr3() const
1.3337 + {return((const TAny *)iArgs[3]);}
1.3338 +
1.3339 +
1.3340 +
1.3341 +/**
1.3342 +Gets a pointer to the session.
1.3343 +
1.3344 +@return A pointer to the session object.
1.3345 +*/
1.3346 +inline CSession2* RMessage2::Session() const
1.3347 + {return (CSession2*)iSessionPtr; }
1.3348 +
1.3349 +
1.3350 +
1.3351 +
1.3352 +// Class TUid
1.3353 +inline TUid TUid::Uid(TInt aUid)
1.3354 +/**
1.3355 +Constructs the TUid object from a 32-bit integer.
1.3356 +
1.3357 +@param aUid The 32-bit integer value from which the TUid object is to be
1.3358 + constructed.
1.3359 +
1.3360 +@return The constructed TUid object.
1.3361 +*/
1.3362 + {TUid uid={aUid};return uid;}
1.3363 +
1.3364 +
1.3365 +
1.3366 +
1.3367 +inline TUid TUid::Null()
1.3368 +/**
1.3369 +Constructs a Null-valued TUid object.
1.3370 +
1.3371 +@return The constructed Null-valued TUid object.
1.3372 +*/
1.3373 + {TUid uid={KNullUidValue};return uid;}
1.3374 +
1.3375 +
1.3376 +
1.3377 +
1.3378 +#ifndef __KERNEL_MODE__
1.3379 +// Template class TArray
1.3380 +template <class T>
1.3381 +inline TArray<T>::TArray(TInt (*aCount)(const CBase *aPtr),const TAny *(*anAt)(const CBase *aPtr,TInt anIndex),const CBase *aPtr)
1.3382 + : iPtr(aPtr),iCount(aCount),iAt(anAt)
1.3383 +/**
1.3384 +Constructor.
1.3385 +
1.3386 +A TArray object is not intended to be instantiated explicitly. An object of
1.3387 +this type is instantiated as a result of a call to to the Array() member
1.3388 +function of a concrete array class
1.3389 +
1.3390 +@param aCount A pointer to a function which takes a
1.3391 + @code
1.3392 + const CBase*
1.3393 + @endcode
1.3394 + argument and returns a
1.3395 + @code
1.3396 + TInt
1.3397 + @endcode
1.3398 + aCount must point to the member function which returns the
1.3399 + current number of elements of type class T contained in the
1.3400 + array at aPtr, for which this TArray is being constructed.
1.3401 + This argument is supplied by the Array() member function of the
1.3402 + array class.
1.3403 +@param anAt A pointer to a function which takes a
1.3404 + @code
1.3405 + const CBase*
1.3406 + @endcode
1.3407 + and a
1.3408 + @code
1.3409 + TInt
1.3410 + @endcode
1.3411 + argument, and returns a pointer to
1.3412 + @code
1.3413 + TAny
1.3414 + @endcode
1.3415 + anAt must point to the member function which returns a reference
1.3416 + to the element located at position anIndex within the array at
1.3417 + aPtr, for which this TArray is being constructed.
1.3418 + This argument is supplied by the Array() member function of the
1.3419 + array class.
1.3420 +@param aPtr A pointer to the array for which this TArray is being
1.3421 + constructed. This argument is supplied by the Array() member
1.3422 + function of the array class.
1.3423 +
1.3424 +@see CArrayFixFlat::Array
1.3425 +@see CArrayFixSeg::Array
1.3426 +@see CArrayVarFlat::Array
1.3427 +@see CArrayVarSeg::Array
1.3428 +@see CArrayPakFlat::Array
1.3429 +@see RArray::Array
1.3430 +@see RPointerArray::Array
1.3431 +@see RArray<TInt>::Array
1.3432 +@see RArray<TUint>::Array
1.3433 +*/
1.3434 + {}
1.3435 +
1.3436 +
1.3437 +
1.3438 +
1.3439 +template <class T>
1.3440 +inline TInt TArray<T>::Count() const
1.3441 +/**
1.3442 +Gets the number of elements currently held in the array for which this generic
1.3443 +array has been constructed.
1.3444 +
1.3445 +@return The number of array elements.
1.3446 +*/
1.3447 + {return((*iCount)(iPtr));}
1.3448 +
1.3449 +
1.3450 +
1.3451 +
1.3452 +template <class T>
1.3453 +inline const T &TArray<T>::operator[](TInt anIndex) const
1.3454 +/**
1.3455 +Gets a reference to the element located at the specified position.
1.3456 +
1.3457 +The returned reference is const and cannot be used to change the element.
1.3458 +Any member function of the referenced template class T must be declared
1.3459 +as const if that function is to be accessed through this operator.
1.3460 +
1.3461 +@param anIndex The position of the element within the array for which this
1.3462 + TArray has been constructed. The position is relative to zero;
1.3463 + i.e. zero implies the first element in the array.
1.3464 +
1.3465 +@return A const reference to the element located at position anIndex within
1.3466 + the array for which this TArray has been constructed.
1.3467 +
1.3468 +@panic E32USER-CBase 21, if anIndex is negative, or greater than or equal to
1.3469 + the number of objects currently within the array.
1.3470 +*/
1.3471 + {return(*((const T *)(*iAt)(iPtr,anIndex)));}
1.3472 +#endif
1.3473 +
1.3474 +
1.3475 +
1.3476 +
1.3477 +// Class TIdentityRelation<T>
1.3478 +template <class T>
1.3479 +inline TIdentityRelation<T>::TIdentityRelation( TBool (*anIdentity)(const T&, const T&) )
1.3480 +/**
1.3481 +Constructs the object taking the specified function as an argument.
1.3482 +
1.3483 +The specified function should implement an algorithm for determining whether
1.3484 +two class T type objects match. It should return:
1.3485 +
1.3486 +1. true, if the two objects match.
1.3487 +
1.3488 +2. false, if the two objects do not match.
1.3489 +
1.3490 +@param anIdentity A pointer to a function that takes constant references to two
1.3491 + class T objects and returns a TInt value.
1.3492 +*/
1.3493 + { iIdentity=(TGeneralIdentityRelation)anIdentity; }
1.3494 +
1.3495 +
1.3496 +
1.3497 +
1.3498 +template <class T>
1.3499 +inline TIdentityRelation<T>::operator TGeneralIdentityRelation() const
1.3500 +/**
1.3501 +Operator that gets the function that determines whether two
1.3502 +objects of a given class type match.
1.3503 +*/
1.3504 + { return iIdentity; }
1.3505 +
1.3506 +
1.3507 +
1.3508 +
1.3509 +// Class TLinearOrder<T>
1.3510 +template <class T>
1.3511 +inline TLinearOrder<T>::TLinearOrder( TInt(*anOrder)(const T&, const T&) )
1.3512 +/**
1.3513 +Constructs the object taking the specified function as an argument.
1.3514 +
1.3515 +The specified function should implement an algorithm that determines the
1.3516 +order of two class T type objects. It should return:
1.3517 +
1.3518 +1. zero, if the two objects are equal.
1.3519 +
1.3520 +2. a negative value, if the first object is less than the second.
1.3521 +
1.3522 +3. a positive value, if the first object is greater than the second.
1.3523 +
1.3524 +@param anOrder A pointer to a function that takes constant references to two
1.3525 + class T objects and returns a TInt value.
1.3526 +*/
1.3527 + { iOrder=(TGeneralLinearOrder)anOrder; }
1.3528 +
1.3529 +
1.3530 +
1.3531 +
1.3532 +template <class T>
1.3533 +inline TLinearOrder<T>::operator TGeneralLinearOrder() const
1.3534 +/**
1.3535 +Operator that gets the function that determines the order of two
1.3536 +objects of a given class type.
1.3537 +*/
1.3538 + { return iOrder; }
1.3539 +
1.3540 +
1.3541 +
1.3542 +
1.3543 +// Class RPointerArray<T>
1.3544 +
1.3545 +/**
1.3546 +Default C++ constructor.
1.3547 +
1.3548 +This constructs an array object for an array of pointers with default
1.3549 +granularity, which is 8.
1.3550 +*/
1.3551 +template <class T>
1.3552 +inline RPointerArray<T>::RPointerArray()
1.3553 + : RPointerArrayBase()
1.3554 + {}
1.3555 +
1.3556 +
1.3557 +
1.3558 +
1.3559 +/**
1.3560 +C++ constructor with granularity.
1.3561 +
1.3562 +This constructs an array object for an array of pointers with the specified
1.3563 +granularity.
1.3564 +
1.3565 +@param aGranularity The granularity of the array.
1.3566 +
1.3567 +@panic USER 127, if aGranularity is not positive, or greater than or equal
1.3568 + to 0x10000000.
1.3569 +*/
1.3570 +template <class T>
1.3571 +inline RPointerArray<T>::RPointerArray(TInt aGranularity)
1.3572 + : RPointerArrayBase(aGranularity)
1.3573 + {}
1.3574 +
1.3575 +
1.3576 +
1.3577 +
1.3578 +/**
1.3579 +C++ constructor with minimum growth step and exponential growth factor.
1.3580 +
1.3581 +This constructs an array object for an array of pointers with the specified
1.3582 +minimum growth step and exponential growth factor.
1.3583 +
1.3584 +@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
1.3585 + 65535 inclusive.
1.3586 +@param aFactor The factor by which the array grows, multiplied by 256.
1.3587 + For example 512 specifies a factor of 2. Must be between 257
1.3588 + and 32767 inclusive.
1.3589 +
1.3590 +@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
1.3591 +@panic USER 193, if aFactor<=257 or aFactor>32767.
1.3592 +*/
1.3593 +template <class T>
1.3594 +inline RPointerArray<T>::RPointerArray(TInt aMinGrowBy, TInt aFactor)
1.3595 + : RPointerArrayBase(aMinGrowBy, aFactor)
1.3596 + {}
1.3597 +
1.3598 +
1.3599 +
1.3600 +
1.3601 +template <class T>
1.3602 +inline void RPointerArray<T>::Close()
1.3603 +/**
1.3604 +Closes the array and frees all memory allocated to it.
1.3605 +
1.3606 +The function must be called before this array object goes out of scope.
1.3607 +
1.3608 +Note that the function does not delete the objects whose pointers are contained
1.3609 +in the array.
1.3610 +*/
1.3611 + {RPointerArrayBase::Close();}
1.3612 +
1.3613 +
1.3614 +
1.3615 +
1.3616 +template <class T>
1.3617 +inline TInt RPointerArray<T>::Count() const
1.3618 +/**
1.3619 +Gets the number of object pointers in the array.
1.3620 +
1.3621 +@return The number of object pointers in the array.
1.3622 +*/
1.3623 + { return RPointerArrayBase::Count(); }
1.3624 +
1.3625 +
1.3626 +
1.3627 +
1.3628 +template <class T>
1.3629 +inline T* const& RPointerArray<T>::operator[](TInt anIndex) const
1.3630 +/**
1.3631 +Gets a reference to the object pointer located at the specified
1.3632 +position within the array.
1.3633 +
1.3634 +The compiler chooses this option if the returned reference is used in
1.3635 +an expression where the reference cannot be modified.
1.3636 +
1.3637 +@param anIndex The position of the object pointer within the array. The
1.3638 + position is relative to zero, i.e. zero implies the object
1.3639 + pointer at the beginning of the array.
1.3640 +
1.3641 +@return A const reference to the object pointer at position anIndex within
1.3642 + the array.
1.3643 +
1.3644 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.3645 + objects currently in the array.
1.3646 +*/
1.3647 + {return (T* const&)At(anIndex);}
1.3648 +
1.3649 +
1.3650 +
1.3651 +
1.3652 +template <class T>
1.3653 +inline T*& RPointerArray<T>::operator[](TInt anIndex)
1.3654 +/**
1.3655 +Gets a reference to the object pointer located at the specified
1.3656 +position within the array.
1.3657 +
1.3658 +The compiler chooses this option if the returned reference is used in
1.3659 +an expression where the reference can be modified.
1.3660 +
1.3661 +@param anIndex The position of the object pointer within the array. The
1.3662 + position is relative to zero, i.e. zero implies the object
1.3663 + pointer at the beginning of the array.
1.3664 +
1.3665 +@return A non-const reference to the object pointer at position anIndex within
1.3666 + the array.
1.3667 +
1.3668 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.3669 + objects currently in the array.
1.3670 +*/
1.3671 + {return (T*&)At(anIndex);}
1.3672 +
1.3673 +
1.3674 +
1.3675 +
1.3676 +template <class T>
1.3677 +inline TInt RPointerArray<T>::Append(const T* anEntry)
1.3678 +/**
1.3679 +Appends an object pointer onto the array.
1.3680 +
1.3681 +@param anEntry The object pointer to be appended.
1.3682 +
1.3683 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.3684 + wide error codes.
1.3685 +*/
1.3686 + { return RPointerArrayBase::Append(anEntry); }
1.3687 +
1.3688 +
1.3689 +
1.3690 +
1.3691 +template <class T>
1.3692 +inline TInt RPointerArray<T>::Insert(const T* anEntry, TInt aPos)
1.3693 +/**
1.3694 +Inserts an object pointer into the array at the specified position.
1.3695 +
1.3696 +@param anEntry The object pointer to be inserted.
1.3697 +@param aPos The position within the array where the object pointer is to be
1.3698 + inserted. The position is relative to zero, i.e. zero implies
1.3699 + that a pointer is inserted at the beginning of the array.
1.3700 +
1.3701 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.3702 + wide error codes.
1.3703 +
1.3704 +@panic USER 131, if aPos is negative, or is greater than the number of object
1.3705 + pointers currently in the array.
1.3706 +*/
1.3707 + { return RPointerArrayBase::Insert(anEntry,aPos); }
1.3708 +
1.3709 +
1.3710 +
1.3711 +
1.3712 +template <class T>
1.3713 +inline void RPointerArray<T>::Remove(TInt anIndex)
1.3714 +/**
1.3715 +Removes the object pointer at the specified position from the array.
1.3716 +
1.3717 +Note that the function does not delete the object whose pointer is removed.
1.3718 +
1.3719 +@param anIndex The position within the array from where the object pointer
1.3720 + is to be removed. The position is relative to zero, i.e. zero
1.3721 + implies that a pointer at the beginning of the array is to be
1.3722 + removed.
1.3723 +
1.3724 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.3725 + objects currently in the array.
1.3726 +*/
1.3727 + {RPointerArrayBase::Remove(anIndex);}
1.3728 +
1.3729 +
1.3730 +
1.3731 +
1.3732 +template <class T>
1.3733 +inline void RPointerArray<T>::Compress()
1.3734 +/**
1.3735 +Compresses the array down to a minimum.
1.3736 +
1.3737 +After a call to this function, the memory allocated to the array is just
1.3738 +sufficient for its contained object pointers.
1.3739 +Subsequently adding a new object pointer to the array
1.3740 +always results in a re-allocation of memory.
1.3741 +*/
1.3742 + {RPointerArrayBase::Compress();}
1.3743 +
1.3744 +
1.3745 +
1.3746 +
1.3747 +template <class T>
1.3748 +inline void RPointerArray<T>::Reset()
1.3749 +/**
1.3750 +Empties the array.
1.3751 +
1.3752 +It frees all memory allocated to the array and resets the internal state so
1.3753 +that it is ready to be reused.
1.3754 +
1.3755 +This array object can be allowed to go out of scope after a call to this
1.3756 +function.
1.3757 +
1.3758 +Note that the function does not delete the objects whose pointers are contained
1.3759 +in the array.
1.3760 +*/
1.3761 + {RPointerArrayBase::Reset();}
1.3762 +
1.3763 +
1.3764 +
1.3765 +
1.3766 +template <class T>
1.3767 +inline TInt RPointerArray<T>::Find(const T* anEntry) const
1.3768 +/**
1.3769 +Finds the first object pointer in the array which matches the specified object
1.3770 +pointer, using a sequential search.
1.3771 +
1.3772 +Matching is based on the comparison of pointers.
1.3773 +
1.3774 +The find operation always starts at the low index end of the array. There
1.3775 +is no assumption about the order of objects in the array.
1.3776 +
1.3777 +@param anEntry The object pointer to be found.
1.3778 +@return The index of the first matching object pointer within the array.
1.3779 + KErrNotFound, if no matching object pointer can be found.
1.3780 +*/
1.3781 + { return RPointerArrayBase::Find(anEntry); }
1.3782 +
1.3783 +
1.3784 +
1.3785 +
1.3786 +template <class T>
1.3787 +inline TInt RPointerArray<T>::Find(const T* anEntry, TIdentityRelation<T> anIdentity) const
1.3788 +/**
1.3789 +Finds the first object pointer in the array whose object matches the specified
1.3790 +object, using a sequential search and a matching algorithm.
1.3791 +
1.3792 +The algorithm for determining whether two class T objects match is provided
1.3793 +by a function supplied by the caller.
1.3794 +
1.3795 +The find operation always starts at the low index end of the array. There
1.3796 +is no assumption about the order of objects in the array.
1.3797 +
1.3798 +@param anEntry The object pointer to be found.
1.3799 +@param anIdentity A package encapsulating the function which determines whether
1.3800 + two class T objects match.
1.3801 +
1.3802 +@return The index of the first matching object pointer within the array.
1.3803 + KErrNotFound, if no suitable object pointer can be found.
1.3804 +*/
1.3805 + { return RPointerArrayBase::Find(anEntry,anIdentity); }
1.3806 +
1.3807 +
1.3808 +
1.3809 +
1.3810 +template <class T>
1.3811 +inline TInt RPointerArray<T>::FindReverse(const T* anEntry) const
1.3812 +/**
1.3813 +Finds the last object pointer in the array which matches the specified object
1.3814 +pointer, using a sequential search.
1.3815 +
1.3816 +Matching is based on the comparison of pointers.
1.3817 +
1.3818 +The find operation always starts at the high index end of the array. There
1.3819 +is no assumption about the order of objects in the array.
1.3820 +
1.3821 +@param anEntry The object pointer to be found.
1.3822 +@return The index of the last matching object pointer within the array.
1.3823 + KErrNotFound, if no matching object pointer can be found.
1.3824 +*/
1.3825 + { return RPointerArrayBase::FindReverse(anEntry); }
1.3826 +
1.3827 +
1.3828 +
1.3829 +
1.3830 +template <class T>
1.3831 +inline TInt RPointerArray<T>::FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const
1.3832 +/**
1.3833 +Finds the last object pointer in the array whose object matches the specified
1.3834 +object, using a sequential search and a matching algorithm.
1.3835 +
1.3836 +The algorithm for determining whether two class T objects match is provided
1.3837 +by a function supplied by the caller.
1.3838 +
1.3839 +The find operation always starts at the high index end of the array. There
1.3840 +is no assumption about the order of objects in the array.
1.3841 +
1.3842 +@param anEntry The object pointer to be found.
1.3843 +@param anIdentity A package encapsulating the function which determines whether
1.3844 + two class T objects match.
1.3845 +
1.3846 +@return The index of the last matching object pointer within the array.
1.3847 + KErrNotFound, if no suitable object pointer can be found.
1.3848 +*/
1.3849 + { return RPointerArrayBase::FindReverse(anEntry,anIdentity); }
1.3850 +
1.3851 +
1.3852 +
1.3853 +
1.3854 +template <class T>
1.3855 +inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry) const
1.3856 +/**
1.3857 +Finds the object pointer in the array that matches the specified object
1.3858 +pointer, using a binary search technique.
1.3859 +
1.3860 +The function assumes that object pointers in the array are in address order.
1.3861 +
1.3862 +@param anEntry The object pointer to be found.
1.3863 +
1.3864 +@return The index of the matching object pointer within the array or KErrNotFound
1.3865 + if no suitable object pointer can be found.
1.3866 +*/
1.3867 + { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); }
1.3868 +
1.3869 +
1.3870 +
1.3871 +
1.3872 +template <class T>
1.3873 +inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const
1.3874 +/**
1.3875 +Finds the object pointer in the array whose object matches the specified
1.3876 +object, using a binary search technique and an ordering algorithm.
1.3877 +
1.3878 +The function assumes that existing object pointers in the array are ordered
1.3879 +so that the objects themselves are in object order as determined by an algorithm
1.3880 +supplied by the caller and packaged as a TLinearOrder<T>.
1.3881 +
1.3882 +@param anEntry The object pointer to be found.
1.3883 +@param anOrder A package encapsulating the function which determines the order
1.3884 + of two class T objects.
1.3885 +
1.3886 +@return The index of the matching object pointer within the array or KErrNotFound,
1.3887 + if no suitable object pointer can be found.
1.3888 +*/
1.3889 + { return RPointerArrayBase::FindIsq(anEntry,anOrder); }
1.3890 +
1.3891 +
1.3892 +
1.3893 +
1.3894 +template <class T>
1.3895 +inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry, TInt& anIndex) const
1.3896 +/**
1.3897 +Finds the object pointer in the array that matches the specified object
1.3898 +pointer, using a binary search technique.
1.3899 +
1.3900 +The function assumes that object pointers in the array are in address order.
1.3901 +
1.3902 +@param anEntry The object pointer to be found.
1.3903 +@param anIndex A TInt supplied by the caller. On return, contains an index
1.3904 + value:
1.3905 + If the function returns KErrNone, this is the index of the
1.3906 + matching object pointer within the array.
1.3907 + If the function returns KErrNotFound, this is the
1.3908 + index of the first object pointer within the array which
1.3909 + logically follows after anEntry.
1.3910 +
1.3911 +@return KErrNone, if a matching object pointer is found.
1.3912 + KErrNotFound, if no suitable object pointer can be found.
1.3913 +*/
1.3914 + { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); }
1.3915 +
1.3916 +
1.3917 +
1.3918 +
1.3919 +template <class T>
1.3920 +inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const
1.3921 +/**
1.3922 +Finds the object pointer in the array whose object matches the specified
1.3923 +object, using a binary search technique and an ordering algorithm.
1.3924 +
1.3925 +The function assumes that existing object pointers in the array are ordered
1.3926 +so that the objects themselves are in object order as determined by an
1.3927 +algorithm supplied by the caller and packaged as a TLinearOrder<T>.
1.3928 +
1.3929 +@param anEntry The object pointer to be found.
1.3930 +@param anIndex A TInt supplied by the caller. On return, contains an
1.3931 + index value:
1.3932 + If the function returns KErrNone, this is the index of the
1.3933 + matching object pointer within the array.
1.3934 + If the function returns KErrNotFound, this is the index of
1.3935 + the first object pointer in the array whose object is larger
1.3936 + than the entry being searched for - if no objects pointed to in
1.3937 + the array are larger, then the index value is the same as the
1.3938 + total number of object pointers in the array.
1.3939 +
1.3940 +@param anOrder A package encapsulating the function which determines the order
1.3941 + of two class T objects.
1.3942 +
1.3943 +@return KErrNone, if a matching object pointer is found.
1.3944 + KErrNotFound, if no suitable object pointer can be found.
1.3945 +*/
1.3946 + { return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder); }
1.3947 +
1.3948 +
1.3949 +
1.3950 +
1.3951 +template <class T>
1.3952 +inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const
1.3953 +/**
1.3954 +Finds the object pointer in the array that matches the specified object
1.3955 +pointer, using a binary search technique.
1.3956 +
1.3957 +Where there is more than one matching element, it finds the first, the last
1.3958 +or any matching element as specified by the value of aMode.
1.3959 +
1.3960 +The function assumes that object pointers in the array are in address order.
1.3961 +
1.3962 +@param anEntry The object pointer to be found.
1.3963 +@param aMode Specifies whether to find the first match, the last match or
1.3964 + any match, as defined by one of the TArrayFindMode enum values.
1.3965 +
1.3966 +@return KErrNotFound, if there is no matching element, otherwise the array
1.3967 + index of a matching element - what the index refers to depends on the
1.3968 + value of aMode:
1.3969 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.3970 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.3971 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.3972 + the last matching element - if the last matching element is also the last element of
1.3973 + the array, then the index value is the same as the total number of elements in the array.
1.3974 +
1.3975 +@see TArrayFindMode
1.3976 +*/
1.3977 + { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); }
1.3978 +
1.3979 +
1.3980 +
1.3981 +
1.3982 +template <class T>
1.3983 +inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const
1.3984 +/**
1.3985 +Finds the object pointer in the array whose object matches the specified
1.3986 +object, using a binary search technique and an ordering algorithm.
1.3987 +
1.3988 +Where there is more than one matching element, it finds the first, the last
1.3989 +or any matching element as specified by the value of aMode.
1.3990 +
1.3991 +The function assumes that existing object pointers in the array are ordered
1.3992 +so that the objects themselves are in object order as determined by an algorithm
1.3993 +supplied by the caller and packaged as a TLinearOrder<T> type.
1.3994 +
1.3995 +@param anEntry The object pointer to be found.
1.3996 +@param anOrder A package encapsulating the function which determines the order
1.3997 + of two class T objects.
1.3998 +@param aMode Specifies whether to find the first match, the last match or any match,
1.3999 + as defined by one of the TArrayFindMode enum values.
1.4000 +
1.4001 +@return KErrNotFound, if there is no matching element, otherwise the array
1.4002 + index of a matching element - what the index refers to depends on
1.4003 + the value of aMode:
1.4004 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.4005 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.4006 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.4007 + the last matching element - if the last matching element is also the last element of the array,
1.4008 + then the index value is the same as the total number of elements in the array.
1.4009 +
1.4010 +@see TArrayFindMode
1.4011 +*/
1.4012 + { return RPointerArrayBase::FindIsq(anEntry,anOrder,aMode); }
1.4013 +
1.4014 +
1.4015 +
1.4016 +
1.4017 +template <class T>
1.4018 +inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const
1.4019 +/**
1.4020 +Finds the object pointer in the array that matches the specified object
1.4021 +pointer, using a binary search technique.
1.4022 +
1.4023 +Where there is more than one matching element, it finds the first, the last
1.4024 +or any matching element as specified by the value of aMode.
1.4025 +
1.4026 +The function assumes that object pointers in the array are in address order.
1.4027 +
1.4028 +@param anEntry The object pointer to be found.
1.4029 +@param anIndex A TInt type supplied by the caller. On return, it contains an
1.4030 + index value depending on whether a match is found and on the
1.4031 + value of aMode.
1.4032 + If there is no matching element in the array, then this is
1.4033 + the index of the first element in the array that is bigger than
1.4034 + the element being searched for - if no elements in the array are
1.4035 + bigger, then the index value is the same as the total number of
1.4036 + elements in the array. If there is a matching element, then what
1.4037 + the index refers to depends on the value of aMode:
1.4038 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.4039 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.4040 + if this is EArrayFindMode_Last, then the index refers to first element that follows the
1.4041 + last matching element - if the last matching element is also the last element of the array,
1.4042 + then the index value is the same as the total number of elements in the array.
1.4043 +
1.4044 +@param aMode Specifies whether to find the first match, the last match or any
1.4045 + match, as defined by one of the TArrayFindMode enum values.
1.4046 +
1.4047 +@return KErrNone, if a matching object pointer is found.
1.4048 + KErrNotFound, if no suitable object pointer can be found.
1.4049 +
1.4050 +@see TArrayFindMode
1.4051 +*/
1.4052 + { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); }
1.4053 +
1.4054 +
1.4055 +
1.4056 +
1.4057 +template <class T>
1.4058 +inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const
1.4059 +/**
1.4060 +Finds the object pointer in the array whose object matches the specified
1.4061 +object, using a binary search technique and an ordering algorithm.
1.4062 +
1.4063 +Where there is more than one matching element, it finds the first, the last or any
1.4064 +matching element as specified by the value of aMode.
1.4065 +
1.4066 +The function assumes that existing object pointers in the array are ordered
1.4067 +so that the objects themselves are in object order as determined by an
1.4068 +algorithm supplied by the caller and packaged as a TLinearOrder<T> type.
1.4069 +
1.4070 +@param anEntry The object pointer to be found.
1.4071 +@param anIndex A TInt type supplied by the caller. On return, it contains an
1.4072 + index value depending on whether a match is found and on the
1.4073 + value of aMode. If there is no matching element in the array,
1.4074 + then this is the index of the first element in the array
1.4075 + that is bigger than the element being searched for - if
1.4076 + no elements in the array are bigger, then the index value
1.4077 + is the same as the total number of elements in the array.
1.4078 + If there is a matching element, then what the index refers to
1.4079 + depends on the value of aMode:
1.4080 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.4081 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.4082 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.4083 + the last matching element - if the last matching element is also the last element
1.4084 + of the array, then the index value is the same as the total number of elements in the array.
1.4085 +
1.4086 +@param anOrder A package encapsulating the function which determines the order
1.4087 + of two class T objects.
1.4088 +@param aMode Specifies whether to find the first match, the last match or
1.4089 + any match, as defined by one of the TArrayFindMode enum values.
1.4090 +
1.4091 +@return KErrNone, if a matching object pointer is found.
1.4092 + KErrNotFound, if no suitable object pointer can be found.
1.4093 +
1.4094 +@see TArrayFindMode
1.4095 +*/
1.4096 + { return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder,aMode); }
1.4097 +
1.4098 +
1.4099 +
1.4100 +
1.4101 +template <class T>
1.4102 +inline TInt RPointerArray<T>::InsertInAddressOrder(const T* anEntry)
1.4103 +/**
1.4104 +Inserts an object pointer into the array in address order.
1.4105 +
1.4106 +No duplicate entries are permitted. The array remains unchanged following
1.4107 +an attempt to insert a duplicate entry.
1.4108 +
1.4109 +The function assumes that existing object pointers within the array are in
1.4110 +address order.
1.4111 +
1.4112 +@param anEntry The object pointer to be inserted.
1.4113 +
1.4114 +@return KErrNone, if the insertion is successful;
1.4115 + KErrAlreadyExists, if an attempt is being made
1.4116 + to insert a duplicate entry; otherwise one of the other system wide
1.4117 + error codes.
1.4118 +*/
1.4119 + { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); }
1.4120 +
1.4121 +
1.4122 +
1.4123 +
1.4124 +template <class T>
1.4125 +inline TInt RPointerArray<T>::InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder)
1.4126 +/**
1.4127 +Inserts an object pointer into the array so that the object itself is in object
1.4128 +order.
1.4129 +
1.4130 +The algorithm for determining the order of two class T objects is provided
1.4131 +by a function supplied by the caller.
1.4132 +
1.4133 +No duplicate entries are permitted. The array remains unchanged following
1.4134 +an attempt to insert a duplicate entry.
1.4135 +
1.4136 +The function assumes that the array is ordered so that the referenced objects
1.4137 +are in object order.
1.4138 +
1.4139 +@param anEntry The object pointer to be inserted.
1.4140 +@param anOrder A package encapsulating the function which determines the order
1.4141 + of two class T objects.
1.4142 +
1.4143 +@return KErrNone, if the insertion is successful;
1.4144 + KErrAlreadyExists, if an attempt is being made
1.4145 + to insert a duplicate entry; otherwise one of the other system wide
1.4146 + error codes.
1.4147 +*/
1.4148 + { return RPointerArrayBase::InsertIsq(anEntry,anOrder,EFalse); }
1.4149 +
1.4150 +
1.4151 +
1.4152 +
1.4153 +template <class T>
1.4154 +inline TInt RPointerArray<T>::InsertInAddressOrderAllowRepeats(const T* anEntry)
1.4155 +/**
1.4156 +Inserts an object pointer into the array in address order, allowing duplicates.
1.4157 +
1.4158 +If the new object pointer is a duplicate of an existing object pointer in
1.4159 +the array, then the new pointer is inserted after the existing one. If more
1.4160 +than one duplicate object pointer already exists in the array, then any new
1.4161 +duplicate pointer is inserted after the last one.
1.4162 +
1.4163 +The function assumes that existing object pointers within the array are in
1.4164 +address order.
1.4165 +
1.4166 +@param anEntry The object pointer to be inserted.
1.4167 +
1.4168 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.4169 + wide error codes.
1.4170 +*/
1.4171 + { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); }
1.4172 +
1.4173 +
1.4174 +
1.4175 +
1.4176 +template <class T>
1.4177 +inline TInt RPointerArray<T>::InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder)
1.4178 +/**
1.4179 +Inserts an object pointer into the array so that the object itself is in object
1.4180 +order, allowing duplicates
1.4181 +
1.4182 +The algorithm for determining the order of two class T objects is provided
1.4183 +by a function supplied by the caller.
1.4184 +
1.4185 +If the specified object is a duplicate of an existing object, then the new
1.4186 +pointer is inserted after the pointer to the existing object. If more than
1.4187 +one duplicate object already exists, then the new pointer is inserted after
1.4188 +the pointer to the last one.
1.4189 +
1.4190 +@param anEntry The object pointer to be inserted.
1.4191 +@param anOrder A package encapsulating the function which determines the order
1.4192 + of two class T objects.
1.4193 +
1.4194 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.4195 + wide error codes.
1.4196 +*/
1.4197 + { return RPointerArrayBase::InsertIsq(anEntry,anOrder,ETrue); }
1.4198 +
1.4199 +
1.4200 +
1.4201 +
1.4202 +#ifndef __KERNEL_MODE__
1.4203 +template <class T>
1.4204 +inline RPointerArray<T>::RPointerArray(T** aEntries, TInt aCount)
1.4205 + : RPointerArrayBase((TAny **)aEntries, aCount)
1.4206 +/**
1.4207 +C++ constructor with a pointer to the first array entry in a pre-existing
1.4208 +array, and the number of entries in that array.
1.4209 +
1.4210 +This constructor takes a pointer to a pre-existing set of entries of type
1.4211 +pointer to class T, which is owned by another RPointerArray object. Ownership
1.4212 +of the set of entries still resides with the original RPointerArray object.
1.4213 +
1.4214 +@param aEntries A pointer to the first entry of type pointer to class T in
1.4215 + the set of entries belonging to the existing array.
1.4216 +@param aCount The number of entries in the existing array. The granularity of
1.4217 + this array is set to this value.
1.4218 +
1.4219 +@panic USER 156, if aCount is not positive.
1.4220 +*/
1.4221 + {}
1.4222 +
1.4223 +
1.4224 +
1.4225 +
1.4226 +template <class T>
1.4227 +inline void RPointerArray<T>::GranularCompress()
1.4228 +/**
1.4229 +Compresses the array down to a granular boundary.
1.4230 +
1.4231 +After a call to this function, the memory allocated to the array is sufficient
1.4232 +for its contained object pointers. Adding new object pointers to the array
1.4233 +does not result in a re-allocation of memory until the the total number of
1.4234 +pointers reaches a multiple of the granularity.
1.4235 +*/
1.4236 + {RPointerArrayBase::GranularCompress();}
1.4237 +
1.4238 +
1.4239 +
1.4240 +
1.4241 +template <class T>
1.4242 +inline TInt RPointerArray<T>::Reserve(TInt aCount)
1.4243 +/**
1.4244 +Reserves space for the specified number of elements.
1.4245 +
1.4246 +After a call to this function, the memory allocated to the array is sufficient
1.4247 +to hold the number of object pointers specified. Adding new object pointers to the array
1.4248 +does not result in a re-allocation of memory until the the total number of
1.4249 +pointers exceeds the specified count.
1.4250 +
1.4251 +@param aCount The number of object pointers for which space should be reserved
1.4252 +@return KErrNone If the operation completed successfully
1.4253 +@return KErrNoMemory If the requested amount of memory could not be allocated
1.4254 +*/
1.4255 + { return RPointerArrayBase::DoReserve(aCount); }
1.4256 +
1.4257 +
1.4258 +
1.4259 +
1.4260 +template <class T>
1.4261 +inline void RPointerArray<T>::SortIntoAddressOrder()
1.4262 +/**
1.4263 +Sorts the object pointers within the array into address order.
1.4264 +*/
1.4265 + { HeapSortUnsigned(); }
1.4266 +
1.4267 +
1.4268 +
1.4269 +
1.4270 +template <class T>
1.4271 +inline void RPointerArray<T>::Sort(TLinearOrder<T> anOrder)
1.4272 +/**
1.4273 +Sorts the object pointers within the array.
1.4274 +
1.4275 +The sort order of the pointers is based on the order of the referenced objects.
1.4276 +The referenced object order is determined by an algorithm supplied by the
1.4277 +caller and packaged as a TLinerOrder<T>.
1.4278 +
1.4279 +@param anOrder A package encapsulating the function which determines the order
1.4280 + of two class T objects.
1.4281 +*/
1.4282 + { HeapSort(anOrder); }
1.4283 +
1.4284 +
1.4285 +
1.4286 +
1.4287 +template <class T>
1.4288 +inline TArray<T*> RPointerArray<T>::Array() const
1.4289 +/**
1.4290 +Constructs and returns a generic array.
1.4291 +
1.4292 +@return A generic array representing this array.
1.4293 +
1.4294 +@see TArray
1.4295 +*/
1.4296 + { return TArray<T*>(GetCount,GetElementPtr,(const CBase*)this); }
1.4297 +#endif
1.4298 +
1.4299 +
1.4300 +
1.4301 +template <class T>
1.4302 +void RPointerArray<T>::ResetAndDestroy()
1.4303 +/**
1.4304 +Empties the array and deletes the referenced objects.
1.4305 +
1.4306 +It frees all memory allocated to the array and resets the internal state so
1.4307 +that it is ready to be reused. The function also deletes all of the objects
1.4308 +whose pointers are contained by the array.
1.4309 +
1.4310 +This array object can be allowed to go out of scope after a call to this function.
1.4311 +*/
1.4312 + {
1.4313 + TInt c=Count();
1.4314 + T** pE=(T**)Entries();
1.4315 + ZeroCount();
1.4316 + TInt i;
1.4317 + for (i=0; i<c; i++)
1.4318 + {
1.4319 + delete *pE;
1.4320 + pE++;
1.4321 + }
1.4322 + Reset();
1.4323 + }
1.4324 +
1.4325 +
1.4326 +
1.4327 +// Specialization for RPointerArray<TAny>
1.4328 +
1.4329 +/**
1.4330 +Default C++ constructor.
1.4331 +
1.4332 +This constructs an array object for an array of TAny pointers with default
1.4333 +granularity, which is 8.
1.4334 +*/
1.4335 +inline RPointerArray<TAny>::RPointerArray()
1.4336 + : RPointerArrayBase()
1.4337 + {}
1.4338 +
1.4339 +
1.4340 +
1.4341 +
1.4342 +/**
1.4343 +C++ constructor with granularity.
1.4344 +
1.4345 +This constructs an array object for an array of TAny pointers with the specified
1.4346 +granularity.
1.4347 +
1.4348 +@param aGranularity The granularity of the array.
1.4349 +
1.4350 +@panic USER 127, if aGranularity is not positive, or greater than or equal
1.4351 + to 0x10000000.
1.4352 +*/
1.4353 +inline RPointerArray<TAny>::RPointerArray(TInt aGranularity)
1.4354 + : RPointerArrayBase(aGranularity)
1.4355 + {}
1.4356 +
1.4357 +
1.4358 +
1.4359 +
1.4360 +/**
1.4361 +C++ constructor with minimum growth step and exponential growth factor.
1.4362 +
1.4363 +This constructs an array object for an array of TAny pointers with the specified
1.4364 +minimum growth step and exponential growth factor.
1.4365 +
1.4366 +@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
1.4367 + 65535 inclusive.
1.4368 +@param aFactor The factor by which the array grows, multiplied by 256.
1.4369 + For example 512 specifies a factor of 2. Must be between 257
1.4370 + and 32767 inclusive.
1.4371 +
1.4372 +@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
1.4373 +@panic USER 193, if aFactor<=257 or aFactor>32767.
1.4374 +*/
1.4375 +inline RPointerArray<TAny>::RPointerArray(TInt aMinGrowBy, TInt aFactor)
1.4376 + : RPointerArrayBase(aMinGrowBy, aFactor)
1.4377 + {}
1.4378 +
1.4379 +
1.4380 +
1.4381 +
1.4382 +inline void RPointerArray<TAny>::Close()
1.4383 +/**
1.4384 +Closes the array and frees all memory allocated to it.
1.4385 +
1.4386 +The function must be called before this array object goes out of scope.
1.4387 +
1.4388 +Note that the function does not delete the objects whose pointers are contained
1.4389 +in the array.
1.4390 +*/
1.4391 + {RPointerArrayBase::Close();}
1.4392 +
1.4393 +
1.4394 +
1.4395 +
1.4396 +inline TInt RPointerArray<TAny>::Count() const
1.4397 +/**
1.4398 +Gets the number of pointers in the array.
1.4399 +
1.4400 +@return The number of pointers in the array.
1.4401 +*/
1.4402 + { return RPointerArrayBase::Count(); }
1.4403 +
1.4404 +
1.4405 +
1.4406 +
1.4407 +inline TAny* const& RPointerArray<TAny>::operator[](TInt anIndex) const
1.4408 +/**
1.4409 +Gets a reference to the pointer located at the specified
1.4410 +position within the array.
1.4411 +
1.4412 +The compiler chooses this option if the returned reference is used in
1.4413 +an expression where the reference cannot be modified.
1.4414 +
1.4415 +@param anIndex The position of the pointer within the array. The
1.4416 + position is relative to zero, i.e. zero implies the object
1.4417 + pointer at the beginning of the array.
1.4418 +
1.4419 +@return A const reference to the pointer at position anIndex within
1.4420 + the array.
1.4421 +
1.4422 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.4423 + objects currently in the array.
1.4424 +*/
1.4425 + {return At(anIndex);}
1.4426 +
1.4427 +
1.4428 +
1.4429 +
1.4430 +inline TAny*& RPointerArray<TAny>::operator[](TInt anIndex)
1.4431 +/**
1.4432 +Gets a reference to the pointer located at the specified
1.4433 +position within the array.
1.4434 +
1.4435 +The compiler chooses this option if the returned reference is used in
1.4436 +an expression where the reference can be modified.
1.4437 +
1.4438 +@param anIndex The position of the pointer within the array. The
1.4439 + position is relative to zero, i.e. zero implies the object
1.4440 + pointer at the beginning of the array.
1.4441 +
1.4442 +@return A non-const reference to the pointer at position anIndex within
1.4443 + the array.
1.4444 +
1.4445 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.4446 + objects currently in the array.
1.4447 +*/
1.4448 + {return At(anIndex);}
1.4449 +
1.4450 +
1.4451 +
1.4452 +
1.4453 +inline TInt RPointerArray<TAny>::Append(const TAny* anEntry)
1.4454 +/**
1.4455 +Appends an pointer onto the array.
1.4456 +
1.4457 +@param anEntry The pointer to be appended.
1.4458 +
1.4459 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.4460 + wide error codes.
1.4461 +*/
1.4462 + { return RPointerArrayBase::Append(anEntry); }
1.4463 +
1.4464 +
1.4465 +
1.4466 +
1.4467 +inline TInt RPointerArray<TAny>::Insert(const TAny* anEntry, TInt aPos)
1.4468 +/**
1.4469 +Inserts an pointer into the array at the specified position.
1.4470 +
1.4471 +@param anEntry The pointer to be inserted.
1.4472 +@param aPos The position within the array where the pointer is to be
1.4473 + inserted. The position is relative to zero, i.e. zero implies
1.4474 + that a pointer is inserted at the beginning of the array.
1.4475 +
1.4476 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.4477 + wide error codes.
1.4478 +
1.4479 +@panic USER 131, if aPos is negative, or is greater than the number of object
1.4480 + pointers currently in the array.
1.4481 +*/
1.4482 + { return RPointerArrayBase::Insert(anEntry,aPos); }
1.4483 +
1.4484 +
1.4485 +
1.4486 +
1.4487 +inline void RPointerArray<TAny>::Remove(TInt anIndex)
1.4488 +/**
1.4489 +Removes the pointer at the specified position from the array.
1.4490 +
1.4491 +Note that the function does not delete the object whose pointer is removed.
1.4492 +
1.4493 +@param anIndex The position within the array from where the pointer
1.4494 + is to be removed. The position is relative to zero, i.e. zero
1.4495 + implies that a pointer at the beginning of the array is to be
1.4496 + removed.
1.4497 +
1.4498 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.4499 + objects currently in the array.
1.4500 +*/
1.4501 + {RPointerArrayBase::Remove(anIndex);}
1.4502 +
1.4503 +
1.4504 +
1.4505 +
1.4506 +inline void RPointerArray<TAny>::Compress()
1.4507 +/**
1.4508 +Compresses the array down to a minimum.
1.4509 +
1.4510 +After a call to this function, the memory allocated to the array is just
1.4511 +sufficient for its contained pointers.
1.4512 +Subsequently adding a new pointer to the array
1.4513 +always results in a re-allocation of memory.
1.4514 +*/
1.4515 + {RPointerArrayBase::Compress();}
1.4516 +
1.4517 +
1.4518 +
1.4519 +
1.4520 +inline void RPointerArray<TAny>::Reset()
1.4521 +/**
1.4522 +Empties the array.
1.4523 +
1.4524 +It frees all memory allocated to the array and resets the internal state so
1.4525 +that it is ready to be reused.
1.4526 +
1.4527 +This array object can be allowed to go out of scope after a call to this
1.4528 +function.
1.4529 +
1.4530 +Note that the function does not delete the objects whose pointers are contained
1.4531 +in the array.
1.4532 +*/
1.4533 + {RPointerArrayBase::Reset();}
1.4534 +
1.4535 +
1.4536 +
1.4537 +
1.4538 +inline TInt RPointerArray<TAny>::Find(const TAny* anEntry) const
1.4539 +/**
1.4540 +Finds the first pointer in the array which matches the specified pointer, using
1.4541 +a sequential search.
1.4542 +
1.4543 +Matching is based on the comparison of pointers.
1.4544 +
1.4545 +The find operation always starts at the low index end of the array. There
1.4546 +is no assumption about the order of objects in the array.
1.4547 +
1.4548 +@param anEntry The pointer to be found.
1.4549 +@return The index of the first matching pointer within the array.
1.4550 + KErrNotFound, if no matching pointer can be found.
1.4551 +*/
1.4552 + { return RPointerArrayBase::Find(anEntry); }
1.4553 +
1.4554 +
1.4555 +
1.4556 +
1.4557 +inline TInt RPointerArray<TAny>::FindReverse(const TAny* anEntry) const
1.4558 +/**
1.4559 +Finds the last pointer in the array which matches the specified pointer, using
1.4560 +a sequential search.
1.4561 +
1.4562 +Matching is based on the comparison of pointers.
1.4563 +
1.4564 +The find operation always starts at the high index end of the array. There
1.4565 +is no assumption about the order of objects in the array.
1.4566 +
1.4567 +@param anEntry The pointer to be found.
1.4568 +@return The index of the last matching pointer within the array.
1.4569 + KErrNotFound, if no matching pointer can be found.
1.4570 +*/
1.4571 + { return RPointerArrayBase::FindReverse(anEntry); }
1.4572 +
1.4573 +
1.4574 +
1.4575 +
1.4576 +inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry) const
1.4577 +/**
1.4578 +Finds the pointer in the array that matches the specified object
1.4579 +pointer, using a binary search technique.
1.4580 +
1.4581 +The function assumes that pointers in the array are in address order.
1.4582 +
1.4583 +@param anEntry The pointer to be found.
1.4584 +
1.4585 +@return The index of the matching pointer within the array or KErrNotFound
1.4586 + if no suitable pointer can be found.
1.4587 +*/
1.4588 + { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); }
1.4589 +
1.4590 +
1.4591 +
1.4592 +
1.4593 +inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const
1.4594 +/**
1.4595 +Finds the pointer in the array that matches the specified object
1.4596 +pointer, using a binary search technique.
1.4597 +
1.4598 +The function assumes that pointers in the array are in address order.
1.4599 +
1.4600 +@param anEntry The pointer to be found.
1.4601 +@param anIndex A TInt supplied by the caller. On return, contains an index
1.4602 + value:
1.4603 + If the function returns KErrNone, this is the index of the
1.4604 + matching pointer within the array.
1.4605 + If the function returns KErrNotFound, this is the index of the
1.4606 + last pointer within the array which logically
1.4607 + precedes anEntry.
1.4608 +
1.4609 +@return KErrNone, if a matching pointer is found.
1.4610 + KErrNotFound, if no suitable pointer can be found.
1.4611 +*/
1.4612 + { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); }
1.4613 +
1.4614 +
1.4615 +
1.4616 +
1.4617 +inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const
1.4618 +/**
1.4619 +Finds the pointer in the array that matches the specified pointer, using a
1.4620 +binary search technique.
1.4621 +
1.4622 +Where there is more than one matching element, it finds the first, the last
1.4623 +or any matching element as specified by the value of aMode.
1.4624 +
1.4625 +The function assumes that pointers in the array are in address order.
1.4626 +
1.4627 +@param anEntry The pointer to be found.
1.4628 +@param aMode Specifies whether to find the first match, the last match or
1.4629 + any match, as defined by one of the TArrayFindMode enum values.
1.4630 +
1.4631 +@return KErrNotFound, if there is no matching element, otherwise the array
1.4632 + index of a matching element - what the index refers to depends on the
1.4633 + value of aMode:
1.4634 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.4635 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.4636 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.4637 + the last matching element - if the last matching element is also the last element of
1.4638 + the array, then the index value is the same as the total number of elements in the array.
1.4639 +
1.4640 +@see TArrayFindMode
1.4641 +*/
1.4642 + { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); }
1.4643 +
1.4644 +
1.4645 +
1.4646 +
1.4647 +inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const
1.4648 +/**
1.4649 +Finds the pointer in the array that matches the specified pointer, using a
1.4650 +binary search technique.
1.4651 +
1.4652 +Where there is more than one matching element, it finds the first, the last
1.4653 +or any matching element as specified by the value of aMode.
1.4654 +
1.4655 +The function assumes that pointers in the array are in address order.
1.4656 +
1.4657 +@param anEntry The pointer to be found.
1.4658 +@param anIndex A TInt type supplied by the caller. On return, it contains an
1.4659 + index value depending on whether a match is found and on the
1.4660 + value of aMode.
1.4661 + If there is no matching element in the array, then this is
1.4662 + the index of the first element in the array that is bigger than
1.4663 + the element being searched for - if no elements in the array are
1.4664 + bigger, then the index value is the same as the total number of
1.4665 + elements in the array. If there is a matching element, then what
1.4666 + the index refers to depends on the value of aMode:
1.4667 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.4668 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.4669 + if this is EArrayFindMode_Last, then the index refers to first element that follows the
1.4670 + last matching element - if the last matching element is also the last element of the array,
1.4671 + then the index value is the same as the total number of elements in the array.
1.4672 +
1.4673 +@param aMode Specifies whether to find the first match, the last match or any
1.4674 + match, as defined by one of the TArrayFindMode enum values.
1.4675 +
1.4676 +@return KErrNone, if a matching pointer is found.
1.4677 + KErrNotFound, if no suitable pointer can be found.
1.4678 +
1.4679 +@see TArrayFindMode
1.4680 +*/
1.4681 + { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); }
1.4682 +
1.4683 +
1.4684 +
1.4685 +
1.4686 +inline TInt RPointerArray<TAny>::InsertInAddressOrder(const TAny* anEntry)
1.4687 +/**
1.4688 +Inserts an pointer into the array in address order.
1.4689 +
1.4690 +No duplicate entries are permitted. The array remains unchanged following
1.4691 +an attempt to insert a duplicate entry.
1.4692 +
1.4693 +The function assumes that existing pointers within the array are in
1.4694 +address order.
1.4695 +
1.4696 +@param anEntry The pointer to be inserted.
1.4697 +
1.4698 +@return KErrNone, if the insertion is successful;
1.4699 + KErrAlreadyExists, if an attempt is being made
1.4700 + to insert a duplicate entry; otherwise one of the other system wide
1.4701 + error codes.
1.4702 +*/
1.4703 + { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); }
1.4704 +
1.4705 +
1.4706 +
1.4707 +
1.4708 +inline TInt RPointerArray<TAny>::InsertInAddressOrderAllowRepeats(const TAny* anEntry)
1.4709 +/**
1.4710 +Inserts an pointer into the array in address order, allowing duplicates.
1.4711 +
1.4712 +If the new pointer is a duplicate of an existing pointer in
1.4713 +the array, then the new pointer is inserted after the existing one. If more
1.4714 +than one duplicate pointer already exists in the array, then any new
1.4715 +duplicate pointer is inserted after the last one.
1.4716 +
1.4717 +The function assumes that existing pointers within the array are in
1.4718 +address order.
1.4719 +
1.4720 +@param anEntry The pointer to be inserted.
1.4721 +
1.4722 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.4723 + wide error codes.
1.4724 +*/
1.4725 + { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); }
1.4726 +
1.4727 +
1.4728 +
1.4729 +
1.4730 +#ifndef __KERNEL_MODE__
1.4731 +inline RPointerArray<TAny>::RPointerArray(TAny** aEntries, TInt aCount)
1.4732 + : RPointerArrayBase((TAny **)aEntries, aCount)
1.4733 +/**
1.4734 +C++ constructor with a pointer to the first array entry in a pre-existing
1.4735 +array, and the number of entries in that array.
1.4736 +
1.4737 +This constructor takes a pointer to a pre-existing set of entries of type TAny*,
1.4738 +which is owned by another RPointerArray object. Ownership of the set of entries
1.4739 +still resides with the original RPointerArray object.
1.4740 +
1.4741 +@param aEntries A pointer to the first entry of type TAny* in the set of entries
1.4742 + belonging to the existing array.
1.4743 +@param aCount The number of entries in the existing array. The granularity of
1.4744 + this array is set to this value.
1.4745 +
1.4746 +@panic USER 156, if aCount is not positive.
1.4747 +*/
1.4748 + {}
1.4749 +
1.4750 +
1.4751 +
1.4752 +
1.4753 +inline void RPointerArray<TAny>::GranularCompress()
1.4754 +/**
1.4755 +Compresses the array down to a granular boundary.
1.4756 +
1.4757 +After a call to this function, the memory allocated to the array is sufficient
1.4758 +for its contained pointers. Adding new pointers to the array
1.4759 +does not result in a re-allocation of memory until the the total number of
1.4760 +pointers reaches a multiple of the granularity.
1.4761 +*/
1.4762 + {RPointerArrayBase::GranularCompress();}
1.4763 +
1.4764 +
1.4765 +
1.4766 +
1.4767 +inline void RPointerArray<TAny>::SortIntoAddressOrder()
1.4768 +/**
1.4769 +Sorts the pointers within the array into address order.
1.4770 +*/
1.4771 + { HeapSortUnsigned(); }
1.4772 +
1.4773 +
1.4774 +
1.4775 +
1.4776 +inline TArray<TAny*> RPointerArray<TAny>::Array() const
1.4777 +/**
1.4778 +Constructs and returns a generic array.
1.4779 +
1.4780 +@return A generic array representing this array.
1.4781 +
1.4782 +@see TArray
1.4783 +*/
1.4784 + { return TArray<TAny*>(GetCount,GetElementPtr,(const CBase*)this); }
1.4785 +#endif
1.4786 +
1.4787 +
1.4788 +
1.4789 +template <class T>
1.4790 +inline RArray<T>::RArray()
1.4791 + : RArrayBase(sizeof(T))
1.4792 +/**
1.4793 +Default C++ constructor.
1.4794 +
1.4795 +This constructs an array object for an array of type class T objects with
1.4796 +default granularity and key offset value. The default granularity is 8 and
1.4797 +the defaul key offset value is zero.
1.4798 +
1.4799 +@panic USER 129, if the size of class T is not positive or is not less
1.4800 + than 640.
1.4801 +*/
1.4802 + {}
1.4803 +
1.4804 +
1.4805 +
1.4806 +
1.4807 +template <class T>
1.4808 +inline RArray<T>::RArray(TInt aGranularity)
1.4809 + : RArrayBase(sizeof(T),aGranularity)
1.4810 +/**
1.4811 +C++ constructor with granularity.
1.4812 +
1.4813 +This constructs an array object for an array of type class T objects with
1.4814 +a specified granularity and default key offset value. The default key offset
1.4815 +value is zero.
1.4816 +
1.4817 +@param aGranularity The granularity of the array.
1.4818 +
1.4819 +@panic USER 129, if the size of class T is not positive or is not less
1.4820 + than 640.
1.4821 +@panic USER 127, if aGranularity is not positive or the product of this
1.4822 + value and the size of class T is not less than 0x10000000.
1.4823 +*/
1.4824 + {}
1.4825 +
1.4826 +
1.4827 +
1.4828 +
1.4829 +template <class T>
1.4830 +inline RArray<T>::RArray(TInt aGranularity, TInt aKeyOffset)
1.4831 + : RArrayBase(sizeof(T),aGranularity,aKeyOffset)
1.4832 +/**
1.4833 +C++ constructor with granularity and key offset.
1.4834 +
1.4835 +This constructs an array object for an array of type class T objects with
1.4836 +a specified granularity and a specified key offset value.
1.4837 +
1.4838 +@param aGranularity The granularity of the array.
1.4839 +@param aKeyOffset The key offset.
1.4840 +
1.4841 +@panic USER 129, if the size of class T is not positive or is not less
1.4842 + than 640.
1.4843 +@panic USER 127, if aGranularity is not positive or the product of this
1.4844 + value and the size of class T is not less than 0x10000000.
1.4845 +@panic USER 128, if aKeyOffset is not positive, or is not less than the
1.4846 + size of class T, or is not a multiple of 4.
1.4847 +*/
1.4848 + {}
1.4849 +
1.4850 +
1.4851 +
1.4852 +
1.4853 +/**
1.4854 +C++ constructor with minimum growth step and exponential growth factor.
1.4855 +
1.4856 +This constructs an array object for an array of class T objects with the
1.4857 +specified minimum growth step and exponential growth factor.
1.4858 +
1.4859 +@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
1.4860 + 65535 inclusive.
1.4861 +@param aKeyOffset The key offset.
1.4862 +@param aFactor The factor by which the array grows, multiplied by 256.
1.4863 + For example 512 specifies a factor of 2. Must be between 257
1.4864 + and 32767 inclusive.
1.4865 +
1.4866 +@panic USER 129, if the size of class T is not positive or is not less than 640.
1.4867 +@panic USER 128, if aKeyOffset is negative, or is not less than the
1.4868 + size of class T, or is not a multiple of 4.
1.4869 +@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
1.4870 +@panic USER 193, if aFactor<=257 or aFactor>32767.
1.4871 +*/
1.4872 +template <class T>
1.4873 +inline RArray<T>::RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor)
1.4874 + : RArrayBase(sizeof(T), aMinGrowBy, aKeyOffset, aFactor)
1.4875 + {}
1.4876 +
1.4877 +
1.4878 +
1.4879 +
1.4880 +template <class T>
1.4881 +inline RArray<T>::RArray(TInt aEntrySize,T* aEntries, TInt aCount)
1.4882 + : RArrayBase(aEntrySize,aEntries,aCount)
1.4883 +/**
1.4884 +C++ constructor with size of entry, a pointer to the first array entry in a
1.4885 +pre-existing array, and the number of entries in that array.
1.4886 +
1.4887 +This constructor takes a pointer to a pre-existing set of entries of type
1.4888 +class T objects owned by another RArray object. Ownership of the set of entries
1.4889 +still resides with the original RArray object.
1.4890 +
1.4891 +This array is assigned a default granularity and key offset value. The default
1.4892 +granularity is 8 and the default key offset value is zero.
1.4893 +
1.4894 +The purpose of constructing an array in this way is to allow sorting and
1.4895 +finding operations to be done without further allocation of memory.
1.4896 +
1.4897 +@param aEntrySize The size of an entry in the existing array.
1.4898 +@param aEntries A pointer to the first entry of type class T in the set of
1.4899 + entries belonging to the existing array.
1.4900 +@param aCount The number of entries in the existing array.
1.4901 +
1.4902 +@panic USER 129, if aEntrySize is not positive or is not less than 640.
1.4903 +@panic USER 156, if aCount is not positive.
1.4904 +*/
1.4905 + {}
1.4906 +
1.4907 +
1.4908 +
1.4909 +
1.4910 +template <class T>
1.4911 +inline void RArray<T>::Close()
1.4912 +/**
1.4913 +Closes the array and frees all memory allocated to the array.
1.4914 +
1.4915 +The function must be called before this array object is destroyed.
1.4916 +*/
1.4917 + {RArrayBase::Close();}
1.4918 +
1.4919 +
1.4920 +
1.4921 +
1.4922 +template <class T>
1.4923 +inline TInt RArray<T>::Count() const
1.4924 +/**
1.4925 +Gets the number of objects in the array.
1.4926 +
1.4927 +@return The number of objects in the array.
1.4928 +*/
1.4929 + {return RArrayBase::Count();}
1.4930 +
1.4931 +
1.4932 +
1.4933 +
1.4934 +template <class T>
1.4935 +inline const T& RArray<T>::operator[](TInt anIndex) const
1.4936 +/**
1.4937 +Gets a reference to an object located at a specified position within the array.
1.4938 +
1.4939 +The compiler chooses this function if the returned reference is used in an
1.4940 +expression where the reference cannot be modified.
1.4941 +
1.4942 +@param anIndex The position of the object within the array. The position is
1.4943 + relative to zero, i.e. zero implies the object at the beginning
1.4944 + of the array.
1.4945 +
1.4946 +@return A const reference to the object at position anIndex within the array.
1.4947 +
1.4948 +@panic USER 130, if anIndex is negative or is greater than the number of
1.4949 + objects currently in the array
1.4950 +*/
1.4951 + {return *(const T*)At(anIndex); }
1.4952 +
1.4953 +
1.4954 +
1.4955 +
1.4956 +template <class T>
1.4957 +inline T& RArray<T>::operator[](TInt anIndex)
1.4958 +/**
1.4959 +Gets a reference to an object located at a specified position within the array.
1.4960 +
1.4961 +The compiler chooses this function if the returned reference is used in an
1.4962 +expression where the reference can be modified.
1.4963 +
1.4964 +@param anIndex The position of the object within the array. The position is
1.4965 + relative to zero, i.e. zero implies the object at the beginning
1.4966 + of the array.
1.4967 +
1.4968 +@return A non-const reference to the object at position anIndex within the array.
1.4969 +
1.4970 +@panic USER 130, if anIndex is negative or is greater than the number of
1.4971 + objects currently in the array
1.4972 +*/
1.4973 + {return *(T*)At(anIndex); }
1.4974 +
1.4975 +
1.4976 +
1.4977 +
1.4978 +template <class T>
1.4979 +inline TInt RArray<T>::Append(const T& anEntry)
1.4980 +/**
1.4981 +Apends an object onto the array.
1.4982 +
1.4983 +@param anEntry A reference to the object of type class T to be appended.
1.4984 +
1.4985 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.4986 + wide error codes.
1.4987 +*/
1.4988 + {return RArrayBase::Append(&anEntry);}
1.4989 +
1.4990 +
1.4991 +
1.4992 +
1.4993 +template <class T>
1.4994 +inline TInt RArray<T>::Insert(const T& anEntry, TInt aPos)
1.4995 +/**
1.4996 +Inserts an object into the array at a specified position.
1.4997 +
1.4998 +@param anEntry The class T object to be inserted.
1.4999 +@param aPos The position within the array where the object is to
1.5000 + be inserted. The position is relative to zero, i.e. zero
1.5001 + implies that an object is inserted at the beginning of
1.5002 + the array.
1.5003 +
1.5004 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.5005 + wide error codes.
1.5006 +
1.5007 +@panic USER 131, if aPos is negative or is greater than the number of objects
1.5008 + currently in the array.
1.5009 +*/
1.5010 + {return RArrayBase::Insert(&anEntry,aPos);}
1.5011 +
1.5012 +
1.5013 +
1.5014 +
1.5015 +template <class T>
1.5016 +inline void RArray<T>::Remove(TInt anIndex)
1.5017 +/**
1.5018 +Removes the object at a specified position from the array.
1.5019 +
1.5020 +@param anIndex The position within the array from where the object is to be
1.5021 + removed. The position is relative to zero, i.e. zero implies
1.5022 + that an object at the beginning of the array is to be removed.
1.5023 +
1.5024 +@panic USER 130, if anIndex is negative or is greater than the number of
1.5025 + objects currently in the array.
1.5026 +*/
1.5027 + {RArrayBase::Remove(anIndex);}
1.5028 +
1.5029 +
1.5030 +
1.5031 +
1.5032 +template <class T>
1.5033 +inline void RArray<T>::Compress()
1.5034 +/**
1.5035 +Compresses the array down to a minimum.
1.5036 +
1.5037 +After a call to this function, the memory allocated to the array is just
1.5038 +sufficient for its contained objects. Subsequently adding a new object to the
1.5039 +array always results in a re-allocation of memory.
1.5040 +*/
1.5041 + {RArrayBase::Compress();}
1.5042 +
1.5043 +
1.5044 +
1.5045 +
1.5046 +template <class T>
1.5047 +inline void RArray<T>::Reset()
1.5048 +/**
1.5049 +Empties the array, so that it is ready to be reused.
1.5050 +
1.5051 +The function frees all memory allocated to the array and resets the internal
1.5052 +state so that it is ready to be reused.
1.5053 +
1.5054 +This array object can be allowed to go out of scope after a call to this function.
1.5055 +*/
1.5056 + {RArrayBase::Reset();}
1.5057 +
1.5058 +
1.5059 +
1.5060 +
1.5061 +template <class T>
1.5062 +inline TInt RArray<T>::Find(const T& anEntry) const
1.5063 +/**
1.5064 +Finds the first object in the array which matches the specified object using
1.5065 +a sequential search.
1.5066 +
1.5067 +Matching is based on the comparison of a TInt value at the key offset position
1.5068 +within the objects.
1.5069 +
1.5070 +The find operation always starts at the low index end of the array. There
1.5071 +is no assumption about the order of objects in the array.
1.5072 +
1.5073 +@param anEntry A reference to an object of type class T to be used for matching.
1.5074 +
1.5075 +@return The index of the first matching object within the array.
1.5076 + KErrNotFound, if no matching object can be found.
1.5077 +*/
1.5078 + {return RArrayBase::Find(&anEntry);}
1.5079 +
1.5080 +
1.5081 +
1.5082 +
1.5083 +template <class T>
1.5084 +inline TInt RArray<T>::Find(const T& anEntry, TIdentityRelation<T> anIdentity) const
1.5085 +/**
1.5086 +Finds the first object in the array which matches the specified object using
1.5087 +a sequential search and a matching algorithm.
1.5088 +
1.5089 +The algorithm for determining whether two class T type objects match is provided
1.5090 +by a function supplied by the caller.
1.5091 +
1.5092 +The find operation always starts at the low index end of the array. There
1.5093 +is no assumption about the order of objects in the array.
1.5094 +
1.5095 +@param anEntry A reference to an object of type class T to be used
1.5096 + for matching.
1.5097 +@param anIdentity A package encapsulating the function which determines whether
1.5098 + two class T type objects match.
1.5099 +
1.5100 +@return The index of the first matching object within the array.
1.5101 + KErrNotFound, if no matching object can be found.
1.5102 +*/
1.5103 + {return RArrayBase::Find(&anEntry,anIdentity);}
1.5104 +
1.5105 +
1.5106 +
1.5107 +
1.5108 +template <class T>
1.5109 +inline TInt RArray<T>::FindReverse(const T& anEntry) const
1.5110 +/**
1.5111 +Finds the last object in the array which matches the specified object using
1.5112 +a sequential search.
1.5113 +
1.5114 +Matching is based on the comparison of a TInt value at the key offset position
1.5115 +within the objects.
1.5116 +
1.5117 +The find operation always starts at the high index end of the array. There
1.5118 +is no assumption about the order of objects in the array.
1.5119 +
1.5120 +@param anEntry A reference to an object of type class T to be used for matching.
1.5121 +
1.5122 +@return The index of the last matching object within the array.
1.5123 + KErrNotFound, if no matching object can be found.
1.5124 +*/
1.5125 + {return RArrayBase::FindReverse(&anEntry);}
1.5126 +
1.5127 +
1.5128 +
1.5129 +
1.5130 +template <class T>
1.5131 +inline TInt RArray<T>::FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const
1.5132 +/**
1.5133 +Finds the last object in the array which matches the specified object using
1.5134 +a sequential search and a matching algorithm.
1.5135 +
1.5136 +The algorithm for determining whether two class T type objects match is provided
1.5137 +by a function supplied by the caller.
1.5138 +
1.5139 +The find operation always starts at the high index end of the array. There
1.5140 +is no assumption about the order of objects in the array.
1.5141 +
1.5142 +@param anEntry A reference to an object of type class T to be used
1.5143 + for matching.
1.5144 +@param anIdentity A package encapsulating the function which determines whether
1.5145 + two class T type objects match.
1.5146 +
1.5147 +@return The index of the last matching object within the array.
1.5148 + KErrNotFound, if no matching object can be found.
1.5149 +*/
1.5150 + {return RArrayBase::FindReverse(&anEntry,anIdentity);}
1.5151 +
1.5152 +
1.5153 +
1.5154 +
1.5155 +template <class T>
1.5156 +inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry) const
1.5157 +/**
1.5158 +Finds the object in the array which matches the specified object using a binary
1.5159 +search technique.
1.5160 +
1.5161 +The function assumes that existing objects within the array are in signed
1.5162 +key order.
1.5163 +
1.5164 +@param anEntry A reference to an object of type class T to be used for matching.
1.5165 +
1.5166 +@return The index of the matching object within the array, or KErrNotFound
1.5167 + if no matching object can be found.
1.5168 +*/
1.5169 + {return RArrayBase::FindIsqSigned(&anEntry);}
1.5170 +
1.5171 +
1.5172 +
1.5173 +
1.5174 +template <class T>
1.5175 +inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry) const
1.5176 +/**
1.5177 +Finds the object in the array which matches the specified object using a binary
1.5178 +search technique.
1.5179 +
1.5180 +The function assumes that existing objects within the array are in unsigned
1.5181 +key order.
1.5182 +
1.5183 +@param anEntry A reference to an object of type class T to be used for matching.
1.5184 +
1.5185 +@return The index of the matching object within the array, or KErrNotFound
1.5186 + if no matching object can be found.
1.5187 +*/
1.5188 + {return RArrayBase::FindIsqUnsigned(&anEntry);}
1.5189 +
1.5190 +
1.5191 +
1.5192 +
1.5193 +template <class T>
1.5194 +inline TInt RArray<T>::FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const
1.5195 +/**
1.5196 +Finds the object in the array which matches the specified object using a binary
1.5197 +search technique and an ordering algorithm.
1.5198 +
1.5199 +The function assumes that existing objects within the array are in object
1.5200 +order as determined by an algorithm supplied by the caller and packaged as
1.5201 +a TLinearOrder<T>.
1.5202 +
1.5203 +@param anEntry A reference to an object of type class T to be used for matching.
1.5204 +@param anOrder A package encapsulating the function which determines the order
1.5205 + of two class T objects.
1.5206 +
1.5207 +@return The index of the matching object within the array, or KErrNotFound if
1.5208 + no matching object can be found.
1.5209 +*/
1.5210 + {return RArrayBase::FindIsq(&anEntry,anOrder);}
1.5211 +
1.5212 +
1.5213 +
1.5214 +
1.5215 +template <class T>
1.5216 +inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const
1.5217 +/**
1.5218 +Finds the object in the array which matches the specified object using a binary
1.5219 +search technique.
1.5220 +
1.5221 +The function assumes that existing objects within the array are in signed
1.5222 +key order.
1.5223 +
1.5224 +@param anEntry A reference to an object of type class T to be used for matching.
1.5225 +@param anIndex On return contains an index value. If the function returns KErrNone,
1.5226 + this is the index of the matching object within the array.
1.5227 + If the function returns KErrNotFound, this is the index of the
1.5228 + first element in the array whose key is bigger than the key of the
1.5229 + element being sought. If there are no elements in the array with
1.5230 + a bigger key, then the index value is the same as the total
1.5231 + number of elements in the array.
1.5232 +@return KErrNone if a matching object is found, or KErrNotFound if no matching
1.5233 + object can be found.
1.5234 +*/
1.5235 + {return RArrayBase::BinarySearchSigned(&anEntry,anIndex);}
1.5236 +
1.5237 +
1.5238 +
1.5239 +
1.5240 +template <class T>
1.5241 +inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const
1.5242 +/**
1.5243 +Finds the object in the array which matches the specified object using a binary
1.5244 +search technique.
1.5245 +
1.5246 +The function assumes that existing objects within the array are in unsigned
1.5247 +key order.
1.5248 +
1.5249 +@param anEntry A reference to an object of type class T to be used for matching.
1.5250 +@param anIndex On return contains an index value. If the function returns
1.5251 + KErrNone, this is the index of the matching object within the
1.5252 + array.
1.5253 + If the function returns KErrNotFound, this is the index of the
1.5254 + first element in the array whose key is bigger than the key of the
1.5255 + element being sought. If there are no elements in the array with
1.5256 + a bigger key, then the index value is the same as the total
1.5257 + number of elements in the array.
1.5258 +@return KErrNone if a matching object is found, or KErrNotFound if no matching
1.5259 + object can be found.
1.5260 +*/
1.5261 + {return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex);}
1.5262 +
1.5263 +
1.5264 +
1.5265 +
1.5266 +template <class T>
1.5267 +inline TInt RArray<T>::FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const
1.5268 +/**
1.5269 +Finds the object in the array which matches the specified object using a binary
1.5270 +search technique and an ordering algorithm.
1.5271 +
1.5272 +The function assumes that existing objects within the array are in object
1.5273 +order as determined by an algorithm supplied by the caller and packaged as
1.5274 +a TLinearOrder<T>.
1.5275 +
1.5276 +@param anEntry A reference to an object of type class T to be used for matching.
1.5277 +@param anIndex On return contains an index value. If the function returns
1.5278 + KErrNone, this is the index of the matching object within the
1.5279 + array.
1.5280 + If the function returns KErrNotFound, this is the index of the
1.5281 + first element in the array that is bigger than the element being
1.5282 + searched for - if no elements in the array are bigger, then
1.5283 + the index value is the same as the total number of elements in
1.5284 + the array.
1.5285 +@param anOrder A package encapsulating the function which determines the order
1.5286 + of two class T objects.
1.5287 +
1.5288 +@return KErrNone if a matching object is found. KErrNotFound if no matching
1.5289 + object can be found.
1.5290 +*/
1.5291 + {return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder);}
1.5292 +
1.5293 +
1.5294 +
1.5295 +
1.5296 +template <class T>
1.5297 +inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const
1.5298 +/**
1.5299 +Finds the object in the array which matches the specified object using a binary
1.5300 +search technique.
1.5301 +
1.5302 +The element ordering is determined by a signed 32-bit word
1.5303 +(the key) embedded in each array element. In the case that there is more than
1.5304 +one matching element, finds the first, last or any match as specified by
1.5305 +the value of aMode.
1.5306 +
1.5307 +The function assumes that existing objects within the array are in signed
1.5308 +key order.
1.5309 +
1.5310 +@param anEntry A reference to an object of type class T to be used for matching.
1.5311 +@param aMode Specifies whether to find the first match, the last match or
1.5312 + any match, as defined by one of the TArrayFindMode enum values.
1.5313 +
1.5314 +@return KErrNotFound, if there is no matching element, otherwise the array
1.5315 + index of a matching element - what the index refers to depends on the
1.5316 + value of aMode:
1.5317 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.5318 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.5319 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.5320 + the last matching element - if the last matching element is also the last element of
1.5321 + the array, then the index value is the same as the total number of elements in the array.
1.5322 +
1.5323 +@see TArrayFindMode
1.5324 +*/
1.5325 + {return RArrayBase::FindIsqSigned(&anEntry,aMode);}
1.5326 +
1.5327 +
1.5328 +
1.5329 +
1.5330 +template <class T>
1.5331 +inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const
1.5332 +/**
1.5333 +Finds the object in the array which matches the specified object using a binary
1.5334 +search technique.
1.5335 +
1.5336 +The element ordering is determined by an unsigned 32-bit word
1.5337 +(the key) embedded in each array element. Where there is more than
1.5338 +one matching element, it finds the first, last or any matching element
1.5339 +as specified by the value of aMode.
1.5340 +
1.5341 +The function assumes that existing objects within the array are in unsigned
1.5342 +key order.
1.5343 +
1.5344 +@param anEntry A reference to an object of type class T to be used for matching.
1.5345 +@param aMode Specifies whether to find the first match, the last match or
1.5346 + any match, as defined by one of the TArrayFindMode enum values.
1.5347 +
1.5348 +@return KErrNotFound, if there is no matching element, otherwise the array
1.5349 + index of a matching element - what the index refers to depends on the
1.5350 + value of aMode:
1.5351 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.5352 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.5353 + if this is EArrayFindMode_Last, then the index refers to first element that follows the
1.5354 + last matching element - if the last matching element is also the last element of the array,
1.5355 + then the index value is the same as the total number of elements in the array.
1.5356 +
1.5357 +@see TArrayFindMode
1.5358 +*/
1.5359 + {return RArrayBase::FindIsqUnsigned(&anEntry,aMode);}
1.5360 +
1.5361 +
1.5362 +
1.5363 +
1.5364 +template <class T>
1.5365 +inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const
1.5366 +/**
1.5367 +Finds the object in the array which matches the specified object using a binary
1.5368 +search technique and an ordering algorithm.
1.5369 +
1.5370 +Where there is more than one matching element, it finds the first, the last
1.5371 +or any matching element as specified by the value of aMode.
1.5372 +
1.5373 +The function assumes that existing objects within the array are in object
1.5374 +order as determined by an algorithm supplied by the caller and packaged as
1.5375 +a TLinearOrder<T> type.
1.5376 +
1.5377 +@param anEntry A reference to an object of type class T to be used for matching.
1.5378 +@param anOrder A package encapsulating the function which determines the order
1.5379 + of two class T objects.
1.5380 +@param aMode Specifies whether to find the first match, the last match or any
1.5381 + match, as defined by one of the TArrayFindMode enum values.
1.5382 +
1.5383 +@return KErrNotFound, if there is no matching element, otherwise the array index
1.5384 + of a matching element - what the index refers to depends on the value of
1.5385 + aMode:
1.5386 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.5387 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.5388 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.5389 + the last matching element - if the last matching element is also the last element of
1.5390 + the array, then the index value is the same as the total number of elements in the array.
1.5391 +*/
1.5392 + {return RArrayBase::FindIsq(&anEntry,anOrder,aMode);}
1.5393 +
1.5394 +
1.5395 +
1.5396 +
1.5397 +template <class T>
1.5398 +inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const
1.5399 +/**
1.5400 +Finds the object in the array which matches the specified object using a binary
1.5401 +search technique.
1.5402 +
1.5403 +The element ordering is determined by a signed 32-bit word
1.5404 +(the key) embedded in each array element. Where there is more than
1.5405 +one matching element, finds the first, last or any matching element as
1.5406 +specified specified by the value of aMode.
1.5407 +
1.5408 +The function assumes that existing objects within the array are in signed
1.5409 +key order.
1.5410 +
1.5411 +@param anEntry A reference to an object of type class T to be used for matching.
1.5412 +@param anIndex A TInt type supplied by the caller. On return, it contains
1.5413 + an index value depending on whether a match is found and on the
1.5414 + value of aMode. If there is no matching element in the array,
1.5415 + then this is the index of the first element in the array that
1.5416 + is bigger than the element being searched for - if no elements
1.5417 + in the array are bigger, then the index value is the same as the
1.5418 + total number of elements in the array. If there is a matching
1.5419 + element, then what the index refers to depends on the value of aMode:
1.5420 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.5421 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.5422 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.5423 + the last matching element - if the last matching element is also the last element of
1.5424 + the array, then the index value is the same as the total number of elements in the array.
1.5425 +@param aMode Specifies whether to find the first match, the last match or any match,
1.5426 + as defined by one of the TArrayFindMode enum values.
1.5427 +
1.5428 +@return KErrNone, if a matching object pointer is found;
1.5429 + KErrNotFound, if no suitable object pointer can be found.
1.5430 +*/
1.5431 + {return RArrayBase::BinarySearchSigned(&anEntry,anIndex,aMode);}
1.5432 +
1.5433 +
1.5434 +
1.5435 +
1.5436 +template <class T>
1.5437 +inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const
1.5438 +/**
1.5439 +Finds the object in the array which matches the specified object using a binary
1.5440 +search technique.
1.5441 +
1.5442 +The element ordering is determined by an unsigned 32-bit word
1.5443 +(the key) embedded in each array element. Where there is more than
1.5444 +one matching element, it finds the first, last or any matching element as
1.5445 +specified by the value of aMode.
1.5446 +
1.5447 +The function assumes that existing objects within the array are in unsigned
1.5448 +key order.
1.5449 +
1.5450 +@param anEntry A reference to an object of type class T to be used for matching.
1.5451 +@param anIndex A TInt type supplied by the caller. On return, it contains an index
1.5452 + value depending on whether a match is found and on the value of aMode.
1.5453 + If there is no matching element in the array, then this is the index
1.5454 + of the first element in the array that is bigger than the element
1.5455 + being searched for - if no elements in the array are bigger, then
1.5456 + the index value is the same as the total number of elements in the array.
1.5457 + If there is a matching element, then what the index refers to depends on
1.5458 + the value of aMode:
1.5459 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.5460 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.5461 + if this is EArrayFindMode_Last, then the index refers to first element that follows the
1.5462 + last matching element - if the last matching element is also the last element of the array,
1.5463 + then the index value is the same as the total number of elements in the array.
1.5464 +@param aMode Specifies whether to find the first match, the last match or any match, as defined by one
1.5465 + of the TArrayFindMode enum values.
1.5466 +@return KErrNone, if a matching object pointer is found; KErrNotFound, if no suitable object pointer can be found.
1.5467 +
1.5468 +@see TArrayFindMode
1.5469 +*/
1.5470 + {return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex,aMode);}
1.5471 +
1.5472 +
1.5473 +
1.5474 +
1.5475 +template <class T>
1.5476 +inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const
1.5477 +/**
1.5478 +Finds the object in the array which matches the specified object using a binary
1.5479 +search technique and a specified ordering algorithm.
1.5480 +
1.5481 +Where there is more than one matching element, it finds the first, the last or
1.5482 +any matching element as specified by the value of aMode.
1.5483 +
1.5484 +The function assumes that existing objects within the array are in object
1.5485 +order as determined by an algorithm supplied by the caller and packaged as
1.5486 +a TLinearOrder<T> type.
1.5487 +
1.5488 +@param anEntry A reference to an object of type class T to be used for matching.
1.5489 +@param anIndex A TInt type supplied by the caller. On return, it contains
1.5490 + an index value depending on whether a match is found and on the
1.5491 + value of aMode. If there is no matching element in the array,
1.5492 + then this is the index of the first element in the array that
1.5493 + is bigger than the element being searched for - if no elements
1.5494 + in the array are bigger, then the index value is the same as
1.5495 + the total number of elements in the array.
1.5496 + If there is a matching element, then what the index refers to
1.5497 + depends on the value of aMode:
1.5498 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.5499 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.5500 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.5501 + the last matching element - if the last matching element is also
1.5502 + the last element of the array, then the index value is the same as
1.5503 + the total number of elements in the array.
1.5504 +@param anOrder A package encapsulating the function which determines the order
1.5505 + of two class T objects.
1.5506 +@param aMode Specifies whether to find the first match, the last match or any match,
1.5507 + as defined by one of the TArrayFindMode enum values.
1.5508 +@return KErrNone, if a matching object pointer is found;
1.5509 + KErrNotFound, if no suitable object pointer can be found.
1.5510 +
1.5511 +*/
1.5512 + {return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder,aMode);}
1.5513 +
1.5514 +
1.5515 +
1.5516 +
1.5517 +template <class T>
1.5518 +inline TInt RArray<T>::InsertInSignedKeyOrder(const T& anEntry)
1.5519 +/**
1.5520 +Inserts an object into the array in ascending signed key order.
1.5521 +
1.5522 +The order of two class T type objects is based on comparing a TInt value
1.5523 +located at the key offset position within the class T object.
1.5524 +
1.5525 +No duplicate entries are permitted. The array remains unchanged following
1.5526 +an attempt to insert a duplicate entry.
1.5527 +
1.5528 +@param anEntry A reference to the object of type class T to be inserted.
1.5529 +
1.5530 +@return KErrNone, if the insertion is successful;
1.5531 + KErrAlreadyExists, if an attempt is being made
1.5532 + to insert a duplicate entry; otherwise one of the other system wide
1.5533 + error codes.
1.5534 +*/
1.5535 + {return RArrayBase::InsertIsqSigned(&anEntry,EFalse);}
1.5536 +
1.5537 +
1.5538 +
1.5539 +
1.5540 +template <class T>
1.5541 +inline TInt RArray<T>::InsertInUnsignedKeyOrder(const T& anEntry)
1.5542 +/**
1.5543 +Inserts an object into the array in ascending unsigned key order.
1.5544 +
1.5545 +The order of two class T type objects is based on comparing a TUint value
1.5546 +located at the key offset position within the class T object.
1.5547 +
1.5548 +No duplicate entries are permitted. The array remains unchanged following
1.5549 +an attempt to insert a duplicate entry.
1.5550 +
1.5551 +@param anEntry A reference to the object of type class T to be inserted.
1.5552 +
1.5553 +@return KErrNone, if the insertion is successful;
1.5554 + KErrAlreadyExists, if an attempt is being made
1.5555 + to insert a duplicate entry; otherwise one of the other system wide
1.5556 + error codes.
1.5557 +*/
1.5558 + {return RArrayBase::InsertIsqUnsigned(&anEntry,EFalse);}
1.5559 +
1.5560 +
1.5561 +
1.5562 +
1.5563 +template <class T>
1.5564 +inline TInt RArray<T>::InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder)
1.5565 +/**
1.5566 +Inserts an object of into the array in object order.
1.5567 +
1.5568 +The algorithm for determining the order of two class T type objects is provided
1.5569 +by a function supplied by the caller.
1.5570 +
1.5571 +No duplicate entries are permitted. The array remains unchanged following
1.5572 +an attempt to insert a duplicate entry.
1.5573 +
1.5574 +The function assumes that existing objects within the array are in object
1.5575 +order.
1.5576 +
1.5577 +@param anEntry A reference to the object of type class T to be inserted.
1.5578 +@param anOrder A package encapsulating the function which determines the order
1.5579 + of two class T objects.
1.5580 +
1.5581 +@return KErrNone, if the insertion is successful;
1.5582 + KErrAlreadyExists, if an attempt is being made
1.5583 + to insert a duplicate entry; otherwise one of the other system wide
1.5584 + error codes.
1.5585 +*/
1.5586 + {return RArrayBase::InsertIsq(&anEntry,anOrder,EFalse);}
1.5587 +
1.5588 +
1.5589 +
1.5590 +
1.5591 +template <class T>
1.5592 +inline TInt RArray<T>::InsertInSignedKeyOrderAllowRepeats(const T& anEntry)
1.5593 +/**
1.5594 +Inserts an object into the array in ascending signed key order,
1.5595 +allowing duplicates.
1.5596 +
1.5597 +The order of two class T type objects is based on comparing a TInt value
1.5598 +located at the key offset position within the class T object.
1.5599 +
1.5600 +If anEntry is a duplicate of an existing object in the array, then the new
1.5601 +object is inserted after the existing object. If more than one duplicate object
1.5602 +already exists in the array, then any new duplicate object is inserted after
1.5603 +the last one.
1.5604 +
1.5605 +@param anEntry A reference to the object of type class T to be inserted.
1.5606 +
1.5607 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.5608 + wide error codes.
1.5609 +*/
1.5610 + {return RArrayBase::InsertIsqSigned(&anEntry,ETrue);}
1.5611 +
1.5612 +
1.5613 +
1.5614 +
1.5615 +template <class T>
1.5616 +inline TInt RArray<T>::InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry)
1.5617 +/**
1.5618 +Inserts an object into the array in ascending unsigned key order, allowing
1.5619 +duplicates.
1.5620 +
1.5621 +The order of two class T type objects is based on comparing a TUint value
1.5622 +located at the key offset position within the class T object.
1.5623 +
1.5624 +If anEntry is a duplicate of an existing object in the array, then the new
1.5625 +object is inserted after the existing object. If more than one duplicate object
1.5626 +already exists in the array, then any new duplicate object is inserted after
1.5627 +the last one.
1.5628 +
1.5629 +@param anEntry A reference to the object of type class T to be inserted.
1.5630 +
1.5631 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.5632 + wide error codes.
1.5633 +*/
1.5634 + {return RArrayBase::InsertIsqUnsigned(&anEntry,ETrue);}
1.5635 +
1.5636 +
1.5637 +
1.5638 +
1.5639 +template <class T>
1.5640 +inline TInt RArray<T>::InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder)
1.5641 +/**
1.5642 +Inserts an object into the array in object order, allowing duplicates.
1.5643 +
1.5644 +The algorithm for determining the order of two class T type objects is provided
1.5645 +by a function supplied by the caller.
1.5646 +
1.5647 +If anEntry is a duplicate of an existing object in the array, then the new
1.5648 +object is inserted after the existing object. If more than one duplicate object
1.5649 +already exists in the array, then anEntry is inserted after the last one.
1.5650 +
1.5651 +The function assumes that existing objects within the array are in object
1.5652 +order.
1.5653 +
1.5654 +@param anEntry A reference to the object of type class T to be inserted.
1.5655 +@param anOrder A package encapsulating the function which determines the order
1.5656 + of two class T objects.
1.5657 +
1.5658 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.5659 + wide error codes.
1.5660 +*/
1.5661 + {return RArrayBase::InsertIsq(&anEntry,anOrder,ETrue);}
1.5662 +
1.5663 +
1.5664 +
1.5665 +#ifndef __KERNEL_MODE__
1.5666 +
1.5667 +template <class T>
1.5668 +inline void RArray<T>::GranularCompress()
1.5669 +/**
1.5670 +Compresses the array down to a granular boundary.
1.5671 +
1.5672 +After a call to this function, the memory allocated to the array is sufficient
1.5673 +for its contained objects. Adding new objects to the array does not result
1.5674 +in a re-allocation of memory until the the total number of objects reaches
1.5675 +a multiple of the granularity.
1.5676 +*/
1.5677 + {RArrayBase::GranularCompress();}
1.5678 +
1.5679 +
1.5680 +
1.5681 +
1.5682 +template <class T>
1.5683 +inline TInt RArray<T>::Reserve(TInt aCount)
1.5684 +/**
1.5685 +Reserves space for the specified number of elements.
1.5686 +
1.5687 +After a call to this function, the memory allocated to the array is sufficient
1.5688 +to hold the number of objects specified. Adding new objects to the array
1.5689 +does not result in a re-allocation of memory until the the total number of
1.5690 +objects exceeds the specified count.
1.5691 +
1.5692 +@param aCount The number of objects for which space should be reserved
1.5693 +@return KErrNone If the operation completed successfully
1.5694 +@return KErrNoMemory If the requested amount of memory could not be allocated
1.5695 +*/
1.5696 + { return RArrayBase::DoReserve(aCount); }
1.5697 +
1.5698 +
1.5699 +
1.5700 +
1.5701 +template <class T>
1.5702 +inline void RArray<T>::SortSigned()
1.5703 +/**
1.5704 +Sorts the objects within the array; the sort order is assumed to be in signed
1.5705 +integer order.
1.5706 +*/
1.5707 + {HeapSortSigned();}
1.5708 +
1.5709 +
1.5710 +
1.5711 +
1.5712 +template <class T>
1.5713 +inline void RArray<T>::SortUnsigned()
1.5714 +/**
1.5715 +Sorts the objects within the array; the sort order is assumed to be in unsigned
1.5716 +integer order.
1.5717 +*/
1.5718 + {HeapSortUnsigned();}
1.5719 +
1.5720 +
1.5721 +
1.5722 +
1.5723 +template <class T>
1.5724 +inline void RArray<T>::Sort(TLinearOrder<T> anOrder)
1.5725 +/**
1.5726 +Sorts the objects within the array using the specified TLinearOrder.
1.5727 +
1.5728 +The sort order is determined by an algorithm supplied by the caller and
1.5729 +packaged as a TLinerOrder<T>.
1.5730 +
1.5731 +@param anOrder A package encapsulating the function which determines the order
1.5732 + of two class T type objects.
1.5733 +*/
1.5734 + {HeapSort(anOrder);}
1.5735 +
1.5736 +
1.5737 +
1.5738 +
1.5739 +template <class T>
1.5740 +inline TArray<T> RArray<T>::Array() const
1.5741 +/**
1.5742 +Constructs and returns a generic array.
1.5743 +
1.5744 +@return A generic array representing this array.
1.5745 +*/
1.5746 + { return TArray<T>(GetCount,GetElementPtr,(const CBase*)this); }
1.5747 +#endif
1.5748 +
1.5749 +
1.5750 +
1.5751 +
1.5752 +inline RArray<TInt>::RArray()
1.5753 + : RPointerArrayBase()
1.5754 +/**
1.5755 +Constructs an array object for an array of signed integers with
1.5756 +default granularity.
1.5757 +
1.5758 +The default granularity is 8.
1.5759 +*/
1.5760 + {}
1.5761 +
1.5762 +
1.5763 +
1.5764 +
1.5765 +inline RArray<TInt>::RArray(TInt aGranularity)
1.5766 + : RPointerArrayBase(aGranularity)
1.5767 +/**
1.5768 +Constructs an array object for an array of signed integers with the specified
1.5769 +granularity.
1.5770 +
1.5771 +@param aGranularity The granularity of the array.
1.5772 +
1.5773 +@panic USER 127, if aGranularity is not positive or is greater than or
1.5774 + equal to 0x10000000.
1.5775 +*/
1.5776 + {}
1.5777 +
1.5778 +
1.5779 +
1.5780 +
1.5781 +/**
1.5782 +C++ constructor with minimum growth step and exponential growth factor.
1.5783 +
1.5784 +This constructs an array object for an array of signed integers with the
1.5785 +specified minimum growth step and exponential growth factor.
1.5786 +
1.5787 +@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
1.5788 + 65535 inclusive.
1.5789 +@param aFactor The factor by which the array grows, multiplied by 256.
1.5790 + For example 512 specifies a factor of 2. Must be between 257
1.5791 + and 32767 inclusive.
1.5792 +
1.5793 +@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
1.5794 +@panic USER 193, if aFactor<=257 or aFactor>32767.
1.5795 +*/
1.5796 +inline RArray<TInt>::RArray(TInt aMinGrowBy, TInt aFactor)
1.5797 + : RPointerArrayBase(aMinGrowBy, aFactor)
1.5798 + {}
1.5799 +
1.5800 +
1.5801 +
1.5802 +
1.5803 +inline void RArray<TInt>::Close()
1.5804 +/**
1.5805 +Closes the array and frees all memory allocated to the array.
1.5806 +
1.5807 +The function must be called before this array object goes out of scope.
1.5808 +*/
1.5809 + {RPointerArrayBase::Close();}
1.5810 +
1.5811 +
1.5812 +
1.5813 +
1.5814 +inline TInt RArray<TInt>::Count() const
1.5815 +/**
1.5816 +Gets the number of signed integers in the array.
1.5817 +
1.5818 +@return The number of signed integers in the array.
1.5819 +*/
1.5820 + { return RPointerArrayBase::Count(); }
1.5821 +
1.5822 +
1.5823 +
1.5824 +
1.5825 +inline const TInt& RArray<TInt>::operator[](TInt anIndex) const
1.5826 +/**
1.5827 +Gets a reference to the signed integer located at a specified position within
1.5828 +the array.
1.5829 +
1.5830 +The compiler chooses this function if the returned reference is used in an
1.5831 +expression where the reference cannot be modified.
1.5832 +
1.5833 +@param anIndex The position of the signed integer within the array. The
1.5834 + position is relative to zero, i.e. zero implies the entry
1.5835 + at the beginning of the array.
1.5836 +
1.5837 +@return A const reference to the signed integer at position anIndex within
1.5838 + the array.
1.5839 +
1.5840 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.5841 + entries currently in the array.
1.5842 +*/
1.5843 + {return (const TInt&)At(anIndex);}
1.5844 +
1.5845 +
1.5846 +
1.5847 +
1.5848 +inline TInt& RArray<TInt>::operator[](TInt anIndex)
1.5849 +/**
1.5850 +Gets a reference to the signed integer located at a specified position within
1.5851 +the array.
1.5852 +
1.5853 +The compiler chooses this function if the returned reference is used in an
1.5854 +expression where the reference can be modified.
1.5855 +
1.5856 +@param anIndex The position of the signed integer within the array. The
1.5857 + position is relative to zero, i.e. zero implies the entry
1.5858 + at the beginning of the array.
1.5859 +
1.5860 +@return A non-const reference to the signed integer at position anIndex within
1.5861 + the array.
1.5862 +
1.5863 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.5864 + entries currently in the array.
1.5865 +*/
1.5866 + {return (TInt&)At(anIndex);}
1.5867 +
1.5868 +
1.5869 +
1.5870 +
1.5871 +inline TInt RArray<TInt>::Append(TInt anEntry)
1.5872 +/**
1.5873 +Appends a signed integer onto the array.
1.5874 +
1.5875 +@param anEntry The signed integer to be appended.
1.5876 +
1.5877 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.5878 + wide error codes.
1.5879 +*/
1.5880 + { return RPointerArrayBase::Append((const TAny*)anEntry); }
1.5881 +
1.5882 +
1.5883 +
1.5884 +
1.5885 +inline TInt RArray<TInt>::Insert(TInt anEntry, TInt aPos)
1.5886 +/**
1.5887 +Inserts a signed integer into the array at the specified position.
1.5888 +
1.5889 +@param anEntry The signed integer to be inserted.
1.5890 +@param aPos The position within the array where the signed integer is to be
1.5891 + inserted. The position is relative to zero, i.e. zero implies
1.5892 + that an entry is inserted at the beginning of the array.
1.5893 +
1.5894 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.5895 + wide error codes.
1.5896 +
1.5897 +@panic USER 131, if aPos is negative, or is greater than the number of entries
1.5898 + currently in the array.
1.5899 +*/
1.5900 + { return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); }
1.5901 +
1.5902 +
1.5903 +
1.5904 +
1.5905 +inline void RArray<TInt>::Remove(TInt anIndex)
1.5906 +/**
1.5907 +Removes the signed integer at the specified position from the array.
1.5908 +
1.5909 +@param anIndex The position within the array from where the signed integer
1.5910 + is to be removed. The position is relative to zero, i.e. zero
1.5911 + implies that an entry at the beginning of the array is to be
1.5912 + removed.
1.5913 +
1.5914 +@panic USER 130, if anIndex is negative or is greater than the number of
1.5915 + entries currently in the array.
1.5916 +*/
1.5917 + {RPointerArrayBase::Remove(anIndex);}
1.5918 +
1.5919 +
1.5920 +
1.5921 +
1.5922 +inline void RArray<TInt>::Compress()
1.5923 +/**
1.5924 +Compresses the array down to a minimum.
1.5925 +
1.5926 +After a call to this function, the memory allocated to the array is just
1.5927 +sufficient for its entries. Subsequently adding a new signed integer to the
1.5928 +array always results in a re-allocation of memory.
1.5929 +*/
1.5930 + {RPointerArrayBase::Compress();}
1.5931 +
1.5932 +
1.5933 +
1.5934 +
1.5935 +inline void RArray<TInt>::Reset()
1.5936 +/**
1.5937 +Empties the array.
1.5938 +
1.5939 +The function frees all memory allocated to the array and
1.5940 +resets the internal state so that it is ready to be reused.
1.5941 +
1.5942 +This array object can be allowed to go out of scope after a call to this
1.5943 +function.
1.5944 +*/
1.5945 + {RPointerArrayBase::Reset();}
1.5946 +
1.5947 +
1.5948 +
1.5949 +
1.5950 +inline TInt RArray<TInt>::Find(TInt anEntry) const
1.5951 +/**
1.5952 +Finds the first signed integer in the array which matches the specified signed
1.5953 +integer using a sequential search.
1.5954 +
1.5955 +The find operation always starts at the low index end of the array. There
1.5956 +is no assumption about the order of entries in the array.
1.5957 +
1.5958 +@param anEntry The signed integer to be found.
1.5959 +
1.5960 +@return The index of the first matching signed integer within the array.
1.5961 + KErrNotFound, if no matching entry can be found.
1.5962 +*/
1.5963 + { return RPointerArrayBase::Find((const TAny*)anEntry); }
1.5964 +
1.5965 +
1.5966 +
1.5967 +
1.5968 +inline TInt RArray<TInt>::FindReverse(TInt anEntry) const
1.5969 +/**
1.5970 +Finds the last signed integer in the array which matches the specified signed
1.5971 +integer using a sequential search.
1.5972 +
1.5973 +The find operation always starts at the high index end of the array. There
1.5974 +is no assumption about the order of entries in the array.
1.5975 +
1.5976 +@param anEntry The signed integer to be found.
1.5977 +
1.5978 +@return The index of the last matching signed integer within the array.
1.5979 + KErrNotFound, if no matching entry can be found.
1.5980 +*/
1.5981 + { return RPointerArrayBase::FindReverse((const TAny*)anEntry); }
1.5982 +
1.5983 +
1.5984 +
1.5985 +
1.5986 +inline TInt RArray<TInt>::FindInOrder(TInt anEntry) const
1.5987 +/**
1.5988 +Finds the signed integer in the array that matches the specified signed integer
1.5989 +using a binary search technique.
1.5990 +
1.5991 +The function assumes that the array is in signed integer order.
1.5992 +
1.5993 +@param anEntry The signed integer to find.
1.5994 +
1.5995 +@return The index of the matching signed integer within the array or KErrNotFound,
1.5996 + if no match can be found.
1.5997 +*/
1.5998 + { return RPointerArrayBase::FindIsqSigned(anEntry); }
1.5999 +
1.6000 +
1.6001 +
1.6002 +
1.6003 +inline TInt RArray<TInt>::FindInOrder(TInt anEntry, TInt& anIndex) const
1.6004 +/**
1.6005 +Finds the signed integer in the array that matches the specified signed integer
1.6006 +using a binary search technique.
1.6007 +
1.6008 +The function assumes that the array is in signed integer order.
1.6009 +
1.6010 +@param anEntry The signed integer to find.
1.6011 +@param anIndex A TInt suplied by the caller. On return contains an index value.
1.6012 + If the function returns KErrNone, this is the index of the
1.6013 + matching signed integer within the array.
1.6014 + If the function returns KErrNotFound, this is the index of the
1.6015 + first signed integer within the array that is bigger than the
1.6016 + signed integer being searched for - if no signed integers within
1.6017 + the array are bigger, then the index value is the same as the
1.6018 + total number of signed integers within the array.
1.6019 +
1.6020 +@return KErrNone if a matching signed integer is found.
1.6021 + KErrNotFound if no match can be found.
1.6022 +*/
1.6023 + { return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex); }
1.6024 +
1.6025 +
1.6026 +
1.6027 +
1.6028 +inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt aMode) const
1.6029 +/**
1.6030 +Finds the signed integer in the array that matches the specified signed integer
1.6031 +using a binary search technique.
1.6032 +
1.6033 +Where there is more than one matching element, it finds the first, last or any
1.6034 +matching element as specified by the value of aMode.
1.6035 +
1.6036 +The function assumes that the array is in signed integer order.
1.6037 +
1.6038 +@param anEntry The signed integer to be found.
1.6039 +@param aMode Specifies whether to find the first match, the last match or any
1.6040 + match, as defined by one of the TArrayFindMode enum values.
1.6041 +
1.6042 +@return KErrNotFound, if there is no matching element, otherwise the array
1.6043 + index of a matching element - what the index refers to depends on the
1.6044 + value of aMode:
1.6045 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.6046 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.6047 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.6048 + the last matching element - if the last matching element is also the last element
1.6049 + of the array, then the index value is the same as the total number of elements in
1.6050 + the array.
1.6051 +
1.6052 +@see TArrayFindMode
1.6053 +*/
1.6054 + { return RPointerArrayBase::FindIsqSigned(anEntry,aMode); }
1.6055 +
1.6056 +
1.6057 +
1.6058 +
1.6059 +inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const
1.6060 +/**
1.6061 +Finds the signed integer in the array that matches the specified signed integer
1.6062 +using a binary search technique.
1.6063 +
1.6064 +Where there is more than one matching element, it finds the first, last or any
1.6065 +matching element as specified by the value of aMode.
1.6066 +
1.6067 +The function assumes that the array is in signed integer order.
1.6068 +
1.6069 +@param anEntry The signed integer to be found.
1.6070 +@param anIndex A TInt type supplied by the caller. On return, it contains an index
1.6071 + value depending on whether a match is found and on the value of aMode.
1.6072 + If there is no matching element in the array, then this is the index of
1.6073 + the first element in the array that is bigger than the element being
1.6074 + searched for - if no elements in the array are bigger, then the index
1.6075 + value is the same as the total number of elements in the array.
1.6076 + If there is a matching element, then what the index refers to depends
1.6077 + on the value of aMode:
1.6078 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.6079 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.6080 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.6081 + the last matching element - if the last matching element is also the last element
1.6082 + of the array, then the index value is the same as the total number of elements in the array.
1.6083 +
1.6084 +@param aMode Specifies whether to find the first match, the last match or any match,
1.6085 + as defined by one of the TArrayFindMode enum values.
1.6086 +
1.6087 +@return KErrNone, if a matching element is found;
1.6088 + KErrNotFound, if no suitable element can be found.
1.6089 +
1.6090 +@see TArrayFindMode
1.6091 +*/
1.6092 + { return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex,aMode); }
1.6093 +
1.6094 +
1.6095 +
1.6096 +
1.6097 +inline TInt RArray<TInt>::InsertInOrder(TInt anEntry)
1.6098 +/**
1.6099 +Inserts a signed integer into the array in signed integer order.
1.6100 +
1.6101 +No duplicate entries are permitted. The array remains unchanged following
1.6102 +an attempt to insert a duplicate entry.
1.6103 +
1.6104 +The function assumes that existing entries within the array are in signed
1.6105 +integer order.
1.6106 +
1.6107 +@param anEntry The signed integer to be inserted
1.6108 +
1.6109 +@return KErrNone, if the insertion is successful;
1.6110 + KErrAlreadyExists, if an attempt is being made
1.6111 + to insert a duplicate entry; otherwise one of the other system wide
1.6112 + error codes.
1.6113 +*/
1.6114 + { return RPointerArrayBase::InsertIsqSigned(anEntry,EFalse); }
1.6115 +
1.6116 +
1.6117 +
1.6118 +
1.6119 +inline TInt RArray<TInt>::InsertInOrderAllowRepeats(TInt anEntry)
1.6120 +/**
1.6121 +Inserts a signed integer into the array in signed integer order,
1.6122 +allowing duplicates.
1.6123 +
1.6124 +If anEntry is a duplicate of an existing entry in the array, then the new
1.6125 +signed integer is inserted after the existing one. If more than one duplicate
1.6126 +entry already exists in the array, then any new duplicate signed integer is
1.6127 +inserted after the last one.
1.6128 +
1.6129 +The function assumes that existing entries within the array are in signed
1.6130 +integer order.
1.6131 +
1.6132 +@param anEntry The signed integer to be inserted.
1.6133 +
1.6134 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.6135 + wide error codes.
1.6136 +*/
1.6137 + { return RPointerArrayBase::InsertIsqSigned(anEntry,ETrue); }
1.6138 +
1.6139 +
1.6140 +
1.6141 +
1.6142 +#ifndef __KERNEL_MODE__
1.6143 +inline RArray<TInt>::RArray(TInt* aEntries, TInt aCount)
1.6144 + : RPointerArrayBase((TAny**)aEntries, aCount)
1.6145 +/**
1.6146 +C++ constructor with a pointer to the first array entry in a
1.6147 +pre-existing array, and the number of entries in that array.
1.6148 +
1.6149 +This constructor takes a pointer to a pre-existing set of entries of type
1.6150 +TInt objects. Ownership of the set of entries does not transfer to
1.6151 +this RArray object.
1.6152 +
1.6153 +The purpose of constructing an array in this way is to allow sorting and
1.6154 +finding operations to be done without further allocation of memory.
1.6155 +
1.6156 +@param aEntries A pointer to the first entry of type class TInt in the set of
1.6157 + entries belonging to the existing array.
1.6158 +@param aCount The number of entries in the existing array.
1.6159 +*/
1.6160 + {}
1.6161 +
1.6162 +inline void RArray<TInt>::GranularCompress()
1.6163 +/**
1.6164 +Compresses the array down to a granular boundary.
1.6165 +
1.6166 +After a call to this function, the memory allocated to the array is sufficient
1.6167 +for its contained entries. Adding new signed integers to the array does not
1.6168 +result in a re-allocation of memory until the total number of entries reaches
1.6169 +a multiple of the granularity.
1.6170 +*/
1.6171 + {RPointerArrayBase::GranularCompress();}
1.6172 +
1.6173 +
1.6174 +
1.6175 +
1.6176 +inline TInt RArray<TInt>::Reserve(TInt aCount)
1.6177 +/**
1.6178 +Reserves space for the specified number of elements.
1.6179 +
1.6180 +After a call to this function, the memory allocated to the array is sufficient
1.6181 +to hold the number of integers specified. Adding new integers to the array
1.6182 +does not result in a re-allocation of memory until the the total number of
1.6183 +integers exceeds the specified count.
1.6184 +
1.6185 +@param aCount The number of integers for which space should be reserved
1.6186 +@return KErrNone If the operation completed successfully
1.6187 +@return KErrNoMemory If the requested amount of memory could not be allocated
1.6188 +*/
1.6189 + { return RPointerArrayBase::DoReserve(aCount); }
1.6190 +
1.6191 +
1.6192 +
1.6193 +
1.6194 +inline void RArray<TInt>::Sort()
1.6195 +/**
1.6196 +Sorts the array entries into signed integer order.
1.6197 +*/
1.6198 + { HeapSortSigned(); }
1.6199 +
1.6200 +
1.6201 +
1.6202 +
1.6203 +inline TArray<TInt> RArray<TInt>::Array() const
1.6204 +/**
1.6205 +Constructs and returns a generic array.
1.6206 +
1.6207 +@return A generic array representing this array.
1.6208 +
1.6209 +@see TArray
1.6210 +*/
1.6211 + { return TArray<TInt>(GetCount,GetElementPtr,(const CBase*)this); }
1.6212 +#endif
1.6213 +
1.6214 +
1.6215 +
1.6216 +inline RArray<TUint>::RArray()
1.6217 + : RPointerArrayBase()
1.6218 +/**
1.6219 +Default C++ constructor.
1.6220 +
1.6221 +This constructs an array object for an array of unsigned
1.6222 +integers with default granularity.
1.6223 +
1.6224 +The default granularity of the array is 8.
1.6225 +*/
1.6226 + {}
1.6227 +
1.6228 +
1.6229 +
1.6230 +
1.6231 +inline RArray<TUint>::RArray(TInt aGranularity)
1.6232 + : RPointerArrayBase(aGranularity)
1.6233 +/**
1.6234 +Constructs an array object for an array of unsigned integers with the specified
1.6235 +granularity.
1.6236 +
1.6237 +@param aGranularity The granularity of the array.
1.6238 +
1.6239 +@panic USER 127, if aGranularity is not positive or is greater than or
1.6240 + equal to 0x10000000.
1.6241 +*/
1.6242 + {}
1.6243 +
1.6244 +
1.6245 +
1.6246 +
1.6247 +/**
1.6248 +C++ constructor with minimum growth step and exponential growth factor.
1.6249 +
1.6250 +This constructs an array object for an array of unsigned integers with the
1.6251 +specified minimum growth step and exponential growth factor.
1.6252 +
1.6253 +@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
1.6254 + 65535 inclusive.
1.6255 +@param aFactor The factor by which the array grows, multiplied by 256.
1.6256 + For example 512 specifies a factor of 2. Must be between 257
1.6257 + and 32767 inclusive.
1.6258 +
1.6259 +@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
1.6260 +@panic USER 193, if aFactor<=257 or aFactor>32767.
1.6261 +*/
1.6262 +inline RArray<TUint>::RArray(TInt aMinGrowBy, TInt aFactor)
1.6263 + : RPointerArrayBase(aMinGrowBy, aFactor)
1.6264 + {}
1.6265 +
1.6266 +
1.6267 +
1.6268 +
1.6269 +inline void RArray<TUint>::Close()
1.6270 +/**
1.6271 +Closes the array and frees all memory allocated to the array.
1.6272 +
1.6273 +The function must be called before this array object goes out of scope.
1.6274 +*/
1.6275 + {RPointerArrayBase::Close();}
1.6276 +
1.6277 +
1.6278 +
1.6279 +
1.6280 +inline TInt RArray<TUint>::Count() const
1.6281 +/**
1.6282 +Gets the number of unsigned integers in the array.
1.6283 +
1.6284 +@return The number of unsigned integers in the array.
1.6285 +*/
1.6286 + {return RPointerArrayBase::Count(); }
1.6287 +
1.6288 +
1.6289 +
1.6290 +
1.6291 +inline const TUint& RArray<TUint>::operator[](TInt anIndex) const
1.6292 +/**
1.6293 +Gets a reference to the unsigned integer located at the specified position
1.6294 +within the array.
1.6295 +
1.6296 +The compiler uses this variant if the returned reference is used in an
1.6297 +expression where the reference cannot be modified.
1.6298 +
1.6299 +@param anIndex The position of the unsigned integer within the array, relative
1.6300 + to zero, i.e. zero implies the entry at the beginning of
1.6301 + the array.
1.6302 +
1.6303 +@return A reference to the const unsigned integer at position anIndex within
1.6304 + the array.
1.6305 +
1.6306 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.6307 + entries currently in the array.
1.6308 +*/
1.6309 + {return (const TUint&)At(anIndex);}
1.6310 +
1.6311 +
1.6312 +
1.6313 +
1.6314 +inline TUint& RArray<TUint>::operator[](TInt anIndex)
1.6315 +/**
1.6316 +Gets a reference to the unsigned integer located at the specified position
1.6317 +within the array.
1.6318 +
1.6319 +The compiler uses this variant if the returned reference is used in an
1.6320 +expression where the reference can be modified.
1.6321 +
1.6322 +@param anIndex The position of the unsigned integer within the array, relative
1.6323 + to zero, i.e. zero implies the entry at the beginning of
1.6324 + the array.
1.6325 +
1.6326 +@return A reference to the non-const unsigned integer at position anIndex
1.6327 + within the array.
1.6328 +
1.6329 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.6330 + entries currently in the array.
1.6331 +*/
1.6332 + {return (TUint&)At(anIndex);}
1.6333 +
1.6334 +
1.6335 +
1.6336 +
1.6337 +inline TInt RArray<TUint>::Append(TUint anEntry)
1.6338 +/**
1.6339 +Appends an unsigned integer onto the array.
1.6340 +
1.6341 +@param anEntry The unsigned integer to be appended.
1.6342 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.6343 + wide error codes.
1.6344 +*/
1.6345 + { return RPointerArrayBase::Append((const TAny*)anEntry); }
1.6346 +
1.6347 +
1.6348 +
1.6349 +
1.6350 +inline TInt RArray<TUint>::Insert(TUint anEntry, TInt aPos)
1.6351 +/**
1.6352 +Inserts an unsigned integer into the array at the specified position.
1.6353 +
1.6354 +@param anEntry The unsigned integer to be inserted.
1.6355 +@param aPos The position within the array where the unsigned integer is to
1.6356 + be inserted. The position is relative to zero, i.e. zero
1.6357 + implies that an entry is inserted at the beginning of
1.6358 + the array.
1.6359 +
1.6360 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.6361 + wide error codes.
1.6362 +
1.6363 +@panic USER 131, if aPos is negative, or is greater than the number of entries
1.6364 + currently in the array.
1.6365 +*/
1.6366 + { return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); }
1.6367 +
1.6368 +
1.6369 +
1.6370 +
1.6371 +inline void RArray<TUint>::Remove(TInt anIndex)
1.6372 +/**
1.6373 +Removes the unsigned integer at the specified position from the array.
1.6374 +
1.6375 +@param anIndex The position within the array from where the unsigned integer
1.6376 + is to be removed. The position is relative to zero, i.e. zero
1.6377 + implies that an entry at the beginning of the array is to be
1.6378 + removed.
1.6379 +
1.6380 +
1.6381 +@panic USER 130, if anIndex is negative, or is greater than the number of
1.6382 + entries currently in the array.
1.6383 +*/
1.6384 + {RPointerArrayBase::Remove(anIndex);}
1.6385 +
1.6386 +
1.6387 +
1.6388 +
1.6389 +inline void RArray<TUint>::Compress()
1.6390 +/**
1.6391 +Compresses the array down to a minimum.
1.6392 +
1.6393 +After a call to this function, the memory allocated to the array is just
1.6394 +sufficient for its entries. Subsequently adding a new unsigned integer to the
1.6395 +array always results in a re-allocation of memory.
1.6396 +*/
1.6397 + {RPointerArrayBase::Compress();}
1.6398 +
1.6399 +
1.6400 +
1.6401 +
1.6402 +inline void RArray<TUint>::Reset()
1.6403 +/**
1.6404 +Empties the array.
1.6405 +
1.6406 +It frees all memory allocated to the array and resets the
1.6407 +internal state so that it is ready to be reused.
1.6408 +
1.6409 +This array object can be allowed to go out of scope after a call to
1.6410 +this function.
1.6411 +*/
1.6412 + {RPointerArrayBase::Reset();}
1.6413 +
1.6414 +
1.6415 +
1.6416 +
1.6417 +inline TInt RArray<TUint>::Find(TUint anEntry) const
1.6418 +/**
1.6419 +Finds the first unsigned integer in the array which matches the specified
1.6420 +value, using a sequential search.
1.6421 +
1.6422 +The find operation always starts at the low index end of the array. There
1.6423 +is no assumption about the order of entries in the array.
1.6424 +
1.6425 +@param anEntry The unsigned integer to be found.
1.6426 +
1.6427 +@return The index of the first matching unsigned integer within the array.
1.6428 + KErrNotFound, if no matching entry can be found.
1.6429 +*/
1.6430 + { return RPointerArrayBase::Find((const TAny*)anEntry); }
1.6431 +
1.6432 +
1.6433 +
1.6434 +
1.6435 +inline TInt RArray<TUint>::FindReverse(TUint anEntry) const
1.6436 +/**
1.6437 +Finds the last unsigned integer in the array which matches the specified
1.6438 +value, using a sequential search.
1.6439 +
1.6440 +The find operation always starts at the high index end of the array. There
1.6441 +is no assumption about the order of entries in the array.
1.6442 +
1.6443 +@param anEntry The unsigned integer to be found.
1.6444 +
1.6445 +@return The index of the last matching unsigned integer within the array.
1.6446 + KErrNotFound, if no matching entry can be found.
1.6447 +*/
1.6448 + { return RPointerArrayBase::FindReverse((const TAny*)anEntry); }
1.6449 +
1.6450 +
1.6451 +
1.6452 +
1.6453 +inline TInt RArray<TUint>::FindInOrder(TUint anEntry) const
1.6454 +/**
1.6455 +Finds the unsigned integer in the array which matches the specified value,
1.6456 +using a binary search technique.
1.6457 +
1.6458 +The functions assume that existing entries within the array are in unsigned
1.6459 +integer order.
1.6460 +
1.6461 +@param anEntry The unsigned integer to be found.
1.6462 +
1.6463 +@return This is either: the index of the matching unsigned integer within the
1.6464 + array;
1.6465 + KErrNotFound, if no suitable entry can be found.
1.6466 +*/
1.6467 + { return RPointerArrayBase::FindIsqUnsigned(anEntry); }
1.6468 +
1.6469 +
1.6470 +
1.6471 +
1.6472 +inline TInt RArray<TUint>::FindInOrder(TUint anEntry, TInt& anIndex) const
1.6473 +/**
1.6474 +Finds the unsigned integer in the array which matches the specified value,
1.6475 +using a binary search technique.
1.6476 +
1.6477 +If the index cannot be found, the function returns the index of the last
1.6478 +unsigned integer within the array which logically precedes anEntry.
1.6479 +
1.6480 +The functions assume that existing entries within the array are in unsigned
1.6481 +integer order.
1.6482 +
1.6483 +@param anEntry The unsigned integer to be found.
1.6484 +@param anIndex A TInt supplied by the caller. On return, contains an index
1.6485 + value.
1.6486 + If the function returns KErrNone, this is the index of the
1.6487 + matching unsigned integer within the array.
1.6488 + If the function returns KErrNotFound, this is the index of the
1.6489 + first unsigned integer within the array that is bigger than the
1.6490 + unsigned integer being searched for - if no unsigned integers within
1.6491 + the array are bigger, then the index value is the same as the
1.6492 + total number of unsigned integers within the array.
1.6493 +@return KErrNone, if a matching unsigned integer is found.
1.6494 + KErrNotFound, if no suitable entry can be found.
1.6495 +*/
1.6496 + { return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex); }
1.6497 +
1.6498 +
1.6499 +
1.6500 +
1.6501 +inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt aMode) const
1.6502 +/**
1.6503 +Finds the unsigned integer in the array that matches the specified unsigned integer
1.6504 +using a binary search technique.
1.6505 +
1.6506 +In the case that there is more than one matching element, finds the first, last
1.6507 +or any match as specified by the value of aMode.
1.6508 +
1.6509 +The function assumes that the array is in unsigned integer order.
1.6510 +
1.6511 +@param anEntry The unsigned integer to be found..
1.6512 +@param aMode Specifies whether to find the first match, the last match or any match,
1.6513 + as defined by one of the TArrayFindMode enum values.
1.6514 +
1.6515 +@return KErrNotFound, if there is no matching element, otherwise the array index of
1.6516 + a matching element - what the index refers to depends on the value of
1.6517 + aMode:
1.6518 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.6519 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.6520 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.6521 + the last matching element - if the last matching element is also the last element of
1.6522 + the array, then the index value is the same as the total number of elements in the array.
1.6523 +
1.6524 +@see TArrayFindMode
1.6525 +*/
1.6526 + { return RPointerArrayBase::FindIsqUnsigned(anEntry,aMode); }
1.6527 +
1.6528 +
1.6529 +
1.6530 +
1.6531 +inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const
1.6532 +/**
1.6533 +Finds the unsigned integer in the array that matches the specified unsigned integer
1.6534 +using a binary search technique.
1.6535 +
1.6536 +In the case that there is more than one matching element, finds the first, last or any match as specified.
1.6537 +
1.6538 +The function assumes that the array is in unsigned integer order.
1.6539 +
1.6540 +@param anEntry The unsigned integer to be found.
1.6541 +@param anIndex A TInt type supplied by the caller. On return, it contains an index
1.6542 + value depending on whether a match is found and on the value of aMode.
1.6543 + If there is no matching element in the array, then this is the index
1.6544 + of the first element in the array that is bigger than the element being
1.6545 + searched for - if no elements in the array are bigger, then the index
1.6546 + value is the same as the total number of elements in the array.
1.6547 + If there is a matching element, then what the index refers to depends
1.6548 + on the value of aMode:
1.6549 + if this is EArrayFindMode_First, then the index refers to the first matching element;
1.6550 + if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
1.6551 + if this is EArrayFindMode_Last, then the index refers to first element that follows
1.6552 + the last matching element - if the last matching element is also the last element of the array,
1.6553 + then the index value is the same as the total number of elements in the array.
1.6554 +@param aMode Specifies whether to find the first match, the last match or any match, as defined by one
1.6555 + of the TArrayFindMode enum values.
1.6556 +
1.6557 +@return KErrNone, if a matching entry is found; KErrNotFound, if no matching entry exists.
1.6558 +
1.6559 +@see TArrayFindMode
1.6560 +*/
1.6561 + { return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex,aMode); }
1.6562 +
1.6563 +
1.6564 +
1.6565 +
1.6566 +inline TInt RArray<TUint>::InsertInOrder(TUint anEntry)
1.6567 +/**
1.6568 +Inserts an unsigned integer into the array in unsigned integer order.
1.6569 +
1.6570 +No duplicate entries are permitted. The array remains unchanged following
1.6571 +an attempt to insert a duplicate entry.
1.6572 +
1.6573 +The function assumes that existing entries within the array are in unsigned
1.6574 +integer order.
1.6575 +
1.6576 +@param anEntry The unsigned integer to be inserted.
1.6577 +
1.6578 +@return KErrNone, if the insertion is successful;
1.6579 + KErrAlreadyExists, if an attempt is being made
1.6580 + to insert a duplicate entry; otherwise one of the other system wide
1.6581 + error codes.
1.6582 +*/
1.6583 + { return RPointerArrayBase::InsertIsqUnsigned(anEntry,EFalse); }
1.6584 +
1.6585 +
1.6586 +
1.6587 +
1.6588 +inline TInt RArray<TUint>::InsertInOrderAllowRepeats(TUint anEntry)
1.6589 +/**
1.6590 +Inserts an unsigned integer into the array in unsigned integer order, allowing
1.6591 +duplicates.
1.6592 +
1.6593 +If the new integer is a duplicate of an existing entry in the array, then
1.6594 +the new unsigned integer is inserted after the existing one. If more than
1.6595 +one duplicate entry already exists in the array, then any new duplicate
1.6596 +unsigned integer is inserted after the last one.
1.6597 +
1.6598 +The function assumes that existing entries within the array are in unsigned
1.6599 +integer order.
1.6600 +
1.6601 +@param anEntry The unsigned integer to be inserted.
1.6602 +
1.6603 +@return KErrNone, if the insertion is successful, otherwise one of the system
1.6604 + wide error codes.
1.6605 +*/
1.6606 + { return RPointerArrayBase::InsertIsqUnsigned(anEntry,ETrue); }
1.6607 +
1.6608 +
1.6609 +
1.6610 +
1.6611 +#ifndef __KERNEL_MODE__
1.6612 +inline RArray<TUint>::RArray(TUint* aEntries, TInt aCount)
1.6613 + : RPointerArrayBase((TAny**)aEntries, aCount)
1.6614 +/**
1.6615 +C++ constructor with a pointer to the first array entry in a
1.6616 +pre-existing array, and the number of entries in that array.
1.6617 +
1.6618 +This constructor takes a pointer to a pre-existing set of entries of type
1.6619 +TUint objects. Ownership of the set of entries does not transfer to
1.6620 +this RArray object.
1.6621 +
1.6622 +The purpose of constructing an array in this way is to allow sorting and
1.6623 +finding operations to be done without further allocation of memory.
1.6624 +
1.6625 +@param aEntries A pointer to the first entry of type class TUint in the set of
1.6626 + entries belonging to the existing array.
1.6627 +@param aCount The number of entries in the existing array.
1.6628 +*/
1.6629 + {}
1.6630 +
1.6631 +
1.6632 +
1.6633 +inline void RArray<TUint>::GranularCompress()
1.6634 +/**
1.6635 +Compresses the array down to a granular boundary.
1.6636 +
1.6637 +After a call to this function, the memory allocated to the array is sufficient
1.6638 +for its contained entries. Adding new unsigned integers to the array does not
1.6639 +result in a re-allocation of memory until the total number of entries reaches
1.6640 +a multiple of the granularity.
1.6641 +*/
1.6642 + {RPointerArrayBase::GranularCompress();}
1.6643 +
1.6644 +
1.6645 +
1.6646 +
1.6647 +inline TInt RArray<TUint>::Reserve(TInt aCount)
1.6648 +/**
1.6649 +Reserves space for the specified number of elements.
1.6650 +
1.6651 +After a call to this function, the memory allocated to the array is sufficient
1.6652 +to hold the number of integers specified. Adding new integers to the array
1.6653 +does not result in a re-allocation of memory until the the total number of
1.6654 +integers exceeds the specified count.
1.6655 +
1.6656 +@param aCount The number of integers for which space should be reserved
1.6657 +@return KErrNone If the operation completed successfully
1.6658 +@return KErrNoMemory If the requested amount of memory could not be allocated
1.6659 +*/
1.6660 + { return RPointerArrayBase::DoReserve(aCount); }
1.6661 +
1.6662 +
1.6663 +
1.6664 +
1.6665 +inline void RArray<TUint>::Sort()
1.6666 +/**
1.6667 +Sorts the array entries into unsigned integer order.
1.6668 +*/
1.6669 + { HeapSortUnsigned(); }
1.6670 +
1.6671 +
1.6672 +
1.6673 +
1.6674 +inline TArray<TUint> RArray<TUint>::Array() const
1.6675 +/**
1.6676 +Constructs and returns a generic array.
1.6677 +
1.6678 +@return A generic array representing this array.
1.6679 +
1.6680 +@see TArray
1.6681 +*/
1.6682 + { return TArray<TUint>(GetCount,GetElementPtr,(const CBase*)this); }
1.6683 +#endif
1.6684 +
1.6685 +
1.6686 +
1.6687 +
1.6688 +/**
1.6689 +Sets an argument to default value and type.
1.6690 +*/
1.6691 +inline void TIpcArgs::Set(TInt,TNothing)
1.6692 + {}
1.6693 +
1.6694 +
1.6695 +
1.6696 +
1.6697 +/**
1.6698 +Sets an argument value of TInt type.
1.6699 +
1.6700 +@param aIndex An index value that identifies the slot in the array of arguments
1.6701 + into which the argument value is to be placed.
1.6702 + This must be a value in the range 0 to 3.
1.6703 +@param aValue The argument value.
1.6704 +*/
1.6705 +inline void TIpcArgs::Set(TInt aIndex,TInt aValue)
1.6706 + {
1.6707 + iArgs[aIndex] = aValue;
1.6708 + iFlags |= EUnspecified<<(aIndex*KBitsPerType);
1.6709 + }
1.6710 +
1.6711 +
1.6712 +
1.6713 +
1.6714 +/**
1.6715 +Sets an argument value of TAny* type.
1.6716 +
1.6717 +@param aIndex An index value that identifies the slot in the array of arguments
1.6718 + into which the argument value is to be placed.
1.6719 + This must be a value in the range 0 to 3.
1.6720 +@param aValue The argument value.
1.6721 +*/
1.6722 +inline void TIpcArgs::Set(TInt aIndex,const TAny* aValue)
1.6723 + {
1.6724 + iArgs[aIndex] = (TInt)aValue;
1.6725 + iFlags |= EUnspecified<<(aIndex*KBitsPerType);
1.6726 + }
1.6727 +
1.6728 +
1.6729 +
1.6730 +
1.6731 +/**
1.6732 +Sets an argument value of RHandleBase type.
1.6733 +
1.6734 +@param aIndex An index value that identifies the slot in the array of arguments
1.6735 + into which the argument value is to be placed.
1.6736 + This must be a value in the range 0 to 3.
1.6737 +@param aValue The argument value.
1.6738 +*/
1.6739 +inline void TIpcArgs::Set(TInt aIndex,RHandleBase aValue)
1.6740 + {
1.6741 + iArgs[aIndex] = (TInt)aValue.Handle();
1.6742 + iFlags |= EHandle<<(aIndex*KBitsPerType);
1.6743 + }
1.6744 +
1.6745 +
1.6746 +
1.6747 +
1.6748 +/**
1.6749 +Sets an argument value TDesC8* type.
1.6750 +
1.6751 +@param aIndex An index value that identifies the slot in the array of arguments
1.6752 + into which the argument value is to be placed.
1.6753 + This must be a value in the range 0 to 3.
1.6754 +@param aValue The argument value.
1.6755 +*/
1.6756 +inline void TIpcArgs::Set(TInt aIndex,const TDesC8* aValue)
1.6757 + {
1.6758 + iArgs[aIndex] = (TInt)aValue;
1.6759 + iFlags |= EDesC8<<(aIndex*KBitsPerType);
1.6760 + }
1.6761 +
1.6762 +
1.6763 +
1.6764 +
1.6765 +#ifndef __KERNEL_MODE__
1.6766 +
1.6767 +/**
1.6768 +Sets an argument value of TDesC16* type.
1.6769 +
1.6770 +@param aIndex An index value that identifies the slot in the array of arguments
1.6771 + into which the argument value is to be placed.
1.6772 + This must be a value in the range 0 to 3.
1.6773 +@param aValue The argument value.
1.6774 +*/
1.6775 +inline void TIpcArgs::Set(TInt aIndex,const TDesC16* aValue)
1.6776 + {
1.6777 + iArgs[aIndex] = (TInt)aValue;
1.6778 + iFlags |= EDesC16<<(aIndex*KBitsPerType);
1.6779 + }
1.6780 +
1.6781 +#endif
1.6782 +
1.6783 +
1.6784 +
1.6785 +
1.6786 +/**
1.6787 +Sets an argument value of TDes8* type.
1.6788 +
1.6789 +@param aIndex An index value that identifies the slot in the array of arguments
1.6790 + into which the argument value is to be placed.
1.6791 + This must be a value in the range 0 to 3.
1.6792 +@param aValue The argument value.
1.6793 +*/
1.6794 +inline void TIpcArgs::Set(TInt aIndex,TDes8* aValue)
1.6795 + {
1.6796 + iArgs[aIndex] = (TInt)aValue;
1.6797 + iFlags |= EDes8<<(aIndex*KBitsPerType);
1.6798 + }
1.6799 +
1.6800 +
1.6801 +
1.6802 +
1.6803 +#ifndef __KERNEL_MODE__
1.6804 +
1.6805 +/**
1.6806 +Sets an argument value of TDes16* type.
1.6807 +
1.6808 +@param aIndex An index value that identifies the slot in the array of arguments
1.6809 + into which the argument value is to be placed.
1.6810 + This must be a value in the range 0 to 3.
1.6811 +@param aValue The argument value.
1.6812 +*/
1.6813 +inline void TIpcArgs::Set(TInt aIndex,TDes16* aValue)
1.6814 + {
1.6815 + iArgs[aIndex] = (TInt)aValue;
1.6816 + iFlags |= EDes16<<(aIndex*KBitsPerType);
1.6817 + }
1.6818 +
1.6819 +#endif
1.6820 +
1.6821 +
1.6822 +
1.6823 +
1.6824 +inline TIpcArgs::TArgType TIpcArgs::Type(TNothing)
1.6825 + { return EUnspecified; }
1.6826 +inline TIpcArgs::TArgType TIpcArgs::Type(TInt)
1.6827 + { return EUnspecified; }
1.6828 +inline TIpcArgs::TArgType TIpcArgs::Type(const TAny*)
1.6829 + { return EUnspecified; }
1.6830 +inline TIpcArgs::TArgType TIpcArgs::Type(RHandleBase)
1.6831 + { return EHandle; }
1.6832 +inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC8*)
1.6833 + { return EDesC8; }
1.6834 +#ifndef __KERNEL_MODE__
1.6835 +inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC16*)
1.6836 + { return EDesC16; }
1.6837 +#endif
1.6838 +inline TIpcArgs::TArgType TIpcArgs::Type(TDes8*)
1.6839 + { return EDes8; }
1.6840 +#ifndef __KERNEL_MODE__
1.6841 +inline TIpcArgs::TArgType TIpcArgs::Type(TDes16*)
1.6842 + { return EDes16; }
1.6843 +#endif
1.6844 +inline void TIpcArgs::Assign(TInt&,TIpcArgs::TNothing)
1.6845 + {}
1.6846 +inline void TIpcArgs::Assign(TInt& aArg,TInt aValue)
1.6847 + { aArg = aValue; }
1.6848 +inline void TIpcArgs::Assign(TInt& aArg,const TAny* aValue)
1.6849 + { aArg = (TInt)aValue; }
1.6850 +inline void TIpcArgs::Assign(TInt& aArg,RHandleBase aValue)
1.6851 + { aArg = (TInt)aValue.Handle(); }
1.6852 +inline void TIpcArgs::Assign(TInt& aArg,const TDesC8* aValue)
1.6853 + { aArg = (TInt)aValue; }
1.6854 +#ifndef __KERNEL_MODE__
1.6855 +inline void TIpcArgs::Assign(TInt& aArg,const TDesC16* aValue)
1.6856 + { aArg = (TInt)aValue; }
1.6857 +#endif
1.6858 +inline void TIpcArgs::Assign(TInt& aArg,TDes8* aValue)
1.6859 + { aArg = (TInt)aValue; }
1.6860 +#ifndef __KERNEL_MODE__
1.6861 +inline void TIpcArgs::Assign(TInt& aArg,TDes16* aValue)
1.6862 + { aArg = (TInt)aValue; }
1.6863 +#endif
1.6864 +
1.6865 +
1.6866 +
1.6867 +// Structures for passing 64 bit integers and doubles across GCC/EABI boundaries
1.6868 +
1.6869 +inline SInt64::SInt64()
1.6870 + {}
1.6871 +
1.6872 +inline SInt64::SInt64(Int64 a)
1.6873 + {
1.6874 + iData[0] = (TUint32)((Uint64)a);
1.6875 + iData[1] = (TUint32)(((Uint64)a)>>32);
1.6876 + }
1.6877 +
1.6878 +inline SInt64& SInt64::operator=(Int64 a)
1.6879 + {
1.6880 + iData[0] = (TUint32)((Uint64)a);
1.6881 + iData[1] = (TUint32)(((Uint64)a)>>32);
1.6882 + return *this;
1.6883 + }
1.6884 +
1.6885 +inline SInt64::operator Int64() const
1.6886 + {
1.6887 + Int64 x;
1.6888 + TUint32* px = (TUint32*)&x;
1.6889 + px[0] = iData[0];
1.6890 + px[1] = iData[1];
1.6891 + return x;
1.6892 + }
1.6893 +
1.6894 +inline SUint64::SUint64()
1.6895 + {}
1.6896 +
1.6897 +inline SUint64::SUint64(Uint64 a)
1.6898 + {
1.6899 + iData[0] = (TUint32)a;
1.6900 + iData[1] = (TUint32)(a>>32);
1.6901 + }
1.6902 +
1.6903 +inline SUint64& SUint64::operator=(Uint64 a)
1.6904 + {
1.6905 + iData[0] = (TUint32)a;
1.6906 + iData[1] = (TUint32)(a>>32);
1.6907 + return *this;
1.6908 + }
1.6909 +
1.6910 +inline SUint64::operator Uint64() const
1.6911 + {
1.6912 + Uint64 x;
1.6913 + TUint32* px = (TUint32*)&x;
1.6914 + px[0] = iData[0];
1.6915 + px[1] = iData[1];
1.6916 + return x;
1.6917 + }
1.6918 +
1.6919 +inline SDouble::SDouble()
1.6920 + {}
1.6921 +
1.6922 +inline SDouble::SDouble(TReal a)
1.6923 + {
1.6924 + const TUint32* pa = (const TUint32*)&a;
1.6925 +#ifdef __DOUBLE_WORDS_SWAPPED__
1.6926 + iData[0] = pa[1];
1.6927 + iData[1] = pa[0]; // compiler puts MS word of double first
1.6928 +#else
1.6929 + iData[0] = pa[0];
1.6930 + iData[1] = pa[1]; // compiler puts MS word of double second
1.6931 +#endif
1.6932 + }
1.6933 +
1.6934 +inline SDouble& SDouble::operator=(TReal a)
1.6935 + {
1.6936 + new (this) SDouble(a);
1.6937 + return *this;
1.6938 + }
1.6939 +
1.6940 +inline SDouble::operator TReal() const
1.6941 + {
1.6942 + TReal x;
1.6943 + TUint32* px = (TUint32*)&x;
1.6944 +#ifdef __DOUBLE_WORDS_SWAPPED__
1.6945 + px[1] = iData[0];
1.6946 + px[0] = iData[1]; // compiler puts MS word of double first
1.6947 +#else
1.6948 + px[0] = iData[0];
1.6949 + px[1] = iData[1]; // compiler puts MS word of double second
1.6950 +#endif
1.6951 + return x;
1.6952 + }
1.6953 +
1.6954 +//
1.6955 +// TSecureId
1.6956 +//
1.6957 +
1.6958 +/** Default constructor. This leaves the object in an undefined state */
1.6959 +inline TSecureId::TSecureId()
1.6960 + {}
1.6961 +
1.6962 +/** Construct 'this' using a TUint32
1.6963 +@param aId The value for the ID */
1.6964 +inline TSecureId::TSecureId(TUint32 aId)
1.6965 + : iId(aId) {}
1.6966 +
1.6967 +/** Convert 'this' into a TUint32
1.6968 +*/
1.6969 +inline TSecureId::operator TUint32() const
1.6970 + { return iId; }
1.6971 +
1.6972 +/** Construct 'this' using a TUid
1.6973 +@param aId The value for the ID */
1.6974 +inline TSecureId::TSecureId(TUid aId)
1.6975 + : iId(aId.iUid) {}
1.6976 +
1.6977 +/** Convert 'this' into a TUid
1.6978 +*/
1.6979 +inline TSecureId::operator TUid() const
1.6980 + { return (TUid&)iId; }
1.6981 +
1.6982 +//
1.6983 +// SSecureId
1.6984 +//
1.6985 +inline const TSecureId* SSecureId::operator&() const
1.6986 + { return (const TSecureId*)this; }
1.6987 +inline SSecureId::operator const TSecureId&() const
1.6988 + { return (const TSecureId&)iId; }
1.6989 +inline SSecureId::operator TUint32() const
1.6990 + { return iId; }
1.6991 +inline SSecureId::operator TUid() const
1.6992 + { return (TUid&)iId; }
1.6993 +
1.6994 +//
1.6995 +// TVendorId
1.6996 +//
1.6997 +
1.6998 +/** Default constructor which leaves the object in an undefined state */
1.6999 +inline TVendorId::TVendorId()
1.7000 + {}
1.7001 +
1.7002 +/** Construct 'this' using a TUint32
1.7003 +@param aId The value for the ID */
1.7004 +inline TVendorId::TVendorId(TUint32 aId)
1.7005 + : iId(aId) {}
1.7006 +
1.7007 +/** Convert 'this' into a TUint32
1.7008 +*/
1.7009 +inline TVendorId::operator TUint32() const
1.7010 + { return iId; }
1.7011 +
1.7012 +/** Construct 'this' using a TUid
1.7013 +@param aId The value for the ID */
1.7014 +inline TVendorId::TVendorId(TUid aId)
1.7015 + : iId(aId.iUid) {}
1.7016 +
1.7017 +/** Convert 'this' into a TUid
1.7018 +*/
1.7019 +inline TVendorId::operator TUid() const
1.7020 + { return (TUid&)iId; }
1.7021 +
1.7022 +//
1.7023 +// SSecureId
1.7024 +//
1.7025 +inline const TVendorId* SVendorId::operator&() const
1.7026 + { return (const TVendorId*)this; }
1.7027 +inline SVendorId::operator const TVendorId&() const
1.7028 + { return (const TVendorId&)iId; }
1.7029 +inline SVendorId::operator TUint32() const
1.7030 + { return iId; }
1.7031 +inline SVendorId::operator TUid() const
1.7032 + { return (TUid&)iId; }
1.7033 +
1.7034 +//
1.7035 +// TSharedChunkBufConfigBase
1.7036 +//
1.7037 +inline TSharedChunkBufConfigBase::TSharedChunkBufConfigBase()
1.7038 + {memset(this,0,sizeof(TSharedChunkBufConfigBase));}
1.7039 +
1.7040 +/**
1.7041 +Default constructor. This leaves the set in an undefned state.
1.7042 +*/
1.7043 +inline TCapabilitySet::TCapabilitySet()
1.7044 + {}
1.7045 +
1.7046 +/**
1.7047 +Construct a set consisting of a single capability.
1.7048 +@param aCapability The single capability
1.7049 +*/
1.7050 +inline TCapabilitySet::TCapabilitySet(TCapability aCapability)
1.7051 + { new (this) TCapabilitySet(aCapability, aCapability); }
1.7052 +
1.7053 +/**
1.7054 +Make this set consist of a single capability.
1.7055 +@param aCapability The single capability.
1.7056 +*/
1.7057 +inline void TCapabilitySet::Set(TCapability aCapability)
1.7058 + { new (this) TCapabilitySet(aCapability, aCapability); }
1.7059 +
1.7060 +/**
1.7061 +Make this set consist of two capabilities.
1.7062 +@param aCapability1 The first capability.
1.7063 +@param aCapability2 The second capability.
1.7064 +*/
1.7065 +inline void TCapabilitySet::Set(TCapability aCapability1, TCapability aCapability2)
1.7066 + { new (this) TCapabilitySet(aCapability1, aCapability2); }
1.7067 +
1.7068 +
1.7069 +/**
1.7070 +Default constructor. This leaves the object in an undefned state.
1.7071 +*/
1.7072 +inline TSecurityInfo::TSecurityInfo()
1.7073 + {}
1.7074 +
1.7075 +/** Constructs a TSecurityPolicy that will always fail, irrespective of the
1.7076 +checked object's attributes.
1.7077 +*/
1.7078 +inline TSecurityPolicy::TSecurityPolicy()
1.7079 + { new (this) TSecurityPolicy(EAlwaysFail); }
1.7080 +
1.7081 +/**
1.7082 +'Address of' operator which generates a TSecurityPolicy*
1.7083 +@return A pointer of type TSecurityPolicy which refers to this object
1.7084 +*/
1.7085 +inline const TSecurityPolicy* TStaticSecurityPolicy::operator&() const
1.7086 + { return (const TSecurityPolicy*)this; }
1.7087 +
1.7088 +/**
1.7089 +'Reference of' operator which generates a TSecurityPolicy&
1.7090 +@return A reference of type TSecurityPolicy which refers to this object
1.7091 +*/
1.7092 +inline TStaticSecurityPolicy::operator const TSecurityPolicy&() const
1.7093 + { return *(const TSecurityPolicy*)this; }
1.7094 +
1.7095 +/**
1.7096 +A method to explicity generate a TSecurityPolicy reference.
1.7097 +@return A reference of type TSecurityPolicy which refers to this object
1.7098 +*/
1.7099 +inline const TSecurityPolicy& TStaticSecurityPolicy::operator()() const
1.7100 + { return *(const TSecurityPolicy*)this; }
1.7101 +
1.7102 +#ifdef __KERNEL_MODE__
1.7103 +#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.7104 +
1.7105 +/** Checks this policy against the platform security attributes of aProcess.
1.7106 +
1.7107 + When a check fails the action taken is determined by the system wide Platform Security
1.7108 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.7109 + If PlatSecEnforcement is OFF, then this function will return ETrue even though the
1.7110 + check failed.
1.7111 +
1.7112 +@param aProcess The DProcess object to check against this TSecurityPolicy.
1.7113 +@param aDiagnostic A string that will be emitted along with any diagnostic message
1.7114 + that may be issued if the policy check fails.
1.7115 + This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.7116 + which enables it to be easily removed from the system.
1.7117 +@return ETrue if all the requirements of this TSecurityPolicy are met by the
1.7118 +platform security attributes of aProcess, EFalse otherwise.
1.7119 +@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
1.7120 +*/
1.7121 +inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, const char* aDiagnostic) const
1.7122 + {
1.7123 + return DoCheckPolicy(aProcess, aDiagnostic);
1.7124 + }
1.7125 +
1.7126 +/** Checks this policy against the platform security attributes of the process
1.7127 +owning aThread.
1.7128 +
1.7129 + When a check fails the action taken is determined by the system wide Platform Security
1.7130 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.7131 + If PlatSecEnforcement is OFF, then this function will return ETrue even though the
1.7132 + check failed.
1.7133 +
1.7134 +@param aThread The thread whose owning process' platform security attributes
1.7135 +are to be checked against this TSecurityPolicy.
1.7136 +@param aDiagnostic A string that will be emitted along with any diagnostic message
1.7137 + that may be issued if the policy check fails.
1.7138 + This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.7139 + which enables it to be easily removed from the system.
1.7140 +@return ETrue if all the requirements of this TSecurityPolicy are met by the
1.7141 +platform security parameters of the owning process of aThread, EFalse otherwise.
1.7142 +@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
1.7143 +*/
1.7144 +inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, const char* aDiagnostic) const
1.7145 + {
1.7146 + return DoCheckPolicy(aThread, aDiagnostic);
1.7147 + }
1.7148 +
1.7149 +#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.7150 +
1.7151 +/** Checks this policy against the platform security attributes of aProcess.
1.7152 +
1.7153 + When a check fails the action taken is determined by the system wide Platform Security
1.7154 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.7155 + If PlatSecEnforcement is OFF, then this function will return ETrue even though the
1.7156 + check failed.
1.7157 +
1.7158 +@param aProcess The DProcess object to check against this TSecurityPolicy.
1.7159 +@param aDiagnostic A string that will be emitted along with any diagnostic message
1.7160 + that may be issued if the policy check fails.
1.7161 + This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.7162 + which enables it to be easily removed from the system.
1.7163 +@return ETrue if all the requirements of this TSecurityPolicy are met by the
1.7164 +platform security attributes of aProcess, EFalse otherwise.
1.7165 +@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
1.7166 +*/
1.7167 +inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, OnlyCreateWithNull /*aDiagnostic*/) const
1.7168 + {
1.7169 + return DoCheckPolicy(aProcess);
1.7170 + }
1.7171 +
1.7172 +/** Checks this policy against the platform security attributes of the process
1.7173 +owning aThread.
1.7174 +
1.7175 + When a check fails the action taken is determined by the system wide Platform Security
1.7176 + configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
1.7177 + If PlatSecEnforcement is OFF, then this function will return ETrue even though the
1.7178 + check failed.
1.7179 +
1.7180 +@param aThread The thread whose owning process' platform security attributes
1.7181 +are to be checked against this TSecurityPolicy.
1.7182 +@param aDiagnostic A string that will be emitted along with any diagnostic message
1.7183 + that may be issued if the policy check fails.
1.7184 + This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
1.7185 + which enables it to be easily removed from the system.
1.7186 +@return ETrue if all the requirements of this TSecurityPolicy are met by the
1.7187 +platform security parameters of the owning process of aThread, EFalse otherwise.
1.7188 +@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
1.7189 +*/
1.7190 +inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, OnlyCreateWithNull /*aDiagnostic*/) const
1.7191 + {
1.7192 + return DoCheckPolicy(aThread);
1.7193 + }
1.7194 +
1.7195 +#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
1.7196 +#endif // __KERNEL_MODE__