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