0
|
1 |
// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\include\e32cmn.inl
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef __PLACEMENT_NEW_INLINE
|
|
19 |
#define __PLACEMENT_NEW_INLINE
|
|
20 |
// Global placement operator new
|
|
21 |
inline TAny* operator new(TUint /*aSize*/, TAny* aBase) __NO_THROW
|
|
22 |
{return aBase;}
|
|
23 |
|
|
24 |
// Global placement operator delete
|
|
25 |
inline void operator delete(TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW
|
|
26 |
{}
|
|
27 |
#endif //__PLACEMENT_NEW_INLINE
|
|
28 |
|
|
29 |
#ifndef __PLACEMENT_VEC_NEW_INLINE
|
|
30 |
#define __PLACEMENT_VEC_NEW_INLINE
|
|
31 |
// Global placement operator new[]
|
|
32 |
inline TAny* operator new[](TUint /*aSize*/, TAny* aBase) __NO_THROW
|
|
33 |
{return aBase;}
|
|
34 |
|
|
35 |
// Global placement operator delete[]
|
|
36 |
inline void operator delete[](TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW
|
|
37 |
{}
|
|
38 |
#endif //__PLACEMENT_VEC_NEW_INLINE
|
|
39 |
|
|
40 |
|
|
41 |
// class RAllocator
|
|
42 |
inline RAllocator::RAllocator()
|
|
43 |
{
|
|
44 |
iAccessCount=1;
|
|
45 |
iHandleCount=0;
|
|
46 |
iHandles=0;
|
|
47 |
iFlags=0;
|
|
48 |
iCellCount=0;
|
|
49 |
iTotalAllocSize=0;
|
|
50 |
}
|
|
51 |
inline void RAllocator::__DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum)
|
|
52 |
{__DbgMarkCheck(aCountAll, aCount, TPtrC8(aFileName), aLineNum);}
|
|
53 |
|
|
54 |
// Class TRefByValue
|
|
55 |
template <class T>
|
|
56 |
inline TRefByValue<T>::TRefByValue(T &aRef)
|
|
57 |
: iRef(aRef)
|
|
58 |
/**
|
|
59 |
Constructs this value reference for the specified referenced object.
|
|
60 |
|
|
61 |
@param aRef The referenced object.
|
|
62 |
*/
|
|
63 |
{}
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
template <class T>
|
|
69 |
inline TRefByValue<T>::operator T &()
|
|
70 |
/**
|
|
71 |
Gets a reference to the object encapsulated inside this value reference.
|
|
72 |
*/
|
|
73 |
{return(iRef);}
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
/**
|
|
79 |
Creates the logical channel.
|
|
80 |
|
|
81 |
@param aDevice The name of the logical device for which the channel
|
|
82 |
is to be constructed. This is the name by which
|
|
83 |
the LDD factory object, i.e. the instance of
|
|
84 |
the DLogicalDevice derived class, is known.
|
|
85 |
@param aVer The required version of the logical device. The driver
|
|
86 |
normally checks this against the version of the logical
|
|
87 |
channel, returning KErrNotSupported if the logical channel
|
|
88 |
is not compatible.
|
|
89 |
@param aUnit A unit of the device. This argument only has meaning if
|
|
90 |
the flag KDeviceAllowUnit is set in the iParseMask data
|
|
91 |
member of the LDD factory object.
|
|
92 |
@param aDriver A pointer to a descriptor containing the name of
|
|
93 |
a physical device. This is the name by which the PDD
|
|
94 |
factory object, i.e. the instance of the DPhysicalDevice
|
|
95 |
derived class, is known.
|
|
96 |
This is NULL, if no explicit name is to be supplied, or
|
|
97 |
the logical device does not require an accompanying physical
|
|
98 |
device.
|
|
99 |
@param aInfo A pointer to an explicit 8-bit descriptor containing extra
|
|
100 |
information for the physical device. This argument only has
|
|
101 |
meaning if the KDeviceAllowInfo flag is set in the iParseMask
|
|
102 |
data member of the LDD factory object.
|
|
103 |
@param aType An enumeration whose enumerators define the ownership of
|
|
104 |
this handle. If not explicitly specified, EOwnerProcess is
|
|
105 |
taken as default.
|
|
106 |
@param aTransferable If false, the channel is created as an object which is
|
|
107 |
local/private to the current process.
|
|
108 |
If true, the channel is an object which may be shared with
|
|
109 |
other processes using the IPC mechanisms for handle passing.
|
|
110 |
|
|
111 |
@return KErrNone, if successful; otherwise one of the other system wide
|
|
112 |
error codes.
|
|
113 |
*/
|
|
114 |
inline TInt RBusLogicalChannel::DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* aInfo, TOwnerType aType, TBool aTransferable)
|
|
115 |
{ return DoCreate(aDevice, aVer, aUnit, aDriver, aInfo, (TInt)aType | (aTransferable?KCreateProtectedObject:0) ); }
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
// Class TChar
|
|
121 |
inline TChar::TChar()
|
|
122 |
/**
|
|
123 |
Default constructor.
|
|
124 |
|
|
125 |
Constructs this character object with an undefined value.
|
|
126 |
*/
|
|
127 |
{}
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
inline TChar::TChar(TUint aChar)
|
|
133 |
: iChar(aChar)
|
|
134 |
/**
|
|
135 |
Constructs this character object and initialises it with the specified value.
|
|
136 |
|
|
137 |
@param aChar The initialisation value.
|
|
138 |
*/
|
|
139 |
{}
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
inline TChar& TChar::operator-=(TUint aChar)
|
|
145 |
/**
|
|
146 |
Subtracts an unsigned integer value from this character object.
|
|
147 |
|
|
148 |
This character object is changed by the operation.
|
|
149 |
|
|
150 |
@param aChar The value to be subtracted.
|
|
151 |
|
|
152 |
@return A reference to this character object.
|
|
153 |
*/
|
|
154 |
{iChar-=aChar;return(*this);}
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
inline TChar& TChar::operator+=(TUint aChar)
|
|
160 |
/**
|
|
161 |
Adds an unsigned integer value to this character object.
|
|
162 |
|
|
163 |
This character object is changed by the operation.
|
|
164 |
|
|
165 |
@param aChar The value to be added.
|
|
166 |
|
|
167 |
@return A reference to this character object.
|
|
168 |
*/
|
|
169 |
{iChar+=aChar;return(*this);}
|
|
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
inline TChar TChar::operator-(TUint aChar)
|
|
175 |
/**
|
|
176 |
Gets the result of subtracting an unsigned integer value from this character
|
|
177 |
object.
|
|
178 |
|
|
179 |
This character object is not changed.
|
|
180 |
|
|
181 |
@param aChar The value to be subtracted.
|
|
182 |
|
|
183 |
@return A character object whose value is the result of the subtraction
|
|
184 |
operation.
|
|
185 |
*/
|
|
186 |
{return(iChar-aChar);}
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
inline TChar TChar::operator+(TUint aChar)
|
|
192 |
/**
|
|
193 |
Gets the result of adding an unsigned integer value to this character object.
|
|
194 |
|
|
195 |
This character object is not changed.
|
|
196 |
|
|
197 |
@param aChar The value to be added.
|
|
198 |
|
|
199 |
@return A character object whose value is the result of the addition operation.
|
|
200 |
*/
|
|
201 |
{return(iChar+aChar);}
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
inline TChar::operator TUint() const
|
|
207 |
/**
|
|
208 |
Gets the value of the character as an unsigned integer.
|
|
209 |
|
|
210 |
The operator casts a TChar to a TUint, returning the TUint value wrapped by
|
|
211 |
this character object.
|
|
212 |
*/
|
|
213 |
{return(iChar);}
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
// Class TDesC8
|
|
219 |
inline TBool TDesC8::operator<(const TDesC8 &aDes) const
|
|
220 |
/**
|
|
221 |
Determines whether this descriptor's data is less than the specified
|
|
222 |
descriptor's data.
|
|
223 |
|
|
224 |
The comparison is implemented using the Compare() member function.
|
|
225 |
|
|
226 |
@param aDes The 8-bit non-modifable descriptor whose data is to be compared
|
|
227 |
with this descriptor's data.
|
|
228 |
|
|
229 |
@return True if greater than or equal, false otherwise.
|
|
230 |
|
|
231 |
@see TDesC8::Compare
|
|
232 |
*/
|
|
233 |
{return(Compare(aDes)<0);}
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
inline TBool TDesC8::operator<=(const TDesC8 &aDes) const
|
|
239 |
/**
|
|
240 |
Determines whether this descriptor's data is less than or equal to the
|
|
241 |
specified descriptor's data.
|
|
242 |
|
|
243 |
The comparison is implemented using the Compare() member function.
|
|
244 |
|
|
245 |
@param aDes The 8-bit non-modifable descriptor whose data is to be compared
|
|
246 |
with this descriptor's data.
|
|
247 |
|
|
248 |
@return True if less than or equal, false otherwise.
|
|
249 |
|
|
250 |
@see TDesC8::Compare
|
|
251 |
*/
|
|
252 |
{return(Compare(aDes)<=0);}
|
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
inline TBool TDesC8::operator>(const TDesC8 &aDes) const
|
|
258 |
/**
|
|
259 |
Determines whether this descriptor's data is greater than the specified
|
|
260 |
descriptor's data.
|
|
261 |
|
|
262 |
The comparison is implemented using the Compare() member function.
|
|
263 |
|
|
264 |
@param aDes The 8-bit non-modifable descriptor whose data is to be compared
|
|
265 |
with this descriptor's data.
|
|
266 |
|
|
267 |
@return True if greater than, false otherwise.
|
|
268 |
|
|
269 |
@see TDesC8::Compare
|
|
270 |
*/
|
|
271 |
{return(Compare(aDes)>0);}
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
inline TBool TDesC8::operator>=(const TDesC8 &aDes) const
|
|
277 |
/**
|
|
278 |
Determines whether this descriptor's data is greater than or equal to the
|
|
279 |
specified descriptor's data.
|
|
280 |
|
|
281 |
The comparison is implemented using the Compare() member function.
|
|
282 |
|
|
283 |
@param aDes The 8-bit non-modifable descriptor whose data is to be compared
|
|
284 |
with this descriptor's data.
|
|
285 |
|
|
286 |
@return True if greater than, false otherwise.
|
|
287 |
|
|
288 |
@see TDesC8::Compare
|
|
289 |
*/
|
|
290 |
{return(Compare(aDes)>=0);}
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
inline TBool TDesC8::operator==(const TDesC8 &aDes) const
|
|
296 |
/**
|
|
297 |
Determines whether this descriptor's data is equal to the specified
|
|
298 |
descriptor's data.
|
|
299 |
|
|
300 |
The comparison is implemented using the Compare() member function.
|
|
301 |
|
|
302 |
@param aDes The 8-bit non-modifable descriptor whose data is to be compared
|
|
303 |
with this descriptor's data.
|
|
304 |
|
|
305 |
@return True if equal, false otherwise.
|
|
306 |
|
|
307 |
@see TDesC8::Compare
|
|
308 |
*/
|
|
309 |
{return(Compare(aDes)==0);}
|
|
310 |
|
|
311 |
|
|
312 |
|
|
313 |
|
|
314 |
inline TBool TDesC8::operator!=(const TDesC8 &aDes) const
|
|
315 |
/**
|
|
316 |
Determines whether this descriptor's data is not equal to the specified
|
|
317 |
descriptor's data.
|
|
318 |
|
|
319 |
The comparison is implemented using the Compare() member function.
|
|
320 |
|
|
321 |
@param aDes The 8-bit non-modifable descriptor whose data is to be compared
|
|
322 |
with this descriptor's data.
|
|
323 |
|
|
324 |
@return True if not equal, false otherwise.
|
|
325 |
|
|
326 |
@see TDesC8::Compare
|
|
327 |
*/
|
|
328 |
{return(Compare(aDes)!=0);}
|
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
|
333 |
inline const TUint8 &TDesC8::operator[](TInt anIndex) const
|
|
334 |
/**
|
|
335 |
Gets a reference to a single data item within this descriptor's data.
|
|
336 |
|
|
337 |
@param anIndex The position of the individual data item within the descriptor's
|
|
338 |
data. This is an offset value; a zero value refers to the
|
|
339 |
leftmost data position.
|
|
340 |
|
|
341 |
@return A reference to the data item.
|
|
342 |
|
|
343 |
@panic USER 21, if anIndex is negative or greater than or equal to the current
|
|
344 |
length of the descriptor.
|
|
345 |
*/
|
|
346 |
{return(AtC(anIndex));}
|
|
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
inline TInt TDesC8::Length() const
|
|
352 |
/**
|
|
353 |
Gets the length of the data.
|
|
354 |
|
|
355 |
This is the number of 8-bit values or data items represented by the descriptor.
|
|
356 |
|
|
357 |
@return The length of the data represented by the descriptor.
|
|
358 |
*/
|
|
359 |
{return(iLength&KMaskDesLength8);}
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
|
364 |
inline TInt TDesC8::Size() const
|
|
365 |
/**
|
|
366 |
Gets the size of the data.
|
|
367 |
|
|
368 |
This is the number of bytes occupied by the data represented by the descriptor.
|
|
369 |
|
|
370 |
@return The size of the data represented by the descriptor.
|
|
371 |
*/
|
|
372 |
{return(Length());}
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
|
377 |
inline void TDesC8::DoSetLength(TInt aLength)
|
|
378 |
{iLength=(iLength&(~KMaskDesLength8))|aLength;}
|
|
379 |
|
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
// Class TPtrC8
|
|
384 |
inline void TPtrC8::Set(const TUint8 *aBuf,TInt aLength)
|
|
385 |
/**
|
|
386 |
Sets the 8-bit non-modifiable pointer descriptor to point to the specified
|
|
387 |
location in memory, whether in RAM or ROM.
|
|
388 |
|
|
389 |
The length of the descriptor is set to the specified length.
|
|
390 |
|
|
391 |
@param aBuf A pointer to the location that the descriptor is to represent.
|
|
392 |
@param aLength The length of the descriptor. This value must be non-negative.
|
|
393 |
|
|
394 |
@panic USER 29, if aLength is negative.
|
|
395 |
*/
|
|
396 |
{new(this) TPtrC8(aBuf,aLength);}
|
|
397 |
|
|
398 |
|
|
399 |
|
|
400 |
|
|
401 |
inline void TPtrC8::Set(const TDesC8 &aDes)
|
|
402 |
/**
|
|
403 |
Sets the 8-bit non-modifiable pointer descriptor from the specified descriptor.
|
|
404 |
|
|
405 |
It is set to point to the same data and is given the same length.
|
|
406 |
|
|
407 |
@param aDes A reference to an 8-bit non-modifiable descriptor.
|
|
408 |
*/
|
|
409 |
{new(this) TPtrC8(aDes);}
|
|
410 |
|
|
411 |
|
|
412 |
|
|
413 |
|
|
414 |
inline void TPtrC8::Set(const TPtrC8& aPtr)
|
|
415 |
/**
|
|
416 |
Sets the 8-bit non-modifiable pointer descriptor from the specified
|
|
417 |
non-modifiable pointer descriptor.
|
|
418 |
|
|
419 |
It is set to point to the same data and is given the same length.
|
|
420 |
|
|
421 |
@param aPtr A reference to an 8-bit non-modifiable pointer descriptor.
|
|
422 |
*/
|
|
423 |
{new(this) TPtrC8(aPtr);}
|
|
424 |
|
|
425 |
|
|
426 |
|
|
427 |
|
|
428 |
|
|
429 |
// class TBufCBase8
|
|
430 |
inline TPtr8 TBufCBase8::DoDes(TInt aMaxLength)
|
|
431 |
{return TPtr8(*this,aMaxLength);}
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
// Template class TBufC8
|
|
437 |
template <TInt S>
|
|
438 |
inline TBufC8<S>::TBufC8()
|
|
439 |
: TBufCBase8()
|
|
440 |
/**
|
|
441 |
Constructs an empty 8-bit non-modifiable buffer descriptor.
|
|
442 |
|
|
443 |
It contains no data.
|
|
444 |
|
|
445 |
The integer template parameter determines the size of the data area which
|
|
446 |
is created as part of the buffer descriptor object.
|
|
447 |
|
|
448 |
Data can, subsequently, be assigned into this buffer descriptor using the
|
|
449 |
assignment operators.
|
|
450 |
|
|
451 |
@see TBufC8::operator=
|
|
452 |
*/
|
|
453 |
{}
|
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
|
|
458 |
template <TInt S>
|
|
459 |
inline TBufC8<S>::TBufC8(const TUint8 *aString)
|
|
460 |
: TBufCBase8(aString,S)
|
|
461 |
/**
|
|
462 |
Constructs the 8-bit non-modifiable buffer descriptor from a zero terminated
|
|
463 |
string.
|
|
464 |
|
|
465 |
The integer template parameter determines the size of the data area which
|
|
466 |
is created as part of this object.
|
|
467 |
|
|
468 |
The string, excluding the zero terminator, is copied into this buffer descriptor's
|
|
469 |
data area. The length of this buffer descriptor is set to the length of the
|
|
470 |
string, excluding the zero terminator.
|
|
471 |
|
|
472 |
@param aString A pointer to a zero terminated string.
|
|
473 |
|
|
474 |
@panic USER 20, if the length of the string, excluding the zero terminator, is
|
|
475 |
greater than the value of the integer template parameter.
|
|
476 |
*/
|
|
477 |
{}
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
template <TInt S>
|
|
483 |
inline TBufC8<S>::TBufC8(const TDesC8 &aDes)
|
|
484 |
: TBufCBase8(aDes,S)
|
|
485 |
/**
|
|
486 |
Constructs the 8-bit non-modifiable buffer descriptor from any
|
|
487 |
existing descriptor.
|
|
488 |
|
|
489 |
The integer template parameter determines the size of the data area which
|
|
490 |
is created as part of this object.
|
|
491 |
|
|
492 |
Data is copied from the source descriptor into this buffer descriptor and
|
|
493 |
the length of this buffer descriptor is set to the length of the
|
|
494 |
source descriptor.
|
|
495 |
|
|
496 |
@param aDes The source 8-bit non-modifiable descriptor.
|
|
497 |
|
|
498 |
@panic USER 20, if the length of the source descriptor is
|
|
499 |
greater than the value of the integer template parameter.
|
|
500 |
*/
|
|
501 |
{}
|
|
502 |
|
|
503 |
|
|
504 |
|
|
505 |
|
|
506 |
template <TInt S>
|
|
507 |
inline TBufC8<S> &TBufC8<S>::operator=(const TUint8 *aString)
|
|
508 |
/**
|
|
509 |
Copies data into this descriptor, replacing any existing data.
|
|
510 |
|
|
511 |
The length of this descriptor is set to reflect the new data.
|
|
512 |
|
|
513 |
@param aString A pointer to a zero-terminated string.
|
|
514 |
|
|
515 |
@return A reference to this descriptor.
|
|
516 |
|
|
517 |
@panic USER 23, if the length of the string, excluding the zero terminator, is
|
|
518 |
greater than the maximum length of this (target) descriptor.
|
|
519 |
*/
|
|
520 |
{Copy(aString,S);return(*this);}
|
|
521 |
|
|
522 |
|
|
523 |
|
|
524 |
|
|
525 |
template <TInt S>
|
|
526 |
inline TBufC8<S> &TBufC8<S>::operator=(const TDesC8 &aDes)
|
|
527 |
/**
|
|
528 |
Copies data into this descriptor, replacing any existing data.
|
|
529 |
|
|
530 |
The length of this descriptor is set to reflect the new data.
|
|
531 |
|
|
532 |
@param aDes An 8-bit non-modifiable descriptor.
|
|
533 |
|
|
534 |
@return A reference to this descriptor.
|
|
535 |
|
|
536 |
@panic USER 23, if the length of the descriptor aDes is
|
|
537 |
greater than the maximum length of this (target) descriptor.
|
|
538 |
*/
|
|
539 |
{Copy(aDes,S);return(*this);}
|
|
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
template <TInt S>
|
|
545 |
inline TPtr8 TBufC8<S>::Des()
|
|
546 |
/**
|
|
547 |
Creates and returns an 8-bit modifiable pointer descriptor for the data
|
|
548 |
represented by this 8-bit non-modifiable buffer descriptor.
|
|
549 |
|
|
550 |
The content of a non-modifiable buffer descriptor normally cannot be altered,
|
|
551 |
other than by complete replacement of the data. Creating a modifiable pointer
|
|
552 |
descriptor provides a way of changing the data.
|
|
553 |
|
|
554 |
The modifiable pointer descriptor is set to point to this non-modifiable buffer
|
|
555 |
descriptor's data.
|
|
556 |
|
|
557 |
The length of the modifiable pointer descriptor is set to the length of this
|
|
558 |
non-modifiable buffer descriptor.
|
|
559 |
|
|
560 |
The maximum length of the modifiable pointer descriptor is set to the value
|
|
561 |
of the integer template parameter.
|
|
562 |
|
|
563 |
When data is modified through this new pointer descriptor, the lengths of
|
|
564 |
both it and this constant buffer descriptor are changed.
|
|
565 |
|
|
566 |
@return An 8-bit modifiable pointer descriptor representing the data in this
|
|
567 |
8-bit non-modifiable buffer descriptor.
|
|
568 |
*/
|
|
569 |
{return DoDes(S);}
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
|
|
574 |
#ifndef __KERNEL_MODE__
|
|
575 |
// Class HBufC8
|
|
576 |
inline HBufC8 &HBufC8::operator=(const HBufC8 &aLcb)
|
|
577 |
/**
|
|
578 |
Copies data into this 8-bit heap descriptor replacing any existing data.
|
|
579 |
|
|
580 |
The length of this descriptor is set to reflect the new data.
|
|
581 |
|
|
582 |
Note that the maximum length of this (target) descriptor is the length
|
|
583 |
of the descriptor buffer in the allocated host heap cell; this may be greater
|
|
584 |
than the maximum length specified when this descriptor was created or
|
|
585 |
last re-allocated.
|
|
586 |
|
|
587 |
@param aLcb The source 8-bit heap descriptor.
|
|
588 |
|
|
589 |
@return A reference to this 8-bit heap descriptor.
|
|
590 |
|
|
591 |
@panic USER 23, if the length of the descriptor aLcb is greater than the
|
|
592 |
maximum length of this (target) descriptor
|
|
593 |
*/
|
|
594 |
{return *this=static_cast<const TDesC8&>(aLcb);}
|
|
595 |
|
|
596 |
|
|
597 |
|
|
598 |
|
|
599 |
// Class RBuf8
|
|
600 |
inline RBuf8& RBuf8::operator=(const TUint8* aString)
|
|
601 |
/**
|
|
602 |
Copies data into this descriptor replacing any existing data.
|
|
603 |
|
|
604 |
The length of this descriptor is set to reflect the new data.
|
|
605 |
|
|
606 |
@param aString A pointer to a zero-terminated string.
|
|
607 |
|
|
608 |
@return A reference to this, the target descriptor.
|
|
609 |
|
|
610 |
@panic USER 11, if the length of the string, excluding the zero terminator, is
|
|
611 |
greater than the maximum length of this (target) descriptor.
|
|
612 |
*/
|
|
613 |
{Copy(aString);return(*this);}
|
|
614 |
|
|
615 |
|
|
616 |
|
|
617 |
|
|
618 |
inline RBuf8& RBuf8::operator=(const TDesC8& aDes)
|
|
619 |
/**
|
|
620 |
Copies data into this descriptor replacing any existing data.
|
|
621 |
|
|
622 |
The length of this descriptor is set to reflect the new data.
|
|
623 |
|
|
624 |
@param aDes An 8-bit non-modifiable descriptor.
|
|
625 |
|
|
626 |
@return A reference to this, the target descriptor.
|
|
627 |
|
|
628 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
629 |
maximum length of this (target) descriptor.
|
|
630 |
*/
|
|
631 |
{Copy(aDes);return(*this);}
|
|
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
inline RBuf8& RBuf8::operator=(const RBuf8& aDes)
|
|
637 |
/**
|
|
638 |
Copies data into this descriptor replacing any existing data.
|
|
639 |
|
|
640 |
The length of this descriptor is set to reflect the new data.
|
|
641 |
|
|
642 |
@param aDes A 8-bit buffer descriptor.
|
|
643 |
|
|
644 |
@return A reference to this, the target descriptor.
|
|
645 |
|
|
646 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
647 |
maximum length of this (target) descriptor.
|
|
648 |
*/
|
|
649 |
{Copy(aDes);return(*this);}
|
|
650 |
|
|
651 |
|
|
652 |
|
|
653 |
|
|
654 |
/**
|
|
655 |
Creates an 8-bit resizable buffer descriptor that has been initialised with
|
|
656 |
data from the specified read stream; leaves on failure.
|
|
657 |
|
|
658 |
Data is assigned to the new descriptor from the specified stream.
|
|
659 |
This variant assumes that the stream contains the length of the data followed
|
|
660 |
by the data itself.
|
|
661 |
|
|
662 |
The function is implemented by calling the HBufC8::NewL(RReadStream&,TInt)
|
|
663 |
variant and then assigning the resulting heap descriptor using
|
|
664 |
the RBuf8::Assign(HBufC8*) variant. The comments that describe
|
|
665 |
the HBufC8::NewL() variant also apply to this RBuf8::CreateL() function.
|
|
666 |
|
|
667 |
The function may leave with one of the system-wide error codes, specifically
|
|
668 |
KErrOverflow, if the length of the data as read from the stream is greater than
|
|
669 |
the upper limit as specified by the aMaxLength parameter.
|
|
670 |
|
|
671 |
@param aStream The stream from which the data length and the data to be
|
|
672 |
assigned to the new descriptor, are taken.
|
|
673 |
@param aMaxLength The upper limit on the length of data that the descriptor is
|
|
674 |
to represent. The value of this parameter must be non-negative
|
|
675 |
otherwise the underlying function will panic.
|
|
676 |
*/
|
|
677 |
inline void RBuf8::CreateL(RReadStream &aStream,TInt aMaxLength)
|
|
678 |
{
|
|
679 |
Assign(HBufC8::NewL(aStream,aMaxLength));
|
|
680 |
}
|
|
681 |
#endif
|
|
682 |
|
|
683 |
|
|
684 |
|
|
685 |
|
|
686 |
// Class TDes8
|
|
687 |
inline TDes8 &TDes8::operator=(const TUint8 *aString)
|
|
688 |
/**
|
|
689 |
Copies data into this descriptor replacing any existing data.
|
|
690 |
|
|
691 |
The length of this descriptor is set to reflect the new data.
|
|
692 |
|
|
693 |
@param aString A pointer to a zero-terminated string.
|
|
694 |
|
|
695 |
@return A reference to this, the target descriptor.
|
|
696 |
|
|
697 |
@panic USER 23, if the length of the string, excluding the zero terminator, is
|
|
698 |
greater than the maximum length of this (target) descriptor.
|
|
699 |
*/
|
|
700 |
{Copy(aString);return(*this);}
|
|
701 |
|
|
702 |
|
|
703 |
|
|
704 |
|
|
705 |
inline TDes8 &TDes8::operator=(const TDesC8 &aDes)
|
|
706 |
/**
|
|
707 |
Copies data into this descriptor replacing any existing data.
|
|
708 |
|
|
709 |
The length of this descriptor is set to reflect the new data.
|
|
710 |
|
|
711 |
@param aDes An 8-bit non-modifiable descriptor.
|
|
712 |
|
|
713 |
@return A reference to this, the target descriptor.
|
|
714 |
|
|
715 |
@panic USER 23, if the length of the descriptor aDes is greater than the
|
|
716 |
maximum length of this (target) descriptor.
|
|
717 |
*/
|
|
718 |
{Copy(aDes);return(*this);}
|
|
719 |
|
|
720 |
|
|
721 |
|
|
722 |
|
|
723 |
inline TDes8 &TDes8::operator=(const TDes8 &aDes)
|
|
724 |
/**
|
|
725 |
Copies data into this descriptor replacing any existing data.
|
|
726 |
|
|
727 |
The length of this descriptor is set to reflect the new data.
|
|
728 |
|
|
729 |
@param aDes An 8-bit modifiable descriptor.
|
|
730 |
|
|
731 |
@return A reference to this, the target descriptor.
|
|
732 |
|
|
733 |
@panic USER 23, if the length of the descriptor aDes is greater than the
|
|
734 |
maximum length of this (target) descriptor.
|
|
735 |
*/
|
|
736 |
{Copy(aDes);return(*this);}
|
|
737 |
|
|
738 |
|
|
739 |
|
|
740 |
|
|
741 |
inline TDes8 &TDes8::operator+=(const TDesC8 &aDes)
|
|
742 |
/**
|
|
743 |
Appends data onto the end of this descriptor's data and returns a reference
|
|
744 |
to this descriptor.
|
|
745 |
|
|
746 |
The length of this descriptor is incremented to reflect the new content.
|
|
747 |
|
|
748 |
@param aDes An-8 bit non-modifiable descriptor whose data is to be appended.
|
|
749 |
|
|
750 |
@return A reference to this descriptor.
|
|
751 |
|
|
752 |
@panic USER 23, if the resulting length of this descriptor is greater than its
|
|
753 |
maximum length.
|
|
754 |
*/
|
|
755 |
{Append(aDes);return(*this);}
|
|
756 |
|
|
757 |
|
|
758 |
|
|
759 |
|
|
760 |
inline const TUint8 &TDes8::operator[](TInt anIndex) const
|
|
761 |
/**
|
|
762 |
Gets a const reference to a single data item within this descriptor's data.
|
|
763 |
|
|
764 |
@param anIndex The position of the data item within this descriptor's data.
|
|
765 |
This is an offset value; a zero value refers to the leftmost
|
|
766 |
data position.
|
|
767 |
|
|
768 |
@return A const reference to the data item at the specified position.
|
|
769 |
|
|
770 |
@panic USER 21, if anIndex is negative or is greater than or equal to the
|
|
771 |
current length of this descriptor.
|
|
772 |
*/
|
|
773 |
{return(AtC(anIndex));}
|
|
774 |
|
|
775 |
|
|
776 |
|
|
777 |
|
|
778 |
inline TUint8 &TDes8::operator[](TInt anIndex)
|
|
779 |
/**
|
|
780 |
Gets a non-const reference to a single data item within this descriptor's
|
|
781 |
data.
|
|
782 |
|
|
783 |
@param anIndex The position of the data item within this descriptor's data.
|
|
784 |
This is an offset value; a zero value refers to the leftmost
|
|
785 |
data position.
|
|
786 |
|
|
787 |
@return A non-const reference to the data item at the specified position.
|
|
788 |
|
|
789 |
@panic USER 21, if anIndex is negative or is greater than or equal to the
|
|
790 |
current length of this descriptor.
|
|
791 |
*/
|
|
792 |
{return((TUint8 &)AtC(anIndex));}
|
|
793 |
|
|
794 |
|
|
795 |
|
|
796 |
|
|
797 |
inline TInt TDes8::MaxLength() const
|
|
798 |
/**
|
|
799 |
Gets the maximum length of the descriptor.
|
|
800 |
|
|
801 |
This is the upper limit for the number of 8-bit values or data items that
|
|
802 |
the descriptor can represent.
|
|
803 |
|
|
804 |
@return The maximum length of data that the descriptor can represent.
|
|
805 |
*/
|
|
806 |
{return(iMaxLength);}
|
|
807 |
|
|
808 |
|
|
809 |
|
|
810 |
|
|
811 |
inline TInt TDes8::MaxSize() const
|
|
812 |
/**
|
|
813 |
Gets the maximum size of the descriptor.
|
|
814 |
|
|
815 |
This is the upper limit for the number of bytes which the data represented by
|
|
816 |
the descriptor can occupy.
|
|
817 |
|
|
818 |
@return The maximum size of the descriptor data.
|
|
819 |
*/
|
|
820 |
{return(iMaxLength);}
|
|
821 |
|
|
822 |
|
|
823 |
|
|
824 |
|
|
825 |
inline TUint8 * TDes8::WPtr() const
|
|
826 |
{return((TUint8 *)Ptr());}
|
|
827 |
|
|
828 |
|
|
829 |
|
|
830 |
|
|
831 |
// Class TPtr8
|
|
832 |
inline TPtr8 &TPtr8::operator=(const TUint8 *aString)
|
|
833 |
/**
|
|
834 |
Copies data into this 8-bit modifiable pointer descriptor replacing any
|
|
835 |
existing data.
|
|
836 |
|
|
837 |
The length of this descriptor is set to reflect the new data.
|
|
838 |
|
|
839 |
@param aString A pointer to a zero-terminated string.
|
|
840 |
|
|
841 |
@return A reference to this 8-bit modifiable pointer descriptor.
|
|
842 |
|
|
843 |
@panic USER 23, if the length of the string, excluding the zero terminator, is
|
|
844 |
greater than the maximum length of this descriptor.
|
|
845 |
*/
|
|
846 |
{Copy(aString);return(*this);}
|
|
847 |
|
|
848 |
|
|
849 |
|
|
850 |
|
|
851 |
inline TPtr8 &TPtr8::operator=(const TDesC8 &aDes)
|
|
852 |
/**
|
|
853 |
Copies data into this 8-bit modifiable pointer descriptor replacing any
|
|
854 |
existing data.
|
|
855 |
|
|
856 |
The length of this descriptor is set to reflect the new data.
|
|
857 |
|
|
858 |
@param aDes An 8-bit modifiable pointer descriptor whose data is to be copied
|
|
859 |
into this descriptor.
|
|
860 |
|
|
861 |
@return A reference to this 8-bit modifiable pointer descriptor.
|
|
862 |
|
|
863 |
@panic USER 23, if the length of aDes is greater than the maximum
|
|
864 |
length of this descriptor.
|
|
865 |
*/
|
|
866 |
{Copy(aDes);return(*this);}
|
|
867 |
|
|
868 |
|
|
869 |
|
|
870 |
|
|
871 |
inline TPtr8 &TPtr8::operator=(const TPtr8 &aDes)
|
|
872 |
/**
|
|
873 |
Copies data into this 8-bit modifiable pointer descriptor replacing any
|
|
874 |
existing data.
|
|
875 |
|
|
876 |
The length of this descriptor is set to reflect the new data.
|
|
877 |
|
|
878 |
@param aDes An 8-bit modifiable pointer descriptor whose data is to be copied
|
|
879 |
into this descriptor.
|
|
880 |
|
|
881 |
@return A reference to this 8-bit modifiable pointer descriptor.
|
|
882 |
|
|
883 |
@panic USER 23, if the length of aDes is greater than the maximum
|
|
884 |
length of this descriptor.
|
|
885 |
*/
|
|
886 |
{Copy(aDes);return(*this);}
|
|
887 |
|
|
888 |
|
|
889 |
|
|
890 |
|
|
891 |
inline void TPtr8::Set(TUint8 *aBuf,TInt aLength,TInt aMaxLength)
|
|
892 |
/**
|
|
893 |
Sets the 8-bit modifiable pointer descriptor to point to the specified location
|
|
894 |
in memory, whether in RAM or ROM.
|
|
895 |
|
|
896 |
The length of the descriptor and its maximum length are set to the specified
|
|
897 |
values.
|
|
898 |
|
|
899 |
@param aBuf A pointer to the location that the descriptor is to represent.
|
|
900 |
@param aLength The length of the descriptor.
|
|
901 |
@param aMaxLength The maximum length of the descriptor.
|
|
902 |
|
|
903 |
@panic USER 20, if aLength is negative or is greater than the maximum length of
|
|
904 |
this descriptor.
|
|
905 |
@panic USER 30, if aMaxLength is negative.
|
|
906 |
*/
|
|
907 |
{new(this) TPtr8(aBuf,aLength,aMaxLength);}
|
|
908 |
|
|
909 |
|
|
910 |
|
|
911 |
|
|
912 |
inline void TPtr8::Set(const TPtr8 &aPtr)
|
|
913 |
/**
|
|
914 |
Sets the 8-bit modifiable pointer descriptor from an existing 8-bit modifiable
|
|
915 |
pointer descriptor.
|
|
916 |
|
|
917 |
It is set to point to the same data, is given the same length and the same
|
|
918 |
maximum length as the source pointer descriptor.
|
|
919 |
|
|
920 |
@param aPtr The source 8-bit modifiable pointer descriptor.
|
|
921 |
*/
|
|
922 |
{new(this) TPtr8(aPtr);}
|
|
923 |
|
|
924 |
|
|
925 |
|
|
926 |
|
|
927 |
// Template class TBuf8
|
|
928 |
template <TInt S>
|
|
929 |
inline TBuf8<S>::TBuf8()
|
|
930 |
: TBufBase8(S)
|
|
931 |
/**
|
|
932 |
Constructs an empty 8-bit modifiable buffer descriptor.
|
|
933 |
|
|
934 |
It contains no data.
|
|
935 |
|
|
936 |
The integer template parameter determines the size of the data area that is created
|
|
937 |
as part of the object, and defines the descriptor's maximum length.
|
|
938 |
*/
|
|
939 |
{}
|
|
940 |
|
|
941 |
|
|
942 |
|
|
943 |
|
|
944 |
template <TInt S>
|
|
945 |
inline TBuf8<S>::TBuf8(TInt aLength)
|
|
946 |
: TBufBase8(aLength,S)
|
|
947 |
/**
|
|
948 |
Constructs an empty 8-bit modifiable buffer descriptor and sets the its length
|
|
949 |
to the specified value.
|
|
950 |
|
|
951 |
No data is assigned to the descriptor.
|
|
952 |
|
|
953 |
The integer template parameter determines the size of the data area that is created
|
|
954 |
as part of the object, and defines the descriptor's maximum length.
|
|
955 |
|
|
956 |
@param aLength The length of this modifiable buffer descriptor.
|
|
957 |
|
|
958 |
@panic USER 20, if aLength is negative or is greater than the
|
|
959 |
value of the integer template parameter.
|
|
960 |
*/
|
|
961 |
{}
|
|
962 |
|
|
963 |
|
|
964 |
|
|
965 |
|
|
966 |
template <TInt S>
|
|
967 |
inline TBuf8<S>::TBuf8(const TUint8 *aString)
|
|
968 |
: TBufBase8(aString,S)
|
|
969 |
/**
|
|
970 |
Constructs the 8-bit modifiable buffer descriptor from a
|
|
971 |
zero terminated string.
|
|
972 |
|
|
973 |
The integer template parameter determines the size of the data area that
|
|
974 |
is created as part of the object, and defines the descriptor's maximum length.
|
|
975 |
|
|
976 |
The string, excluding the zero terminator, is copied into this buffer
|
|
977 |
descriptor's data area. The length of this buffer descriptor is set to the
|
|
978 |
length of the string, excluding the zero terminator.
|
|
979 |
|
|
980 |
@param aString A pointer to a zero terminated string.
|
|
981 |
|
|
982 |
@panic USER 23, if the length of the string, excluding the zero terminator,
|
|
983 |
is greater than the value of the integer template parameter.
|
|
984 |
*/
|
|
985 |
{}
|
|
986 |
|
|
987 |
|
|
988 |
|
|
989 |
|
|
990 |
template <TInt S>
|
|
991 |
inline TBuf8<S>::TBuf8(const TDesC8 &aDes)
|
|
992 |
: TBufBase8(aDes,S)
|
|
993 |
/**
|
|
994 |
Constructs the 8-bit modifiable buffer descriptor from any existing
|
|
995 |
8-bit descriptor.
|
|
996 |
|
|
997 |
The integer template parameter determines the size of the data area created
|
|
998 |
as part of this object and defines the descriptor's maximum length.
|
|
999 |
|
|
1000 |
Data is copied from the source descriptor into this modifiable buffer
|
|
1001 |
descriptor and the length of this modifiable buffer descriptor is set to
|
|
1002 |
the length of the source descriptor.
|
|
1003 |
|
|
1004 |
@param aDes The source 8-bit non-modifiable descriptor.
|
|
1005 |
|
|
1006 |
@panic USER 23, if the length of the source descriptor is greater than the
|
|
1007 |
value of the integer template parameter.
|
|
1008 |
*/
|
|
1009 |
{}
|
|
1010 |
|
|
1011 |
|
|
1012 |
|
|
1013 |
|
|
1014 |
template <TInt S>
|
|
1015 |
inline TBuf8<S> &TBuf8<S>::operator=(const TUint8 *aString)
|
|
1016 |
/**
|
|
1017 |
Copies data into this 8-bit modifiable buffer descriptor, replacing any
|
|
1018 |
existing data.
|
|
1019 |
|
|
1020 |
The length of this descriptor is set to reflect the new data.
|
|
1021 |
|
|
1022 |
@param aString A pointer to a zero-terminated string.
|
|
1023 |
|
|
1024 |
@return A reference to this 8-bit modifiable buffer descriptor.
|
|
1025 |
|
|
1026 |
@panic USER 23, if the length of the string, excluding the zero terminator,
|
|
1027 |
is greater than the maximum length of this (target) descriptor.
|
|
1028 |
*/
|
|
1029 |
{Copy(aString);return(*this);}
|
|
1030 |
|
|
1031 |
|
|
1032 |
|
|
1033 |
|
|
1034 |
template <TInt S>
|
|
1035 |
inline TBuf8<S> &TBuf8<S>::operator=(const TDesC8 &aDes)
|
|
1036 |
/**
|
|
1037 |
Copies data into this 8-bit modifiable buffer descriptor, replacing any
|
|
1038 |
existing data.
|
|
1039 |
|
|
1040 |
The length of this descriptor is set to reflect the new data.
|
|
1041 |
|
|
1042 |
@param aDes An 8 bit non-modifiable descriptor.
|
|
1043 |
|
|
1044 |
@return A reference to this 8-bit modifiable buffer descriptor.
|
|
1045 |
|
|
1046 |
@panic USER 23, if the length of the descriptor aDes is greater than the
|
|
1047 |
maximum length of this (target) descriptor.
|
|
1048 |
*/
|
|
1049 |
{Copy(aDes);return(*this);}
|
|
1050 |
|
|
1051 |
|
|
1052 |
|
|
1053 |
|
|
1054 |
template <TInt S>
|
|
1055 |
inline TBuf8<S>& TBuf8<S>::operator=(const TBuf8<S>& aBuf)
|
|
1056 |
/**
|
|
1057 |
Copies data into this 8-bit modifiable buffer descriptor replacing any
|
|
1058 |
existing data.
|
|
1059 |
|
|
1060 |
The length of this descriptor is set to reflect the new data.
|
|
1061 |
|
|
1062 |
@param aBuf The source 8-bit modifiable buffer descriptor with the same
|
|
1063 |
template value.
|
|
1064 |
|
|
1065 |
@return A reference to this 8-bit modifiable buffer descriptor.
|
|
1066 |
*/
|
|
1067 |
{Copy(aBuf);return *this;}
|
|
1068 |
|
|
1069 |
|
|
1070 |
|
|
1071 |
|
|
1072 |
// Template class TAlignedBuf8
|
|
1073 |
template <TInt S>
|
|
1074 |
inline TAlignedBuf8<S>::TAlignedBuf8()
|
|
1075 |
: TBufBase8(S)
|
|
1076 |
/**
|
|
1077 |
Constructs an empty 8-bit modifiable buffer descriptor.
|
|
1078 |
|
|
1079 |
It contains no data.
|
|
1080 |
|
|
1081 |
The integer template parameter determines the size of the data area that is created
|
|
1082 |
as part of the object, and defines the descriptor's maximum length.
|
|
1083 |
*/
|
|
1084 |
{}
|
|
1085 |
|
|
1086 |
|
|
1087 |
|
|
1088 |
|
|
1089 |
template <TInt S>
|
|
1090 |
inline TAlignedBuf8<S>::TAlignedBuf8(TInt aLength)
|
|
1091 |
: TBufBase8(aLength,S)
|
|
1092 |
/**
|
|
1093 |
Constructs an empty 8-bit modifiable buffer descriptor and sets the its length
|
|
1094 |
to the specified value.
|
|
1095 |
|
|
1096 |
No data is assigned to the descriptor.
|
|
1097 |
|
|
1098 |
The integer template parameter determines the size of the data area that is created
|
|
1099 |
as part of the object, and defines the descriptor's maximum length.
|
|
1100 |
|
|
1101 |
@param aLength The length of this modifiable buffer descriptor.
|
|
1102 |
|
|
1103 |
@panic USER 20, if aLength is negative or is greater than the
|
|
1104 |
value of the integer template parameter.
|
|
1105 |
*/
|
|
1106 |
{}
|
|
1107 |
|
|
1108 |
|
|
1109 |
|
|
1110 |
|
|
1111 |
template <TInt S>
|
|
1112 |
inline TAlignedBuf8<S>::TAlignedBuf8(const TUint8 *aString)
|
|
1113 |
: TBufBase8(aString,S)
|
|
1114 |
/**
|
|
1115 |
Constructs the 8-bit modifiable buffer descriptor from a
|
|
1116 |
zero terminated string.
|
|
1117 |
|
|
1118 |
The integer template parameter determines the size of the data area that
|
|
1119 |
is created as part of the object, and defines the descriptor's maximum length.
|
|
1120 |
|
|
1121 |
The string, excluding the zero terminator, is copied into this buffer
|
|
1122 |
descriptor's data area. The length of this buffer descriptor is set to the
|
|
1123 |
length of the string, excluding the zero terminator.
|
|
1124 |
|
|
1125 |
@param aString A pointer to a zero terminated string.
|
|
1126 |
|
|
1127 |
@panic USER 23, if the length of the string, excluding the zero terminator,
|
|
1128 |
is greater than the value of the integer template parameter.
|
|
1129 |
*/
|
|
1130 |
{}
|
|
1131 |
|
|
1132 |
|
|
1133 |
|
|
1134 |
|
|
1135 |
template <TInt S>
|
|
1136 |
inline TAlignedBuf8<S>::TAlignedBuf8(const TDesC8 &aDes)
|
|
1137 |
: TBufBase8(aDes,S)
|
|
1138 |
/**
|
|
1139 |
Constructs the 8-bit modifiable buffer descriptor from any existing
|
|
1140 |
8-bit descriptor.
|
|
1141 |
|
|
1142 |
The integer template parameter determines the size of the data area created
|
|
1143 |
as part of this object and defines the descriptor's maximum length.
|
|
1144 |
|
|
1145 |
Data is copied from the source descriptor into this modifiable buffer
|
|
1146 |
descriptor and the length of this modifiable buffer descriptor is set to
|
|
1147 |
the length of the source descriptor.
|
|
1148 |
|
|
1149 |
@param aDes The source 8-bit non-modifiable descriptor.
|
|
1150 |
|
|
1151 |
@panic USER 23, if the length of the source descriptor is greater than the
|
|
1152 |
value of the integer template parameter.
|
|
1153 |
*/
|
|
1154 |
{}
|
|
1155 |
|
|
1156 |
|
|
1157 |
|
|
1158 |
|
|
1159 |
template <TInt S>
|
|
1160 |
inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TUint8 *aString)
|
|
1161 |
/**
|
|
1162 |
Copies data into this 8-bit modifiable buffer descriptor, replacing any
|
|
1163 |
existing data.
|
|
1164 |
|
|
1165 |
The length of this descriptor is set to reflect the new data.
|
|
1166 |
|
|
1167 |
@param aString A pointer to a zero-terminated string.
|
|
1168 |
|
|
1169 |
@return A reference to this 8-bit modifiable buffer descriptor.
|
|
1170 |
|
|
1171 |
@panic USER 23, if the length of the string, excluding the zero terminator,
|
|
1172 |
is greater than the maximum length of this (target) descriptor.
|
|
1173 |
*/
|
|
1174 |
{Copy(aString);return(*this);}
|
|
1175 |
|
|
1176 |
|
|
1177 |
|
|
1178 |
|
|
1179 |
template <TInt S>
|
|
1180 |
inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TDesC8 &aDes)
|
|
1181 |
/**
|
|
1182 |
Copies data into this 8-bit modifiable buffer descriptor, replacing any
|
|
1183 |
existing data.
|
|
1184 |
|
|
1185 |
The length of this descriptor is set to reflect the new data.
|
|
1186 |
|
|
1187 |
@param aDes An 8 bit non-modifiable descriptor.
|
|
1188 |
|
|
1189 |
@return A reference to this 8-bit modifiable buffer descriptor.
|
|
1190 |
|
|
1191 |
@panic USER 23, if the length of the descriptor aDes is greater than the
|
|
1192 |
maximum length of this (target) descriptor.
|
|
1193 |
*/
|
|
1194 |
{Copy(aDes);return(*this);}
|
|
1195 |
|
|
1196 |
|
|
1197 |
|
|
1198 |
|
|
1199 |
template <TInt S>
|
|
1200 |
inline TAlignedBuf8<S>& TAlignedBuf8<S>::operator=(const TAlignedBuf8<S>& aBuf)
|
|
1201 |
/**
|
|
1202 |
Copies data into this 8-bit modifiable buffer descriptor replacing any
|
|
1203 |
existing data.
|
|
1204 |
|
|
1205 |
The length of this descriptor is set to reflect the new data.
|
|
1206 |
|
|
1207 |
@param aBuf The source 8-bit modifiable buffer descriptor with the same
|
|
1208 |
template value.
|
|
1209 |
|
|
1210 |
@return A reference to this 8-bit modifiable buffer descriptor.
|
|
1211 |
*/
|
|
1212 |
{Copy(aBuf);return *this;}
|
|
1213 |
|
|
1214 |
|
|
1215 |
|
|
1216 |
|
|
1217 |
// Template class TLitC8
|
|
1218 |
template <TInt S>
|
|
1219 |
inline const TDesC8* TLitC8<S>::operator&() const
|
|
1220 |
/**
|
|
1221 |
Returns a const TDesC8 type pointer.
|
|
1222 |
|
|
1223 |
@return A descriptor type pointer to this literal.
|
|
1224 |
*/
|
|
1225 |
{return REINTERPRET_CAST(const TDesC8*,this);}
|
|
1226 |
|
|
1227 |
|
|
1228 |
|
|
1229 |
|
|
1230 |
template <TInt S>
|
|
1231 |
inline const TDesC8& TLitC8<S>::operator()() const
|
|
1232 |
/**
|
|
1233 |
Returns a const TDesC8 type reference.
|
|
1234 |
|
|
1235 |
@return A descriptor type reference to this literal
|
|
1236 |
*/
|
|
1237 |
{return *operator&();}
|
|
1238 |
|
|
1239 |
|
|
1240 |
|
|
1241 |
|
|
1242 |
template <TInt S>
|
|
1243 |
inline TLitC8<S>::operator const TDesC8&() const
|
|
1244 |
/**
|
|
1245 |
Invoked by the compiler when a TLitC8<TInt> type is passed to a function
|
|
1246 |
which is prototyped to take a const TDesC8& type.
|
|
1247 |
*/
|
|
1248 |
{return *operator&();}
|
|
1249 |
|
|
1250 |
|
|
1251 |
|
|
1252 |
template <TInt S>
|
|
1253 |
inline TLitC8<S>::operator const __TRefDesC8() const
|
|
1254 |
/**
|
|
1255 |
Invoked by the compiler when a TLitC8<TInt> type is passed to a function
|
|
1256 |
which is prototyped to take a const TRefByValue<const TDesC8> type.
|
|
1257 |
|
|
1258 |
@see __TRefDesC8
|
|
1259 |
*/
|
|
1260 |
{return *operator&();}
|
|
1261 |
|
|
1262 |
|
|
1263 |
|
|
1264 |
|
|
1265 |
#ifndef __KERNEL_MODE__
|
|
1266 |
// Class TDesC16
|
|
1267 |
inline TBool TDesC16::operator<(const TDesC16 &aDes) const
|
|
1268 |
/**
|
|
1269 |
Determines whether this descriptor's data is less than the specified descriptor's
|
|
1270 |
data.
|
|
1271 |
|
|
1272 |
The comparison is implemented using the Compare() member function.
|
|
1273 |
|
|
1274 |
@param aDes The 16-bit non-modifable descriptor whose data is to be compared
|
|
1275 |
with this descriptor's data.
|
|
1276 |
|
|
1277 |
@return True if less than, false otherwise.
|
|
1278 |
|
|
1279 |
@see TDesC16::Compare
|
|
1280 |
*/
|
|
1281 |
{return(Compare(aDes)<0);}
|
|
1282 |
|
|
1283 |
|
|
1284 |
|
|
1285 |
|
|
1286 |
inline TBool TDesC16::operator<=(const TDesC16 &aDes) const
|
|
1287 |
/**
|
|
1288 |
Determines whether this descriptor's data is less than or equal
|
|
1289 |
to the specified descriptor's data.
|
|
1290 |
|
|
1291 |
The comparison is implemented using the Compare() member function.
|
|
1292 |
|
|
1293 |
@param aDes The 16-bit non- modifiable descriptor whose data is to be compared
|
|
1294 |
with this descriptor's data.
|
|
1295 |
|
|
1296 |
@return True if less than or equal, false otherwise.
|
|
1297 |
|
|
1298 |
@see TDesC16::Compare
|
|
1299 |
*/
|
|
1300 |
{return(Compare(aDes)<=0);}
|
|
1301 |
|
|
1302 |
|
|
1303 |
|
|
1304 |
|
|
1305 |
inline TBool TDesC16::operator>(const TDesC16 &aDes) const
|
|
1306 |
/**
|
|
1307 |
Determines whether this descriptor's data is greater than the specified
|
|
1308 |
descriptor's data.
|
|
1309 |
|
|
1310 |
The comparison is implemented using the Compare() member function.
|
|
1311 |
|
|
1312 |
@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
|
|
1313 |
with this descriptor's data.
|
|
1314 |
|
|
1315 |
@return True if greater than, false otherwise.
|
|
1316 |
|
|
1317 |
@see TDesC16::Compare
|
|
1318 |
*/
|
|
1319 |
{return(Compare(aDes)>0);}
|
|
1320 |
|
|
1321 |
|
|
1322 |
|
|
1323 |
|
|
1324 |
inline TBool TDesC16::operator>=(const TDesC16 &aDes) const
|
|
1325 |
/**
|
|
1326 |
Determines whether this descriptor's data is greater than or equal to the
|
|
1327 |
specified descriptor's data.
|
|
1328 |
|
|
1329 |
The comparison is implemented using the Compare() member function.
|
|
1330 |
|
|
1331 |
@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
|
|
1332 |
with this descriptor's data.
|
|
1333 |
|
|
1334 |
@return True if greater than or equal, false otherwise.
|
|
1335 |
|
|
1336 |
@see TDesC16::Compare
|
|
1337 |
*/
|
|
1338 |
{return(Compare(aDes)>=0);}
|
|
1339 |
|
|
1340 |
|
|
1341 |
|
|
1342 |
|
|
1343 |
inline TBool TDesC16::operator==(const TDesC16 &aDes) const
|
|
1344 |
/**
|
|
1345 |
Determines whether this descriptor's data is equal to the specified
|
|
1346 |
descriptor's data.
|
|
1347 |
|
|
1348 |
The comparison is implemented using the Compare() member function.
|
|
1349 |
|
|
1350 |
@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
|
|
1351 |
with this descriptor's data.
|
|
1352 |
|
|
1353 |
@return True if equal, false otherwise.
|
|
1354 |
|
|
1355 |
@see TDesC16::Compare
|
|
1356 |
*/
|
|
1357 |
{return(Compare(aDes)==0);}
|
|
1358 |
|
|
1359 |
|
|
1360 |
|
|
1361 |
|
|
1362 |
inline TBool TDesC16::operator!=(const TDesC16 &aDes) const
|
|
1363 |
/**
|
|
1364 |
Determines whether this descriptor's data is not equal to the specified
|
|
1365 |
descriptor's data.
|
|
1366 |
|
|
1367 |
The comparison is implemented using the Compare() member function.
|
|
1368 |
|
|
1369 |
@param aDes The 16-bit non-modifiable descriptor whose data is to be compared
|
|
1370 |
with this descriptor's data.
|
|
1371 |
|
|
1372 |
@return True if not equal, false otherwise.
|
|
1373 |
|
|
1374 |
@see TDesC16::Compare
|
|
1375 |
*/
|
|
1376 |
{return(Compare(aDes)!=0);}
|
|
1377 |
|
|
1378 |
|
|
1379 |
|
|
1380 |
|
|
1381 |
inline const TUint16 &TDesC16::operator[](TInt anIndex) const
|
|
1382 |
/**
|
|
1383 |
Gets a reference to a single data item within this descriptor's data.
|
|
1384 |
|
|
1385 |
@param anIndex The position of the individual data item within the descriptor's
|
|
1386 |
data. This is an offset value; a zero value refers to the
|
|
1387 |
leftmost data position.
|
|
1388 |
|
|
1389 |
@return A reference to the data item.
|
|
1390 |
|
|
1391 |
@panic USER 9, if anIndex is negative or greater than or equal to the current
|
|
1392 |
length of the descriptor.
|
|
1393 |
*/
|
|
1394 |
{return(AtC(anIndex));}
|
|
1395 |
|
|
1396 |
|
|
1397 |
|
|
1398 |
|
|
1399 |
inline TInt TDesC16::Length() const
|
|
1400 |
/**
|
|
1401 |
Gets the length of the data.
|
|
1402 |
|
|
1403 |
This is the number of 16-bit values or data items represented by the descriptor.
|
|
1404 |
|
|
1405 |
@return The length of the data represented by the descriptor.
|
|
1406 |
*/
|
|
1407 |
{return(iLength&KMaskDesLength16);}
|
|
1408 |
|
|
1409 |
|
|
1410 |
|
|
1411 |
|
|
1412 |
inline TInt TDesC16::Size() const
|
|
1413 |
/**
|
|
1414 |
Gets the size of the data.
|
|
1415 |
|
|
1416 |
This is the number of bytes occupied by the data represented by the descriptor.
|
|
1417 |
|
|
1418 |
@return The size of the data represented by the descriptor. This is always
|
|
1419 |
twice the length.
|
|
1420 |
*/
|
|
1421 |
{return(Length()<<1);}
|
|
1422 |
|
|
1423 |
|
|
1424 |
|
|
1425 |
|
|
1426 |
inline void TDesC16::DoSetLength(TInt aLength)
|
|
1427 |
{iLength=(iLength&(~KMaskDesLength16))|aLength;}
|
|
1428 |
|
|
1429 |
|
|
1430 |
|
|
1431 |
|
|
1432 |
// Class TPtrC16
|
|
1433 |
inline void TPtrC16::Set(const TUint16 *aBuf,TInt aLength)
|
|
1434 |
/**
|
|
1435 |
Sets the 16-bit non-modifiable pointer descriptor to point to the specified
|
|
1436 |
location in memory, whether in RAM or ROM.
|
|
1437 |
|
|
1438 |
The length of the descriptor is set to the specified length.
|
|
1439 |
|
|
1440 |
@param aBuf A pointer to the location that the descriptor is to represent.
|
|
1441 |
@param aLength The length of the descriptor. This value must be non-negative
|
|
1442 |
|
|
1443 |
@panic USER 17, if aLength is negative.
|
|
1444 |
*/
|
|
1445 |
{new(this) TPtrC16(aBuf,aLength);}
|
|
1446 |
|
|
1447 |
|
|
1448 |
|
|
1449 |
|
|
1450 |
inline void TPtrC16::Set(const TDesC16 &aDes)
|
|
1451 |
/**
|
|
1452 |
Sets the 16-bit non-modifiable pointer descriptor from the specified descriptor.
|
|
1453 |
|
|
1454 |
It is set to point to the same data and is given the same length.
|
|
1455 |
|
|
1456 |
@param aDes A reference to a 16-bit non-modifiable descriptor
|
|
1457 |
*/
|
|
1458 |
{new(this) TPtrC16(aDes);}
|
|
1459 |
|
|
1460 |
|
|
1461 |
|
|
1462 |
|
|
1463 |
inline void TPtrC16::Set(const TPtrC16& aPtr)
|
|
1464 |
{new(this) TPtrC16(aPtr);}
|
|
1465 |
|
|
1466 |
|
|
1467 |
|
|
1468 |
|
|
1469 |
// class TBufCBase16
|
|
1470 |
inline TPtr16 TBufCBase16::DoDes(TInt aMaxLength)
|
|
1471 |
{return TPtr16(*this,aMaxLength);}
|
|
1472 |
|
|
1473 |
|
|
1474 |
|
|
1475 |
|
|
1476 |
// Template class TBufC16
|
|
1477 |
template <TInt S>
|
|
1478 |
inline TBufC16<S>::TBufC16()
|
|
1479 |
: TBufCBase16()
|
|
1480 |
/**
|
|
1481 |
Constructs an empty 16-bit non-modifiable buffer descriptor.
|
|
1482 |
|
|
1483 |
It contains no data.
|
|
1484 |
|
|
1485 |
The integer template parameter determines the size of the data area which
|
|
1486 |
is created as part of the buffer descriptor object.
|
|
1487 |
|
|
1488 |
Data can, subsequently, be assigned into this buffer descriptor using the
|
|
1489 |
assignment operators.
|
|
1490 |
|
|
1491 |
@see TBufC16::operator=
|
|
1492 |
*/
|
|
1493 |
{}
|
|
1494 |
|
|
1495 |
|
|
1496 |
|
|
1497 |
|
|
1498 |
template <TInt S>
|
|
1499 |
inline TBufC16<S>::TBufC16(const TUint16 *aString)
|
|
1500 |
: TBufCBase16(aString,S)
|
|
1501 |
/**
|
|
1502 |
Constructs the 16-bit non-modifiable buffer descriptor from a zero terminated
|
|
1503 |
string.
|
|
1504 |
|
|
1505 |
The integer template parameter determines the size of the data area which
|
|
1506 |
is created as part of this object.
|
|
1507 |
|
|
1508 |
The string, excluding the zero terminator, is copied into this buffer descriptor's
|
|
1509 |
data area. The length of this buffer descriptor is set to the length of the
|
|
1510 |
string, excluding the zero terminator.
|
|
1511 |
|
|
1512 |
@panic USER 8, if the length of the string, excluding the zero terminator, is
|
|
1513 |
greater than the value of the integer template parameter.
|
|
1514 |
|
|
1515 |
@param aString A pointer to a zero terminated string.
|
|
1516 |
*/
|
|
1517 |
{}
|
|
1518 |
|
|
1519 |
|
|
1520 |
|
|
1521 |
|
|
1522 |
template <TInt S>
|
|
1523 |
inline TBufC16<S>::TBufC16(const TDesC16 &aDes)
|
|
1524 |
: TBufCBase16(aDes,S)
|
|
1525 |
/**
|
|
1526 |
Constructs the 16-bit non-modifiable buffer descriptor from any
|
|
1527 |
existing descriptor.
|
|
1528 |
|
|
1529 |
The integer template parameter determines the size of the data area which
|
|
1530 |
is created as part of this object.
|
|
1531 |
|
|
1532 |
Data is copied from the source descriptor into this buffer descriptor and
|
|
1533 |
the length of this buffer descriptor is set to the length of the
|
|
1534 |
source descriptor.
|
|
1535 |
|
|
1536 |
@param aDes The source 16-bit non-modifiable descriptor.
|
|
1537 |
|
|
1538 |
@panic USER 8, if the length of the source descriptor is
|
|
1539 |
greater than the value of the integer template parameter.
|
|
1540 |
*/
|
|
1541 |
{}
|
|
1542 |
|
|
1543 |
|
|
1544 |
|
|
1545 |
|
|
1546 |
template <TInt S>
|
|
1547 |
inline TBufC16<S> &TBufC16<S>::operator=(const TUint16 *aString)
|
|
1548 |
/**
|
|
1549 |
Copies data into this descriptor replacing any existing data.
|
|
1550 |
|
|
1551 |
The length of this descriptor is set to reflect the new data.
|
|
1552 |
|
|
1553 |
@param aString A pointer to a zero-terminated string.
|
|
1554 |
|
|
1555 |
@return A reference to this descriptor.
|
|
1556 |
|
|
1557 |
@panic USER 11, if the length of the string, excluding the zero terminator, is
|
|
1558 |
greater than the maximum length of this (target) descriptor.
|
|
1559 |
*/
|
|
1560 |
{Copy(aString,S);return(*this);}
|
|
1561 |
|
|
1562 |
|
|
1563 |
|
|
1564 |
|
|
1565 |
template <TInt S>
|
|
1566 |
inline TBufC16<S> &TBufC16<S>::operator=(const TDesC16 &aDes)
|
|
1567 |
/**
|
|
1568 |
Copies data into this descriptor, replacing any existing data.
|
|
1569 |
|
|
1570 |
The length of this descriptor is set to reflect the new data.
|
|
1571 |
|
|
1572 |
@param aDes A 16-bit non-modifiable descriptor.
|
|
1573 |
|
|
1574 |
@panic USER 11, if the length of the descriptor aDes is
|
|
1575 |
greater than the maximum length of this (target) descriptor.
|
|
1576 |
|
|
1577 |
@return A reference to this descriptor.
|
|
1578 |
*/
|
|
1579 |
{Copy(aDes,S);return(*this);}
|
|
1580 |
|
|
1581 |
|
|
1582 |
|
|
1583 |
|
|
1584 |
template <TInt S>
|
|
1585 |
inline TPtr16 TBufC16<S>::Des()
|
|
1586 |
/**
|
|
1587 |
Creates and returns a 16-bit modifiable pointer descriptor for the data
|
|
1588 |
represented by this 16-bit non-modifiable buffer descriptor.
|
|
1589 |
|
|
1590 |
The content of a non-modifiable buffer descriptor normally cannot be altered,
|
|
1591 |
other than by complete replacement of the data. Creating a modifiable pointer
|
|
1592 |
descriptor provides a way of changing the data.
|
|
1593 |
|
|
1594 |
The modifiable pointer descriptor is set to point to this non-modifiable buffer
|
|
1595 |
descriptor's data.
|
|
1596 |
|
|
1597 |
The length of the modifiable pointer descriptor is set to the length of this
|
|
1598 |
non-modifiable buffer descriptor.
|
|
1599 |
|
|
1600 |
The maximum length of the modifiable pointer descriptor is set to the value
|
|
1601 |
of the integer template parameter.
|
|
1602 |
|
|
1603 |
When data is modified through this new pointer descriptor, the lengths of
|
|
1604 |
both it and this constant buffer descriptor are changed.
|
|
1605 |
|
|
1606 |
@return A 16-bit modifiable pointer descriptor representing the data in this
|
|
1607 |
16-bit non-modifiable buffer descriptor.
|
|
1608 |
*/
|
|
1609 |
{return(DoDes(S));}
|
|
1610 |
|
|
1611 |
|
|
1612 |
|
|
1613 |
|
|
1614 |
#ifndef __KERNEL_MODE__
|
|
1615 |
// Class HBufC16
|
|
1616 |
inline HBufC16 &HBufC16::operator=(const HBufC16 &aLcb)
|
|
1617 |
/**
|
|
1618 |
Copies data into this 16-bit heap descriptor replacing any existing data.
|
|
1619 |
|
|
1620 |
The length of this descriptor is set to reflect the new data.
|
|
1621 |
|
|
1622 |
Note that the maximum length of this (target) descriptor is the length
|
|
1623 |
of the descriptor buffer in the allocated host heap cell; this may be greater
|
|
1624 |
than the maximum length specified when this descriptor was created or
|
|
1625 |
last re-allocated.
|
|
1626 |
|
|
1627 |
@param aLcb The source 16-bit heap descriptor.
|
|
1628 |
|
|
1629 |
@return A reference to this 16-bit heap descriptor.
|
|
1630 |
|
|
1631 |
@panic USER 11, if the length of the descriptor aLcb is greater than the
|
|
1632 |
maximum length of this (target) descriptor
|
|
1633 |
*/
|
|
1634 |
{return *this=static_cast<const TDesC16&>(aLcb);}
|
|
1635 |
#endif
|
|
1636 |
|
|
1637 |
|
|
1638 |
|
|
1639 |
|
|
1640 |
// Class TDes16
|
|
1641 |
inline TDes16 &TDes16::operator=(const TUint16 *aString)
|
|
1642 |
/**
|
|
1643 |
Copies data into this descriptor replacing any existing data.
|
|
1644 |
|
|
1645 |
The length of this descriptor is set to reflect the new data.
|
|
1646 |
|
|
1647 |
@param aString A pointer to a zero-terminated string.
|
|
1648 |
|
|
1649 |
@return A reference to this, the target descriptor.
|
|
1650 |
|
|
1651 |
@panic USER 11, if the length of the string, excluding the zero terminator, is
|
|
1652 |
greater than the maximum length of this (target) descriptor.
|
|
1653 |
*/
|
|
1654 |
{Copy(aString);return(*this);}
|
|
1655 |
|
|
1656 |
|
|
1657 |
|
|
1658 |
|
|
1659 |
inline TDes16 &TDes16::operator=(const TDesC16 &aDes)
|
|
1660 |
/**
|
|
1661 |
Copies data into this descriptor replacing any existing data.
|
|
1662 |
|
|
1663 |
The length of this descriptor is set to reflect the new data.
|
|
1664 |
|
|
1665 |
@param aDes A 16-bit non-modifiable descriptor.
|
|
1666 |
|
|
1667 |
@return A reference to this, the target descriptor.
|
|
1668 |
|
|
1669 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
1670 |
maximum length of this (target) descriptor.
|
|
1671 |
*/
|
|
1672 |
{Copy(aDes);return(*this);}
|
|
1673 |
|
|
1674 |
|
|
1675 |
|
|
1676 |
|
|
1677 |
inline TDes16 &TDes16::operator=(const TDes16 &aDes)
|
|
1678 |
/**
|
|
1679 |
Copies data into this descriptor replacing any existing data.
|
|
1680 |
|
|
1681 |
The length of this descriptor is set to reflect the new data.
|
|
1682 |
|
|
1683 |
@param aDes A 16-bit modifiable descriptor.
|
|
1684 |
|
|
1685 |
@return A reference to this, the target descriptor.
|
|
1686 |
|
|
1687 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
1688 |
maximum length of this (target) descriptor.
|
|
1689 |
*/
|
|
1690 |
{Copy(aDes);return(*this);}
|
|
1691 |
|
|
1692 |
|
|
1693 |
|
|
1694 |
|
|
1695 |
inline TDes16 &TDes16::operator+=(const TDesC16 &aDes)
|
|
1696 |
/**
|
|
1697 |
Appends data onto the end of this descriptor's data and returns a reference
|
|
1698 |
to this descriptor.
|
|
1699 |
|
|
1700 |
The length of this descriptor is incremented to reflect the new content.
|
|
1701 |
|
|
1702 |
@param aDes A 16-bit non-modifiable descriptor whose data is to be appended.
|
|
1703 |
|
|
1704 |
@return A reference to this descriptor.
|
|
1705 |
|
|
1706 |
@panic USER 11, if the resulting length of this descriptor is greater than its
|
|
1707 |
maximum length.
|
|
1708 |
*/
|
|
1709 |
{Append(aDes);return(*this);}
|
|
1710 |
|
|
1711 |
|
|
1712 |
|
|
1713 |
|
|
1714 |
inline const TUint16 &TDes16::operator[](TInt anIndex) const
|
|
1715 |
/**
|
|
1716 |
Gets a const reference to a single data item within this descriptor's data.
|
|
1717 |
|
|
1718 |
@param anIndex The position the data item within this descriptor's data. This
|
|
1719 |
is an offset value; a zero value refers to the leftmost data position.
|
|
1720 |
|
|
1721 |
@return A const reference to the data item at the specified position.
|
|
1722 |
|
|
1723 |
@panic USER 9, if anIndex is negative or is greater than or equal to the
|
|
1724 |
current length of this descriptor.
|
|
1725 |
*/
|
|
1726 |
{return(AtC(anIndex));}
|
|
1727 |
|
|
1728 |
|
|
1729 |
|
|
1730 |
|
|
1731 |
inline TUint16 &TDes16::operator[](TInt anIndex)
|
|
1732 |
/**
|
|
1733 |
Gets a non-const reference to a single data item within this descriptor's
|
|
1734 |
data.
|
|
1735 |
|
|
1736 |
@param anIndex The position of the data item within this descriptor's data.
|
|
1737 |
This is an offset value; a zero value refers to the leftmost
|
|
1738 |
data position.
|
|
1739 |
|
|
1740 |
@return A non-const reference to the data item at the specified position.
|
|
1741 |
|
|
1742 |
@panic USER 9, if anIndex is negative or is greater than or equal to the
|
|
1743 |
current length of this descriptor.
|
|
1744 |
*/
|
|
1745 |
{return((TUint16 &)AtC(anIndex));}
|
|
1746 |
|
|
1747 |
|
|
1748 |
|
|
1749 |
|
|
1750 |
inline TInt TDes16::MaxLength() const
|
|
1751 |
/**
|
|
1752 |
Gets the maximum length of the descriptor.
|
|
1753 |
|
|
1754 |
This is the upper limit for the number of 16-bit values or data items that
|
|
1755 |
the descriptor can represent.
|
|
1756 |
|
|
1757 |
@return The maximum length of data that the descriptor can represent.
|
|
1758 |
*/
|
|
1759 |
{return(iMaxLength);}
|
|
1760 |
|
|
1761 |
|
|
1762 |
|
|
1763 |
|
|
1764 |
inline TInt TDes16::MaxSize() const
|
|
1765 |
/**
|
|
1766 |
Gets the maximum size of the descriptor.
|
|
1767 |
|
|
1768 |
This is the upper limit for the number of bytes which the data represented by
|
|
1769 |
the descriptor can occupy.
|
|
1770 |
|
|
1771 |
@return The maximum size of the descriptor data.
|
|
1772 |
*/
|
|
1773 |
{return(iMaxLength<<1);}
|
|
1774 |
|
|
1775 |
|
|
1776 |
|
|
1777 |
|
|
1778 |
inline TUint16 * TDes16::WPtr() const
|
|
1779 |
{return((TUint16 *)Ptr());}
|
|
1780 |
|
|
1781 |
|
|
1782 |
|
|
1783 |
|
|
1784 |
// Class TPtr16
|
|
1785 |
inline TPtr16 &TPtr16::operator=(const TUint16 *aString)
|
|
1786 |
/**
|
|
1787 |
Copies data into this 16-bit modifiable pointer descriptor replacing
|
|
1788 |
any existing data.
|
|
1789 |
|
|
1790 |
The length of this descriptor is set to reflect the new data.
|
|
1791 |
|
|
1792 |
@param aString A pointer to a zero-terminated string.
|
|
1793 |
|
|
1794 |
@return A reference to this 16-bit modifiable pointer descriptor.
|
|
1795 |
|
|
1796 |
@panic USER 11, if the length of the string, excluding the zero terminator, is
|
|
1797 |
greater than the maximum length of this descriptor.
|
|
1798 |
*/
|
|
1799 |
{Copy(aString);return(*this);}
|
|
1800 |
|
|
1801 |
|
|
1802 |
|
|
1803 |
|
|
1804 |
inline TPtr16 &TPtr16::operator=(const TDesC16 &aDes)
|
|
1805 |
/**
|
|
1806 |
Copies data into this 16-bit modifiable pointer descriptor replacing any
|
|
1807 |
existing data.
|
|
1808 |
|
|
1809 |
The length of this descriptor is set to reflect the new data.
|
|
1810 |
|
|
1811 |
@param aDes A 16-bit non-modifiable descriptor whose data is to be copied
|
|
1812 |
into this descriptor.
|
|
1813 |
|
|
1814 |
@return A reference to this 16-bit modifiable pointer descriptor.
|
|
1815 |
|
|
1816 |
@panic USER 11, if the length of aDes is greater than the maximum
|
|
1817 |
length of this descriptor.
|
|
1818 |
*/
|
|
1819 |
{Copy(aDes);return(*this);}
|
|
1820 |
|
|
1821 |
|
|
1822 |
|
|
1823 |
|
|
1824 |
inline TPtr16 &TPtr16::operator=(const TPtr16 &aDes)
|
|
1825 |
/**
|
|
1826 |
Copies data into this 16-bit modifiable pointer descriptor replacing any
|
|
1827 |
existing data.
|
|
1828 |
|
|
1829 |
The length of this descriptor is set to reflect the new data.
|
|
1830 |
|
|
1831 |
@param aDes A 16-bit modifiable pointer descriptor whose data is to be copied
|
|
1832 |
into this descriptor.
|
|
1833 |
|
|
1834 |
@return A reference to this 16-bit modifiable pointer descriptor.
|
|
1835 |
|
|
1836 |
@panic USER 11, if the length of aDes is greater than the maximum
|
|
1837 |
length of this descriptor.
|
|
1838 |
*/
|
|
1839 |
{Copy(aDes);return(*this);}
|
|
1840 |
|
|
1841 |
|
|
1842 |
|
|
1843 |
|
|
1844 |
inline void TPtr16::Set(TUint16 *aBuf,TInt aLength,TInt aMaxLength)
|
|
1845 |
/**
|
|
1846 |
Sets the 16-bit modifiable pointer descriptor to point to the specified location
|
|
1847 |
in memory, whether in RAM or ROM.
|
|
1848 |
|
|
1849 |
The length of the descriptor and its maximum length are set to the specified
|
|
1850 |
values.
|
|
1851 |
|
|
1852 |
@param aBuf A pointer to the location that the descriptor is to represent.
|
|
1853 |
@param aLength The length of the descriptor.
|
|
1854 |
@param aMaxLength The maximum length of the descriptor.
|
|
1855 |
|
|
1856 |
@panic USER 8, if aLength is negative or is greater than the maximum length of
|
|
1857 |
this descriptor.
|
|
1858 |
@panic USER 18, if aMaxLength is negative.
|
|
1859 |
*/
|
|
1860 |
{new(this) TPtr16(aBuf,aLength,aMaxLength);}
|
|
1861 |
|
|
1862 |
|
|
1863 |
|
|
1864 |
|
|
1865 |
inline void TPtr16::Set(const TPtr16 &aPtr)
|
|
1866 |
/**
|
|
1867 |
Sets the 16-bit modifiable pointer descriptor from an existing
|
|
1868 |
16-bit modifiable pointer descriptor.
|
|
1869 |
|
|
1870 |
It is set to point to the same data, is given the same length and the same
|
|
1871 |
maximum length as the source pointer descriptor.
|
|
1872 |
|
|
1873 |
@param aPtr The source 16-bit modifiable pointer descriptor.
|
|
1874 |
*/
|
|
1875 |
{new(this) TPtr16(aPtr);}
|
|
1876 |
|
|
1877 |
|
|
1878 |
|
|
1879 |
|
|
1880 |
// Template class TBuf16
|
|
1881 |
template <TInt S>
|
|
1882 |
inline TBuf16<S>::TBuf16()
|
|
1883 |
: TBufBase16(S)
|
|
1884 |
/**
|
|
1885 |
Constructs an empty 16-bit modifiable buffer descriptor.
|
|
1886 |
|
|
1887 |
It contains no data.
|
|
1888 |
|
|
1889 |
The integer template parameter determines the size of the data area created
|
|
1890 |
as part of the object and defines the descriptor's maximum length.
|
|
1891 |
*/
|
|
1892 |
{}
|
|
1893 |
|
|
1894 |
|
|
1895 |
|
|
1896 |
|
|
1897 |
template <TInt S>
|
|
1898 |
inline TBuf16<S>::TBuf16(TInt aLength)
|
|
1899 |
: TBufBase16(aLength,S)
|
|
1900 |
/**
|
|
1901 |
Constructs an empty 16-bit modifiable buffer descriptor and sets the its length
|
|
1902 |
to the specified value.
|
|
1903 |
|
|
1904 |
No data is assigned to the descriptor.
|
|
1905 |
|
|
1906 |
The integer template parameter defines the size of the data area created as
|
|
1907 |
part of the object and defines the descriptor's maximum length.
|
|
1908 |
|
|
1909 |
@param aLength The length of this modifiable buffer descriptor.
|
|
1910 |
|
|
1911 |
@panic USER 8, if aLength is negative or is greater than the
|
|
1912 |
value of the integer template parameter.
|
|
1913 |
*/
|
|
1914 |
{}
|
|
1915 |
|
|
1916 |
|
|
1917 |
|
|
1918 |
|
|
1919 |
template <TInt S>
|
|
1920 |
inline TBuf16<S>::TBuf16(const TUint16 *aString)
|
|
1921 |
: TBufBase16(aString,S)
|
|
1922 |
/**
|
|
1923 |
Constructs the 16-bit modifiable buffer descriptor from
|
|
1924 |
a zero terminated string.
|
|
1925 |
|
|
1926 |
The integer template parameter determines the size of the data area that is
|
|
1927 |
created as part of this object, and defines the descriptor's maximum length.
|
|
1928 |
|
|
1929 |
The string, excluding the zero terminator, is copied into this buffer
|
|
1930 |
descriptor's data area. The length of this buffer descriptor is set to the
|
|
1931 |
length of the string, excluding the zero terminator.
|
|
1932 |
|
|
1933 |
@param aString A pointer to a zero terminated string.
|
|
1934 |
|
|
1935 |
@panic USER 11, if the length of the string, excluding the zero terminator,
|
|
1936 |
is greater than the value of the integer template parameter.
|
|
1937 |
*/
|
|
1938 |
{}
|
|
1939 |
|
|
1940 |
|
|
1941 |
|
|
1942 |
|
|
1943 |
template <TInt S>
|
|
1944 |
inline TBuf16<S>::TBuf16(const TDesC16 &aDes)
|
|
1945 |
: TBufBase16(aDes,S)
|
|
1946 |
/**
|
|
1947 |
Constructs the 16-bit modifiable buffer descriptor from any existing
|
|
1948 |
16-bit descriptor.
|
|
1949 |
|
|
1950 |
The integer template parameter determines the size of the data area created
|
|
1951 |
as part of this object and defines the descriptor's maximum length.
|
|
1952 |
|
|
1953 |
Data is copied from the source descriptor into this modifiable buffer descriptor
|
|
1954 |
and the length of this modifiable buffer descriptor is set to the length of
|
|
1955 |
the source descriptor.
|
|
1956 |
|
|
1957 |
@param aDes The source 16-bit non-modifiable descriptor.
|
|
1958 |
|
|
1959 |
@panic USER 11, if the length of the source descriptor is greater than the
|
|
1960 |
value of the integer template parameter.
|
|
1961 |
*/
|
|
1962 |
{}
|
|
1963 |
|
|
1964 |
|
|
1965 |
|
|
1966 |
|
|
1967 |
template <TInt S>
|
|
1968 |
inline TBuf16<S> &TBuf16<S>::operator=(const TUint16 *aString)
|
|
1969 |
/**
|
|
1970 |
Copies data into this 16-bit modifiable buffer descriptor, replacing any
|
|
1971 |
existing data.
|
|
1972 |
|
|
1973 |
The length of this descriptor is set to reflect the new data.
|
|
1974 |
|
|
1975 |
@param aString A pointer to a zero-terminated string.
|
|
1976 |
|
|
1977 |
@return A reference to this descriptor.
|
|
1978 |
|
|
1979 |
@panic USER 11, if the length of the string, excluding the zero terminator,
|
|
1980 |
is greater than the maximum length of this (target) descriptor.
|
|
1981 |
*/
|
|
1982 |
{Copy(aString);return(*this);}
|
|
1983 |
|
|
1984 |
|
|
1985 |
|
|
1986 |
|
|
1987 |
template <TInt S>
|
|
1988 |
inline TBuf16<S> &TBuf16<S>::operator=(const TDesC16 &aDes)
|
|
1989 |
/**
|
|
1990 |
Copies data into this 16-bit modifiable descriptor, replacing any
|
|
1991 |
existing data.
|
|
1992 |
|
|
1993 |
The length of this descriptor is set to reflect the new data.
|
|
1994 |
|
|
1995 |
@param aDes A 16-bit non-modifiable descriptor.
|
|
1996 |
|
|
1997 |
@return A reference to this descriptor.
|
|
1998 |
|
|
1999 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
2000 |
maximum length of this (target) descriptor.
|
|
2001 |
*/
|
|
2002 |
{Copy(aDes);return(*this);}
|
|
2003 |
|
|
2004 |
|
|
2005 |
|
|
2006 |
|
|
2007 |
template <TInt S>
|
|
2008 |
inline TBuf16<S>& TBuf16<S>::operator=(const TBuf16<S>& aBuf)
|
|
2009 |
/**
|
|
2010 |
Copies data into this 16-bit modifiable buffer descriptor replacing any
|
|
2011 |
existing data.
|
|
2012 |
|
|
2013 |
The length of this descriptor is set to reflect the new data.
|
|
2014 |
|
|
2015 |
@param aBuf The source 16-bit modifiable buffer descriptor with the same
|
|
2016 |
template value.
|
|
2017 |
|
|
2018 |
@return A reference to this 16-bit modifiable buffer descriptor.
|
|
2019 |
|
|
2020 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
2021 |
maximum length of this (target) descriptor.
|
|
2022 |
*/
|
|
2023 |
{Copy(aBuf);return *this;}
|
|
2024 |
|
|
2025 |
|
|
2026 |
// Class RBuf16
|
|
2027 |
inline RBuf16& RBuf16::operator=(const TUint16* aString)
|
|
2028 |
/**
|
|
2029 |
Copies data into this descriptor replacing any existing data.
|
|
2030 |
|
|
2031 |
The length of this descriptor is set to reflect the new data.
|
|
2032 |
|
|
2033 |
@param aString A pointer to a zero-terminated string.
|
|
2034 |
|
|
2035 |
@return A reference to this, the target descriptor.
|
|
2036 |
|
|
2037 |
@panic USER 11, if the length of the string, excluding the zero terminator, is
|
|
2038 |
greater than the maximum length of this (target) descriptor.
|
|
2039 |
*/
|
|
2040 |
{Copy(aString);return(*this);}
|
|
2041 |
|
|
2042 |
|
|
2043 |
|
|
2044 |
|
|
2045 |
inline RBuf16& RBuf16::operator=(const TDesC16& aDes)
|
|
2046 |
/**
|
|
2047 |
Copies data into this descriptor replacing any existing data.
|
|
2048 |
|
|
2049 |
The length of this descriptor is set to reflect the new data.
|
|
2050 |
|
|
2051 |
@param aDes A 16-bit non-modifiable descriptor.
|
|
2052 |
|
|
2053 |
@return A reference to this, the target descriptor.
|
|
2054 |
|
|
2055 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
2056 |
maximum length of this (target) descriptor.
|
|
2057 |
*/
|
|
2058 |
{Copy(aDes);return(*this);}
|
|
2059 |
|
|
2060 |
|
|
2061 |
|
|
2062 |
|
|
2063 |
inline RBuf16& RBuf16::operator=(const RBuf16& aDes)
|
|
2064 |
/**
|
|
2065 |
Copies data into this descriptor replacing any existing data.
|
|
2066 |
|
|
2067 |
The length of this descriptor is set to reflect the new data.
|
|
2068 |
|
|
2069 |
@param aDes A 16-bit buffer descriptor.
|
|
2070 |
|
|
2071 |
@return A reference to this, the target descriptor.
|
|
2072 |
|
|
2073 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
2074 |
maximum length of this (target) descriptor.
|
|
2075 |
*/
|
|
2076 |
{Copy(aDes);return(*this);}
|
|
2077 |
|
|
2078 |
|
|
2079 |
|
|
2080 |
|
|
2081 |
/**
|
|
2082 |
Creates a 16-bit resizable buffer descriptor that has been initialised with
|
|
2083 |
data from the specified read stream; leaves on failure.
|
|
2084 |
|
|
2085 |
Data is assigned to the new descriptor from the specified stream.
|
|
2086 |
This variant assumes that the stream contains the length of the data followed
|
|
2087 |
by the data itself.
|
|
2088 |
|
|
2089 |
The function is implemented by calling the HBufC16::NewL(RReadStream&,TInt)
|
|
2090 |
variant and then assigning the resulting heap descriptor using
|
|
2091 |
the RBuf16::Assign(HBufC16*) variant. The comments that describe
|
|
2092 |
the HBufC16::NewL() variant also apply to this RBuf16::CreateL() function.
|
|
2093 |
|
|
2094 |
The function may leave with one of the system-wide error codes, specifically
|
|
2095 |
KErrOverflow, if the length of the data as read from the stream is greater than
|
|
2096 |
the upper limit as specified by the aMaxLength parameter.
|
|
2097 |
|
|
2098 |
@param aStream The stream from which the data length and the data to be
|
|
2099 |
assigned to the new descriptor, are taken.
|
|
2100 |
@param aMaxLength The upper limit on the length of data that the descriptor is
|
|
2101 |
to represent. The value of this parameter must be non-negative
|
|
2102 |
otherwise the underlying function will panic.
|
|
2103 |
*/
|
|
2104 |
inline void RBuf16::CreateL(RReadStream &aStream,TInt aMaxLength)
|
|
2105 |
{
|
|
2106 |
Assign(HBufC16::NewL(aStream,aMaxLength));
|
|
2107 |
}
|
|
2108 |
|
|
2109 |
|
|
2110 |
// Template class TLitC16
|
|
2111 |
template <TInt S>
|
|
2112 |
inline const TDesC16* TLitC16<S>::operator&() const
|
|
2113 |
/**
|
|
2114 |
Returns a const TDesC16 type pointer.
|
|
2115 |
|
|
2116 |
@return A descriptor type pointer to this literal.
|
|
2117 |
*/
|
|
2118 |
{return REINTERPRET_CAST(const TDesC16*,this);}
|
|
2119 |
|
|
2120 |
|
|
2121 |
|
|
2122 |
|
|
2123 |
template <TInt S>
|
|
2124 |
inline const TDesC16& TLitC16<S>::operator()() const
|
|
2125 |
/**
|
|
2126 |
Returns a const TDesC16 type reference.
|
|
2127 |
|
|
2128 |
@return A descriptor type reference to this literal
|
|
2129 |
*/
|
|
2130 |
{return *operator&();}
|
|
2131 |
|
|
2132 |
|
|
2133 |
|
|
2134 |
|
|
2135 |
template <TInt S>
|
|
2136 |
inline TLitC16<S>::operator const TDesC16&() const
|
|
2137 |
/**
|
|
2138 |
Invoked by the compiler when a TLitC16<TInt> type is passed to a function
|
|
2139 |
which is prototyped to take a const TDesC16& type.
|
|
2140 |
*/
|
|
2141 |
{return *operator&();}
|
|
2142 |
|
|
2143 |
|
|
2144 |
|
|
2145 |
|
|
2146 |
template <TInt S>
|
|
2147 |
inline TLitC16<S>::operator const __TRefDesC16() const
|
|
2148 |
/**
|
|
2149 |
Invoked by the compiler when a TLitC16<TInt> type is passed to a function
|
|
2150 |
which is prototyped to take a const TRefByValue<const TDesC16> type.
|
|
2151 |
|
|
2152 |
@see __TRefDesC16
|
|
2153 |
*/
|
|
2154 |
{return *operator&();}
|
|
2155 |
#endif //__KERNEL_MODE__
|
|
2156 |
|
|
2157 |
|
|
2158 |
|
|
2159 |
|
|
2160 |
// Template class TBufC
|
|
2161 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
|
|
2162 |
template <TInt S>
|
|
2163 |
inline TBufC<S>::TBufC()
|
|
2164 |
: TBufCBase16()
|
|
2165 |
/**
|
|
2166 |
Constructs an empty build independent non-modifiable buffer descriptor.
|
|
2167 |
|
|
2168 |
It contains no data.
|
|
2169 |
|
|
2170 |
The integer template parameter determines the size of the data area which
|
|
2171 |
is created as part of the buffer descriptor object.
|
|
2172 |
|
|
2173 |
Data can, subsequently, be assigned into this buffer descriptor using the
|
|
2174 |
assignment operators.
|
|
2175 |
|
|
2176 |
@see TBufC::operator=
|
|
2177 |
*/
|
|
2178 |
{}
|
|
2179 |
|
|
2180 |
|
|
2181 |
|
|
2182 |
|
|
2183 |
template <TInt S>
|
|
2184 |
inline TBufC<S>::TBufC(const TText *aString)
|
|
2185 |
: TBufCBase16(aString,S)
|
|
2186 |
/**
|
|
2187 |
Constructs a build independent non-modifiable
|
|
2188 |
buffer descriptor from a zero terminated string.
|
|
2189 |
|
|
2190 |
The integer template parameter determines the size of the data area which
|
|
2191 |
is created as part of this object.
|
|
2192 |
|
|
2193 |
The string, excluding the zero terminator, is copied into this buffer descriptor's
|
|
2194 |
data area. The length of this buffer descriptor is set to the length of the
|
|
2195 |
string, excluding the zero terminator.
|
|
2196 |
|
|
2197 |
@param aString A pointer to a zero terminated string.
|
|
2198 |
|
|
2199 |
@panic USER 8, if the length of the string, excluding the zero terminator, is
|
|
2200 |
greater than the value of the integer template parameter for
|
|
2201 |
the 16-bit build variant.
|
|
2202 |
|
|
2203 |
@panic USER 20, if the length of the string, excluding the zero terminator, is
|
|
2204 |
greater than the value of the integer template parameter for
|
|
2205 |
the 8-bit build variant.
|
|
2206 |
*/
|
|
2207 |
{}
|
|
2208 |
|
|
2209 |
|
|
2210 |
|
|
2211 |
|
|
2212 |
template <TInt S>
|
|
2213 |
inline TBufC<S>::TBufC(const TDesC &aDes)
|
|
2214 |
: TBufCBase16(aDes,S)
|
|
2215 |
/**
|
|
2216 |
Constructs a build-independent non-modifiable buffer descriptor from any
|
|
2217 |
existing build independent descriptor.
|
|
2218 |
|
|
2219 |
The integer template parameter determines the size of the data area which
|
|
2220 |
is created as part of this object.
|
|
2221 |
|
|
2222 |
Data is copied from the source descriptor into this buffer descriptor and
|
|
2223 |
the length of this buffer descriptor is set to the length of the source descriptor.
|
|
2224 |
|
|
2225 |
The length of the source descriptor must not be greater than the value of
|
|
2226 |
the integer template parameter, otherwise the constructor raises a USER 20
|
|
2227 |
panic for an 8 bit build variant or a USER 8 panic for a 16 bit (Unicode)
|
|
2228 |
build variant.
|
|
2229 |
|
|
2230 |
@param aDes The source build independent non-modifiable descriptor.
|
|
2231 |
|
|
2232 |
@panic USER 8, if the length of the source descriptor is
|
|
2233 |
greater than the value of the integer template parameter for
|
|
2234 |
the 16-bit build variant.
|
|
2235 |
|
|
2236 |
@panic USER 20, if the length of the source descriptor is
|
|
2237 |
greater than the value of the integer template parameter for
|
|
2238 |
the 8-bit build variant.
|
|
2239 |
*/
|
|
2240 |
{}
|
|
2241 |
#else
|
|
2242 |
template <TInt S>
|
|
2243 |
inline TBufC<S>::TBufC()
|
|
2244 |
: TBufCBase8()
|
|
2245 |
{}
|
|
2246 |
template <TInt S>
|
|
2247 |
inline TBufC<S>::TBufC(const TText *aString)
|
|
2248 |
: TBufCBase8(aString,S)
|
|
2249 |
{}
|
|
2250 |
template <TInt S>
|
|
2251 |
inline TBufC<S>::TBufC(const TDesC &aDes)
|
|
2252 |
: TBufCBase8(aDes,S)
|
|
2253 |
{}
|
|
2254 |
#endif
|
|
2255 |
template <TInt S>
|
|
2256 |
inline TBufC<S> &TBufC<S>::operator=(const TText *aString)
|
|
2257 |
/**
|
|
2258 |
Copies data into this descriptor, replacing any existing data.
|
|
2259 |
|
|
2260 |
The length of this descriptor is set to reflect the new data.
|
|
2261 |
|
|
2262 |
@param aString A pointer to a zero-terminated string.
|
|
2263 |
|
|
2264 |
@return A reference to this descriptor.
|
|
2265 |
|
|
2266 |
@panic USER 11, if the length of the string, excluding the zero terminator,
|
|
2267 |
is greater than the maximum length of this (target) descriptor
|
|
2268 |
for the 16-bit build variant.
|
|
2269 |
|
|
2270 |
@panic USER 23, if the length of the string, excluding the zero terminator,
|
|
2271 |
is greater than the maximum length of this (target) descriptor
|
|
2272 |
for the 8-bit build variant.
|
|
2273 |
*/
|
|
2274 |
{Copy(aString,S);return(*this);}
|
|
2275 |
|
|
2276 |
|
|
2277 |
|
|
2278 |
|
|
2279 |
template <TInt S>
|
|
2280 |
inline TBufC<S> &TBufC<S>::operator=(const TDesC &aDes)
|
|
2281 |
/**
|
|
2282 |
Copies data into this descriptor, replacing any existing data.
|
|
2283 |
|
|
2284 |
The length of this descriptor is set to reflect the new data.
|
|
2285 |
|
|
2286 |
@param aDes A build independent non-modifiable descriptor.
|
|
2287 |
|
|
2288 |
@return A reference to this descriptor.
|
|
2289 |
|
|
2290 |
@panic USER 11, if the length of the descriptor aDes is greater than the
|
|
2291 |
maximum length of this (target) descriptor for the 16-bit
|
|
2292 |
build variant.
|
|
2293 |
|
|
2294 |
@panic USER 23, if the length of the descriptor aDes is greater than the
|
|
2295 |
maximum length of this (target) descriptor for the 8-bit
|
|
2296 |
build variant.
|
|
2297 |
*/
|
|
2298 |
{Copy(aDes,S);return(*this);}
|
|
2299 |
|
|
2300 |
|
|
2301 |
|
|
2302 |
|
|
2303 |
template <TInt S>
|
|
2304 |
inline TPtr TBufC<S>::Des()
|
|
2305 |
/**
|
|
2306 |
Creates and returns a build-independent modifiable pointer descriptor for
|
|
2307 |
the data represented by this build-independent non-modifiable buffer
|
|
2308 |
descriptor.
|
|
2309 |
|
|
2310 |
The content of a non-modifiable buffer descriptor normally cannot be altered,
|
|
2311 |
other than by complete replacement of the data. Creating a modifiable pointer
|
|
2312 |
descriptor provides a way of changing the data.
|
|
2313 |
|
|
2314 |
The modifiable pointer descriptor is set to point to this non-modifiable buffer
|
|
2315 |
descriptor's data.
|
|
2316 |
|
|
2317 |
The length of the modifiable pointer descriptor is set to the length of this
|
|
2318 |
non-modifiable buffer descriptor.
|
|
2319 |
|
|
2320 |
The maximum length of the modifiable pointer descriptor is set to the value
|
|
2321 |
of the integer template parameter.
|
|
2322 |
|
|
2323 |
When data is modified through this new pointer descriptor, the lengths of
|
|
2324 |
both it and this constant buffer descriptor are changed.
|
|
2325 |
|
|
2326 |
@return A build independent modifiable pointer descriptor representing the
|
|
2327 |
data in this build independent non-modifiable buffer descriptor.
|
|
2328 |
*/
|
|
2329 |
{return(DoDes(S));}
|
|
2330 |
|
|
2331 |
|
|
2332 |
|
|
2333 |
|
|
2334 |
// Template class TBuf
|
|
2335 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__)
|
|
2336 |
template <TInt S>
|
|
2337 |
inline TBuf<S>::TBuf()
|
|
2338 |
: TBufBase16(S)
|
|
2339 |
/**
|
|
2340 |
Creates a build-independent modifiable buffer descriptor which
|
|
2341 |
contains no data.
|
|
2342 |
|
|
2343 |
The integer template parameter determines the size of the data area that is created
|
|
2344 |
as part of the object, and defines the descriptor's maximum length.
|
|
2345 |
*/
|
|
2346 |
{}
|
|
2347 |
|
|
2348 |
|
|
2349 |
|
|
2350 |
|
|
2351 |
template <TInt S>
|
|
2352 |
inline TBuf<S>::TBuf(TInt aLength)
|
|
2353 |
: TBufBase16(aLength,S)
|
|
2354 |
/**
|
|
2355 |
Constructs an empty build independent modifiable buffer descriptor and
|
|
2356 |
sets its length to the specified value.
|
|
2357 |
|
|
2358 |
No data is assigned to the descriptor.
|
|
2359 |
|
|
2360 |
The integer template parameter determines the size of the data area created
|
|
2361 |
as part of the object and defines the descriptor's maximum length.
|
|
2362 |
|
|
2363 |
@param aLength The length of this modifiable buffer descriptor.
|
|
2364 |
|
|
2365 |
@panic USER 8, if aLength is negative and is greater than the value of the
|
|
2366 |
integer template parameter for a 16-bit build variant.
|
|
2367 |
|
|
2368 |
@panic USER 20, if aLength is negative and is greater than the value of the
|
|
2369 |
integer template parameter for a 8-bit build variant.
|
|
2370 |
*/
|
|
2371 |
{}
|
|
2372 |
|
|
2373 |
|
|
2374 |
|
|
2375 |
|
|
2376 |
template <TInt S>
|
|
2377 |
inline TBuf<S>::TBuf(const TText *aString)
|
|
2378 |
: TBufBase16(aString,S)
|
|
2379 |
/**
|
|
2380 |
Constructs the build-independent modifiable buffer descriptor from
|
|
2381 |
a zero terminated string.
|
|
2382 |
|
|
2383 |
The integer template parameter determines the size of the data area which
|
|
2384 |
is created as part of this object.
|
|
2385 |
|
|
2386 |
The string, excluding the zero terminator, is copied into this buffer
|
|
2387 |
descriptor's data area. The length of this buffer descriptor is set to
|
|
2388 |
the length of the string, excluding the zero terminator.
|
|
2389 |
|
|
2390 |
@param aString A pointer to a zero terminated string.
|
|
2391 |
|
|
2392 |
@panic USER 11, if the length of the string, excluding the zero terminator,
|
|
2393 |
is greater than the value of the integer template parameter
|
|
2394 |
for a 16-bit build variant.
|
|
2395 |
@panic USER 23, if the length of the string, excluding the zero terminator,
|
|
2396 |
is greater than the value of the integer template parameter
|
|
2397 |
for a 8-bit build variant.
|
|
2398 |
*/
|
|
2399 |
{}
|
|
2400 |
|
|
2401 |
|
|
2402 |
|
|
2403 |
|
|
2404 |
template <TInt S>
|
|
2405 |
inline TBuf<S>::TBuf(const TDesC &aDes)
|
|
2406 |
: TBufBase16(aDes,S)
|
|
2407 |
/**
|
|
2408 |
Constructs the build-independent modifiable buffer descriptor from any
|
|
2409 |
existing build-independent descriptor.
|
|
2410 |
|
|
2411 |
The integer template parameter determines the size of the data area created
|
|
2412 |
as part of this object, and defines the descriptor's maximum length.
|
|
2413 |
|
|
2414 |
Data is copied from the source descriptor into this modifiable buffer descriptor
|
|
2415 |
and the length of this modifiable buffer descriptor is set to the length of
|
|
2416 |
the source descriptor.
|
|
2417 |
|
|
2418 |
@param aDes The source build independent non-modifiable descriptor.
|
|
2419 |
|
|
2420 |
@panic USER 11, if the length of the source descriptor is greater than the
|
|
2421 |
value of the integer template parameter for a 16-bit
|
|
2422 |
build variant.
|
|
2423 |
@panic USER 23, if the length of the source descriptor is greater than the
|
|
2424 |
value of the integer template parameter for an 8-bit
|
|
2425 |
build variant.
|
|
2426 |
|
|
2427 |
*/
|
|
2428 |
{}
|
|
2429 |
#else
|
|
2430 |
template <TInt S>
|
|
2431 |
inline TBuf<S>::TBuf()
|
|
2432 |
: TBufBase8(S)
|
|
2433 |
{}
|
|
2434 |
template <TInt S>
|
|
2435 |
inline TBuf<S>::TBuf(TInt aLength)
|
|
2436 |
: TBufBase8(aLength,S)
|
|
2437 |
{}
|
|
2438 |
template <TInt S>
|
|
2439 |
inline TBuf<S>::TBuf(const TText *aString)
|
|
2440 |
: TBufBase8(aString,S)
|
|
2441 |
{}
|
|
2442 |
template <TInt S>
|
|
2443 |
inline TBuf<S>::TBuf(const TDesC &aDes)
|
|
2444 |
: TBufBase8(aDes,S)
|
|
2445 |
{}
|
|
2446 |
#endif
|
|
2447 |
template <TInt S>
|
|
2448 |
inline TBuf<S> &TBuf<S>::operator=(const TText *aString)
|
|
2449 |
{Copy(aString);return(*this);}
|
|
2450 |
template <TInt S>
|
|
2451 |
inline TBuf<S> &TBuf<S>::operator=(const TDesC &aDes)
|
|
2452 |
{Copy(aDes);return(*this);}
|
|
2453 |
template <TInt S>
|
|
2454 |
inline TBuf<S> &TBuf<S>::operator=(const TBuf<S> &aBuf)
|
|
2455 |
{Copy(aBuf);return(*this);}
|
|
2456 |
|
|
2457 |
|
|
2458 |
|
|
2459 |
|
|
2460 |
// Template class TLitC
|
|
2461 |
template <TInt S>
|
|
2462 |
inline const TDesC* TLitC<S>::operator&() const
|
|
2463 |
/**
|
|
2464 |
Returns a const TDesC type pointer.
|
|
2465 |
|
|
2466 |
@return A descriptor type pointer to this literal.
|
|
2467 |
*/
|
|
2468 |
{return REINTERPRET_CAST(const TDesC*,this);}
|
|
2469 |
|
|
2470 |
|
|
2471 |
|
|
2472 |
|
|
2473 |
template <TInt S>
|
|
2474 |
inline const TDesC& TLitC<S>::operator()() const
|
|
2475 |
/**
|
|
2476 |
Returns a const TDesC type reference.
|
|
2477 |
|
|
2478 |
@return A descriptor type reference to this literal
|
|
2479 |
*/
|
|
2480 |
{return *operator&();}
|
|
2481 |
|
|
2482 |
|
|
2483 |
|
|
2484 |
|
|
2485 |
template <TInt S>
|
|
2486 |
inline TLitC<S>::operator const TDesC&() const
|
|
2487 |
/**
|
|
2488 |
Invoked by the compiler when a TLitC<TInt> type is passed to a function
|
|
2489 |
which is prototyped to take a const TDesC& type.
|
|
2490 |
*/
|
|
2491 |
{return *operator&();}
|
|
2492 |
|
|
2493 |
|
|
2494 |
|
|
2495 |
|
|
2496 |
template <TInt S>
|
|
2497 |
inline TLitC<S>::operator const __TRefDesC() const
|
|
2498 |
/**
|
|
2499 |
Invoked by the compiler when a TLitC<TInt> type is passed to a function
|
|
2500 |
which is prototyped to take a const TRefByValue<const TDesC> type.
|
|
2501 |
|
|
2502 |
@see __TRefDesC.
|
|
2503 |
*/
|
|
2504 |
{return *operator&();}
|
|
2505 |
|
|
2506 |
|
|
2507 |
|
|
2508 |
|
|
2509 |
// Template class TPckgC
|
|
2510 |
template <class T>
|
|
2511 |
inline TPckgC<T>::TPckgC(const T &aRef)
|
|
2512 |
: TPtrC8((const TUint8 *)&aRef,sizeof(T))
|
|
2513 |
/**
|
|
2514 |
Constructs a packaged non-modifiable pointer descriptor to represent
|
|
2515 |
the specified object whose type is defined by the template parameter.
|
|
2516 |
|
|
2517 |
@param aRef The object to be represented by this packaged non-modifiable
|
|
2518 |
pointer descriptor.
|
|
2519 |
*/
|
|
2520 |
{}
|
|
2521 |
|
|
2522 |
|
|
2523 |
|
|
2524 |
|
|
2525 |
template <class T>
|
|
2526 |
inline const T &TPckgC<T>::operator()() const
|
|
2527 |
/**
|
|
2528 |
Gets a reference to the object represented by this packaged non-modifiable
|
|
2529 |
pointer descriptor.
|
|
2530 |
|
|
2531 |
@return The packaged object
|
|
2532 |
*/
|
|
2533 |
{return(*((const T *)iPtr));}
|
|
2534 |
|
|
2535 |
|
|
2536 |
|
|
2537 |
|
|
2538 |
// Template class TPckg
|
|
2539 |
template <class T>
|
|
2540 |
inline TPckg<T>::TPckg(const T &aRef)
|
|
2541 |
: TPtr8((TUint8 *)&aRef,sizeof(T),sizeof(T))
|
|
2542 |
/**
|
|
2543 |
Constructs a packaged modifiable pointer descriptor to represent the specified
|
|
2544 |
object whose type is defined by the template parameter.
|
|
2545 |
|
|
2546 |
@param aRef The object to be represented by this packaged modifiable pointer
|
|
2547 |
descriptor.
|
|
2548 |
*/
|
|
2549 |
{}
|
|
2550 |
|
|
2551 |
|
|
2552 |
|
|
2553 |
|
|
2554 |
template <class T>
|
|
2555 |
inline T &TPckg<T>::operator()()
|
|
2556 |
/**
|
|
2557 |
Gets a reference to the object represented by this packaged
|
|
2558 |
modifiable pointer descriptor.
|
|
2559 |
|
|
2560 |
@return The packaged object.
|
|
2561 |
*/
|
|
2562 |
{return(*((T *)iPtr));}
|
|
2563 |
|
|
2564 |
|
|
2565 |
|
|
2566 |
|
|
2567 |
// Template class TPckgBuf
|
|
2568 |
template <class T>
|
|
2569 |
inline TPckgBuf<T>::TPckgBuf()
|
|
2570 |
: TAlignedBuf8<sizeof(T)>(sizeof(T))
|
|
2571 |
/**
|
|
2572 |
Constructs a packaged modifiable buffer descriptor for an object whose type
|
|
2573 |
is defined by the template parameter.
|
|
2574 |
|
|
2575 |
The length of the packaged descriptor is set to the length of the templated
|
|
2576 |
class but no data is assigned into the descriptor.
|
|
2577 |
*/
|
|
2578 |
{new(&this->iBuf[0]) T;}
|
|
2579 |
|
|
2580 |
|
|
2581 |
|
|
2582 |
|
|
2583 |
template <class T>
|
|
2584 |
inline TPckgBuf<T>::TPckgBuf(const T &aRef)
|
|
2585 |
: TAlignedBuf8<sizeof(T)>(sizeof(T))
|
|
2586 |
/**
|
|
2587 |
Constructs a packaged modifiable buffer descriptor for an object whose type
|
|
2588 |
is defined by the template parameter and copies the supplied object into the
|
|
2589 |
descriptor.
|
|
2590 |
|
|
2591 |
The length of the packaged descriptor is set to the length of the templated
|
|
2592 |
class.
|
|
2593 |
|
|
2594 |
@param aRef The source object to be copied into the packaged modifiable buffer
|
|
2595 |
descriptor.
|
|
2596 |
*/
|
|
2597 |
{new(&this->iBuf[0]) T(aRef);}
|
|
2598 |
|
|
2599 |
|
|
2600 |
|
|
2601 |
|
|
2602 |
template <class T>
|
|
2603 |
inline TPckgBuf<T> &TPckgBuf<T>::operator=(const TPckgBuf<T> &aRef)
|
|
2604 |
/**
|
|
2605 |
Copies data from the specified packaged modifiable buffer descriptor into this
|
|
2606 |
packaged modifiable buffer descriptor, replacing any existing data.
|
|
2607 |
|
|
2608 |
@param aRef The source packaged modifiable buffer descriptor.
|
|
2609 |
@return A reference to this packaged modifiable descriptor.
|
|
2610 |
*/
|
|
2611 |
{this->Copy(aRef);return(*this);}
|
|
2612 |
|
|
2613 |
|
|
2614 |
|
|
2615 |
|
|
2616 |
template <class T>
|
|
2617 |
inline T &TPckgBuf<T>::operator=(const T &aRef)
|
|
2618 |
/**
|
|
2619 |
Copies data from the specified object into this packaged modifiable buffer
|
|
2620 |
descriptor, replacing any existing data.
|
|
2621 |
|
|
2622 |
@param aRef The source object.
|
|
2623 |
@return A reference to the copy of the source object in the packaged modifiable
|
|
2624 |
buffer descriptor.
|
|
2625 |
*/
|
|
2626 |
{this->Copy((TUint8 *)&aRef,sizeof(T));return(*((T *)&this->iBuf[0]));}
|
|
2627 |
|
|
2628 |
|
|
2629 |
|
|
2630 |
|
|
2631 |
template <class T>
|
|
2632 |
inline T &TPckgBuf<T>::operator()()
|
|
2633 |
/**
|
|
2634 |
Gets a reference to the object contained by this packaged modifiable
|
|
2635 |
buffer descriptor.
|
|
2636 |
|
|
2637 |
@return The packaged object.
|
|
2638 |
*/
|
|
2639 |
{return(*((T *)&this->iBuf[0]));}
|
|
2640 |
|
|
2641 |
|
|
2642 |
|
|
2643 |
|
|
2644 |
template <class T>
|
|
2645 |
inline const T &TPckgBuf<T>::operator()() const
|
|
2646 |
/**
|
|
2647 |
Gets a const reference to the object contained by this packaged modifiable
|
|
2648 |
buffer descriptor.
|
|
2649 |
|
|
2650 |
@return The (const) packaged object.
|
|
2651 |
*/
|
|
2652 |
{return(*((T *)&this->iBuf[0]));}
|
|
2653 |
|
|
2654 |
|
|
2655 |
|
|
2656 |
|
|
2657 |
// Class TRequestStatus
|
|
2658 |
inline TRequestStatus::TRequestStatus()
|
|
2659 |
/**
|
|
2660 |
Default constructor.
|
|
2661 |
*/
|
|
2662 |
: iFlags(0)
|
|
2663 |
{}
|
|
2664 |
|
|
2665 |
|
|
2666 |
|
|
2667 |
|
|
2668 |
inline TRequestStatus::TRequestStatus(TInt aVal)
|
|
2669 |
/**
|
|
2670 |
Constructs an asynchronous request status object and assigns a completion value
|
|
2671 |
to it.
|
|
2672 |
|
|
2673 |
@param aVal The completion value to be assigned to the constructed request
|
|
2674 |
status object.
|
|
2675 |
*/
|
|
2676 |
: iStatus(aVal),
|
|
2677 |
iFlags(aVal==KRequestPending ? TRequestStatus::ERequestPending : 0)
|
|
2678 |
|
|
2679 |
{}
|
|
2680 |
|
|
2681 |
|
|
2682 |
|
|
2683 |
|
|
2684 |
inline TInt TRequestStatus::operator=(TInt aVal)
|
|
2685 |
/**
|
|
2686 |
Assigns the specified completion code to the request status object.
|
|
2687 |
|
|
2688 |
@param aVal The value to be assigned.
|
|
2689 |
|
|
2690 |
@return The value assigned.
|
|
2691 |
*/
|
|
2692 |
{
|
|
2693 |
if(aVal==KRequestPending)
|
|
2694 |
iFlags|=TRequestStatus::ERequestPending;
|
|
2695 |
else
|
|
2696 |
iFlags&=~TRequestStatus::ERequestPending;
|
|
2697 |
return (iStatus=aVal);
|
|
2698 |
}
|
|
2699 |
|
|
2700 |
|
|
2701 |
|
|
2702 |
|
|
2703 |
inline TBool TRequestStatus::operator==(TInt aVal) const
|
|
2704 |
/**
|
|
2705 |
Tests whether the request status object's completion code is the same as
|
|
2706 |
the specified value.
|
|
2707 |
|
|
2708 |
@param aVal The value to be compared.
|
|
2709 |
|
|
2710 |
@return True, if the values are equal; false otherwise.
|
|
2711 |
*/
|
|
2712 |
{return(iStatus==aVal);}
|
|
2713 |
|
|
2714 |
|
|
2715 |
|
|
2716 |
|
|
2717 |
inline TBool TRequestStatus::operator!=(TInt aVal) const
|
|
2718 |
/**
|
|
2719 |
Tests whether the request status object's completion code is not equal to
|
|
2720 |
the specified value.
|
|
2721 |
|
|
2722 |
@param aVal The value to be compared.
|
|
2723 |
|
|
2724 |
@return True, if the values are unequal; false otherwise.
|
|
2725 |
*/
|
|
2726 |
{return(iStatus!=aVal);}
|
|
2727 |
|
|
2728 |
|
|
2729 |
|
|
2730 |
|
|
2731 |
inline TBool TRequestStatus::operator>=(TInt aVal) const
|
|
2732 |
/**
|
|
2733 |
Tests whether the request status object's completion code is greater than
|
|
2734 |
or equal to the specified value.
|
|
2735 |
|
|
2736 |
@param aVal The value to be compared.
|
|
2737 |
|
|
2738 |
@return True, if the request status object's value is greater than or equal
|
|
2739 |
to the specified value; false, otherwise.
|
|
2740 |
*/
|
|
2741 |
{return(iStatus>=aVal);}
|
|
2742 |
|
|
2743 |
|
|
2744 |
|
|
2745 |
|
|
2746 |
inline TBool TRequestStatus::operator<=(TInt aVal) const
|
|
2747 |
/**
|
|
2748 |
Tests whether the request status object's completion code is less than or
|
|
2749 |
equal to the specified value.
|
|
2750 |
|
|
2751 |
@param aVal The value to be compared.
|
|
2752 |
|
|
2753 |
@return True, if the request status object's value is less than or equal
|
|
2754 |
to the specified value; false, otherwise.
|
|
2755 |
*/
|
|
2756 |
{return(iStatus<=aVal);}
|
|
2757 |
|
|
2758 |
|
|
2759 |
|
|
2760 |
|
|
2761 |
inline TBool TRequestStatus::operator>(TInt aVal) const
|
|
2762 |
/**
|
|
2763 |
Tests whether the request status object's completion code is greater than
|
|
2764 |
the specified value.
|
|
2765 |
|
|
2766 |
@param aVal The value to be compared.
|
|
2767 |
|
|
2768 |
@return True, if the request status object's value is greater than
|
|
2769 |
the specified value; false, otherwise.
|
|
2770 |
*/
|
|
2771 |
{return(iStatus>aVal);}
|
|
2772 |
|
|
2773 |
|
|
2774 |
|
|
2775 |
|
|
2776 |
inline TBool TRequestStatus::operator<(TInt aVal) const
|
|
2777 |
/**
|
|
2778 |
Tests whether the request status object's completion code is less than the
|
|
2779 |
specified value.
|
|
2780 |
|
|
2781 |
@param aVal The value to be compared.
|
|
2782 |
|
|
2783 |
@return True, if the request status object's value is less than the specified
|
|
2784 |
value; false, otherwise.
|
|
2785 |
*/
|
|
2786 |
{return(iStatus<aVal);}
|
|
2787 |
|
|
2788 |
|
|
2789 |
|
|
2790 |
|
|
2791 |
inline TInt TRequestStatus::Int() const
|
|
2792 |
/**
|
|
2793 |
Gets this request status object's completion code value.
|
|
2794 |
|
|
2795 |
@return The completion code.
|
|
2796 |
*/
|
|
2797 |
{return(iStatus);}
|
|
2798 |
|
|
2799 |
|
|
2800 |
|
|
2801 |
|
|
2802 |
// Class TPoint
|
|
2803 |
#ifndef __KERNEL_MODE__
|
|
2804 |
inline TPoint::TPoint()
|
|
2805 |
: iX(0),iY(0)
|
|
2806 |
/**
|
|
2807 |
Constructs default point, initialising its iX and iY members to zero.
|
|
2808 |
*/
|
|
2809 |
{}
|
|
2810 |
|
|
2811 |
|
|
2812 |
|
|
2813 |
|
|
2814 |
inline TPoint::TPoint(TInt aX,TInt aY)
|
|
2815 |
: iX(aX),iY(aY)
|
|
2816 |
/**
|
|
2817 |
Constructs a point with the specified x and y co-ordinates.
|
|
2818 |
|
|
2819 |
@param aX The x co-ordinate value.
|
|
2820 |
@param aY The y co-ordinate value.
|
|
2821 |
*/
|
|
2822 |
{}
|
|
2823 |
|
|
2824 |
|
|
2825 |
|
|
2826 |
|
|
2827 |
// Class TSize
|
|
2828 |
inline TSize::TSize()
|
|
2829 |
: iWidth(0),iHeight(0)
|
|
2830 |
/**
|
|
2831 |
Constructs the size object with its iWidth and iHeight members set to zero.
|
|
2832 |
*/
|
|
2833 |
{}
|
|
2834 |
|
|
2835 |
|
|
2836 |
|
|
2837 |
|
|
2838 |
inline TSize::TSize(TInt aWidth,TInt aHeight)
|
|
2839 |
: iWidth(aWidth),iHeight(aHeight)
|
|
2840 |
/**
|
|
2841 |
Constructs the size object with the specified width and height values.
|
|
2842 |
|
|
2843 |
@param aWidth The width value.
|
|
2844 |
@param aHeight The height value .
|
|
2845 |
*/
|
|
2846 |
{}
|
|
2847 |
#endif
|
|
2848 |
|
|
2849 |
|
|
2850 |
|
|
2851 |
// Class TPoint3D
|
|
2852 |
#ifndef __KERNEL_MODE__
|
|
2853 |
inline TPoint3D::TPoint3D()
|
|
2854 |
: iX(0),iY(0),iZ(0)
|
|
2855 |
/**
|
|
2856 |
Constructs default 3Dpoint, initialising its iX, iY and iZ members to zero.
|
|
2857 |
*/
|
|
2858 |
{}
|
|
2859 |
|
|
2860 |
inline TPoint3D::TPoint3D(TInt aX,TInt aY,TInt aZ)
|
|
2861 |
: iX(aX),iY(aY),iZ(aZ)
|
|
2862 |
/**
|
|
2863 |
Constructs TPoint3D with the specified x,y and z co-ordinates.
|
|
2864 |
|
|
2865 |
@param aX The x co-ordinate value.
|
|
2866 |
@param aY The y co-ordinate value.
|
|
2867 |
@param aZ The z co-ordinate value.
|
|
2868 |
*/
|
|
2869 |
{}
|
|
2870 |
|
|
2871 |
|
|
2872 |
|
|
2873 |
|
|
2874 |
inline TPoint3D::TPoint3D(const TPoint& aPoint)
|
|
2875 |
:iX(aPoint.iX),iY(aPoint.iY),iZ(0)
|
|
2876 |
/*
|
|
2877 |
Copy Construct from TPoint , initialises Z co-ordinate to Zero
|
|
2878 |
@param aPoint The TPoint from which we create TPoint3D object
|
|
2879 |
*/
|
|
2880 |
{}
|
|
2881 |
|
|
2882 |
|
|
2883 |
#endif
|
|
2884 |
|
|
2885 |
|
|
2886 |
// Class TFindHandle
|
|
2887 |
inline TFindHandle::TFindHandle()
|
|
2888 |
: iHandle(0), iSpare1(0), iObjectIdLow(0), iObjectIdHigh(0)
|
|
2889 |
{}
|
|
2890 |
|
|
2891 |
|
|
2892 |
|
|
2893 |
|
|
2894 |
inline TInt TFindHandle::Handle() const
|
|
2895 |
/**
|
|
2896 |
@publishedAll
|
|
2897 |
@released
|
|
2898 |
|
|
2899 |
Gets the find-handle number associated with the Kernel object.
|
|
2900 |
|
|
2901 |
The find-handle number identifies the kernel object with respect to
|
|
2902 |
its container.
|
|
2903 |
|
|
2904 |
Note that setting the find-handle number into a TFindHandle object is not
|
|
2905 |
implemented by this class; it is implemented by derived classes, typically by
|
|
2906 |
their Next() member functions. The class TFindSemaphore is a good example.
|
|
2907 |
|
|
2908 |
@return The find-handle number.
|
|
2909 |
*/
|
|
2910 |
{return iHandle;}
|
|
2911 |
|
|
2912 |
|
|
2913 |
|
|
2914 |
|
|
2915 |
#ifdef __KERNEL_MODE__
|
|
2916 |
const TInt KFindHandleUniqueIdShift=16; ///< @internalComponent
|
|
2917 |
const TInt KFindHandleUniqueIdMask=0x7fff; ///< @internalComponent
|
|
2918 |
const TInt KFindHandleIndexMask=0x7fff; ///< @internalComponent
|
|
2919 |
|
|
2920 |
|
|
2921 |
|
|
2922 |
|
|
2923 |
/**
|
|
2924 |
Gets the index into its container at which the kernel object was last seen.
|
|
2925 |
|
|
2926 |
@return The object's index in its container.
|
|
2927 |
*/
|
|
2928 |
inline TInt TFindHandle::Index() const
|
|
2929 |
{return(iHandle&KFindHandleIndexMask);}
|
|
2930 |
|
|
2931 |
|
|
2932 |
|
|
2933 |
|
|
2934 |
/**
|
|
2935 |
Gets the unique ID of the kernel container this object resides in.
|
|
2936 |
|
|
2937 |
@return The ID of this object's container.
|
|
2938 |
*/
|
|
2939 |
inline TInt TFindHandle::UniqueID() const
|
|
2940 |
{return((iHandle>>KFindHandleUniqueIdShift)&KFindHandleUniqueIdMask);}
|
|
2941 |
|
|
2942 |
|
|
2943 |
|
|
2944 |
|
|
2945 |
/**
|
|
2946 |
Gets the unique ID of the kernel object itself.
|
|
2947 |
|
|
2948 |
@return The ID of the object.
|
|
2949 |
*/
|
|
2950 |
inline TUint64 TFindHandle::ObjectID() const
|
|
2951 |
{return MAKE_TUINT64(iObjectIdHigh, iObjectIdLow);}
|
|
2952 |
|
|
2953 |
|
|
2954 |
|
|
2955 |
|
|
2956 |
/**
|
|
2957 |
Sets the find handle to refer to a specific object.
|
|
2958 |
|
|
2959 |
@oaram aIndex The current index of the object in its container.
|
|
2960 |
@param aUniqueId The unique ID of the container object.
|
|
2961 |
@param aObjectId The unique ID of the object iteself.
|
|
2962 |
*/
|
|
2963 |
inline void TFindHandle::Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId)
|
|
2964 |
{
|
|
2965 |
iHandle=(TInt)((aUniqueId<<KFindHandleUniqueIdShift)|aIndex);
|
|
2966 |
iObjectIdLow=I64LOW(aObjectId);
|
|
2967 |
iObjectIdHigh=I64HIGH(aObjectId);
|
|
2968 |
}
|
|
2969 |
|
|
2970 |
|
|
2971 |
#else
|
|
2972 |
|
|
2973 |
|
|
2974 |
/**
|
|
2975 |
Resets the find handle to its initial state.
|
|
2976 |
*/
|
|
2977 |
inline void TFindHandle::Reset()
|
|
2978 |
{
|
|
2979 |
iHandle=iSpare1=iObjectIdLow=iObjectIdHigh=0;
|
|
2980 |
}
|
|
2981 |
#endif
|
|
2982 |
|
|
2983 |
|
|
2984 |
|
|
2985 |
|
|
2986 |
// Class RHandleBase
|
|
2987 |
inline RHandleBase::RHandleBase()
|
|
2988 |
: iHandle(0)
|
|
2989 |
/**
|
|
2990 |
Default constructor.
|
|
2991 |
*/
|
|
2992 |
{}
|
|
2993 |
|
|
2994 |
|
|
2995 |
|
|
2996 |
|
|
2997 |
#ifndef __KERNEL_MODE__
|
|
2998 |
inline RHandleBase::RHandleBase(TInt aHandle)
|
|
2999 |
: iHandle(aHandle)
|
|
3000 |
/**
|
|
3001 |
Copy constructor.
|
|
3002 |
|
|
3003 |
It constructs this handle from an existing one. Specifically, the handle-number
|
|
3004 |
encapsulated by the specified handle is copied to this handle.
|
|
3005 |
|
|
3006 |
@param aHandle The existing handle to be copied.
|
|
3007 |
*/
|
|
3008 |
{}
|
|
3009 |
#endif
|
|
3010 |
|
|
3011 |
|
|
3012 |
|
|
3013 |
|
|
3014 |
inline void RHandleBase::SetHandle(TInt aHandle)
|
|
3015 |
/**
|
|
3016 |
Sets the handle-number of this handle to the specified
|
|
3017 |
value.
|
|
3018 |
|
|
3019 |
@param aHandle The handle-number to be set.
|
|
3020 |
*/
|
|
3021 |
{ iHandle=aHandle; }
|
|
3022 |
|
|
3023 |
|
|
3024 |
|
|
3025 |
|
|
3026 |
inline TInt RHandleBase::Handle() const
|
|
3027 |
/**
|
|
3028 |
Retrieves the handle-number of the object associated with this handle.
|
|
3029 |
|
|
3030 |
@return The handle number
|
|
3031 |
*/
|
|
3032 |
{return(iHandle);}
|
|
3033 |
|
|
3034 |
|
|
3035 |
|
|
3036 |
|
|
3037 |
inline TInt RHandleBase::SetReturnedHandle(TInt aHandleOrError)
|
|
3038 |
/**
|
|
3039 |
Sets the handle-number of this handle to the specified
|
|
3040 |
value.
|
|
3041 |
|
|
3042 |
The function can take a (zero or positive) handle-number,
|
|
3043 |
or a (negative) error number.
|
|
3044 |
|
|
3045 |
If aHandleOrError represents a handle-number, then the handle-number of this handle
|
|
3046 |
is set to that value.
|
|
3047 |
If aHandleOrError represents an error number, then the handle-number of this handle is set to zero
|
|
3048 |
and the negative value is returned.
|
|
3049 |
|
|
3050 |
@param aHandleOrError A handle-number, if zero or positive; an error value, if negative.
|
|
3051 |
|
|
3052 |
@return KErrNone, if aHandle is a handle-number; the value of aHandleOrError, otherwise.
|
|
3053 |
*/
|
|
3054 |
{
|
|
3055 |
if(aHandleOrError>=0)
|
|
3056 |
{
|
|
3057 |
iHandle = aHandleOrError;
|
|
3058 |
return KErrNone;
|
|
3059 |
}
|
|
3060 |
iHandle = 0;
|
|
3061 |
return aHandleOrError;
|
|
3062 |
}
|
|
3063 |
|
|
3064 |
|
|
3065 |
|
|
3066 |
|
|
3067 |
// Class RSemaphore
|
|
3068 |
#ifndef __KERNEL_MODE__
|
|
3069 |
inline TInt RSemaphore::Open(const TFindSemaphore& aFind,TOwnerType aType)
|
|
3070 |
/**
|
|
3071 |
Opens a handle to the global semaphore found using a TFindSemaphore object.
|
|
3072 |
|
|
3073 |
A TFindSemaphore object is used to find all global semaphores whose full names
|
|
3074 |
match a specified pattern.
|
|
3075 |
|
|
3076 |
By default, any thread in the process can use this instance of RSemaphore
|
|
3077 |
to access the semaphore. However, specifying EOwnerThread as the second parameter
|
|
3078 |
to this function, means that only the opening thread can use this instance
|
|
3079 |
of RSemaphore to access the semaphore; any other thread in this process that
|
|
3080 |
wants to access the semaphore must either duplicate the handle or use OpenGlobal()
|
|
3081 |
again.
|
|
3082 |
|
|
3083 |
@param aFind A reference to the TFindSemaphore object used to find the semaphore.
|
|
3084 |
@param aType An enumeration whose enumerators define the ownership of this
|
|
3085 |
semaphore handle. If not explicitly specified, EOwnerProcess is
|
|
3086 |
taken as default.
|
|
3087 |
|
|
3088 |
@return KErrNone if successful otherwise another of the system wide error codes.
|
|
3089 |
*/
|
|
3090 |
{return(RHandleBase::Open((const TFindHandleBase&)aFind,aType));}
|
|
3091 |
#endif
|
|
3092 |
|
|
3093 |
|
|
3094 |
|
|
3095 |
|
|
3096 |
// Class RFastLock
|
|
3097 |
|
|
3098 |
|
|
3099 |
/**
|
|
3100 |
Default constructor.
|
|
3101 |
*/
|
|
3102 |
inline RFastLock::RFastLock()
|
|
3103 |
: iCount(0)
|
|
3104 |
{}
|
|
3105 |
|
|
3106 |
|
|
3107 |
|
|
3108 |
|
|
3109 |
/**
|
|
3110 |
Default constructor.
|
|
3111 |
*/
|
|
3112 |
inline RReadWriteLock::RReadWriteLock()
|
|
3113 |
: iValues(0), iPriority(EAlternatePriority), iReaderSem(), iWriterSem()
|
|
3114 |
{}
|
|
3115 |
|
|
3116 |
|
|
3117 |
|
|
3118 |
|
|
3119 |
// Class RMessagePtr2
|
|
3120 |
|
|
3121 |
|
|
3122 |
/**
|
|
3123 |
Default constructor
|
|
3124 |
*/
|
|
3125 |
inline RMessagePtr2::RMessagePtr2()
|
|
3126 |
: iHandle(0)
|
|
3127 |
{}
|
|
3128 |
|
|
3129 |
|
|
3130 |
|
|
3131 |
|
|
3132 |
/**
|
|
3133 |
Tests whether this message handle is empty.
|
|
3134 |
|
|
3135 |
@return True, if this message handle is empty, false, otherwise.
|
|
3136 |
*/
|
|
3137 |
inline TBool RMessagePtr2::IsNull() const
|
|
3138 |
{return iHandle==0;}
|
|
3139 |
|
|
3140 |
|
|
3141 |
|
|
3142 |
|
|
3143 |
/**
|
|
3144 |
Gets the message handle value.
|
|
3145 |
|
|
3146 |
@return The message handle value.
|
|
3147 |
*/
|
|
3148 |
inline TInt RMessagePtr2::Handle() const
|
|
3149 |
{return iHandle;}
|
|
3150 |
inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight)
|
|
3151 |
{return aLeft.Handle()==aRight.Handle();}
|
|
3152 |
inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight)
|
|
3153 |
{return aLeft.Handle()!=aRight.Handle();}
|
|
3154 |
|
|
3155 |
|
|
3156 |
|
|
3157 |
|
|
3158 |
|
|
3159 |
// Class RMessage
|
|
3160 |
|
|
3161 |
|
|
3162 |
/**
|
|
3163 |
Default constructor
|
|
3164 |
*/
|
|
3165 |
inline RMessage2::RMessage2()
|
|
3166 |
:iFunction(0), iSpare1(0), iSessionPtr(NULL), iFlags(0), iSpare3(0)
|
|
3167 |
{}
|
|
3168 |
|
|
3169 |
|
|
3170 |
|
|
3171 |
|
|
3172 |
/**
|
|
3173 |
Gets the the number of the function requested by the client.
|
|
3174 |
|
|
3175 |
@return The function number.
|
|
3176 |
*/
|
|
3177 |
inline TInt RMessage2::Function() const
|
|
3178 |
{return(iFunction);}
|
|
3179 |
|
|
3180 |
|
|
3181 |
|
|
3182 |
|
|
3183 |
/**
|
|
3184 |
Gets the first message argument as an integer value.
|
|
3185 |
|
|
3186 |
@return The first message argument.
|
|
3187 |
*/
|
|
3188 |
inline TInt RMessage2::Int0() const
|
|
3189 |
{return(iArgs[0]);}
|
|
3190 |
|
|
3191 |
|
|
3192 |
|
|
3193 |
|
|
3194 |
/**
|
|
3195 |
Gets the second message argument as an integer value.
|
|
3196 |
|
|
3197 |
@return The second message argument.
|
|
3198 |
*/
|
|
3199 |
inline TInt RMessage2::Int1() const
|
|
3200 |
{return(iArgs[1]);}
|
|
3201 |
|
|
3202 |
|
|
3203 |
|
|
3204 |
|
|
3205 |
/**
|
|
3206 |
Gets the third message argument as an integer value.
|
|
3207 |
|
|
3208 |
@return The third message argument.
|
|
3209 |
*/
|
|
3210 |
inline TInt RMessage2::Int2() const
|
|
3211 |
{return(iArgs[2]);}
|
|
3212 |
|
|
3213 |
|
|
3214 |
|
|
3215 |
/**
|
|
3216 |
Gets the fourth message argument as an integer value.
|
|
3217 |
|
|
3218 |
@return The fourth message argument.
|
|
3219 |
*/
|
|
3220 |
inline TInt RMessage2::Int3() const
|
|
3221 |
{return(iArgs[3]);}
|
|
3222 |
|
|
3223 |
|
|
3224 |
|
|
3225 |
/**
|
|
3226 |
Gets the first message argument as a pointer type.
|
|
3227 |
|
|
3228 |
@return The first message argument.
|
|
3229 |
*/
|
|
3230 |
inline const TAny *RMessage2::Ptr0() const
|
|
3231 |
{return((const TAny *)iArgs[0]);}
|
|
3232 |
|
|
3233 |
|
|
3234 |
|
|
3235 |
|
|
3236 |
/**
|
|
3237 |
Gets the second message argument as a pointer type.
|
|
3238 |
|
|
3239 |
@return The second message argument.
|
|
3240 |
*/
|
|
3241 |
inline const TAny *RMessage2::Ptr1() const
|
|
3242 |
{return((const TAny *)iArgs[1]);}
|
|
3243 |
|
|
3244 |
|
|
3245 |
|
|
3246 |
|
|
3247 |
/**
|
|
3248 |
Gets the third message argument as a pointer type.
|
|
3249 |
|
|
3250 |
@return The third message argument.
|
|
3251 |
*/
|
|
3252 |
inline const TAny *RMessage2::Ptr2() const
|
|
3253 |
{return((const TAny *)iArgs[2]);}
|
|
3254 |
|
|
3255 |
|
|
3256 |
|
|
3257 |
|
|
3258 |
/**
|
|
3259 |
Gets the fourth message argument as a pointer type.
|
|
3260 |
|
|
3261 |
@return The fourth message argument.
|
|
3262 |
*/
|
|
3263 |
inline const TAny *RMessage2::Ptr3() const
|
|
3264 |
{return((const TAny *)iArgs[3]);}
|
|
3265 |
|
|
3266 |
|
|
3267 |
|
|
3268 |
/**
|
|
3269 |
Gets a pointer to the session.
|
|
3270 |
|
|
3271 |
@return A pointer to the session object.
|
|
3272 |
*/
|
|
3273 |
inline CSession2* RMessage2::Session() const
|
|
3274 |
{return (CSession2*)iSessionPtr; }
|
|
3275 |
|
|
3276 |
|
|
3277 |
|
|
3278 |
|
|
3279 |
// Class TUid
|
|
3280 |
inline TUid TUid::Uid(TInt aUid)
|
|
3281 |
/**
|
|
3282 |
Constructs the TUid object from a 32-bit integer.
|
|
3283 |
|
|
3284 |
@param aUid The 32-bit integer value from which the TUid object is to be
|
|
3285 |
constructed.
|
|
3286 |
|
|
3287 |
@return The constructed TUid object.
|
|
3288 |
*/
|
|
3289 |
{TUid uid={aUid};return uid;}
|
|
3290 |
|
|
3291 |
|
|
3292 |
|
|
3293 |
|
|
3294 |
inline TUid TUid::Null()
|
|
3295 |
/**
|
|
3296 |
Constructs a Null-valued TUid object.
|
|
3297 |
|
|
3298 |
@return The constructed Null-valued TUid object.
|
|
3299 |
*/
|
|
3300 |
{TUid uid={KNullUidValue};return uid;}
|
|
3301 |
|
|
3302 |
|
|
3303 |
|
|
3304 |
|
|
3305 |
#ifndef __KERNEL_MODE__
|
|
3306 |
// Template class TArray
|
|
3307 |
template <class T>
|
|
3308 |
inline TArray<T>::TArray(TInt (*aCount)(const CBase *aPtr),const TAny *(*anAt)(const CBase *aPtr,TInt anIndex),const CBase *aPtr)
|
|
3309 |
: iPtr(aPtr),iCount(aCount),iAt(anAt)
|
|
3310 |
/**
|
|
3311 |
Constructor.
|
|
3312 |
|
|
3313 |
A TArray object is not intended to be instantiated explicitly. An object of
|
|
3314 |
this type is instantiated as a result of a call to to the Array() member
|
|
3315 |
function of a concrete array class
|
|
3316 |
|
|
3317 |
@param aCount A pointer to a function which takes a
|
|
3318 |
@code
|
|
3319 |
const CBase*
|
|
3320 |
@endcode
|
|
3321 |
argument and returns a
|
|
3322 |
@code
|
|
3323 |
TInt
|
|
3324 |
@endcode
|
|
3325 |
aCount must point to the member function which returns the
|
|
3326 |
current number of elements of type class T contained in the
|
|
3327 |
array at aPtr, for which this TArray is being constructed.
|
|
3328 |
This argument is supplied by the Array() member function of the
|
|
3329 |
array class.
|
|
3330 |
@param anAt A pointer to a function which takes a
|
|
3331 |
@code
|
|
3332 |
const CBase*
|
|
3333 |
@endcode
|
|
3334 |
and a
|
|
3335 |
@code
|
|
3336 |
TInt
|
|
3337 |
@endcode
|
|
3338 |
argument, and returns a pointer to
|
|
3339 |
@code
|
|
3340 |
TAny
|
|
3341 |
@endcode
|
|
3342 |
anAt must point to the member function which returns a reference
|
|
3343 |
to the element located at position anIndex within the array at
|
|
3344 |
aPtr, for which this TArray is being constructed.
|
|
3345 |
This argument is supplied by the Array() member function of the
|
|
3346 |
array class.
|
|
3347 |
@param aPtr A pointer to the array for which this TArray is being
|
|
3348 |
constructed. This argument is supplied by the Array() member
|
|
3349 |
function of the array class.
|
|
3350 |
|
|
3351 |
@see CArrayFixFlat::Array
|
|
3352 |
@see CArrayFixSeg::Array
|
|
3353 |
@see CArrayVarFlat::Array
|
|
3354 |
@see CArrayVarSeg::Array
|
|
3355 |
@see CArrayPakFlat::Array
|
|
3356 |
@see RArray::Array
|
|
3357 |
@see RPointerArray::Array
|
|
3358 |
@see RArray<TInt>::Array
|
|
3359 |
@see RArray<TUint>::Array
|
|
3360 |
*/
|
|
3361 |
{}
|
|
3362 |
|
|
3363 |
|
|
3364 |
|
|
3365 |
|
|
3366 |
template <class T>
|
|
3367 |
inline TInt TArray<T>::Count() const
|
|
3368 |
/**
|
|
3369 |
Gets the number of elements currently held in the array for which this generic
|
|
3370 |
array has been constructed.
|
|
3371 |
|
|
3372 |
@return The number of array elements.
|
|
3373 |
*/
|
|
3374 |
{return((*iCount)(iPtr));}
|
|
3375 |
|
|
3376 |
|
|
3377 |
|
|
3378 |
|
|
3379 |
template <class T>
|
|
3380 |
inline const T &TArray<T>::operator[](TInt anIndex) const
|
|
3381 |
/**
|
|
3382 |
Gets a reference to the element located at the specified position.
|
|
3383 |
|
|
3384 |
The returned reference is const and cannot be used to change the element.
|
|
3385 |
Any member function of the referenced template class T must be declared
|
|
3386 |
as const if that function is to be accessed through this operator.
|
|
3387 |
|
|
3388 |
@param anIndex The position of the element within the array for which this
|
|
3389 |
TArray has been constructed. The position is relative to zero;
|
|
3390 |
i.e. zero implies the first element in the array.
|
|
3391 |
|
|
3392 |
@return A const reference to the element located at position anIndex within
|
|
3393 |
the array for which this TArray has been constructed.
|
|
3394 |
|
|
3395 |
@panic E32USER-CBase 21, if anIndex is negative, or greater than or equal to
|
|
3396 |
the number of objects currently within the array.
|
|
3397 |
*/
|
|
3398 |
{return(*((const T *)(*iAt)(iPtr,anIndex)));}
|
|
3399 |
#endif
|
|
3400 |
|
|
3401 |
|
|
3402 |
|
|
3403 |
|
|
3404 |
// Class TIdentityRelation<T>
|
|
3405 |
template <class T>
|
|
3406 |
inline TIdentityRelation<T>::TIdentityRelation()
|
|
3407 |
/**
|
|
3408 |
Constructs the object to use the equality operator (==) defined for class T
|
|
3409 |
to determine whether two class T type objects match.
|
|
3410 |
*/
|
|
3411 |
{iIdentity=(TGeneralIdentityRelation)&EqualityOperatorCompare;}
|
|
3412 |
|
|
3413 |
|
|
3414 |
|
|
3415 |
|
|
3416 |
template <class T>
|
|
3417 |
inline TIdentityRelation<T>::TIdentityRelation( TBool (*anIdentity)(const T&, const T&) )
|
|
3418 |
/**
|
|
3419 |
Constructs the object taking the specified function as an argument.
|
|
3420 |
|
|
3421 |
The specified function should implement an algorithm for determining whether
|
|
3422 |
two class T type objects match. It should return:
|
|
3423 |
|
|
3424 |
1. true, if the two objects match.
|
|
3425 |
|
|
3426 |
2. false, if the two objects do not match.
|
|
3427 |
|
|
3428 |
@param anIdentity A pointer to a function that takes constant references to two
|
|
3429 |
class T objects and returns a TInt value.
|
|
3430 |
*/
|
|
3431 |
{ iIdentity=(TGeneralIdentityRelation)anIdentity; }
|
|
3432 |
|
|
3433 |
|
|
3434 |
|
|
3435 |
|
|
3436 |
template <class T>
|
|
3437 |
inline TIdentityRelation<T>::operator TGeneralIdentityRelation() const
|
|
3438 |
/**
|
|
3439 |
Operator that gets the function that determines whether two
|
|
3440 |
objects of a given class type match.
|
|
3441 |
*/
|
|
3442 |
{ return iIdentity; }
|
|
3443 |
|
|
3444 |
|
|
3445 |
|
|
3446 |
template <class T>
|
|
3447 |
inline TBool TIdentityRelation<T>::EqualityOperatorCompare(const T& aLeft, const T& aRight)
|
|
3448 |
/**
|
|
3449 |
Compares two objects of class T using the equality operator defined for class T.
|
|
3450 |
*/
|
|
3451 |
{return aLeft == aRight;}
|
|
3452 |
|
|
3453 |
|
|
3454 |
|
|
3455 |
// Class TLinearOrder<T>
|
|
3456 |
template <class T>
|
|
3457 |
inline TLinearOrder<T>::TLinearOrder( TInt(*anOrder)(const T&, const T&) )
|
|
3458 |
/**
|
|
3459 |
Constructs the object taking the specified function as an argument.
|
|
3460 |
|
|
3461 |
The specified function should implement an algorithm that determines the
|
|
3462 |
order of two class T type objects. It should return:
|
|
3463 |
|
|
3464 |
1. zero, if the two objects are equal.
|
|
3465 |
|
|
3466 |
2. a negative value, if the first object is less than the second.
|
|
3467 |
|
|
3468 |
3. a positive value, if the first object is greater than the second.
|
|
3469 |
|
|
3470 |
@param anOrder A pointer to a function that takes constant references to two
|
|
3471 |
class T objects and returns a TInt value.
|
|
3472 |
*/
|
|
3473 |
{ iOrder=(TGeneralLinearOrder)anOrder; }
|
|
3474 |
|
|
3475 |
|
|
3476 |
|
|
3477 |
|
|
3478 |
template <class T>
|
|
3479 |
inline TLinearOrder<T>::operator TGeneralLinearOrder() const
|
|
3480 |
/**
|
|
3481 |
Operator that gets the function that determines the order of two
|
|
3482 |
objects of a given class type.
|
|
3483 |
*/
|
|
3484 |
{ return iOrder; }
|
|
3485 |
|
|
3486 |
|
|
3487 |
|
|
3488 |
|
|
3489 |
// Class RPointerArray<T>
|
|
3490 |
|
|
3491 |
/**
|
|
3492 |
Default C++ constructor.
|
|
3493 |
|
|
3494 |
This constructs an array object for an array of pointers with default
|
|
3495 |
granularity, which is 8.
|
|
3496 |
*/
|
|
3497 |
template <class T>
|
|
3498 |
inline RPointerArray<T>::RPointerArray()
|
|
3499 |
: RPointerArrayBase()
|
|
3500 |
{}
|
|
3501 |
|
|
3502 |
|
|
3503 |
|
|
3504 |
|
|
3505 |
/**
|
|
3506 |
C++ constructor with granularity.
|
|
3507 |
|
|
3508 |
This constructs an array object for an array of pointers with the specified
|
|
3509 |
granularity.
|
|
3510 |
|
|
3511 |
@param aGranularity The granularity of the array.
|
|
3512 |
|
|
3513 |
@panic USER 127, if aGranularity is not positive, or greater than or equal
|
|
3514 |
to 0x10000000.
|
|
3515 |
*/
|
|
3516 |
template <class T>
|
|
3517 |
inline RPointerArray<T>::RPointerArray(TInt aGranularity)
|
|
3518 |
: RPointerArrayBase(aGranularity)
|
|
3519 |
{}
|
|
3520 |
|
|
3521 |
|
|
3522 |
|
|
3523 |
|
|
3524 |
/**
|
|
3525 |
C++ constructor with minimum growth step and exponential growth factor.
|
|
3526 |
|
|
3527 |
This constructs an array object for an array of pointers with the specified
|
|
3528 |
minimum growth step and exponential growth factor.
|
|
3529 |
|
|
3530 |
@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
|
|
3531 |
65535 inclusive.
|
|
3532 |
@param aFactor The factor by which the array grows, multiplied by 256.
|
|
3533 |
For example 512 specifies a factor of 2. Must be between 257
|
|
3534 |
and 32767 inclusive.
|
|
3535 |
|
|
3536 |
@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
|
|
3537 |
@panic USER 193, if aFactor<=257 or aFactor>32767.
|
|
3538 |
*/
|
|
3539 |
template <class T>
|
|
3540 |
inline RPointerArray<T>::RPointerArray(TInt aMinGrowBy, TInt aFactor)
|
|
3541 |
: RPointerArrayBase(aMinGrowBy, aFactor)
|
|
3542 |
{}
|
|
3543 |
|
|
3544 |
|
|
3545 |
|
|
3546 |
|
|
3547 |
template <class T>
|
|
3548 |
inline void RPointerArray<T>::Close()
|
|
3549 |
/**
|
|
3550 |
Closes the array and frees all memory allocated to it.
|
|
3551 |
|
|
3552 |
The function must be called before this array object goes out of scope.
|
|
3553 |
|
|
3554 |
Note that the function does not delete the objects whose pointers are contained
|
|
3555 |
in the array.
|
|
3556 |
*/
|
|
3557 |
{RPointerArrayBase::Close();}
|
|
3558 |
|
|
3559 |
|
|
3560 |
|
|
3561 |
|
|
3562 |
template <class T>
|
|
3563 |
inline TInt RPointerArray<T>::Count() const
|
|
3564 |
/**
|
|
3565 |
Gets the number of object pointers in the array.
|
|
3566 |
|
|
3567 |
@return The number of object pointers in the array.
|
|
3568 |
*/
|
|
3569 |
{ return RPointerArrayBase::Count(); }
|
|
3570 |
|
|
3571 |
|
|
3572 |
|
|
3573 |
|
|
3574 |
template <class T>
|
|
3575 |
inline T* const& RPointerArray<T>::operator[](TInt anIndex) const
|
|
3576 |
/**
|
|
3577 |
Gets a reference to the object pointer located at the specified
|
|
3578 |
position within the array.
|
|
3579 |
|
|
3580 |
The compiler chooses this option if the returned reference is used in
|
|
3581 |
an expression where the reference cannot be modified.
|
|
3582 |
|
|
3583 |
@param anIndex The position of the object pointer within the array. The
|
|
3584 |
position is relative to zero, i.e. zero implies the object
|
|
3585 |
pointer at the beginning of the array.
|
|
3586 |
|
|
3587 |
@return A const reference to the object pointer at position anIndex within
|
|
3588 |
the array.
|
|
3589 |
|
|
3590 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
3591 |
objects currently in the array.
|
|
3592 |
*/
|
|
3593 |
{return (T* const&)At(anIndex);}
|
|
3594 |
|
|
3595 |
|
|
3596 |
|
|
3597 |
|
|
3598 |
template <class T>
|
|
3599 |
inline T*& RPointerArray<T>::operator[](TInt anIndex)
|
|
3600 |
/**
|
|
3601 |
Gets a reference to the object pointer located at the specified
|
|
3602 |
position within the array.
|
|
3603 |
|
|
3604 |
The compiler chooses this option if the returned reference is used in
|
|
3605 |
an expression where the reference can be modified.
|
|
3606 |
|
|
3607 |
@param anIndex The position of the object pointer within the array. The
|
|
3608 |
position is relative to zero, i.e. zero implies the object
|
|
3609 |
pointer at the beginning of the array.
|
|
3610 |
|
|
3611 |
@return A non-const reference to the object pointer at position anIndex within
|
|
3612 |
the array.
|
|
3613 |
|
|
3614 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
3615 |
objects currently in the array.
|
|
3616 |
*/
|
|
3617 |
{return (T*&)At(anIndex);}
|
|
3618 |
|
|
3619 |
|
|
3620 |
|
|
3621 |
|
|
3622 |
template <class T>
|
|
3623 |
inline TInt RPointerArray<T>::Append(const T* anEntry)
|
|
3624 |
/**
|
|
3625 |
Appends an object pointer onto the array.
|
|
3626 |
|
|
3627 |
@param anEntry The object pointer to be appended.
|
|
3628 |
|
|
3629 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
3630 |
wide error codes.
|
|
3631 |
*/
|
|
3632 |
{ return RPointerArrayBase::Append(anEntry); }
|
|
3633 |
|
|
3634 |
|
|
3635 |
|
|
3636 |
|
|
3637 |
template <class T>
|
|
3638 |
inline TInt RPointerArray<T>::Insert(const T* anEntry, TInt aPos)
|
|
3639 |
/**
|
|
3640 |
Inserts an object pointer into the array at the specified position.
|
|
3641 |
|
|
3642 |
@param anEntry The object pointer to be inserted.
|
|
3643 |
@param aPos The position within the array where the object pointer is to be
|
|
3644 |
inserted. The position is relative to zero, i.e. zero implies
|
|
3645 |
that a pointer is inserted at the beginning of the array.
|
|
3646 |
|
|
3647 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
3648 |
wide error codes.
|
|
3649 |
|
|
3650 |
@panic USER 131, if aPos is negative, or is greater than the number of object
|
|
3651 |
pointers currently in the array.
|
|
3652 |
*/
|
|
3653 |
{ return RPointerArrayBase::Insert(anEntry,aPos); }
|
|
3654 |
|
|
3655 |
|
|
3656 |
|
|
3657 |
|
|
3658 |
template <class T>
|
|
3659 |
inline void RPointerArray<T>::Remove(TInt anIndex)
|
|
3660 |
/**
|
|
3661 |
Removes the object pointer at the specified position from the array.
|
|
3662 |
|
|
3663 |
Note that the function does not delete the object whose pointer is removed.
|
|
3664 |
|
|
3665 |
@param anIndex The position within the array from where the object pointer
|
|
3666 |
is to be removed. The position is relative to zero, i.e. zero
|
|
3667 |
implies that a pointer at the beginning of the array is to be
|
|
3668 |
removed.
|
|
3669 |
|
|
3670 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
3671 |
objects currently in the array.
|
|
3672 |
*/
|
|
3673 |
{RPointerArrayBase::Remove(anIndex);}
|
|
3674 |
|
|
3675 |
|
|
3676 |
|
|
3677 |
|
|
3678 |
template <class T>
|
|
3679 |
inline void RPointerArray<T>::Compress()
|
|
3680 |
/**
|
|
3681 |
Compresses the array down to a minimum.
|
|
3682 |
|
|
3683 |
After a call to this function, the memory allocated to the array is just
|
|
3684 |
sufficient for its contained object pointers.
|
|
3685 |
Subsequently adding a new object pointer to the array
|
|
3686 |
always results in a re-allocation of memory.
|
|
3687 |
*/
|
|
3688 |
{RPointerArrayBase::Compress();}
|
|
3689 |
|
|
3690 |
|
|
3691 |
|
|
3692 |
|
|
3693 |
template <class T>
|
|
3694 |
inline void RPointerArray<T>::Reset()
|
|
3695 |
/**
|
|
3696 |
Empties the array.
|
|
3697 |
|
|
3698 |
It frees all memory allocated to the array and resets the internal state so
|
|
3699 |
that it is ready to be reused.
|
|
3700 |
|
|
3701 |
This array object can be allowed to go out of scope after a call to this
|
|
3702 |
function.
|
|
3703 |
|
|
3704 |
Note that the function does not delete the objects whose pointers are contained
|
|
3705 |
in the array.
|
|
3706 |
*/
|
|
3707 |
{RPointerArrayBase::Reset();}
|
|
3708 |
|
|
3709 |
|
|
3710 |
|
|
3711 |
|
|
3712 |
template <class T>
|
|
3713 |
inline TInt RPointerArray<T>::Find(const T* anEntry) const
|
|
3714 |
/**
|
|
3715 |
Finds the first object pointer in the array which matches the specified object
|
|
3716 |
pointer, using a sequential search.
|
|
3717 |
|
|
3718 |
Matching is based on the comparison of pointers.
|
|
3719 |
|
|
3720 |
The find operation always starts at the low index end of the array. There
|
|
3721 |
is no assumption about the order of objects in the array.
|
|
3722 |
|
|
3723 |
@param anEntry The object pointer to be found.
|
|
3724 |
@return The index of the first matching object pointer within the array.
|
|
3725 |
KErrNotFound, if no matching object pointer can be found.
|
|
3726 |
*/
|
|
3727 |
{ return RPointerArrayBase::Find(anEntry); }
|
|
3728 |
|
|
3729 |
|
|
3730 |
|
|
3731 |
|
|
3732 |
template <class T>
|
|
3733 |
inline TInt RPointerArray<T>::Find(const T* anEntry, TIdentityRelation<T> anIdentity) const
|
|
3734 |
/**
|
|
3735 |
Finds the first object pointer in the array whose object matches the specified
|
|
3736 |
object, using a sequential search and a matching algorithm.
|
|
3737 |
|
|
3738 |
The algorithm for determining whether two class T objects match is provided
|
|
3739 |
by a function supplied by the caller.
|
|
3740 |
|
|
3741 |
The find operation always starts at the low index end of the array. There
|
|
3742 |
is no assumption about the order of objects in the array.
|
|
3743 |
|
|
3744 |
@param anEntry The object pointer to be found.
|
|
3745 |
@param anIdentity A package encapsulating the function which determines whether
|
|
3746 |
two class T objects match.
|
|
3747 |
|
|
3748 |
@return The index of the first matching object pointer within the array.
|
|
3749 |
KErrNotFound, if no suitable object pointer can be found.
|
|
3750 |
*/
|
|
3751 |
{ return RPointerArrayBase::Find(anEntry,anIdentity); }
|
|
3752 |
|
|
3753 |
|
|
3754 |
|
|
3755 |
|
|
3756 |
template <class T>
|
|
3757 |
inline TInt RPointerArray<T>::FindReverse(const T* anEntry) const
|
|
3758 |
/**
|
|
3759 |
Finds the last object pointer in the array which matches the specified object
|
|
3760 |
pointer, using a sequential search.
|
|
3761 |
|
|
3762 |
Matching is based on the comparison of pointers.
|
|
3763 |
|
|
3764 |
The find operation always starts at the high index end of the array. There
|
|
3765 |
is no assumption about the order of objects in the array.
|
|
3766 |
|
|
3767 |
@param anEntry The object pointer to be found.
|
|
3768 |
@return The index of the last matching object pointer within the array.
|
|
3769 |
KErrNotFound, if no matching object pointer can be found.
|
|
3770 |
*/
|
|
3771 |
{ return RPointerArrayBase::FindReverse(anEntry); }
|
|
3772 |
|
|
3773 |
|
|
3774 |
|
|
3775 |
|
|
3776 |
template <class T>
|
|
3777 |
inline TInt RPointerArray<T>::FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const
|
|
3778 |
/**
|
|
3779 |
Finds the last object pointer in the array whose object matches the specified
|
|
3780 |
object, using a sequential search and a matching algorithm.
|
|
3781 |
|
|
3782 |
The algorithm for determining whether two class T objects match is provided
|
|
3783 |
by a function supplied by the caller.
|
|
3784 |
|
|
3785 |
The find operation always starts at the high index end of the array. There
|
|
3786 |
is no assumption about the order of objects in the array.
|
|
3787 |
|
|
3788 |
@param anEntry The object pointer to be found.
|
|
3789 |
@param anIdentity A package encapsulating the function which determines whether
|
|
3790 |
two class T objects match.
|
|
3791 |
|
|
3792 |
@return The index of the last matching object pointer within the array.
|
|
3793 |
KErrNotFound, if no suitable object pointer can be found.
|
|
3794 |
*/
|
|
3795 |
{ return RPointerArrayBase::FindReverse(anEntry,anIdentity); }
|
|
3796 |
|
|
3797 |
|
|
3798 |
|
|
3799 |
|
|
3800 |
template <class T>
|
|
3801 |
inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry) const
|
|
3802 |
/**
|
|
3803 |
Finds the object pointer in the array that matches the specified object
|
|
3804 |
pointer, using a binary search technique.
|
|
3805 |
|
|
3806 |
The function assumes that object pointers in the array are in address order.
|
|
3807 |
|
|
3808 |
@param anEntry The object pointer to be found.
|
|
3809 |
|
|
3810 |
@return The index of the matching object pointer within the array or KErrNotFound
|
|
3811 |
if no suitable object pointer can be found.
|
|
3812 |
*/
|
|
3813 |
{ return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); }
|
|
3814 |
|
|
3815 |
|
|
3816 |
|
|
3817 |
|
|
3818 |
template <class T>
|
|
3819 |
inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const
|
|
3820 |
/**
|
|
3821 |
Finds the object pointer in the array whose object matches the specified
|
|
3822 |
object, using a binary search technique and an ordering algorithm.
|
|
3823 |
|
|
3824 |
The function assumes that existing object pointers in the array are ordered
|
|
3825 |
so that the objects themselves are in object order as determined by an algorithm
|
|
3826 |
supplied by the caller and packaged as a TLinearOrder<T>.
|
|
3827 |
|
|
3828 |
@param anEntry The object pointer to be found.
|
|
3829 |
@param anOrder A package encapsulating the function which determines the order
|
|
3830 |
of two class T objects.
|
|
3831 |
|
|
3832 |
@return The index of the matching object pointer within the array or KErrNotFound,
|
|
3833 |
if no suitable object pointer can be found.
|
|
3834 |
*/
|
|
3835 |
{ return RPointerArrayBase::FindIsq(anEntry,anOrder); }
|
|
3836 |
|
|
3837 |
|
|
3838 |
|
|
3839 |
|
|
3840 |
template <class T>
|
|
3841 |
inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry, TInt& anIndex) const
|
|
3842 |
/**
|
|
3843 |
Finds the object pointer in the array that matches the specified object
|
|
3844 |
pointer, using a binary search technique.
|
|
3845 |
|
|
3846 |
The function assumes that object pointers in the array are in address order.
|
|
3847 |
|
|
3848 |
@param anEntry The object pointer to be found.
|
|
3849 |
@param anIndex A TInt supplied by the caller. On return, contains an index
|
|
3850 |
value:
|
|
3851 |
If the function returns KErrNone, this is the index of the
|
|
3852 |
matching object pointer within the array.
|
|
3853 |
If the function returns KErrNotFound, this is the
|
|
3854 |
index of the first object pointer within the array which
|
|
3855 |
logically follows after anEntry.
|
|
3856 |
|
|
3857 |
@return KErrNone, if a matching object pointer is found.
|
|
3858 |
KErrNotFound, if no suitable object pointer can be found.
|
|
3859 |
*/
|
|
3860 |
{ return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); }
|
|
3861 |
|
|
3862 |
|
|
3863 |
|
|
3864 |
|
|
3865 |
template <class T>
|
|
3866 |
inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const
|
|
3867 |
/**
|
|
3868 |
Finds the object pointer in the array whose object matches the specified
|
|
3869 |
object, using a binary search technique and an ordering algorithm.
|
|
3870 |
|
|
3871 |
The function assumes that existing object pointers in the array are ordered
|
|
3872 |
so that the objects themselves are in object order as determined by an
|
|
3873 |
algorithm supplied by the caller and packaged as a TLinearOrder<T>.
|
|
3874 |
|
|
3875 |
@param anEntry The object pointer to be found.
|
|
3876 |
@param anIndex A TInt supplied by the caller. On return, contains an
|
|
3877 |
index value:
|
|
3878 |
If the function returns KErrNone, this is the index of the
|
|
3879 |
matching object pointer within the array.
|
|
3880 |
If the function returns KErrNotFound, this is the index of
|
|
3881 |
the first object pointer in the array whose object is larger
|
|
3882 |
than the entry being searched for - if no objects pointed to in
|
|
3883 |
the array are larger, then the index value is the same as the
|
|
3884 |
total number of object pointers in the array.
|
|
3885 |
|
|
3886 |
@param anOrder A package encapsulating the function which determines the order
|
|
3887 |
of two class T objects.
|
|
3888 |
|
|
3889 |
@return KErrNone, if a matching object pointer is found.
|
|
3890 |
KErrNotFound, if no suitable object pointer can be found.
|
|
3891 |
*/
|
|
3892 |
{ return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder); }
|
|
3893 |
|
|
3894 |
|
|
3895 |
|
|
3896 |
|
|
3897 |
template <class T>
|
|
3898 |
inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const
|
|
3899 |
/**
|
|
3900 |
Finds the object pointer in the array that matches the specified object
|
|
3901 |
pointer, using a binary search technique.
|
|
3902 |
|
|
3903 |
Where there is more than one matching element, it finds the first, the last
|
|
3904 |
or any matching element as specified by the value of aMode.
|
|
3905 |
|
|
3906 |
The function assumes that object pointers in the array are in address order.
|
|
3907 |
|
|
3908 |
@param anEntry The object pointer to be found.
|
|
3909 |
@param aMode Specifies whether to find the first match, the last match or
|
|
3910 |
any match, as defined by one of the TArrayFindMode enum values.
|
|
3911 |
|
|
3912 |
@return KErrNotFound, if there is no matching element, otherwise the array
|
|
3913 |
index of a matching element - what the index refers to depends on the
|
|
3914 |
value of aMode:
|
|
3915 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
3916 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
3917 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
3918 |
the last matching element - if the last matching element is also the last element of
|
|
3919 |
the array, then the index value is the same as the total number of elements in the array.
|
|
3920 |
|
|
3921 |
@see TArrayFindMode
|
|
3922 |
*/
|
|
3923 |
{ return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); }
|
|
3924 |
|
|
3925 |
|
|
3926 |
|
|
3927 |
|
|
3928 |
template <class T>
|
|
3929 |
inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const
|
|
3930 |
/**
|
|
3931 |
Finds the object pointer in the array whose object matches the specified
|
|
3932 |
object, using a binary search technique and an ordering algorithm.
|
|
3933 |
|
|
3934 |
Where there is more than one matching element, it finds the first, the last
|
|
3935 |
or any matching element as specified by the value of aMode.
|
|
3936 |
|
|
3937 |
The function assumes that existing object pointers in the array are ordered
|
|
3938 |
so that the objects themselves are in object order as determined by an algorithm
|
|
3939 |
supplied by the caller and packaged as a TLinearOrder<T> type.
|
|
3940 |
|
|
3941 |
@param anEntry The object pointer to be found.
|
|
3942 |
@param anOrder A package encapsulating the function which determines the order
|
|
3943 |
of two class T objects.
|
|
3944 |
@param aMode Specifies whether to find the first match, the last match or any match,
|
|
3945 |
as defined by one of the TArrayFindMode enum values.
|
|
3946 |
|
|
3947 |
@return KErrNotFound, if there is no matching element, otherwise the array
|
|
3948 |
index of a matching element - what the index refers to depends on
|
|
3949 |
the value of aMode:
|
|
3950 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
3951 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
3952 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
3953 |
the last matching element - if the last matching element is also the last element of the array,
|
|
3954 |
then the index value is the same as the total number of elements in the array.
|
|
3955 |
|
|
3956 |
@see TArrayFindMode
|
|
3957 |
*/
|
|
3958 |
{ return RPointerArrayBase::FindIsq(anEntry,anOrder,aMode); }
|
|
3959 |
|
|
3960 |
|
|
3961 |
|
|
3962 |
|
|
3963 |
template <class T>
|
|
3964 |
inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const
|
|
3965 |
/**
|
|
3966 |
Finds the object pointer in the array that matches the specified object
|
|
3967 |
pointer, using a binary search technique.
|
|
3968 |
|
|
3969 |
Where there is more than one matching element, it finds the first, the last
|
|
3970 |
or any matching element as specified by the value of aMode.
|
|
3971 |
|
|
3972 |
The function assumes that object pointers in the array are in address order.
|
|
3973 |
|
|
3974 |
@param anEntry The object pointer to be found.
|
|
3975 |
@param anIndex A TInt type supplied by the caller. On return, it contains an
|
|
3976 |
index value depending on whether a match is found and on the
|
|
3977 |
value of aMode.
|
|
3978 |
If there is no matching element in the array, then this is
|
|
3979 |
the index of the first element in the array that is bigger than
|
|
3980 |
the element being searched for - if no elements in the array are
|
|
3981 |
bigger, then the index value is the same as the total number of
|
|
3982 |
elements in the array. If there is a matching element, then what
|
|
3983 |
the index refers to depends on the value of aMode:
|
|
3984 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
3985 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
3986 |
if this is EArrayFindMode_Last, then the index refers to first element that follows the
|
|
3987 |
last matching element - if the last matching element is also the last element of the array,
|
|
3988 |
then the index value is the same as the total number of elements in the array.
|
|
3989 |
|
|
3990 |
@param aMode Specifies whether to find the first match, the last match or any
|
|
3991 |
match, as defined by one of the TArrayFindMode enum values.
|
|
3992 |
|
|
3993 |
@return KErrNone, if a matching object pointer is found.
|
|
3994 |
KErrNotFound, if no suitable object pointer can be found.
|
|
3995 |
|
|
3996 |
@see TArrayFindMode
|
|
3997 |
*/
|
|
3998 |
{ return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); }
|
|
3999 |
|
|
4000 |
|
|
4001 |
|
|
4002 |
|
|
4003 |
template <class T>
|
|
4004 |
inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const
|
|
4005 |
/**
|
|
4006 |
Finds the object pointer in the array whose object matches the specified
|
|
4007 |
object, using a binary search technique and an ordering algorithm.
|
|
4008 |
|
|
4009 |
Where there is more than one matching element, it finds the first, the last or any
|
|
4010 |
matching element as specified by the value of aMode.
|
|
4011 |
|
|
4012 |
The function assumes that existing object pointers in the array are ordered
|
|
4013 |
so that the objects themselves are in object order as determined by an
|
|
4014 |
algorithm supplied by the caller and packaged as a TLinearOrder<T> type.
|
|
4015 |
|
|
4016 |
@param anEntry The object pointer to be found.
|
|
4017 |
@param anIndex A TInt type supplied by the caller. On return, it contains an
|
|
4018 |
index value depending on whether a match is found and on the
|
|
4019 |
value of aMode. If there is no matching element in the array,
|
|
4020 |
then this is the index of the first element in the array
|
|
4021 |
that is bigger than the element being searched for - if
|
|
4022 |
no elements in the array are bigger, then the index value
|
|
4023 |
is the same as the total number of elements in the array.
|
|
4024 |
If there is a matching element, then what the index refers to
|
|
4025 |
depends on the value of aMode:
|
|
4026 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
4027 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
4028 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
4029 |
the last matching element - if the last matching element is also the last element
|
|
4030 |
of the array, then the index value is the same as the total number of elements in the array.
|
|
4031 |
|
|
4032 |
@param anOrder A package encapsulating the function which determines the order
|
|
4033 |
of two class T objects.
|
|
4034 |
@param aMode Specifies whether to find the first match, the last match or
|
|
4035 |
any match, as defined by one of the TArrayFindMode enum values.
|
|
4036 |
|
|
4037 |
@return KErrNone, if a matching object pointer is found.
|
|
4038 |
KErrNotFound, if no suitable object pointer can be found.
|
|
4039 |
|
|
4040 |
@see TArrayFindMode
|
|
4041 |
*/
|
|
4042 |
{ return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder,aMode); }
|
|
4043 |
|
|
4044 |
|
|
4045 |
|
|
4046 |
|
|
4047 |
template <class T>
|
|
4048 |
inline TInt RPointerArray<T>::InsertInAddressOrder(const T* anEntry)
|
|
4049 |
/**
|
|
4050 |
Inserts an object pointer into the array in address order.
|
|
4051 |
|
|
4052 |
No duplicate entries are permitted. The array remains unchanged following
|
|
4053 |
an attempt to insert a duplicate entry.
|
|
4054 |
|
|
4055 |
The function assumes that existing object pointers within the array are in
|
|
4056 |
address order.
|
|
4057 |
|
|
4058 |
@param anEntry The object pointer to be inserted.
|
|
4059 |
|
|
4060 |
@return KErrNone, if the insertion is successful;
|
|
4061 |
KErrAlreadyExists, if an attempt is being made
|
|
4062 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
4063 |
error codes.
|
|
4064 |
*/
|
|
4065 |
{ return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); }
|
|
4066 |
|
|
4067 |
|
|
4068 |
|
|
4069 |
|
|
4070 |
template <class T>
|
|
4071 |
inline TInt RPointerArray<T>::InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder)
|
|
4072 |
/**
|
|
4073 |
Inserts an object pointer into the array so that the object itself is in object
|
|
4074 |
order.
|
|
4075 |
|
|
4076 |
The algorithm for determining the order of two class T objects is provided
|
|
4077 |
by a function supplied by the caller.
|
|
4078 |
|
|
4079 |
No duplicate entries are permitted. The array remains unchanged following
|
|
4080 |
an attempt to insert a duplicate entry.
|
|
4081 |
|
|
4082 |
The function assumes that the array is ordered so that the referenced objects
|
|
4083 |
are in object order.
|
|
4084 |
|
|
4085 |
@param anEntry The object pointer to be inserted.
|
|
4086 |
@param anOrder A package encapsulating the function which determines the order
|
|
4087 |
of two class T objects.
|
|
4088 |
|
|
4089 |
@return KErrNone, if the insertion is successful;
|
|
4090 |
KErrAlreadyExists, if an attempt is being made
|
|
4091 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
4092 |
error codes.
|
|
4093 |
*/
|
|
4094 |
{ return RPointerArrayBase::InsertIsq(anEntry,anOrder,EFalse); }
|
|
4095 |
|
|
4096 |
|
|
4097 |
|
|
4098 |
|
|
4099 |
template <class T>
|
|
4100 |
inline TInt RPointerArray<T>::InsertInAddressOrderAllowRepeats(const T* anEntry)
|
|
4101 |
/**
|
|
4102 |
Inserts an object pointer into the array in address order, allowing duplicates.
|
|
4103 |
|
|
4104 |
If the new object pointer is a duplicate of an existing object pointer in
|
|
4105 |
the array, then the new pointer is inserted after the existing one. If more
|
|
4106 |
than one duplicate object pointer already exists in the array, then any new
|
|
4107 |
duplicate pointer is inserted after the last one.
|
|
4108 |
|
|
4109 |
The function assumes that existing object pointers within the array are in
|
|
4110 |
address order.
|
|
4111 |
|
|
4112 |
@param anEntry The object pointer to be inserted.
|
|
4113 |
|
|
4114 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
4115 |
wide error codes.
|
|
4116 |
*/
|
|
4117 |
{ return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); }
|
|
4118 |
|
|
4119 |
|
|
4120 |
|
|
4121 |
|
|
4122 |
template <class T>
|
|
4123 |
inline TInt RPointerArray<T>::InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder)
|
|
4124 |
/**
|
|
4125 |
Inserts an object pointer into the array so that the object itself is in object
|
|
4126 |
order, allowing duplicates
|
|
4127 |
|
|
4128 |
The algorithm for determining the order of two class T objects is provided
|
|
4129 |
by a function supplied by the caller.
|
|
4130 |
|
|
4131 |
If the specified object is a duplicate of an existing object, then the new
|
|
4132 |
pointer is inserted after the pointer to the existing object. If more than
|
|
4133 |
one duplicate object already exists, then the new pointer is inserted after
|
|
4134 |
the pointer to the last one.
|
|
4135 |
|
|
4136 |
@param anEntry The object pointer to be inserted.
|
|
4137 |
@param anOrder A package encapsulating the function which determines the order
|
|
4138 |
of two class T objects.
|
|
4139 |
|
|
4140 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
4141 |
wide error codes.
|
|
4142 |
*/
|
|
4143 |
{ return RPointerArrayBase::InsertIsq(anEntry,anOrder,ETrue); }
|
|
4144 |
|
|
4145 |
|
|
4146 |
|
|
4147 |
|
|
4148 |
#ifndef __KERNEL_MODE__
|
|
4149 |
template <class T>
|
|
4150 |
inline RPointerArray<T>::RPointerArray(T** aEntries, TInt aCount)
|
|
4151 |
: RPointerArrayBase((TAny **)aEntries, aCount)
|
|
4152 |
/**
|
|
4153 |
C++ constructor with a pointer to the first array entry in a pre-existing
|
|
4154 |
array, and the number of entries in that array.
|
|
4155 |
|
|
4156 |
This constructor takes a pointer to a pre-existing set of entries of type
|
|
4157 |
pointer to class T, which is owned by another RPointerArray object. Ownership
|
|
4158 |
of the set of entries still resides with the original RPointerArray object.
|
|
4159 |
|
|
4160 |
@param aEntries A pointer to the first entry of type pointer to class T in
|
|
4161 |
the set of entries belonging to the existing array.
|
|
4162 |
@param aCount The number of entries in the existing array. The granularity of
|
|
4163 |
this array is set to this value.
|
|
4164 |
|
|
4165 |
@panic USER 156, if aCount is not positive.
|
|
4166 |
*/
|
|
4167 |
{}
|
|
4168 |
|
|
4169 |
|
|
4170 |
|
|
4171 |
|
|
4172 |
template <class T>
|
|
4173 |
inline void RPointerArray<T>::GranularCompress()
|
|
4174 |
/**
|
|
4175 |
Compresses the array down to a granular boundary.
|
|
4176 |
|
|
4177 |
After a call to this function, the memory allocated to the array is sufficient
|
|
4178 |
for its contained object pointers. Adding new object pointers to the array
|
|
4179 |
does not result in a re-allocation of memory until the the total number of
|
|
4180 |
pointers reaches a multiple of the granularity.
|
|
4181 |
*/
|
|
4182 |
{RPointerArrayBase::GranularCompress();}
|
|
4183 |
|
|
4184 |
|
|
4185 |
|
|
4186 |
|
|
4187 |
template <class T>
|
|
4188 |
inline TInt RPointerArray<T>::Reserve(TInt aCount)
|
|
4189 |
/**
|
|
4190 |
Reserves space for the specified number of elements.
|
|
4191 |
|
|
4192 |
After a call to this function, the memory allocated to the array is sufficient
|
|
4193 |
to hold the number of object pointers specified. Adding new object pointers to the array
|
|
4194 |
does not result in a re-allocation of memory until the the total number of
|
|
4195 |
pointers exceeds the specified count.
|
|
4196 |
|
|
4197 |
@param aCount The number of object pointers for which space should be reserved
|
|
4198 |
@return KErrNone If the operation completed successfully
|
|
4199 |
@return KErrNoMemory If the requested amount of memory could not be allocated
|
|
4200 |
*/
|
|
4201 |
{ return RPointerArrayBase::DoReserve(aCount); }
|
|
4202 |
|
|
4203 |
|
|
4204 |
|
|
4205 |
|
|
4206 |
template <class T>
|
|
4207 |
inline void RPointerArray<T>::SortIntoAddressOrder()
|
|
4208 |
/**
|
|
4209 |
Sorts the object pointers within the array into address order.
|
|
4210 |
*/
|
|
4211 |
{ HeapSortUnsigned(); }
|
|
4212 |
|
|
4213 |
|
|
4214 |
|
|
4215 |
|
|
4216 |
template <class T>
|
|
4217 |
inline void RPointerArray<T>::Sort(TLinearOrder<T> anOrder)
|
|
4218 |
/**
|
|
4219 |
Sorts the object pointers within the array.
|
|
4220 |
|
|
4221 |
The sort order of the pointers is based on the order of the referenced objects.
|
|
4222 |
The referenced object order is determined by an algorithm supplied by the
|
|
4223 |
caller and packaged as a TLinerOrder<T>.
|
|
4224 |
|
|
4225 |
@param anOrder A package encapsulating the function which determines the order
|
|
4226 |
of two class T objects.
|
|
4227 |
*/
|
|
4228 |
{ HeapSort(anOrder); }
|
|
4229 |
|
|
4230 |
|
|
4231 |
|
|
4232 |
|
|
4233 |
template <class T>
|
|
4234 |
inline TArray<T*> RPointerArray<T>::Array() const
|
|
4235 |
/**
|
|
4236 |
Constructs and returns a generic array.
|
|
4237 |
|
|
4238 |
@return A generic array representing this array.
|
|
4239 |
|
|
4240 |
@see TArray
|
|
4241 |
*/
|
|
4242 |
{ return TArray<T*>(GetCount,GetElementPtr,(const CBase*)this); }
|
|
4243 |
#endif
|
|
4244 |
|
|
4245 |
|
|
4246 |
|
|
4247 |
template <class T>
|
|
4248 |
void RPointerArray<T>::ResetAndDestroy()
|
|
4249 |
/**
|
|
4250 |
Empties the array and deletes the referenced objects.
|
|
4251 |
|
|
4252 |
It frees all memory allocated to the array and resets the internal state so
|
|
4253 |
that it is ready to be reused. The function also deletes all of the objects
|
|
4254 |
whose pointers are contained by the array.
|
|
4255 |
|
|
4256 |
This array object can be allowed to go out of scope after a call to this function.
|
|
4257 |
*/
|
|
4258 |
{
|
|
4259 |
TInt c=Count();
|
|
4260 |
T** pE=(T**)Entries();
|
|
4261 |
ZeroCount();
|
|
4262 |
TInt i;
|
|
4263 |
for (i=0; i<c; i++)
|
|
4264 |
{
|
|
4265 |
delete *pE;
|
|
4266 |
pE++;
|
|
4267 |
}
|
|
4268 |
Reset();
|
|
4269 |
}
|
|
4270 |
|
|
4271 |
|
|
4272 |
|
|
4273 |
// Specialization for RPointerArray<TAny>
|
|
4274 |
|
|
4275 |
/**
|
|
4276 |
Default C++ constructor.
|
|
4277 |
|
|
4278 |
This constructs an array object for an array of TAny pointers with default
|
|
4279 |
granularity, which is 8.
|
|
4280 |
*/
|
|
4281 |
inline RPointerArray<TAny>::RPointerArray()
|
|
4282 |
: RPointerArrayBase()
|
|
4283 |
{}
|
|
4284 |
|
|
4285 |
|
|
4286 |
|
|
4287 |
|
|
4288 |
/**
|
|
4289 |
C++ constructor with granularity.
|
|
4290 |
|
|
4291 |
This constructs an array object for an array of TAny pointers with the specified
|
|
4292 |
granularity.
|
|
4293 |
|
|
4294 |
@param aGranularity The granularity of the array.
|
|
4295 |
|
|
4296 |
@panic USER 127, if aGranularity is not positive, or greater than or equal
|
|
4297 |
to 0x10000000.
|
|
4298 |
*/
|
|
4299 |
inline RPointerArray<TAny>::RPointerArray(TInt aGranularity)
|
|
4300 |
: RPointerArrayBase(aGranularity)
|
|
4301 |
{}
|
|
4302 |
|
|
4303 |
|
|
4304 |
|
|
4305 |
|
|
4306 |
/**
|
|
4307 |
C++ constructor with minimum growth step and exponential growth factor.
|
|
4308 |
|
|
4309 |
This constructs an array object for an array of TAny pointers with the specified
|
|
4310 |
minimum growth step and exponential growth factor.
|
|
4311 |
|
|
4312 |
@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
|
|
4313 |
65535 inclusive.
|
|
4314 |
@param aFactor The factor by which the array grows, multiplied by 256.
|
|
4315 |
For example 512 specifies a factor of 2. Must be between 257
|
|
4316 |
and 32767 inclusive.
|
|
4317 |
|
|
4318 |
@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
|
|
4319 |
@panic USER 193, if aFactor<=257 or aFactor>32767.
|
|
4320 |
*/
|
|
4321 |
inline RPointerArray<TAny>::RPointerArray(TInt aMinGrowBy, TInt aFactor)
|
|
4322 |
: RPointerArrayBase(aMinGrowBy, aFactor)
|
|
4323 |
{}
|
|
4324 |
|
|
4325 |
|
|
4326 |
|
|
4327 |
|
|
4328 |
inline void RPointerArray<TAny>::Close()
|
|
4329 |
/**
|
|
4330 |
Closes the array and frees all memory allocated to it.
|
|
4331 |
|
|
4332 |
The function must be called before this array object goes out of scope.
|
|
4333 |
|
|
4334 |
Note that the function does not delete the objects whose pointers are contained
|
|
4335 |
in the array.
|
|
4336 |
*/
|
|
4337 |
{RPointerArrayBase::Close();}
|
|
4338 |
|
|
4339 |
|
|
4340 |
|
|
4341 |
|
|
4342 |
inline TInt RPointerArray<TAny>::Count() const
|
|
4343 |
/**
|
|
4344 |
Gets the number of pointers in the array.
|
|
4345 |
|
|
4346 |
@return The number of pointers in the array.
|
|
4347 |
*/
|
|
4348 |
{ return RPointerArrayBase::Count(); }
|
|
4349 |
|
|
4350 |
|
|
4351 |
|
|
4352 |
|
|
4353 |
inline TAny* const& RPointerArray<TAny>::operator[](TInt anIndex) const
|
|
4354 |
/**
|
|
4355 |
Gets a reference to the pointer located at the specified
|
|
4356 |
position within the array.
|
|
4357 |
|
|
4358 |
The compiler chooses this option if the returned reference is used in
|
|
4359 |
an expression where the reference cannot be modified.
|
|
4360 |
|
|
4361 |
@param anIndex The position of the pointer within the array. The
|
|
4362 |
position is relative to zero, i.e. zero implies the object
|
|
4363 |
pointer at the beginning of the array.
|
|
4364 |
|
|
4365 |
@return A const reference to the pointer at position anIndex within
|
|
4366 |
the array.
|
|
4367 |
|
|
4368 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
4369 |
objects currently in the array.
|
|
4370 |
*/
|
|
4371 |
{return At(anIndex);}
|
|
4372 |
|
|
4373 |
|
|
4374 |
|
|
4375 |
|
|
4376 |
inline TAny*& RPointerArray<TAny>::operator[](TInt anIndex)
|
|
4377 |
/**
|
|
4378 |
Gets a reference to the pointer located at the specified
|
|
4379 |
position within the array.
|
|
4380 |
|
|
4381 |
The compiler chooses this option if the returned reference is used in
|
|
4382 |
an expression where the reference can be modified.
|
|
4383 |
|
|
4384 |
@param anIndex The position of the pointer within the array. The
|
|
4385 |
position is relative to zero, i.e. zero implies the object
|
|
4386 |
pointer at the beginning of the array.
|
|
4387 |
|
|
4388 |
@return A non-const reference to the pointer at position anIndex within
|
|
4389 |
the array.
|
|
4390 |
|
|
4391 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
4392 |
objects currently in the array.
|
|
4393 |
*/
|
|
4394 |
{return At(anIndex);}
|
|
4395 |
|
|
4396 |
|
|
4397 |
|
|
4398 |
|
|
4399 |
inline TInt RPointerArray<TAny>::Append(const TAny* anEntry)
|
|
4400 |
/**
|
|
4401 |
Appends an pointer onto the array.
|
|
4402 |
|
|
4403 |
@param anEntry The pointer to be appended.
|
|
4404 |
|
|
4405 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
4406 |
wide error codes.
|
|
4407 |
*/
|
|
4408 |
{ return RPointerArrayBase::Append(anEntry); }
|
|
4409 |
|
|
4410 |
|
|
4411 |
|
|
4412 |
|
|
4413 |
inline TInt RPointerArray<TAny>::Insert(const TAny* anEntry, TInt aPos)
|
|
4414 |
/**
|
|
4415 |
Inserts an pointer into the array at the specified position.
|
|
4416 |
|
|
4417 |
@param anEntry The pointer to be inserted.
|
|
4418 |
@param aPos The position within the array where the pointer is to be
|
|
4419 |
inserted. The position is relative to zero, i.e. zero implies
|
|
4420 |
that a pointer is inserted at the beginning of the array.
|
|
4421 |
|
|
4422 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
4423 |
wide error codes.
|
|
4424 |
|
|
4425 |
@panic USER 131, if aPos is negative, or is greater than the number of object
|
|
4426 |
pointers currently in the array.
|
|
4427 |
*/
|
|
4428 |
{ return RPointerArrayBase::Insert(anEntry,aPos); }
|
|
4429 |
|
|
4430 |
|
|
4431 |
|
|
4432 |
|
|
4433 |
inline void RPointerArray<TAny>::Remove(TInt anIndex)
|
|
4434 |
/**
|
|
4435 |
Removes the pointer at the specified position from the array.
|
|
4436 |
|
|
4437 |
Note that the function does not delete the object whose pointer is removed.
|
|
4438 |
|
|
4439 |
@param anIndex The position within the array from where the pointer
|
|
4440 |
is to be removed. The position is relative to zero, i.e. zero
|
|
4441 |
implies that a pointer at the beginning of the array is to be
|
|
4442 |
removed.
|
|
4443 |
|
|
4444 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
4445 |
objects currently in the array.
|
|
4446 |
*/
|
|
4447 |
{RPointerArrayBase::Remove(anIndex);}
|
|
4448 |
|
|
4449 |
|
|
4450 |
|
|
4451 |
|
|
4452 |
inline void RPointerArray<TAny>::Compress()
|
|
4453 |
/**
|
|
4454 |
Compresses the array down to a minimum.
|
|
4455 |
|
|
4456 |
After a call to this function, the memory allocated to the array is just
|
|
4457 |
sufficient for its contained pointers.
|
|
4458 |
Subsequently adding a new pointer to the array
|
|
4459 |
always results in a re-allocation of memory.
|
|
4460 |
*/
|
|
4461 |
{RPointerArrayBase::Compress();}
|
|
4462 |
|
|
4463 |
|
|
4464 |
|
|
4465 |
|
|
4466 |
inline void RPointerArray<TAny>::Reset()
|
|
4467 |
/**
|
|
4468 |
Empties the array.
|
|
4469 |
|
|
4470 |
It frees all memory allocated to the array and resets the internal state so
|
|
4471 |
that it is ready to be reused.
|
|
4472 |
|
|
4473 |
This array object can be allowed to go out of scope after a call to this
|
|
4474 |
function.
|
|
4475 |
|
|
4476 |
Note that the function does not delete the objects whose pointers are contained
|
|
4477 |
in the array.
|
|
4478 |
*/
|
|
4479 |
{RPointerArrayBase::Reset();}
|
|
4480 |
|
|
4481 |
|
|
4482 |
|
|
4483 |
|
|
4484 |
inline TInt RPointerArray<TAny>::Find(const TAny* anEntry) const
|
|
4485 |
/**
|
|
4486 |
Finds the first pointer in the array which matches the specified pointer, using
|
|
4487 |
a sequential search.
|
|
4488 |
|
|
4489 |
Matching is based on the comparison of pointers.
|
|
4490 |
|
|
4491 |
The find operation always starts at the low index end of the array. There
|
|
4492 |
is no assumption about the order of objects in the array.
|
|
4493 |
|
|
4494 |
@param anEntry The pointer to be found.
|
|
4495 |
@return The index of the first matching pointer within the array.
|
|
4496 |
KErrNotFound, if no matching pointer can be found.
|
|
4497 |
*/
|
|
4498 |
{ return RPointerArrayBase::Find(anEntry); }
|
|
4499 |
|
|
4500 |
|
|
4501 |
|
|
4502 |
|
|
4503 |
inline TInt RPointerArray<TAny>::FindReverse(const TAny* anEntry) const
|
|
4504 |
/**
|
|
4505 |
Finds the last pointer in the array which matches the specified pointer, using
|
|
4506 |
a sequential search.
|
|
4507 |
|
|
4508 |
Matching is based on the comparison of pointers.
|
|
4509 |
|
|
4510 |
The find operation always starts at the high index end of the array. There
|
|
4511 |
is no assumption about the order of objects in the array.
|
|
4512 |
|
|
4513 |
@param anEntry The pointer to be found.
|
|
4514 |
@return The index of the last matching pointer within the array.
|
|
4515 |
KErrNotFound, if no matching pointer can be found.
|
|
4516 |
*/
|
|
4517 |
{ return RPointerArrayBase::FindReverse(anEntry); }
|
|
4518 |
|
|
4519 |
|
|
4520 |
|
|
4521 |
|
|
4522 |
inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry) const
|
|
4523 |
/**
|
|
4524 |
Finds the pointer in the array that matches the specified object
|
|
4525 |
pointer, using a binary search technique.
|
|
4526 |
|
|
4527 |
The function assumes that pointers in the array are in address order.
|
|
4528 |
|
|
4529 |
@param anEntry The pointer to be found.
|
|
4530 |
|
|
4531 |
@return The index of the matching pointer within the array or KErrNotFound
|
|
4532 |
if no suitable pointer can be found.
|
|
4533 |
*/
|
|
4534 |
{ return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); }
|
|
4535 |
|
|
4536 |
|
|
4537 |
|
|
4538 |
|
|
4539 |
inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const
|
|
4540 |
/**
|
|
4541 |
Finds the pointer in the array that matches the specified object
|
|
4542 |
pointer, using a binary search technique.
|
|
4543 |
|
|
4544 |
The function assumes that pointers in the array are in address order.
|
|
4545 |
|
|
4546 |
@param anEntry The pointer to be found.
|
|
4547 |
@param anIndex A TInt supplied by the caller. On return, contains an index
|
|
4548 |
value:
|
|
4549 |
If the function returns KErrNone, this is the index of the
|
|
4550 |
matching pointer within the array.
|
|
4551 |
If the function returns KErrNotFound, this is the index of the
|
|
4552 |
last pointer within the array which logically
|
|
4553 |
precedes anEntry.
|
|
4554 |
|
|
4555 |
@return KErrNone, if a matching pointer is found.
|
|
4556 |
KErrNotFound, if no suitable pointer can be found.
|
|
4557 |
*/
|
|
4558 |
{ return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); }
|
|
4559 |
|
|
4560 |
|
|
4561 |
|
|
4562 |
|
|
4563 |
inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const
|
|
4564 |
/**
|
|
4565 |
Finds the pointer in the array that matches the specified pointer, using a
|
|
4566 |
binary search technique.
|
|
4567 |
|
|
4568 |
Where there is more than one matching element, it finds the first, the last
|
|
4569 |
or any matching element as specified by the value of aMode.
|
|
4570 |
|
|
4571 |
The function assumes that pointers in the array are in address order.
|
|
4572 |
|
|
4573 |
@param anEntry The pointer to be found.
|
|
4574 |
@param aMode Specifies whether to find the first match, the last match or
|
|
4575 |
any match, as defined by one of the TArrayFindMode enum values.
|
|
4576 |
|
|
4577 |
@return KErrNotFound, if there is no matching element, otherwise the array
|
|
4578 |
index of a matching element - what the index refers to depends on the
|
|
4579 |
value of aMode:
|
|
4580 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
4581 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
4582 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
4583 |
the last matching element - if the last matching element is also the last element of
|
|
4584 |
the array, then the index value is the same as the total number of elements in the array.
|
|
4585 |
|
|
4586 |
@see TArrayFindMode
|
|
4587 |
*/
|
|
4588 |
{ return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); }
|
|
4589 |
|
|
4590 |
|
|
4591 |
|
|
4592 |
|
|
4593 |
inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const
|
|
4594 |
/**
|
|
4595 |
Finds the pointer in the array that matches the specified pointer, using a
|
|
4596 |
binary search technique.
|
|
4597 |
|
|
4598 |
Where there is more than one matching element, it finds the first, the last
|
|
4599 |
or any matching element as specified by the value of aMode.
|
|
4600 |
|
|
4601 |
The function assumes that pointers in the array are in address order.
|
|
4602 |
|
|
4603 |
@param anEntry The pointer to be found.
|
|
4604 |
@param anIndex A TInt type supplied by the caller. On return, it contains an
|
|
4605 |
index value depending on whether a match is found and on the
|
|
4606 |
value of aMode.
|
|
4607 |
If there is no matching element in the array, then this is
|
|
4608 |
the index of the first element in the array that is bigger than
|
|
4609 |
the element being searched for - if no elements in the array are
|
|
4610 |
bigger, then the index value is the same as the total number of
|
|
4611 |
elements in the array. If there is a matching element, then what
|
|
4612 |
the index refers to depends on the value of aMode:
|
|
4613 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
4614 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
4615 |
if this is EArrayFindMode_Last, then the index refers to first element that follows the
|
|
4616 |
last matching element - if the last matching element is also the last element of the array,
|
|
4617 |
then the index value is the same as the total number of elements in the array.
|
|
4618 |
|
|
4619 |
@param aMode Specifies whether to find the first match, the last match or any
|
|
4620 |
match, as defined by one of the TArrayFindMode enum values.
|
|
4621 |
|
|
4622 |
@return KErrNone, if a matching pointer is found.
|
|
4623 |
KErrNotFound, if no suitable pointer can be found.
|
|
4624 |
|
|
4625 |
@see TArrayFindMode
|
|
4626 |
*/
|
|
4627 |
{ return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); }
|
|
4628 |
|
|
4629 |
|
|
4630 |
|
|
4631 |
|
|
4632 |
inline TInt RPointerArray<TAny>::InsertInAddressOrder(const TAny* anEntry)
|
|
4633 |
/**
|
|
4634 |
Inserts an pointer into the array in address order.
|
|
4635 |
|
|
4636 |
No duplicate entries are permitted. The array remains unchanged following
|
|
4637 |
an attempt to insert a duplicate entry.
|
|
4638 |
|
|
4639 |
The function assumes that existing pointers within the array are in
|
|
4640 |
address order.
|
|
4641 |
|
|
4642 |
@param anEntry The pointer to be inserted.
|
|
4643 |
|
|
4644 |
@return KErrNone, if the insertion is successful;
|
|
4645 |
KErrAlreadyExists, if an attempt is being made
|
|
4646 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
4647 |
error codes.
|
|
4648 |
*/
|
|
4649 |
{ return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); }
|
|
4650 |
|
|
4651 |
|
|
4652 |
|
|
4653 |
|
|
4654 |
inline TInt RPointerArray<TAny>::InsertInAddressOrderAllowRepeats(const TAny* anEntry)
|
|
4655 |
/**
|
|
4656 |
Inserts an pointer into the array in address order, allowing duplicates.
|
|
4657 |
|
|
4658 |
If the new pointer is a duplicate of an existing pointer in
|
|
4659 |
the array, then the new pointer is inserted after the existing one. If more
|
|
4660 |
than one duplicate pointer already exists in the array, then any new
|
|
4661 |
duplicate pointer is inserted after the last one.
|
|
4662 |
|
|
4663 |
The function assumes that existing pointers within the array are in
|
|
4664 |
address order.
|
|
4665 |
|
|
4666 |
@param anEntry The pointer to be inserted.
|
|
4667 |
|
|
4668 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
4669 |
wide error codes.
|
|
4670 |
*/
|
|
4671 |
{ return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); }
|
|
4672 |
|
|
4673 |
|
|
4674 |
|
|
4675 |
|
|
4676 |
#ifndef __KERNEL_MODE__
|
|
4677 |
inline RPointerArray<TAny>::RPointerArray(TAny** aEntries, TInt aCount)
|
|
4678 |
: RPointerArrayBase((TAny **)aEntries, aCount)
|
|
4679 |
/**
|
|
4680 |
C++ constructor with a pointer to the first array entry in a pre-existing
|
|
4681 |
array, and the number of entries in that array.
|
|
4682 |
|
|
4683 |
This constructor takes a pointer to a pre-existing set of entries of type TAny*,
|
|
4684 |
which is owned by another RPointerArray object. Ownership of the set of entries
|
|
4685 |
still resides with the original RPointerArray object.
|
|
4686 |
|
|
4687 |
@param aEntries A pointer to the first entry of type TAny* in the set of entries
|
|
4688 |
belonging to the existing array.
|
|
4689 |
@param aCount The number of entries in the existing array. The granularity of
|
|
4690 |
this array is set to this value.
|
|
4691 |
|
|
4692 |
@panic USER 156, if aCount is not positive.
|
|
4693 |
*/
|
|
4694 |
{}
|
|
4695 |
|
|
4696 |
|
|
4697 |
|
|
4698 |
|
|
4699 |
inline void RPointerArray<TAny>::GranularCompress()
|
|
4700 |
/**
|
|
4701 |
Compresses the array down to a granular boundary.
|
|
4702 |
|
|
4703 |
After a call to this function, the memory allocated to the array is sufficient
|
|
4704 |
for its contained pointers. Adding new pointers to the array
|
|
4705 |
does not result in a re-allocation of memory until the the total number of
|
|
4706 |
pointers reaches a multiple of the granularity.
|
|
4707 |
*/
|
|
4708 |
{RPointerArrayBase::GranularCompress();}
|
|
4709 |
|
|
4710 |
|
|
4711 |
|
|
4712 |
|
|
4713 |
inline void RPointerArray<TAny>::SortIntoAddressOrder()
|
|
4714 |
/**
|
|
4715 |
Sorts the pointers within the array into address order.
|
|
4716 |
*/
|
|
4717 |
{ HeapSortUnsigned(); }
|
|
4718 |
|
|
4719 |
|
|
4720 |
|
|
4721 |
|
|
4722 |
inline TArray<TAny*> RPointerArray<TAny>::Array() const
|
|
4723 |
/**
|
|
4724 |
Constructs and returns a generic array.
|
|
4725 |
|
|
4726 |
@return A generic array representing this array.
|
|
4727 |
|
|
4728 |
@see TArray
|
|
4729 |
*/
|
|
4730 |
{ return TArray<TAny*>(GetCount,GetElementPtr,(const CBase*)this); }
|
|
4731 |
#endif
|
|
4732 |
|
|
4733 |
|
|
4734 |
|
|
4735 |
template <class T>
|
|
4736 |
inline RArray<T>::RArray()
|
|
4737 |
: RArrayBase(sizeof(T))
|
|
4738 |
/**
|
|
4739 |
Default C++ constructor.
|
|
4740 |
|
|
4741 |
This constructs an array object for an array of type class T objects with
|
|
4742 |
default granularity and key offset value. The default granularity is 8 and
|
|
4743 |
the defaul key offset value is zero.
|
|
4744 |
|
|
4745 |
@panic USER 129, if the size of class T is not positive or is not less
|
|
4746 |
than 640.
|
|
4747 |
*/
|
|
4748 |
{}
|
|
4749 |
|
|
4750 |
|
|
4751 |
|
|
4752 |
|
|
4753 |
template <class T>
|
|
4754 |
inline RArray<T>::RArray(TInt aGranularity)
|
|
4755 |
: RArrayBase(sizeof(T),aGranularity)
|
|
4756 |
/**
|
|
4757 |
C++ constructor with granularity.
|
|
4758 |
|
|
4759 |
This constructs an array object for an array of type class T objects with
|
|
4760 |
a specified granularity and default key offset value. The default key offset
|
|
4761 |
value is zero.
|
|
4762 |
|
|
4763 |
@param aGranularity The granularity of the array.
|
|
4764 |
|
|
4765 |
@panic USER 129, if the size of class T is not positive or is not less
|
|
4766 |
than 640.
|
|
4767 |
@panic USER 127, if aGranularity is not positive or the product of this
|
|
4768 |
value and the size of class T is not less than 0x10000000.
|
|
4769 |
*/
|
|
4770 |
{}
|
|
4771 |
|
|
4772 |
|
|
4773 |
|
|
4774 |
|
|
4775 |
template <class T>
|
|
4776 |
inline RArray<T>::RArray(TInt aGranularity, TInt aKeyOffset)
|
|
4777 |
: RArrayBase(sizeof(T),aGranularity,aKeyOffset)
|
|
4778 |
/**
|
|
4779 |
C++ constructor with granularity and key offset.
|
|
4780 |
|
|
4781 |
This constructs an array object for an array of type class T objects with
|
|
4782 |
a specified granularity and a specified key offset value.
|
|
4783 |
|
|
4784 |
@param aGranularity The granularity of the array.
|
|
4785 |
@param aKeyOffset The key offset.
|
|
4786 |
|
|
4787 |
@panic USER 129, if the size of class T is not positive or is not less
|
|
4788 |
than 640.
|
|
4789 |
@panic USER 127, if aGranularity is not positive or the product of this
|
|
4790 |
value and the size of class T is not less than 0x10000000.
|
|
4791 |
@panic USER 128, if aKeyOffset is not positive, or is not less than the
|
|
4792 |
size of class T, or is not a multiple of 4.
|
|
4793 |
*/
|
|
4794 |
{}
|
|
4795 |
|
|
4796 |
|
|
4797 |
|
|
4798 |
|
|
4799 |
/**
|
|
4800 |
C++ constructor with minimum growth step and exponential growth factor.
|
|
4801 |
|
|
4802 |
This constructs an array object for an array of class T objects with the
|
|
4803 |
specified minimum growth step and exponential growth factor.
|
|
4804 |
|
|
4805 |
@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
|
|
4806 |
65535 inclusive.
|
|
4807 |
@param aKeyOffset The key offset.
|
|
4808 |
@param aFactor The factor by which the array grows, multiplied by 256.
|
|
4809 |
For example 512 specifies a factor of 2. Must be between 257
|
|
4810 |
and 32767 inclusive.
|
|
4811 |
|
|
4812 |
@panic USER 129, if the size of class T is not positive or is not less than 640.
|
|
4813 |
@panic USER 128, if aKeyOffset is negative, or is not less than the
|
|
4814 |
size of class T, or is not a multiple of 4.
|
|
4815 |
@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
|
|
4816 |
@panic USER 193, if aFactor<=257 or aFactor>32767.
|
|
4817 |
*/
|
|
4818 |
template <class T>
|
|
4819 |
inline RArray<T>::RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor)
|
|
4820 |
: RArrayBase(sizeof(T), aMinGrowBy, aKeyOffset, aFactor)
|
|
4821 |
{}
|
|
4822 |
|
|
4823 |
|
|
4824 |
|
|
4825 |
|
|
4826 |
template <class T>
|
|
4827 |
inline RArray<T>::RArray(TInt aEntrySize,T* aEntries, TInt aCount)
|
|
4828 |
: RArrayBase(aEntrySize,aEntries,aCount)
|
|
4829 |
/**
|
|
4830 |
C++ constructor with size of entry, a pointer to the first array entry in a
|
|
4831 |
pre-existing array, and the number of entries in that array.
|
|
4832 |
|
|
4833 |
This constructor takes a pointer to a pre-existing set of entries of type
|
|
4834 |
class T objects owned by another RArray object. Ownership of the set of entries
|
|
4835 |
still resides with the original RArray object.
|
|
4836 |
|
|
4837 |
This array is assigned a default granularity and key offset value. The default
|
|
4838 |
granularity is 8 and the default key offset value is zero.
|
|
4839 |
|
|
4840 |
The purpose of constructing an array in this way is to allow sorting and
|
|
4841 |
finding operations to be done without further allocation of memory.
|
|
4842 |
|
|
4843 |
@param aEntrySize The size of an entry in the existing array.
|
|
4844 |
@param aEntries A pointer to the first entry of type class T in the set of
|
|
4845 |
entries belonging to the existing array.
|
|
4846 |
@param aCount The number of entries in the existing array.
|
|
4847 |
|
|
4848 |
@panic USER 129, if aEntrySize is not positive or is not less than 640.
|
|
4849 |
@panic USER 156, if aCount is not positive.
|
|
4850 |
*/
|
|
4851 |
{}
|
|
4852 |
|
|
4853 |
|
|
4854 |
|
|
4855 |
|
|
4856 |
template <class T>
|
|
4857 |
inline void RArray<T>::Close()
|
|
4858 |
/**
|
|
4859 |
Closes the array and frees all memory allocated to the array.
|
|
4860 |
|
|
4861 |
The function must be called before this array object is destroyed.
|
|
4862 |
*/
|
|
4863 |
{RArrayBase::Close();}
|
|
4864 |
|
|
4865 |
|
|
4866 |
|
|
4867 |
|
|
4868 |
template <class T>
|
148
|
4869 |
inline void RArray<T>::SetKeyOffset(TInt aOffset)
|
|
4870 |
/**
|
|
4871 |
Sets the offset of the ordering key within each array entry.
|
|
4872 |
|
|
4873 |
@param aKeyOffset The key offset.
|
|
4874 |
|
|
4875 |
@panic USER 128, if aKeyOffset is not positive, or is not less than the
|
|
4876 |
size of class T, or is not a multiple of 4.
|
|
4877 |
*/
|
|
4878 |
{RArrayBase::SetKeyOffset(aOffset);}
|
|
4879 |
|
|
4880 |
|
|
4881 |
|
|
4882 |
|
|
4883 |
template <class T>
|
0
|
4884 |
inline TInt RArray<T>::Count() const
|
|
4885 |
/**
|
|
4886 |
Gets the number of objects in the array.
|
|
4887 |
|
|
4888 |
@return The number of objects in the array.
|
|
4889 |
*/
|
|
4890 |
{return RArrayBase::Count();}
|
|
4891 |
|
|
4892 |
|
|
4893 |
|
|
4894 |
|
|
4895 |
template <class T>
|
|
4896 |
inline const T& RArray<T>::operator[](TInt anIndex) const
|
|
4897 |
/**
|
|
4898 |
Gets a reference to an object located at a specified position within the array.
|
|
4899 |
|
|
4900 |
The compiler chooses this function if the returned reference is used in an
|
|
4901 |
expression where the reference cannot be modified.
|
|
4902 |
|
|
4903 |
@param anIndex The position of the object within the array. The position is
|
|
4904 |
relative to zero, i.e. zero implies the object at the beginning
|
|
4905 |
of the array.
|
|
4906 |
|
|
4907 |
@return A const reference to the object at position anIndex within the array.
|
|
4908 |
|
|
4909 |
@panic USER 130, if anIndex is negative or is greater than the number of
|
|
4910 |
objects currently in the array
|
|
4911 |
*/
|
|
4912 |
{return *(const T*)At(anIndex); }
|
|
4913 |
|
|
4914 |
|
|
4915 |
|
|
4916 |
|
|
4917 |
template <class T>
|
|
4918 |
inline T& RArray<T>::operator[](TInt anIndex)
|
|
4919 |
/**
|
|
4920 |
Gets a reference to an object located at a specified position within the array.
|
|
4921 |
|
|
4922 |
The compiler chooses this function if the returned reference is used in an
|
|
4923 |
expression where the reference can be modified.
|
|
4924 |
|
|
4925 |
@param anIndex The position of the object within the array. The position is
|
|
4926 |
relative to zero, i.e. zero implies the object at the beginning
|
|
4927 |
of the array.
|
|
4928 |
|
|
4929 |
@return A non-const reference to the object at position anIndex within the array.
|
|
4930 |
|
|
4931 |
@panic USER 130, if anIndex is negative or is greater than the number of
|
|
4932 |
objects currently in the array
|
|
4933 |
*/
|
|
4934 |
{return *(T*)At(anIndex); }
|
|
4935 |
|
|
4936 |
|
|
4937 |
|
|
4938 |
|
|
4939 |
template <class T>
|
|
4940 |
inline TInt RArray<T>::Append(const T& anEntry)
|
|
4941 |
/**
|
|
4942 |
Apends an object onto the array.
|
|
4943 |
|
|
4944 |
@param anEntry A reference to the object of type class T to be appended.
|
|
4945 |
|
|
4946 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
4947 |
wide error codes.
|
|
4948 |
*/
|
|
4949 |
{return RArrayBase::Append(&anEntry);}
|
|
4950 |
|
|
4951 |
|
|
4952 |
|
|
4953 |
|
|
4954 |
template <class T>
|
|
4955 |
inline TInt RArray<T>::Insert(const T& anEntry, TInt aPos)
|
|
4956 |
/**
|
|
4957 |
Inserts an object into the array at a specified position.
|
|
4958 |
|
|
4959 |
@param anEntry The class T object to be inserted.
|
|
4960 |
@param aPos The position within the array where the object is to
|
|
4961 |
be inserted. The position is relative to zero, i.e. zero
|
|
4962 |
implies that an object is inserted at the beginning of
|
|
4963 |
the array.
|
|
4964 |
|
|
4965 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
4966 |
wide error codes.
|
|
4967 |
|
|
4968 |
@panic USER 131, if aPos is negative or is greater than the number of objects
|
|
4969 |
currently in the array.
|
|
4970 |
*/
|
|
4971 |
{return RArrayBase::Insert(&anEntry,aPos);}
|
|
4972 |
|
|
4973 |
|
|
4974 |
|
|
4975 |
|
|
4976 |
template <class T>
|
|
4977 |
inline void RArray<T>::Remove(TInt anIndex)
|
|
4978 |
/**
|
|
4979 |
Removes the object at a specified position from the array.
|
|
4980 |
|
|
4981 |
@param anIndex The position within the array from where the object is to be
|
|
4982 |
removed. The position is relative to zero, i.e. zero implies
|
|
4983 |
that an object at the beginning of the array is to be removed.
|
|
4984 |
|
|
4985 |
@panic USER 130, if anIndex is negative or is greater than the number of
|
|
4986 |
objects currently in the array.
|
|
4987 |
*/
|
|
4988 |
{RArrayBase::Remove(anIndex);}
|
|
4989 |
|
|
4990 |
|
|
4991 |
|
|
4992 |
|
|
4993 |
template <class T>
|
|
4994 |
inline void RArray<T>::Compress()
|
|
4995 |
/**
|
|
4996 |
Compresses the array down to a minimum.
|
|
4997 |
|
|
4998 |
After a call to this function, the memory allocated to the array is just
|
|
4999 |
sufficient for its contained objects. Subsequently adding a new object to the
|
|
5000 |
array always results in a re-allocation of memory.
|
|
5001 |
*/
|
|
5002 |
{RArrayBase::Compress();}
|
|
5003 |
|
|
5004 |
|
|
5005 |
|
|
5006 |
|
|
5007 |
template <class T>
|
|
5008 |
inline void RArray<T>::Reset()
|
|
5009 |
/**
|
|
5010 |
Empties the array, so that it is ready to be reused.
|
|
5011 |
|
|
5012 |
The function frees all memory allocated to the array and resets the internal
|
|
5013 |
state so that it is ready to be reused.
|
|
5014 |
|
|
5015 |
This array object can be allowed to go out of scope after a call to this function.
|
|
5016 |
*/
|
|
5017 |
{RArrayBase::Reset();}
|
|
5018 |
|
|
5019 |
|
|
5020 |
|
|
5021 |
|
|
5022 |
template <class T>
|
|
5023 |
inline TInt RArray<T>::Find(const T& anEntry) const
|
|
5024 |
/**
|
|
5025 |
Finds the first object in the array which matches the specified object using
|
|
5026 |
a sequential search.
|
|
5027 |
|
|
5028 |
Matching is based on the comparison of a TInt value at the key offset position
|
|
5029 |
within the objects.
|
|
5030 |
|
|
5031 |
For classes which define their own equality operator (==), the alternative method
|
|
5032 |
Find(const T& anEntry, TIdentityRelation<T> anIdentity) is recommended.
|
|
5033 |
|
|
5034 |
The find operation always starts at the low index end of the array. There
|
|
5035 |
is no assumption about the order of objects in the array.
|
|
5036 |
|
|
5037 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5038 |
|
|
5039 |
@return The index of the first matching object within the array.
|
|
5040 |
KErrNotFound, if no matching object can be found.
|
|
5041 |
*/
|
|
5042 |
{return RArrayBase::Find(&anEntry);}
|
|
5043 |
|
|
5044 |
|
|
5045 |
|
|
5046 |
|
|
5047 |
template <class T>
|
|
5048 |
inline TInt RArray<T>::Find(const T& anEntry, TIdentityRelation<T> anIdentity) const
|
|
5049 |
/**
|
|
5050 |
Finds the first object in the array which matches the specified object using
|
|
5051 |
a sequential search and a matching algorithm.
|
|
5052 |
|
|
5053 |
The algorithm for determining whether two class T type objects match is provided
|
|
5054 |
by a function supplied by the caller.
|
|
5055 |
|
|
5056 |
Such a function need not be supplied if an equality operator (==) is defined for class T.
|
|
5057 |
In this case, default construction of anIdentity provides matching, as in the example below:
|
|
5058 |
|
|
5059 |
@code
|
|
5060 |
//Construct a TPoint and append to an RArray<TPoint>
|
|
5061 |
TPoint p1(0,0);
|
|
5062 |
RArray<TPoint> points;
|
|
5063 |
points.AppendL(p1);
|
|
5064 |
//Find position of p1 in points using TIdentityRelation<TPoint> default construction
|
|
5065 |
TInt r = points.Find(p1, TIdentityRelation<TPoint>());
|
|
5066 |
@endcode
|
|
5067 |
|
|
5068 |
The find operation always starts at the low index end of the array. There
|
|
5069 |
is no assumption about the order of objects in the array.
|
|
5070 |
|
|
5071 |
@param anEntry A reference to an object of type class T to be used
|
|
5072 |
for matching.
|
|
5073 |
@param anIdentity A package encapsulating the function which determines whether
|
|
5074 |
two class T type objects match.
|
|
5075 |
|
|
5076 |
@return The index of the first matching object within the array.
|
|
5077 |
KErrNotFound, if no matching object can be found.
|
|
5078 |
*/
|
|
5079 |
{return RArrayBase::Find(&anEntry,anIdentity);}
|
|
5080 |
|
|
5081 |
|
|
5082 |
|
|
5083 |
|
|
5084 |
template <class T>
|
|
5085 |
inline TInt RArray<T>::FindReverse(const T& anEntry) const
|
|
5086 |
/**
|
|
5087 |
Finds the last object in the array which matches the specified object using
|
|
5088 |
a sequential search.
|
|
5089 |
|
|
5090 |
Matching is based on the comparison of a TInt value at the key offset position
|
|
5091 |
within the objects.
|
|
5092 |
|
|
5093 |
For classes which define their own equality operator (==), the alternative method
|
|
5094 |
FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) is recommended.
|
|
5095 |
|
|
5096 |
The find operation always starts at the high index end of the array. There
|
|
5097 |
is no assumption about the order of objects in the array.
|
|
5098 |
|
|
5099 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5100 |
|
|
5101 |
@return The index of the last matching object within the array.
|
|
5102 |
KErrNotFound, if no matching object can be found.
|
|
5103 |
*/
|
|
5104 |
{return RArrayBase::FindReverse(&anEntry);}
|
|
5105 |
|
|
5106 |
|
|
5107 |
|
|
5108 |
|
|
5109 |
template <class T>
|
|
5110 |
inline TInt RArray<T>::FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const
|
|
5111 |
/**
|
|
5112 |
Finds the last object in the array which matches the specified object using
|
|
5113 |
a sequential search and a matching algorithm.
|
|
5114 |
|
|
5115 |
The algorithm for determining whether two class T type objects match is provided
|
|
5116 |
by a function supplied by the caller.
|
|
5117 |
|
|
5118 |
Such a function need not be supplied if an equality operator (==) is defined for class T.
|
|
5119 |
In this case, default construction of anIdentity provides matching.
|
|
5120 |
|
|
5121 |
See Find(const T& anEntry, TIdentityRelation<T> anIdentity) for more details.
|
|
5122 |
|
|
5123 |
The find operation always starts at the high index end of the array. There
|
|
5124 |
is no assumption about the order of objects in the array.
|
|
5125 |
|
|
5126 |
@param anEntry A reference to an object of type class T to be used
|
|
5127 |
for matching.
|
|
5128 |
@param anIdentity A package encapsulating the function which determines whether
|
|
5129 |
two class T type objects match.
|
|
5130 |
|
|
5131 |
@return The index of the last matching object within the array.
|
|
5132 |
KErrNotFound, if no matching object can be found.
|
|
5133 |
*/
|
|
5134 |
{return RArrayBase::FindReverse(&anEntry,anIdentity);}
|
|
5135 |
|
|
5136 |
|
|
5137 |
|
|
5138 |
|
|
5139 |
template <class T>
|
|
5140 |
inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry) const
|
|
5141 |
/**
|
|
5142 |
Finds the object in the array which matches the specified object using a binary
|
|
5143 |
search technique.
|
|
5144 |
|
|
5145 |
The function assumes that existing objects within the array are in signed
|
|
5146 |
key order.
|
|
5147 |
|
|
5148 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5149 |
|
|
5150 |
@return The index of the matching object within the array, or KErrNotFound
|
|
5151 |
if no matching object can be found.
|
|
5152 |
*/
|
|
5153 |
{return RArrayBase::FindIsqSigned(&anEntry);}
|
|
5154 |
|
|
5155 |
|
|
5156 |
|
|
5157 |
|
|
5158 |
template <class T>
|
|
5159 |
inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry) const
|
|
5160 |
/**
|
|
5161 |
Finds the object in the array which matches the specified object using a binary
|
|
5162 |
search technique.
|
|
5163 |
|
|
5164 |
The function assumes that existing objects within the array are in unsigned
|
|
5165 |
key order.
|
|
5166 |
|
|
5167 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5168 |
|
|
5169 |
@return The index of the matching object within the array, or KErrNotFound
|
|
5170 |
if no matching object can be found.
|
|
5171 |
*/
|
|
5172 |
{return RArrayBase::FindIsqUnsigned(&anEntry);}
|
|
5173 |
|
|
5174 |
|
|
5175 |
|
|
5176 |
|
|
5177 |
template <class T>
|
|
5178 |
inline TInt RArray<T>::FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const
|
|
5179 |
/**
|
|
5180 |
Finds the object in the array which matches the specified object using a binary
|
|
5181 |
search technique and an ordering algorithm.
|
|
5182 |
|
|
5183 |
The function assumes that existing objects within the array are in object
|
|
5184 |
order as determined by an algorithm supplied by the caller and packaged as
|
|
5185 |
a TLinearOrder<T>.
|
|
5186 |
|
|
5187 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5188 |
@param anOrder A package encapsulating the function which determines the order
|
|
5189 |
of two class T objects.
|
|
5190 |
|
|
5191 |
@return The index of the matching object within the array, or KErrNotFound if
|
|
5192 |
no matching object can be found.
|
|
5193 |
*/
|
|
5194 |
{return RArrayBase::FindIsq(&anEntry,anOrder);}
|
|
5195 |
|
|
5196 |
|
|
5197 |
|
|
5198 |
|
|
5199 |
template <class T>
|
|
5200 |
inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const
|
|
5201 |
/**
|
|
5202 |
Finds the object in the array which matches the specified object using a binary
|
|
5203 |
search technique.
|
|
5204 |
|
|
5205 |
The function assumes that existing objects within the array are in signed
|
|
5206 |
key order.
|
|
5207 |
|
|
5208 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5209 |
@param anIndex On return contains an index value. If the function returns KErrNone,
|
|
5210 |
this is the index of the matching object within the array.
|
|
5211 |
If the function returns KErrNotFound, this is the index of the
|
|
5212 |
first element in the array whose key is bigger than the key of the
|
|
5213 |
element being sought. If there are no elements in the array with
|
|
5214 |
a bigger key, then the index value is the same as the total
|
|
5215 |
number of elements in the array.
|
|
5216 |
@return KErrNone if a matching object is found, or KErrNotFound if no matching
|
|
5217 |
object can be found.
|
|
5218 |
*/
|
|
5219 |
{return RArrayBase::BinarySearchSigned(&anEntry,anIndex);}
|
|
5220 |
|
|
5221 |
|
|
5222 |
|
|
5223 |
|
|
5224 |
template <class T>
|
|
5225 |
inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const
|
|
5226 |
/**
|
|
5227 |
Finds the object in the array which matches the specified object using a binary
|
|
5228 |
search technique.
|
|
5229 |
|
|
5230 |
The function assumes that existing objects within the array are in unsigned
|
|
5231 |
key order.
|
|
5232 |
|
|
5233 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5234 |
@param anIndex On return contains an index value. If the function returns
|
|
5235 |
KErrNone, this is the index of the matching object within the
|
|
5236 |
array.
|
|
5237 |
If the function returns KErrNotFound, this is the index of the
|
|
5238 |
first element in the array whose key is bigger than the key of the
|
|
5239 |
element being sought. If there are no elements in the array with
|
|
5240 |
a bigger key, then the index value is the same as the total
|
|
5241 |
number of elements in the array.
|
|
5242 |
@return KErrNone if a matching object is found, or KErrNotFound if no matching
|
|
5243 |
object can be found.
|
|
5244 |
*/
|
|
5245 |
{return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex);}
|
|
5246 |
|
|
5247 |
|
|
5248 |
|
|
5249 |
|
|
5250 |
template <class T>
|
|
5251 |
inline TInt RArray<T>::FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const
|
|
5252 |
/**
|
|
5253 |
Finds the object in the array which matches the specified object using a binary
|
|
5254 |
search technique and an ordering algorithm.
|
|
5255 |
|
|
5256 |
The function assumes that existing objects within the array are in object
|
|
5257 |
order as determined by an algorithm supplied by the caller and packaged as
|
|
5258 |
a TLinearOrder<T>.
|
|
5259 |
|
|
5260 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5261 |
@param anIndex On return contains an index value. If the function returns
|
|
5262 |
KErrNone, this is the index of the matching object within the
|
|
5263 |
array.
|
|
5264 |
If the function returns KErrNotFound, this is the index of the
|
|
5265 |
first element in the array that is bigger than the element being
|
|
5266 |
searched for - if no elements in the array are bigger, then
|
|
5267 |
the index value is the same as the total number of elements in
|
|
5268 |
the array.
|
|
5269 |
@param anOrder A package encapsulating the function which determines the order
|
|
5270 |
of two class T objects.
|
|
5271 |
|
|
5272 |
@return KErrNone if a matching object is found. KErrNotFound if no matching
|
|
5273 |
object can be found.
|
|
5274 |
*/
|
|
5275 |
{return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder);}
|
|
5276 |
|
|
5277 |
|
|
5278 |
|
|
5279 |
|
|
5280 |
template <class T>
|
|
5281 |
inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const
|
|
5282 |
/**
|
|
5283 |
Finds the object in the array which matches the specified object using a binary
|
|
5284 |
search technique.
|
|
5285 |
|
|
5286 |
The element ordering is determined by a signed 32-bit word
|
|
5287 |
(the key) embedded in each array element. In the case that there is more than
|
|
5288 |
one matching element, finds the first, last or any match as specified by
|
|
5289 |
the value of aMode.
|
|
5290 |
|
|
5291 |
The function assumes that existing objects within the array are in signed
|
|
5292 |
key order.
|
|
5293 |
|
|
5294 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5295 |
@param aMode Specifies whether to find the first match, the last match or
|
|
5296 |
any match, as defined by one of the TArrayFindMode enum values.
|
|
5297 |
|
|
5298 |
@return KErrNotFound, if there is no matching element, otherwise the array
|
|
5299 |
index of a matching element - what the index refers to depends on the
|
|
5300 |
value of aMode:
|
|
5301 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
5302 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
5303 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
5304 |
the last matching element - if the last matching element is also the last element of
|
|
5305 |
the array, then the index value is the same as the total number of elements in the array.
|
|
5306 |
|
|
5307 |
@see TArrayFindMode
|
|
5308 |
*/
|
|
5309 |
{return RArrayBase::FindIsqSigned(&anEntry,aMode);}
|
|
5310 |
|
|
5311 |
|
|
5312 |
|
|
5313 |
|
|
5314 |
template <class T>
|
|
5315 |
inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const
|
|
5316 |
/**
|
|
5317 |
Finds the object in the array which matches the specified object using a binary
|
|
5318 |
search technique.
|
|
5319 |
|
|
5320 |
The element ordering is determined by an unsigned 32-bit word
|
|
5321 |
(the key) embedded in each array element. Where there is more than
|
|
5322 |
one matching element, it finds the first, last or any matching element
|
|
5323 |
as specified by the value of aMode.
|
|
5324 |
|
|
5325 |
The function assumes that existing objects within the array are in unsigned
|
|
5326 |
key order.
|
|
5327 |
|
|
5328 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5329 |
@param aMode Specifies whether to find the first match, the last match or
|
|
5330 |
any match, as defined by one of the TArrayFindMode enum values.
|
|
5331 |
|
|
5332 |
@return KErrNotFound, if there is no matching element, otherwise the array
|
|
5333 |
index of a matching element - what the index refers to depends on the
|
|
5334 |
value of aMode:
|
|
5335 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
5336 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
5337 |
if this is EArrayFindMode_Last, then the index refers to first element that follows the
|
|
5338 |
last matching element - if the last matching element is also the last element of the array,
|
|
5339 |
then the index value is the same as the total number of elements in the array.
|
|
5340 |
|
|
5341 |
@see TArrayFindMode
|
|
5342 |
*/
|
|
5343 |
{return RArrayBase::FindIsqUnsigned(&anEntry,aMode);}
|
|
5344 |
|
|
5345 |
|
|
5346 |
|
|
5347 |
|
|
5348 |
template <class T>
|
|
5349 |
inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const
|
|
5350 |
/**
|
|
5351 |
Finds the object in the array which matches the specified object using a binary
|
|
5352 |
search technique and an ordering algorithm.
|
|
5353 |
|
|
5354 |
Where there is more than one matching element, it finds the first, the last
|
|
5355 |
or any matching element as specified by the value of aMode.
|
|
5356 |
|
|
5357 |
The function assumes that existing objects within the array are in object
|
|
5358 |
order as determined by an algorithm supplied by the caller and packaged as
|
|
5359 |
a TLinearOrder<T> type.
|
|
5360 |
|
|
5361 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5362 |
@param anOrder A package encapsulating the function which determines the order
|
|
5363 |
of two class T objects.
|
|
5364 |
@param aMode Specifies whether to find the first match, the last match or any
|
|
5365 |
match, as defined by one of the TArrayFindMode enum values.
|
|
5366 |
|
|
5367 |
@return KErrNotFound, if there is no matching element, otherwise the array index
|
|
5368 |
of a matching element - what the index refers to depends on the value of
|
|
5369 |
aMode:
|
|
5370 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
5371 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
5372 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
5373 |
the last matching element - if the last matching element is also the last element of
|
|
5374 |
the array, then the index value is the same as the total number of elements in the array.
|
|
5375 |
*/
|
|
5376 |
{return RArrayBase::FindIsq(&anEntry,anOrder,aMode);}
|
|
5377 |
|
|
5378 |
|
|
5379 |
|
|
5380 |
|
|
5381 |
template <class T>
|
|
5382 |
inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const
|
|
5383 |
/**
|
|
5384 |
Finds the object in the array which matches the specified object using a binary
|
|
5385 |
search technique.
|
|
5386 |
|
|
5387 |
The element ordering is determined by a signed 32-bit word
|
|
5388 |
(the key) embedded in each array element. Where there is more than
|
|
5389 |
one matching element, finds the first, last or any matching element as
|
|
5390 |
specified specified by the value of aMode.
|
|
5391 |
|
|
5392 |
The function assumes that existing objects within the array are in signed
|
|
5393 |
key order.
|
|
5394 |
|
|
5395 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5396 |
@param anIndex A TInt type supplied by the caller. On return, it contains
|
|
5397 |
an index value depending on whether a match is found and on the
|
|
5398 |
value of aMode. If there is no matching element in the array,
|
|
5399 |
then this is the index of the first element in the array that
|
|
5400 |
is bigger than the element being searched for - if no elements
|
|
5401 |
in the array are bigger, then the index value is the same as the
|
|
5402 |
total number of elements in the array. If there is a matching
|
|
5403 |
element, then what the index refers to depends on the value of aMode:
|
|
5404 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
5405 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
5406 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
5407 |
the last matching element - if the last matching element is also the last element of
|
|
5408 |
the array, then the index value is the same as the total number of elements in the array.
|
|
5409 |
@param aMode Specifies whether to find the first match, the last match or any match,
|
|
5410 |
as defined by one of the TArrayFindMode enum values.
|
|
5411 |
|
|
5412 |
@return KErrNone, if a matching object pointer is found;
|
|
5413 |
KErrNotFound, if no suitable object pointer can be found.
|
|
5414 |
*/
|
|
5415 |
{return RArrayBase::BinarySearchSigned(&anEntry,anIndex,aMode);}
|
|
5416 |
|
|
5417 |
|
|
5418 |
|
|
5419 |
|
|
5420 |
template <class T>
|
|
5421 |
inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const
|
|
5422 |
/**
|
|
5423 |
Finds the object in the array which matches the specified object using a binary
|
|
5424 |
search technique.
|
|
5425 |
|
|
5426 |
The element ordering is determined by an unsigned 32-bit word
|
|
5427 |
(the key) embedded in each array element. Where there is more than
|
|
5428 |
one matching element, it finds the first, last or any matching element as
|
|
5429 |
specified by the value of aMode.
|
|
5430 |
|
|
5431 |
The function assumes that existing objects within the array are in unsigned
|
|
5432 |
key order.
|
|
5433 |
|
|
5434 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5435 |
@param anIndex A TInt type supplied by the caller. On return, it contains an index
|
|
5436 |
value depending on whether a match is found and on the value of aMode.
|
|
5437 |
If there is no matching element in the array, then this is the index
|
|
5438 |
of the first element in the array that is bigger than the element
|
|
5439 |
being searched for - if no elements in the array are bigger, then
|
|
5440 |
the index value is the same as the total number of elements in the array.
|
|
5441 |
If there is a matching element, then what the index refers to depends on
|
|
5442 |
the value of aMode:
|
|
5443 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
5444 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
5445 |
if this is EArrayFindMode_Last, then the index refers to first element that follows the
|
|
5446 |
last matching element - if the last matching element is also the last element of the array,
|
|
5447 |
then the index value is the same as the total number of elements in the array.
|
|
5448 |
@param aMode Specifies whether to find the first match, the last match or any match, as defined by one
|
|
5449 |
of the TArrayFindMode enum values.
|
|
5450 |
@return KErrNone, if a matching object pointer is found; KErrNotFound, if no suitable object pointer can be found.
|
|
5451 |
|
|
5452 |
@see TArrayFindMode
|
|
5453 |
*/
|
|
5454 |
{return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex,aMode);}
|
|
5455 |
|
|
5456 |
|
|
5457 |
|
|
5458 |
|
|
5459 |
template <class T>
|
|
5460 |
inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const
|
|
5461 |
/**
|
|
5462 |
Finds the object in the array which matches the specified object using a binary
|
|
5463 |
search technique and a specified ordering algorithm.
|
|
5464 |
|
|
5465 |
Where there is more than one matching element, it finds the first, the last or
|
|
5466 |
any matching element as specified by the value of aMode.
|
|
5467 |
|
|
5468 |
The function assumes that existing objects within the array are in object
|
|
5469 |
order as determined by an algorithm supplied by the caller and packaged as
|
|
5470 |
a TLinearOrder<T> type.
|
|
5471 |
|
|
5472 |
@param anEntry A reference to an object of type class T to be used for matching.
|
|
5473 |
@param anIndex A TInt type supplied by the caller. On return, it contains
|
|
5474 |
an index value depending on whether a match is found and on the
|
|
5475 |
value of aMode. If there is no matching element in the array,
|
|
5476 |
then this is the index of the first element in the array that
|
|
5477 |
is bigger than the element being searched for - if no elements
|
|
5478 |
in the array are bigger, then the index value is the same as
|
|
5479 |
the total number of elements in the array.
|
|
5480 |
If there is a matching element, then what the index refers to
|
|
5481 |
depends on the value of aMode:
|
|
5482 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
5483 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
5484 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
5485 |
the last matching element - if the last matching element is also
|
|
5486 |
the last element of the array, then the index value is the same as
|
|
5487 |
the total number of elements in the array.
|
|
5488 |
@param anOrder A package encapsulating the function which determines the order
|
|
5489 |
of two class T objects.
|
|
5490 |
@param aMode Specifies whether to find the first match, the last match or any match,
|
|
5491 |
as defined by one of the TArrayFindMode enum values.
|
|
5492 |
@return KErrNone, if a matching object pointer is found;
|
|
5493 |
KErrNotFound, if no suitable object pointer can be found.
|
|
5494 |
|
|
5495 |
*/
|
|
5496 |
{return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder,aMode);}
|
|
5497 |
|
|
5498 |
|
|
5499 |
|
|
5500 |
|
|
5501 |
template <class T>
|
|
5502 |
inline TInt RArray<T>::InsertInSignedKeyOrder(const T& anEntry)
|
|
5503 |
/**
|
|
5504 |
Inserts an object into the array in ascending signed key order.
|
|
5505 |
|
|
5506 |
The order of two class T type objects is based on comparing a TInt value
|
|
5507 |
located at the key offset position within the class T object.
|
|
5508 |
|
|
5509 |
No duplicate entries are permitted. The array remains unchanged following
|
|
5510 |
an attempt to insert a duplicate entry.
|
|
5511 |
|
|
5512 |
@param anEntry A reference to the object of type class T to be inserted.
|
|
5513 |
|
|
5514 |
@return KErrNone, if the insertion is successful;
|
|
5515 |
KErrAlreadyExists, if an attempt is being made
|
|
5516 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
5517 |
error codes.
|
|
5518 |
*/
|
|
5519 |
{return RArrayBase::InsertIsqSigned(&anEntry,EFalse);}
|
|
5520 |
|
|
5521 |
|
|
5522 |
|
|
5523 |
|
|
5524 |
template <class T>
|
|
5525 |
inline TInt RArray<T>::InsertInUnsignedKeyOrder(const T& anEntry)
|
|
5526 |
/**
|
|
5527 |
Inserts an object into the array in ascending unsigned key order.
|
|
5528 |
|
|
5529 |
The order of two class T type objects is based on comparing a TUint value
|
|
5530 |
located at the key offset position within the class T object.
|
|
5531 |
|
|
5532 |
No duplicate entries are permitted. The array remains unchanged following
|
|
5533 |
an attempt to insert a duplicate entry.
|
|
5534 |
|
|
5535 |
@param anEntry A reference to the object of type class T to be inserted.
|
|
5536 |
|
|
5537 |
@return KErrNone, if the insertion is successful;
|
|
5538 |
KErrAlreadyExists, if an attempt is being made
|
|
5539 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
5540 |
error codes.
|
|
5541 |
*/
|
|
5542 |
{return RArrayBase::InsertIsqUnsigned(&anEntry,EFalse);}
|
|
5543 |
|
|
5544 |
|
|
5545 |
|
|
5546 |
|
|
5547 |
template <class T>
|
|
5548 |
inline TInt RArray<T>::InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder)
|
|
5549 |
/**
|
|
5550 |
Inserts an object of into the array in object order.
|
|
5551 |
|
|
5552 |
The algorithm for determining the order of two class T type objects is provided
|
|
5553 |
by a function supplied by the caller.
|
|
5554 |
|
|
5555 |
No duplicate entries are permitted. The array remains unchanged following
|
|
5556 |
an attempt to insert a duplicate entry.
|
|
5557 |
|
|
5558 |
The function assumes that existing objects within the array are in object
|
|
5559 |
order.
|
|
5560 |
|
|
5561 |
@param anEntry A reference to the object of type class T to be inserted.
|
|
5562 |
@param anOrder A package encapsulating the function which determines the order
|
|
5563 |
of two class T objects.
|
|
5564 |
|
|
5565 |
@return KErrNone, if the insertion is successful;
|
|
5566 |
KErrAlreadyExists, if an attempt is being made
|
|
5567 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
5568 |
error codes.
|
|
5569 |
*/
|
|
5570 |
{return RArrayBase::InsertIsq(&anEntry,anOrder,EFalse);}
|
|
5571 |
|
|
5572 |
|
|
5573 |
|
|
5574 |
|
|
5575 |
template <class T>
|
|
5576 |
inline TInt RArray<T>::InsertInSignedKeyOrderAllowRepeats(const T& anEntry)
|
|
5577 |
/**
|
|
5578 |
Inserts an object into the array in ascending signed key order,
|
|
5579 |
allowing duplicates.
|
|
5580 |
|
|
5581 |
The order of two class T type objects is based on comparing a TInt value
|
|
5582 |
located at the key offset position within the class T object.
|
|
5583 |
|
|
5584 |
If anEntry is a duplicate of an existing object in the array, then the new
|
|
5585 |
object is inserted after the existing object. If more than one duplicate object
|
|
5586 |
already exists in the array, then any new duplicate object is inserted after
|
|
5587 |
the last one.
|
|
5588 |
|
|
5589 |
@param anEntry A reference to the object of type class T to be inserted.
|
|
5590 |
|
|
5591 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
5592 |
wide error codes.
|
|
5593 |
*/
|
|
5594 |
{return RArrayBase::InsertIsqSigned(&anEntry,ETrue);}
|
|
5595 |
|
|
5596 |
|
|
5597 |
|
|
5598 |
|
|
5599 |
template <class T>
|
|
5600 |
inline TInt RArray<T>::InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry)
|
|
5601 |
/**
|
|
5602 |
Inserts an object into the array in ascending unsigned key order, allowing
|
|
5603 |
duplicates.
|
|
5604 |
|
|
5605 |
The order of two class T type objects is based on comparing a TUint value
|
|
5606 |
located at the key offset position within the class T object.
|
|
5607 |
|
|
5608 |
If anEntry is a duplicate of an existing object in the array, then the new
|
|
5609 |
object is inserted after the existing object. If more than one duplicate object
|
|
5610 |
already exists in the array, then any new duplicate object is inserted after
|
|
5611 |
the last one.
|
|
5612 |
|
|
5613 |
@param anEntry A reference to the object of type class T to be inserted.
|
|
5614 |
|
|
5615 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
5616 |
wide error codes.
|
|
5617 |
*/
|
|
5618 |
{return RArrayBase::InsertIsqUnsigned(&anEntry,ETrue);}
|
|
5619 |
|
|
5620 |
|
|
5621 |
|
|
5622 |
|
|
5623 |
template <class T>
|
|
5624 |
inline TInt RArray<T>::InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder)
|
|
5625 |
/**
|
|
5626 |
Inserts an object into the array in object order, allowing duplicates.
|
|
5627 |
|
|
5628 |
The algorithm for determining the order of two class T type objects is provided
|
|
5629 |
by a function supplied by the caller.
|
|
5630 |
|
|
5631 |
If anEntry is a duplicate of an existing object in the array, then the new
|
|
5632 |
object is inserted after the existing object. If more than one duplicate object
|
|
5633 |
already exists in the array, then anEntry is inserted after the last one.
|
|
5634 |
|
|
5635 |
The function assumes that existing objects within the array are in object
|
|
5636 |
order.
|
|
5637 |
|
|
5638 |
@param anEntry A reference to the object of type class T to be inserted.
|
|
5639 |
@param anOrder A package encapsulating the function which determines the order
|
|
5640 |
of two class T objects.
|
|
5641 |
|
|
5642 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
5643 |
wide error codes.
|
|
5644 |
*/
|
|
5645 |
{return RArrayBase::InsertIsq(&anEntry,anOrder,ETrue);}
|
|
5646 |
|
|
5647 |
|
|
5648 |
|
|
5649 |
#ifndef __KERNEL_MODE__
|
|
5650 |
|
|
5651 |
template <class T>
|
|
5652 |
inline void RArray<T>::GranularCompress()
|
|
5653 |
/**
|
|
5654 |
Compresses the array down to a granular boundary.
|
|
5655 |
|
|
5656 |
After a call to this function, the memory allocated to the array is sufficient
|
|
5657 |
for its contained objects. Adding new objects to the array does not result
|
|
5658 |
in a re-allocation of memory until the the total number of objects reaches
|
|
5659 |
a multiple of the granularity.
|
|
5660 |
*/
|
|
5661 |
{RArrayBase::GranularCompress();}
|
|
5662 |
|
|
5663 |
|
|
5664 |
|
|
5665 |
|
|
5666 |
template <class T>
|
|
5667 |
inline TInt RArray<T>::Reserve(TInt aCount)
|
|
5668 |
/**
|
|
5669 |
Reserves space for the specified number of elements.
|
|
5670 |
|
|
5671 |
After a call to this function, the memory allocated to the array is sufficient
|
|
5672 |
to hold the number of objects specified. Adding new objects to the array
|
|
5673 |
does not result in a re-allocation of memory until the the total number of
|
|
5674 |
objects exceeds the specified count.
|
|
5675 |
|
|
5676 |
@param aCount The number of objects for which space should be reserved
|
|
5677 |
@return KErrNone If the operation completed successfully
|
|
5678 |
@return KErrNoMemory If the requested amount of memory could not be allocated
|
|
5679 |
*/
|
|
5680 |
{ return RArrayBase::DoReserve(aCount); }
|
|
5681 |
|
|
5682 |
|
|
5683 |
|
|
5684 |
|
|
5685 |
template <class T>
|
|
5686 |
inline void RArray<T>::SortSigned()
|
|
5687 |
/**
|
|
5688 |
Sorts the objects within the array; the sort order is assumed to be in signed
|
|
5689 |
integer order.
|
|
5690 |
*/
|
|
5691 |
{HeapSortSigned();}
|
|
5692 |
|
|
5693 |
|
|
5694 |
|
|
5695 |
|
|
5696 |
template <class T>
|
|
5697 |
inline void RArray<T>::SortUnsigned()
|
|
5698 |
/**
|
|
5699 |
Sorts the objects within the array; the sort order is assumed to be in unsigned
|
|
5700 |
integer order.
|
|
5701 |
*/
|
|
5702 |
{HeapSortUnsigned();}
|
|
5703 |
|
|
5704 |
|
|
5705 |
|
|
5706 |
|
|
5707 |
template <class T>
|
|
5708 |
inline void RArray<T>::Sort(TLinearOrder<T> anOrder)
|
|
5709 |
/**
|
|
5710 |
Sorts the objects within the array using the specified TLinearOrder.
|
|
5711 |
|
|
5712 |
The sort order is determined by an algorithm supplied by the caller and
|
|
5713 |
packaged as a TLinerOrder<T>.
|
|
5714 |
|
|
5715 |
@param anOrder A package encapsulating the function which determines the order
|
|
5716 |
of two class T type objects.
|
|
5717 |
*/
|
|
5718 |
{HeapSort(anOrder);}
|
|
5719 |
|
|
5720 |
|
|
5721 |
|
|
5722 |
|
|
5723 |
template <class T>
|
|
5724 |
inline TArray<T> RArray<T>::Array() const
|
|
5725 |
/**
|
|
5726 |
Constructs and returns a generic array.
|
|
5727 |
|
|
5728 |
@return A generic array representing this array.
|
|
5729 |
*/
|
|
5730 |
{ return TArray<T>(GetCount,GetElementPtr,(const CBase*)this); }
|
|
5731 |
#endif
|
|
5732 |
|
|
5733 |
|
|
5734 |
|
|
5735 |
|
|
5736 |
inline RArray<TInt>::RArray()
|
|
5737 |
: RPointerArrayBase()
|
|
5738 |
/**
|
|
5739 |
Constructs an array object for an array of signed integers with
|
|
5740 |
default granularity.
|
|
5741 |
|
|
5742 |
The default granularity is 8.
|
|
5743 |
*/
|
|
5744 |
{}
|
|
5745 |
|
|
5746 |
|
|
5747 |
|
|
5748 |
|
|
5749 |
inline RArray<TInt>::RArray(TInt aGranularity)
|
|
5750 |
: RPointerArrayBase(aGranularity)
|
|
5751 |
/**
|
|
5752 |
Constructs an array object for an array of signed integers with the specified
|
|
5753 |
granularity.
|
|
5754 |
|
|
5755 |
@param aGranularity The granularity of the array.
|
|
5756 |
|
|
5757 |
@panic USER 127, if aGranularity is not positive or is greater than or
|
|
5758 |
equal to 0x10000000.
|
|
5759 |
*/
|
|
5760 |
{}
|
|
5761 |
|
|
5762 |
|
|
5763 |
|
|
5764 |
|
|
5765 |
/**
|
|
5766 |
C++ constructor with minimum growth step and exponential growth factor.
|
|
5767 |
|
|
5768 |
This constructs an array object for an array of signed integers with the
|
|
5769 |
specified minimum growth step and exponential growth factor.
|
|
5770 |
|
|
5771 |
@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
|
|
5772 |
65535 inclusive.
|
|
5773 |
@param aFactor The factor by which the array grows, multiplied by 256.
|
|
5774 |
For example 512 specifies a factor of 2. Must be between 257
|
|
5775 |
and 32767 inclusive.
|
|
5776 |
|
|
5777 |
@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
|
|
5778 |
@panic USER 193, if aFactor<=257 or aFactor>32767.
|
|
5779 |
*/
|
|
5780 |
inline RArray<TInt>::RArray(TInt aMinGrowBy, TInt aFactor)
|
|
5781 |
: RPointerArrayBase(aMinGrowBy, aFactor)
|
|
5782 |
{}
|
|
5783 |
|
|
5784 |
|
|
5785 |
|
|
5786 |
|
|
5787 |
inline void RArray<TInt>::Close()
|
|
5788 |
/**
|
|
5789 |
Closes the array and frees all memory allocated to the array.
|
|
5790 |
|
|
5791 |
The function must be called before this array object goes out of scope.
|
|
5792 |
*/
|
|
5793 |
{RPointerArrayBase::Close();}
|
|
5794 |
|
|
5795 |
|
|
5796 |
|
|
5797 |
|
|
5798 |
inline TInt RArray<TInt>::Count() const
|
|
5799 |
/**
|
|
5800 |
Gets the number of signed integers in the array.
|
|
5801 |
|
|
5802 |
@return The number of signed integers in the array.
|
|
5803 |
*/
|
|
5804 |
{ return RPointerArrayBase::Count(); }
|
|
5805 |
|
|
5806 |
|
|
5807 |
|
|
5808 |
|
|
5809 |
inline const TInt& RArray<TInt>::operator[](TInt anIndex) const
|
|
5810 |
/**
|
|
5811 |
Gets a reference to the signed integer located at a specified position within
|
|
5812 |
the array.
|
|
5813 |
|
|
5814 |
The compiler chooses this function if the returned reference is used in an
|
|
5815 |
expression where the reference cannot be modified.
|
|
5816 |
|
|
5817 |
@param anIndex The position of the signed integer within the array. The
|
|
5818 |
position is relative to zero, i.e. zero implies the entry
|
|
5819 |
at the beginning of the array.
|
|
5820 |
|
|
5821 |
@return A const reference to the signed integer at position anIndex within
|
|
5822 |
the array.
|
|
5823 |
|
|
5824 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
5825 |
entries currently in the array.
|
|
5826 |
*/
|
|
5827 |
{return (const TInt&)At(anIndex);}
|
|
5828 |
|
|
5829 |
|
|
5830 |
|
|
5831 |
|
|
5832 |
inline TInt& RArray<TInt>::operator[](TInt anIndex)
|
|
5833 |
/**
|
|
5834 |
Gets a reference to the signed integer located at a specified position within
|
|
5835 |
the array.
|
|
5836 |
|
|
5837 |
The compiler chooses this function if the returned reference is used in an
|
|
5838 |
expression where the reference can be modified.
|
|
5839 |
|
|
5840 |
@param anIndex The position of the signed integer within the array. The
|
|
5841 |
position is relative to zero, i.e. zero implies the entry
|
|
5842 |
at the beginning of the array.
|
|
5843 |
|
|
5844 |
@return A non-const reference to the signed integer at position anIndex within
|
|
5845 |
the array.
|
|
5846 |
|
|
5847 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
5848 |
entries currently in the array.
|
|
5849 |
*/
|
|
5850 |
{return (TInt&)At(anIndex);}
|
|
5851 |
|
|
5852 |
|
|
5853 |
|
|
5854 |
|
|
5855 |
inline TInt RArray<TInt>::Append(TInt anEntry)
|
|
5856 |
/**
|
|
5857 |
Appends a signed integer onto the array.
|
|
5858 |
|
|
5859 |
@param anEntry The signed integer to be appended.
|
|
5860 |
|
|
5861 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
5862 |
wide error codes.
|
|
5863 |
*/
|
|
5864 |
{ return RPointerArrayBase::Append((const TAny*)anEntry); }
|
|
5865 |
|
|
5866 |
|
|
5867 |
|
|
5868 |
|
|
5869 |
inline TInt RArray<TInt>::Insert(TInt anEntry, TInt aPos)
|
|
5870 |
/**
|
|
5871 |
Inserts a signed integer into the array at the specified position.
|
|
5872 |
|
|
5873 |
@param anEntry The signed integer to be inserted.
|
|
5874 |
@param aPos The position within the array where the signed integer is to be
|
|
5875 |
inserted. The position is relative to zero, i.e. zero implies
|
|
5876 |
that an entry is inserted at the beginning of the array.
|
|
5877 |
|
|
5878 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
5879 |
wide error codes.
|
|
5880 |
|
|
5881 |
@panic USER 131, if aPos is negative, or is greater than the number of entries
|
|
5882 |
currently in the array.
|
|
5883 |
*/
|
|
5884 |
{ return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); }
|
|
5885 |
|
|
5886 |
|
|
5887 |
|
|
5888 |
|
|
5889 |
inline void RArray<TInt>::Remove(TInt anIndex)
|
|
5890 |
/**
|
|
5891 |
Removes the signed integer at the specified position from the array.
|
|
5892 |
|
|
5893 |
@param anIndex The position within the array from where the signed integer
|
|
5894 |
is to be removed. The position is relative to zero, i.e. zero
|
|
5895 |
implies that an entry at the beginning of the array is to be
|
|
5896 |
removed.
|
|
5897 |
|
|
5898 |
@panic USER 130, if anIndex is negative or is greater than the number of
|
|
5899 |
entries currently in the array.
|
|
5900 |
*/
|
|
5901 |
{RPointerArrayBase::Remove(anIndex);}
|
|
5902 |
|
|
5903 |
|
|
5904 |
|
|
5905 |
|
|
5906 |
inline void RArray<TInt>::Compress()
|
|
5907 |
/**
|
|
5908 |
Compresses the array down to a minimum.
|
|
5909 |
|
|
5910 |
After a call to this function, the memory allocated to the array is just
|
|
5911 |
sufficient for its entries. Subsequently adding a new signed integer to the
|
|
5912 |
array always results in a re-allocation of memory.
|
|
5913 |
*/
|
|
5914 |
{RPointerArrayBase::Compress();}
|
|
5915 |
|
|
5916 |
|
|
5917 |
|
|
5918 |
|
|
5919 |
inline void RArray<TInt>::Reset()
|
|
5920 |
/**
|
|
5921 |
Empties the array.
|
|
5922 |
|
|
5923 |
The function frees all memory allocated to the array and
|
|
5924 |
resets the internal state so that it is ready to be reused.
|
|
5925 |
|
|
5926 |
This array object can be allowed to go out of scope after a call to this
|
|
5927 |
function.
|
|
5928 |
*/
|
|
5929 |
{RPointerArrayBase::Reset();}
|
|
5930 |
|
|
5931 |
|
|
5932 |
|
|
5933 |
|
|
5934 |
inline TInt RArray<TInt>::Find(TInt anEntry) const
|
|
5935 |
/**
|
|
5936 |
Finds the first signed integer in the array which matches the specified signed
|
|
5937 |
integer using a sequential search.
|
|
5938 |
|
|
5939 |
The find operation always starts at the low index end of the array. There
|
|
5940 |
is no assumption about the order of entries in the array.
|
|
5941 |
|
|
5942 |
@param anEntry The signed integer to be found.
|
|
5943 |
|
|
5944 |
@return The index of the first matching signed integer within the array.
|
|
5945 |
KErrNotFound, if no matching entry can be found.
|
|
5946 |
*/
|
|
5947 |
{ return RPointerArrayBase::Find((const TAny*)anEntry); }
|
|
5948 |
|
|
5949 |
|
|
5950 |
|
|
5951 |
|
|
5952 |
inline TInt RArray<TInt>::FindReverse(TInt anEntry) const
|
|
5953 |
/**
|
|
5954 |
Finds the last signed integer in the array which matches the specified signed
|
|
5955 |
integer using a sequential search.
|
|
5956 |
|
|
5957 |
The find operation always starts at the high index end of the array. There
|
|
5958 |
is no assumption about the order of entries in the array.
|
|
5959 |
|
|
5960 |
@param anEntry The signed integer to be found.
|
|
5961 |
|
|
5962 |
@return The index of the last matching signed integer within the array.
|
|
5963 |
KErrNotFound, if no matching entry can be found.
|
|
5964 |
*/
|
|
5965 |
{ return RPointerArrayBase::FindReverse((const TAny*)anEntry); }
|
|
5966 |
|
|
5967 |
|
|
5968 |
|
|
5969 |
|
|
5970 |
inline TInt RArray<TInt>::FindInOrder(TInt anEntry) const
|
|
5971 |
/**
|
|
5972 |
Finds the signed integer in the array that matches the specified signed integer
|
|
5973 |
using a binary search technique.
|
|
5974 |
|
|
5975 |
The function assumes that the array is in signed integer order.
|
|
5976 |
|
|
5977 |
@param anEntry The signed integer to find.
|
|
5978 |
|
|
5979 |
@return The index of the matching signed integer within the array or KErrNotFound,
|
|
5980 |
if no match can be found.
|
|
5981 |
*/
|
|
5982 |
{ return RPointerArrayBase::FindIsqSigned(anEntry); }
|
|
5983 |
|
|
5984 |
|
|
5985 |
|
|
5986 |
|
|
5987 |
inline TInt RArray<TInt>::FindInOrder(TInt anEntry, TInt& anIndex) const
|
|
5988 |
/**
|
|
5989 |
Finds the signed integer in the array that matches the specified signed integer
|
|
5990 |
using a binary search technique.
|
|
5991 |
|
|
5992 |
The function assumes that the array is in signed integer order.
|
|
5993 |
|
|
5994 |
@param anEntry The signed integer to find.
|
|
5995 |
@param anIndex A TInt suplied by the caller. On return contains an index value.
|
|
5996 |
If the function returns KErrNone, this is the index of the
|
|
5997 |
matching signed integer within the array.
|
|
5998 |
If the function returns KErrNotFound, this is the index of the
|
|
5999 |
first signed integer within the array that is bigger than the
|
|
6000 |
signed integer being searched for - if no signed integers within
|
|
6001 |
the array are bigger, then the index value is the same as the
|
|
6002 |
total number of signed integers within the array.
|
|
6003 |
|
|
6004 |
@return KErrNone if a matching signed integer is found.
|
|
6005 |
KErrNotFound if no match can be found.
|
|
6006 |
*/
|
|
6007 |
{ return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex); }
|
|
6008 |
|
|
6009 |
|
|
6010 |
|
|
6011 |
|
|
6012 |
inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt aMode) const
|
|
6013 |
/**
|
|
6014 |
Finds the signed integer in the array that matches the specified signed integer
|
|
6015 |
using a binary search technique.
|
|
6016 |
|
|
6017 |
Where there is more than one matching element, it finds the first, last or any
|
|
6018 |
matching element as specified by the value of aMode.
|
|
6019 |
|
|
6020 |
The function assumes that the array is in signed integer order.
|
|
6021 |
|
|
6022 |
@param anEntry The signed integer to be found.
|
|
6023 |
@param aMode Specifies whether to find the first match, the last match or any
|
|
6024 |
match, as defined by one of the TArrayFindMode enum values.
|
|
6025 |
|
|
6026 |
@return KErrNotFound, if there is no matching element, otherwise the array
|
|
6027 |
index of a matching element - what the index refers to depends on the
|
|
6028 |
value of aMode:
|
|
6029 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
6030 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
6031 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
6032 |
the last matching element - if the last matching element is also the last element
|
|
6033 |
of the array, then the index value is the same as the total number of elements in
|
|
6034 |
the array.
|
|
6035 |
|
|
6036 |
@see TArrayFindMode
|
|
6037 |
*/
|
|
6038 |
{ return RPointerArrayBase::FindIsqSigned(anEntry,aMode); }
|
|
6039 |
|
|
6040 |
|
|
6041 |
|
|
6042 |
|
|
6043 |
inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const
|
|
6044 |
/**
|
|
6045 |
Finds the signed integer in the array that matches the specified signed integer
|
|
6046 |
using a binary search technique.
|
|
6047 |
|
|
6048 |
Where there is more than one matching element, it finds the first, last or any
|
|
6049 |
matching element as specified by the value of aMode.
|
|
6050 |
|
|
6051 |
The function assumes that the array is in signed integer order.
|
|
6052 |
|
|
6053 |
@param anEntry The signed integer to be found.
|
|
6054 |
@param anIndex A TInt type supplied by the caller. On return, it contains an index
|
|
6055 |
value depending on whether a match is found and on the value of aMode.
|
|
6056 |
If there is no matching element in the array, then this is the index of
|
|
6057 |
the first element in the array that is bigger than the element being
|
|
6058 |
searched for - if no elements in the array are bigger, then the index
|
|
6059 |
value is the same as the total number of elements in the array.
|
|
6060 |
If there is a matching element, then what the index refers to depends
|
|
6061 |
on the value of aMode:
|
|
6062 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
6063 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
6064 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
6065 |
the last matching element - if the last matching element is also the last element
|
|
6066 |
of the array, then the index value is the same as the total number of elements in the array.
|
|
6067 |
|
|
6068 |
@param aMode Specifies whether to find the first match, the last match or any match,
|
|
6069 |
as defined by one of the TArrayFindMode enum values.
|
|
6070 |
|
|
6071 |
@return KErrNone, if a matching element is found;
|
|
6072 |
KErrNotFound, if no suitable element can be found.
|
|
6073 |
|
|
6074 |
@see TArrayFindMode
|
|
6075 |
*/
|
|
6076 |
{ return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex,aMode); }
|
|
6077 |
|
|
6078 |
|
|
6079 |
|
|
6080 |
|
|
6081 |
inline TInt RArray<TInt>::InsertInOrder(TInt anEntry)
|
|
6082 |
/**
|
|
6083 |
Inserts a signed integer into the array in signed integer order.
|
|
6084 |
|
|
6085 |
No duplicate entries are permitted. The array remains unchanged following
|
|
6086 |
an attempt to insert a duplicate entry.
|
|
6087 |
|
|
6088 |
The function assumes that existing entries within the array are in signed
|
|
6089 |
integer order.
|
|
6090 |
|
|
6091 |
@param anEntry The signed integer to be inserted
|
|
6092 |
|
|
6093 |
@return KErrNone, if the insertion is successful;
|
|
6094 |
KErrAlreadyExists, if an attempt is being made
|
|
6095 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
6096 |
error codes.
|
|
6097 |
*/
|
|
6098 |
{ return RPointerArrayBase::InsertIsqSigned(anEntry,EFalse); }
|
|
6099 |
|
|
6100 |
|
|
6101 |
|
|
6102 |
|
|
6103 |
inline TInt RArray<TInt>::InsertInOrderAllowRepeats(TInt anEntry)
|
|
6104 |
/**
|
|
6105 |
Inserts a signed integer into the array in signed integer order,
|
|
6106 |
allowing duplicates.
|
|
6107 |
|
|
6108 |
If anEntry is a duplicate of an existing entry in the array, then the new
|
|
6109 |
signed integer is inserted after the existing one. If more than one duplicate
|
|
6110 |
entry already exists in the array, then any new duplicate signed integer is
|
|
6111 |
inserted after the last one.
|
|
6112 |
|
|
6113 |
The function assumes that existing entries within the array are in signed
|
|
6114 |
integer order.
|
|
6115 |
|
|
6116 |
@param anEntry The signed integer to be inserted.
|
|
6117 |
|
|
6118 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
6119 |
wide error codes.
|
|
6120 |
*/
|
|
6121 |
{ return RPointerArrayBase::InsertIsqSigned(anEntry,ETrue); }
|
|
6122 |
|
|
6123 |
|
|
6124 |
|
|
6125 |
|
|
6126 |
#ifndef __KERNEL_MODE__
|
|
6127 |
inline RArray<TInt>::RArray(TInt* aEntries, TInt aCount)
|
|
6128 |
: RPointerArrayBase((TAny**)aEntries, aCount)
|
|
6129 |
/**
|
|
6130 |
C++ constructor with a pointer to the first array entry in a
|
|
6131 |
pre-existing array, and the number of entries in that array.
|
|
6132 |
|
|
6133 |
This constructor takes a pointer to a pre-existing set of entries of type
|
|
6134 |
TInt objects. Ownership of the set of entries does not transfer to
|
|
6135 |
this RArray object.
|
|
6136 |
|
|
6137 |
The purpose of constructing an array in this way is to allow sorting and
|
|
6138 |
finding operations to be done without further allocation of memory.
|
|
6139 |
|
|
6140 |
@param aEntries A pointer to the first entry of type class TInt in the set of
|
|
6141 |
entries belonging to the existing array.
|
|
6142 |
@param aCount The number of entries in the existing array.
|
|
6143 |
*/
|
|
6144 |
{}
|
|
6145 |
|
|
6146 |
inline void RArray<TInt>::GranularCompress()
|
|
6147 |
/**
|
|
6148 |
Compresses the array down to a granular boundary.
|
|
6149 |
|
|
6150 |
After a call to this function, the memory allocated to the array is sufficient
|
|
6151 |
for its contained entries. Adding new signed integers to the array does not
|
|
6152 |
result in a re-allocation of memory until the total number of entries reaches
|
|
6153 |
a multiple of the granularity.
|
|
6154 |
*/
|
|
6155 |
{RPointerArrayBase::GranularCompress();}
|
|
6156 |
|
|
6157 |
|
|
6158 |
|
|
6159 |
|
|
6160 |
inline TInt RArray<TInt>::Reserve(TInt aCount)
|
|
6161 |
/**
|
|
6162 |
Reserves space for the specified number of elements.
|
|
6163 |
|
|
6164 |
After a call to this function, the memory allocated to the array is sufficient
|
|
6165 |
to hold the number of integers specified. Adding new integers to the array
|
|
6166 |
does not result in a re-allocation of memory until the the total number of
|
|
6167 |
integers exceeds the specified count.
|
|
6168 |
|
|
6169 |
@param aCount The number of integers for which space should be reserved
|
|
6170 |
@return KErrNone If the operation completed successfully
|
|
6171 |
@return KErrNoMemory If the requested amount of memory could not be allocated
|
|
6172 |
*/
|
|
6173 |
{ return RPointerArrayBase::DoReserve(aCount); }
|
|
6174 |
|
|
6175 |
|
|
6176 |
|
|
6177 |
|
|
6178 |
inline void RArray<TInt>::Sort()
|
|
6179 |
/**
|
|
6180 |
Sorts the array entries into signed integer order.
|
|
6181 |
*/
|
|
6182 |
{ HeapSortSigned(); }
|
|
6183 |
|
|
6184 |
|
|
6185 |
|
|
6186 |
|
|
6187 |
inline TArray<TInt> RArray<TInt>::Array() const
|
|
6188 |
/**
|
|
6189 |
Constructs and returns a generic array.
|
|
6190 |
|
|
6191 |
@return A generic array representing this array.
|
|
6192 |
|
|
6193 |
@see TArray
|
|
6194 |
*/
|
|
6195 |
{ return TArray<TInt>(GetCount,GetElementPtr,(const CBase*)this); }
|
|
6196 |
#endif
|
|
6197 |
|
|
6198 |
|
|
6199 |
|
|
6200 |
inline RArray<TUint>::RArray()
|
|
6201 |
: RPointerArrayBase()
|
|
6202 |
/**
|
|
6203 |
Default C++ constructor.
|
|
6204 |
|
|
6205 |
This constructs an array object for an array of unsigned
|
|
6206 |
integers with default granularity.
|
|
6207 |
|
|
6208 |
The default granularity of the array is 8.
|
|
6209 |
*/
|
|
6210 |
{}
|
|
6211 |
|
|
6212 |
|
|
6213 |
|
|
6214 |
|
|
6215 |
inline RArray<TUint>::RArray(TInt aGranularity)
|
|
6216 |
: RPointerArrayBase(aGranularity)
|
|
6217 |
/**
|
|
6218 |
Constructs an array object for an array of unsigned integers with the specified
|
|
6219 |
granularity.
|
|
6220 |
|
|
6221 |
@param aGranularity The granularity of the array.
|
|
6222 |
|
|
6223 |
@panic USER 127, if aGranularity is not positive or is greater than or
|
|
6224 |
equal to 0x10000000.
|
|
6225 |
*/
|
|
6226 |
{}
|
|
6227 |
|
|
6228 |
|
|
6229 |
|
|
6230 |
|
|
6231 |
/**
|
|
6232 |
C++ constructor with minimum growth step and exponential growth factor.
|
|
6233 |
|
|
6234 |
This constructs an array object for an array of unsigned integers with the
|
|
6235 |
specified minimum growth step and exponential growth factor.
|
|
6236 |
|
|
6237 |
@param aMinGrowBy The minimum growth step of the array. Must be between 1 and
|
|
6238 |
65535 inclusive.
|
|
6239 |
@param aFactor The factor by which the array grows, multiplied by 256.
|
|
6240 |
For example 512 specifies a factor of 2. Must be between 257
|
|
6241 |
and 32767 inclusive.
|
|
6242 |
|
|
6243 |
@panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
|
|
6244 |
@panic USER 193, if aFactor<=257 or aFactor>32767.
|
|
6245 |
*/
|
|
6246 |
inline RArray<TUint>::RArray(TInt aMinGrowBy, TInt aFactor)
|
|
6247 |
: RPointerArrayBase(aMinGrowBy, aFactor)
|
|
6248 |
{}
|
|
6249 |
|
|
6250 |
|
|
6251 |
|
|
6252 |
|
|
6253 |
inline void RArray<TUint>::Close()
|
|
6254 |
/**
|
|
6255 |
Closes the array and frees all memory allocated to the array.
|
|
6256 |
|
|
6257 |
The function must be called before this array object goes out of scope.
|
|
6258 |
*/
|
|
6259 |
{RPointerArrayBase::Close();}
|
|
6260 |
|
|
6261 |
|
|
6262 |
|
|
6263 |
|
|
6264 |
inline TInt RArray<TUint>::Count() const
|
|
6265 |
/**
|
|
6266 |
Gets the number of unsigned integers in the array.
|
|
6267 |
|
|
6268 |
@return The number of unsigned integers in the array.
|
|
6269 |
*/
|
|
6270 |
{return RPointerArrayBase::Count(); }
|
|
6271 |
|
|
6272 |
|
|
6273 |
|
|
6274 |
|
|
6275 |
inline const TUint& RArray<TUint>::operator[](TInt anIndex) const
|
|
6276 |
/**
|
|
6277 |
Gets a reference to the unsigned integer located at the specified position
|
|
6278 |
within the array.
|
|
6279 |
|
|
6280 |
The compiler uses this variant if the returned reference is used in an
|
|
6281 |
expression where the reference cannot be modified.
|
|
6282 |
|
|
6283 |
@param anIndex The position of the unsigned integer within the array, relative
|
|
6284 |
to zero, i.e. zero implies the entry at the beginning of
|
|
6285 |
the array.
|
|
6286 |
|
|
6287 |
@return A reference to the const unsigned integer at position anIndex within
|
|
6288 |
the array.
|
|
6289 |
|
|
6290 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
6291 |
entries currently in the array.
|
|
6292 |
*/
|
|
6293 |
{return (const TUint&)At(anIndex);}
|
|
6294 |
|
|
6295 |
|
|
6296 |
|
|
6297 |
|
|
6298 |
inline TUint& RArray<TUint>::operator[](TInt anIndex)
|
|
6299 |
/**
|
|
6300 |
Gets a reference to the unsigned integer located at the specified position
|
|
6301 |
within the array.
|
|
6302 |
|
|
6303 |
The compiler uses this variant if the returned reference is used in an
|
|
6304 |
expression where the reference can be modified.
|
|
6305 |
|
|
6306 |
@param anIndex The position of the unsigned integer within the array, relative
|
|
6307 |
to zero, i.e. zero implies the entry at the beginning of
|
|
6308 |
the array.
|
|
6309 |
|
|
6310 |
@return A reference to the non-const unsigned integer at position anIndex
|
|
6311 |
within the array.
|
|
6312 |
|
|
6313 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
6314 |
entries currently in the array.
|
|
6315 |
*/
|
|
6316 |
{return (TUint&)At(anIndex);}
|
|
6317 |
|
|
6318 |
|
|
6319 |
|
|
6320 |
|
|
6321 |
inline TInt RArray<TUint>::Append(TUint anEntry)
|
|
6322 |
/**
|
|
6323 |
Appends an unsigned integer onto the array.
|
|
6324 |
|
|
6325 |
@param anEntry The unsigned integer to be appended.
|
|
6326 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
6327 |
wide error codes.
|
|
6328 |
*/
|
|
6329 |
{ return RPointerArrayBase::Append((const TAny*)anEntry); }
|
|
6330 |
|
|
6331 |
|
|
6332 |
|
|
6333 |
|
|
6334 |
inline TInt RArray<TUint>::Insert(TUint anEntry, TInt aPos)
|
|
6335 |
/**
|
|
6336 |
Inserts an unsigned integer into the array at the specified position.
|
|
6337 |
|
|
6338 |
@param anEntry The unsigned integer to be inserted.
|
|
6339 |
@param aPos The position within the array where the unsigned integer is to
|
|
6340 |
be inserted. The position is relative to zero, i.e. zero
|
|
6341 |
implies that an entry is inserted at the beginning of
|
|
6342 |
the array.
|
|
6343 |
|
|
6344 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
6345 |
wide error codes.
|
|
6346 |
|
|
6347 |
@panic USER 131, if aPos is negative, or is greater than the number of entries
|
|
6348 |
currently in the array.
|
|
6349 |
*/
|
|
6350 |
{ return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); }
|
|
6351 |
|
|
6352 |
|
|
6353 |
|
|
6354 |
|
|
6355 |
inline void RArray<TUint>::Remove(TInt anIndex)
|
|
6356 |
/**
|
|
6357 |
Removes the unsigned integer at the specified position from the array.
|
|
6358 |
|
|
6359 |
@param anIndex The position within the array from where the unsigned integer
|
|
6360 |
is to be removed. The position is relative to zero, i.e. zero
|
|
6361 |
implies that an entry at the beginning of the array is to be
|
|
6362 |
removed.
|
|
6363 |
|
|
6364 |
|
|
6365 |
@panic USER 130, if anIndex is negative, or is greater than the number of
|
|
6366 |
entries currently in the array.
|
|
6367 |
*/
|
|
6368 |
{RPointerArrayBase::Remove(anIndex);}
|
|
6369 |
|
|
6370 |
|
|
6371 |
|
|
6372 |
|
|
6373 |
inline void RArray<TUint>::Compress()
|
|
6374 |
/**
|
|
6375 |
Compresses the array down to a minimum.
|
|
6376 |
|
|
6377 |
After a call to this function, the memory allocated to the array is just
|
|
6378 |
sufficient for its entries. Subsequently adding a new unsigned integer to the
|
|
6379 |
array always results in a re-allocation of memory.
|
|
6380 |
*/
|
|
6381 |
{RPointerArrayBase::Compress();}
|
|
6382 |
|
|
6383 |
|
|
6384 |
|
|
6385 |
|
|
6386 |
inline void RArray<TUint>::Reset()
|
|
6387 |
/**
|
|
6388 |
Empties the array.
|
|
6389 |
|
|
6390 |
It frees all memory allocated to the array and resets the
|
|
6391 |
internal state so that it is ready to be reused.
|
|
6392 |
|
|
6393 |
This array object can be allowed to go out of scope after a call to
|
|
6394 |
this function.
|
|
6395 |
*/
|
|
6396 |
{RPointerArrayBase::Reset();}
|
|
6397 |
|
|
6398 |
|
|
6399 |
|
|
6400 |
|
|
6401 |
inline TInt RArray<TUint>::Find(TUint anEntry) const
|
|
6402 |
/**
|
|
6403 |
Finds the first unsigned integer in the array which matches the specified
|
|
6404 |
value, using a sequential search.
|
|
6405 |
|
|
6406 |
The find operation always starts at the low index end of the array. There
|
|
6407 |
is no assumption about the order of entries in the array.
|
|
6408 |
|
|
6409 |
@param anEntry The unsigned integer to be found.
|
|
6410 |
|
|
6411 |
@return The index of the first matching unsigned integer within the array.
|
|
6412 |
KErrNotFound, if no matching entry can be found.
|
|
6413 |
*/
|
|
6414 |
{ return RPointerArrayBase::Find((const TAny*)anEntry); }
|
|
6415 |
|
|
6416 |
|
|
6417 |
|
|
6418 |
|
|
6419 |
inline TInt RArray<TUint>::FindReverse(TUint anEntry) const
|
|
6420 |
/**
|
|
6421 |
Finds the last unsigned integer in the array which matches the specified
|
|
6422 |
value, using a sequential search.
|
|
6423 |
|
|
6424 |
The find operation always starts at the high index end of the array. There
|
|
6425 |
is no assumption about the order of entries in the array.
|
|
6426 |
|
|
6427 |
@param anEntry The unsigned integer to be found.
|
|
6428 |
|
|
6429 |
@return The index of the last matching unsigned integer within the array.
|
|
6430 |
KErrNotFound, if no matching entry can be found.
|
|
6431 |
*/
|
|
6432 |
{ return RPointerArrayBase::FindReverse((const TAny*)anEntry); }
|
|
6433 |
|
|
6434 |
|
|
6435 |
|
|
6436 |
|
|
6437 |
inline TInt RArray<TUint>::FindInOrder(TUint anEntry) const
|
|
6438 |
/**
|
|
6439 |
Finds the unsigned integer in the array which matches the specified value,
|
|
6440 |
using a binary search technique.
|
|
6441 |
|
|
6442 |
The functions assume that existing entries within the array are in unsigned
|
|
6443 |
integer order.
|
|
6444 |
|
|
6445 |
@param anEntry The unsigned integer to be found.
|
|
6446 |
|
|
6447 |
@return This is either: the index of the matching unsigned integer within the
|
|
6448 |
array;
|
|
6449 |
KErrNotFound, if no suitable entry can be found.
|
|
6450 |
*/
|
|
6451 |
{ return RPointerArrayBase::FindIsqUnsigned(anEntry); }
|
|
6452 |
|
|
6453 |
|
|
6454 |
|
|
6455 |
|
|
6456 |
inline TInt RArray<TUint>::FindInOrder(TUint anEntry, TInt& anIndex) const
|
|
6457 |
/**
|
|
6458 |
Finds the unsigned integer in the array which matches the specified value,
|
|
6459 |
using a binary search technique.
|
|
6460 |
|
|
6461 |
If the index cannot be found, the function returns the index of the last
|
|
6462 |
unsigned integer within the array which logically precedes anEntry.
|
|
6463 |
|
|
6464 |
The functions assume that existing entries within the array are in unsigned
|
|
6465 |
integer order.
|
|
6466 |
|
|
6467 |
@param anEntry The unsigned integer to be found.
|
|
6468 |
@param anIndex A TInt supplied by the caller. On return, contains an index
|
|
6469 |
value.
|
|
6470 |
If the function returns KErrNone, this is the index of the
|
|
6471 |
matching unsigned integer within the array.
|
|
6472 |
If the function returns KErrNotFound, this is the index of the
|
|
6473 |
first unsigned integer within the array that is bigger than the
|
|
6474 |
unsigned integer being searched for - if no unsigned integers within
|
|
6475 |
the array are bigger, then the index value is the same as the
|
|
6476 |
total number of unsigned integers within the array.
|
|
6477 |
@return KErrNone, if a matching unsigned integer is found.
|
|
6478 |
KErrNotFound, if no suitable entry can be found.
|
|
6479 |
*/
|
|
6480 |
{ return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex); }
|
|
6481 |
|
|
6482 |
|
|
6483 |
|
|
6484 |
|
|
6485 |
inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt aMode) const
|
|
6486 |
/**
|
|
6487 |
Finds the unsigned integer in the array that matches the specified unsigned integer
|
|
6488 |
using a binary search technique.
|
|
6489 |
|
|
6490 |
In the case that there is more than one matching element, finds the first, last
|
|
6491 |
or any match as specified by the value of aMode.
|
|
6492 |
|
|
6493 |
The function assumes that the array is in unsigned integer order.
|
|
6494 |
|
|
6495 |
@param anEntry The unsigned integer to be found..
|
|
6496 |
@param aMode Specifies whether to find the first match, the last match or any match,
|
|
6497 |
as defined by one of the TArrayFindMode enum values.
|
|
6498 |
|
|
6499 |
@return KErrNotFound, if there is no matching element, otherwise the array index of
|
|
6500 |
a matching element - what the index refers to depends on the value of
|
|
6501 |
aMode:
|
|
6502 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
6503 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
6504 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
6505 |
the last matching element - if the last matching element is also the last element of
|
|
6506 |
the array, then the index value is the same as the total number of elements in the array.
|
|
6507 |
|
|
6508 |
@see TArrayFindMode
|
|
6509 |
*/
|
|
6510 |
{ return RPointerArrayBase::FindIsqUnsigned(anEntry,aMode); }
|
|
6511 |
|
|
6512 |
|
|
6513 |
|
|
6514 |
|
|
6515 |
inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const
|
|
6516 |
/**
|
|
6517 |
Finds the unsigned integer in the array that matches the specified unsigned integer
|
|
6518 |
using a binary search technique.
|
|
6519 |
|
|
6520 |
In the case that there is more than one matching element, finds the first, last or any match as specified.
|
|
6521 |
|
|
6522 |
The function assumes that the array is in unsigned integer order.
|
|
6523 |
|
|
6524 |
@param anEntry The unsigned integer to be found.
|
|
6525 |
@param anIndex A TInt type supplied by the caller. On return, it contains an index
|
|
6526 |
value depending on whether a match is found and on the value of aMode.
|
|
6527 |
If there is no matching element in the array, then this is the index
|
|
6528 |
of the first element in the array that is bigger than the element being
|
|
6529 |
searched for - if no elements in the array are bigger, then the index
|
|
6530 |
value is the same as the total number of elements in the array.
|
|
6531 |
If there is a matching element, then what the index refers to depends
|
|
6532 |
on the value of aMode:
|
|
6533 |
if this is EArrayFindMode_First, then the index refers to the first matching element;
|
|
6534 |
if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
|
|
6535 |
if this is EArrayFindMode_Last, then the index refers to first element that follows
|
|
6536 |
the last matching element - if the last matching element is also the last element of the array,
|
|
6537 |
then the index value is the same as the total number of elements in the array.
|
|
6538 |
@param aMode Specifies whether to find the first match, the last match or any match, as defined by one
|
|
6539 |
of the TArrayFindMode enum values.
|
|
6540 |
|
|
6541 |
@return KErrNone, if a matching entry is found; KErrNotFound, if no matching entry exists.
|
|
6542 |
|
|
6543 |
@see TArrayFindMode
|
|
6544 |
*/
|
|
6545 |
{ return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex,aMode); }
|
|
6546 |
|
|
6547 |
|
|
6548 |
|
|
6549 |
|
|
6550 |
inline TInt RArray<TUint>::InsertInOrder(TUint anEntry)
|
|
6551 |
/**
|
|
6552 |
Inserts an unsigned integer into the array in unsigned integer order.
|
|
6553 |
|
|
6554 |
No duplicate entries are permitted. The array remains unchanged following
|
|
6555 |
an attempt to insert a duplicate entry.
|
|
6556 |
|
|
6557 |
The function assumes that existing entries within the array are in unsigned
|
|
6558 |
integer order.
|
|
6559 |
|
|
6560 |
@param anEntry The unsigned integer to be inserted.
|
|
6561 |
|
|
6562 |
@return KErrNone, if the insertion is successful;
|
|
6563 |
KErrAlreadyExists, if an attempt is being made
|
|
6564 |
to insert a duplicate entry; otherwise one of the other system wide
|
|
6565 |
error codes.
|
|
6566 |
*/
|
|
6567 |
{ return RPointerArrayBase::InsertIsqUnsigned(anEntry,EFalse); }
|
|
6568 |
|
|
6569 |
|
|
6570 |
|
|
6571 |
|
|
6572 |
inline TInt RArray<TUint>::InsertInOrderAllowRepeats(TUint anEntry)
|
|
6573 |
/**
|
|
6574 |
Inserts an unsigned integer into the array in unsigned integer order, allowing
|
|
6575 |
duplicates.
|
|
6576 |
|
|
6577 |
If the new integer is a duplicate of an existing entry in the array, then
|
|
6578 |
the new unsigned integer is inserted after the existing one. If more than
|
|
6579 |
one duplicate entry already exists in the array, then any new duplicate
|
|
6580 |
unsigned integer is inserted after the last one.
|
|
6581 |
|
|
6582 |
The function assumes that existing entries within the array are in unsigned
|
|
6583 |
integer order.
|
|
6584 |
|
|
6585 |
@param anEntry The unsigned integer to be inserted.
|
|
6586 |
|
|
6587 |
@return KErrNone, if the insertion is successful, otherwise one of the system
|
|
6588 |
wide error codes.
|
|
6589 |
*/
|
|
6590 |
{ return RPointerArrayBase::InsertIsqUnsigned(anEntry,ETrue); }
|
|
6591 |
|
|
6592 |
|
|
6593 |
|
|
6594 |
|
|
6595 |
#ifndef __KERNEL_MODE__
|
|
6596 |
inline RArray<TUint>::RArray(TUint* aEntries, TInt aCount)
|
|
6597 |
: RPointerArrayBase((TAny**)aEntries, aCount)
|
|
6598 |
/**
|
|
6599 |
C++ constructor with a pointer to the first array entry in a
|
|
6600 |
pre-existing array, and the number of entries in that array.
|
|
6601 |
|
|
6602 |
This constructor takes a pointer to a pre-existing set of entries of type
|
|
6603 |
TUint objects. Ownership of the set of entries does not transfer to
|
|
6604 |
this RArray object.
|
|
6605 |
|
|
6606 |
The purpose of constructing an array in this way is to allow sorting and
|
|
6607 |
finding operations to be done without further allocation of memory.
|
|
6608 |
|
|
6609 |
@param aEntries A pointer to the first entry of type class TUint in the set of
|
|
6610 |
entries belonging to the existing array.
|
|
6611 |
@param aCount The number of entries in the existing array.
|
|
6612 |
*/
|
|
6613 |
{}
|
|
6614 |
|
|
6615 |
|
|
6616 |
|
|
6617 |
inline void RArray<TUint>::GranularCompress()
|
|
6618 |
/**
|
|
6619 |
Compresses the array down to a granular boundary.
|
|
6620 |
|
|
6621 |
After a call to this function, the memory allocated to the array is sufficient
|
|
6622 |
for its contained entries. Adding new unsigned integers to the array does not
|
|
6623 |
result in a re-allocation of memory until the total number of entries reaches
|
|
6624 |
a multiple of the granularity.
|
|
6625 |
*/
|
|
6626 |
{RPointerArrayBase::GranularCompress();}
|
|
6627 |
|
|
6628 |
|
|
6629 |
|
|
6630 |
|
|
6631 |
inline TInt RArray<TUint>::Reserve(TInt aCount)
|
|
6632 |
/**
|
|
6633 |
Reserves space for the specified number of elements.
|
|
6634 |
|
|
6635 |
After a call to this function, the memory allocated to the array is sufficient
|
|
6636 |
to hold the number of integers specified. Adding new integers to the array
|
|
6637 |
does not result in a re-allocation of memory until the the total number of
|
|
6638 |
integers exceeds the specified count.
|
|
6639 |
|
|
6640 |
@param aCount The number of integers for which space should be reserved
|
|
6641 |
@return KErrNone If the operation completed successfully
|
|
6642 |
@return KErrNoMemory If the requested amount of memory could not be allocated
|
|
6643 |
*/
|
|
6644 |
{ return RPointerArrayBase::DoReserve(aCount); }
|
|
6645 |
|
|
6646 |
|
|
6647 |
|
|
6648 |
|
|
6649 |
inline void RArray<TUint>::Sort()
|
|
6650 |
/**
|
|
6651 |
Sorts the array entries into unsigned integer order.
|
|
6652 |
*/
|
|
6653 |
{ HeapSortUnsigned(); }
|
|
6654 |
|
|
6655 |
|
|
6656 |
|
|
6657 |
|
|
6658 |
inline TArray<TUint> RArray<TUint>::Array() const
|
|
6659 |
/**
|
|
6660 |
Constructs and returns a generic array.
|
|
6661 |
|
|
6662 |
@return A generic array representing this array.
|
|
6663 |
|
|
6664 |
@see TArray
|
|
6665 |
*/
|
|
6666 |
{ return TArray<TUint>(GetCount,GetElementPtr,(const CBase*)this); }
|
|
6667 |
#endif
|
|
6668 |
|
|
6669 |
|
|
6670 |
|
|
6671 |
|
|
6672 |
/**
|
|
6673 |
Sets an argument to default value and type.
|
|
6674 |
*/
|
|
6675 |
inline void TIpcArgs::Set(TInt,TNothing)
|
|
6676 |
{}
|
|
6677 |
|
|
6678 |
|
|
6679 |
|
|
6680 |
|
|
6681 |
/**
|
|
6682 |
Sets an argument value of TInt type.
|
|
6683 |
|
|
6684 |
@param aIndex An index value that identifies the slot in the array of arguments
|
|
6685 |
into which the argument value is to be placed.
|
|
6686 |
This must be a value in the range 0 to 3.
|
|
6687 |
@param aValue The argument value.
|
|
6688 |
*/
|
|
6689 |
inline void TIpcArgs::Set(TInt aIndex,TInt aValue)
|
|
6690 |
{
|
|
6691 |
iArgs[aIndex] = aValue;
|
|
6692 |
iFlags |= EUnspecified<<(aIndex*KBitsPerType);
|
|
6693 |
}
|
|
6694 |
|
|
6695 |
|
|
6696 |
|
|
6697 |
|
|
6698 |
/**
|
|
6699 |
Sets an argument value of TAny* type.
|
|
6700 |
|
|
6701 |
@param aIndex An index value that identifies the slot in the array of arguments
|
|
6702 |
into which the argument value is to be placed.
|
|
6703 |
This must be a value in the range 0 to 3.
|
|
6704 |
@param aValue The argument value.
|
|
6705 |
*/
|
|
6706 |
inline void TIpcArgs::Set(TInt aIndex,const TAny* aValue)
|
|
6707 |
{
|
|
6708 |
iArgs[aIndex] = (TInt)aValue;
|
|
6709 |
iFlags |= EUnspecified<<(aIndex*KBitsPerType);
|
|
6710 |
}
|
|
6711 |
|
|
6712 |
|
|
6713 |
|
|
6714 |
|
|
6715 |
/**
|
|
6716 |
Sets an argument value of RHandleBase type.
|
|
6717 |
|
|
6718 |
@param aIndex An index value that identifies the slot in the array of arguments
|
|
6719 |
into which the argument value is to be placed.
|
|
6720 |
This must be a value in the range 0 to 3.
|
|
6721 |
@param aValue The argument value.
|
|
6722 |
*/
|
|
6723 |
inline void TIpcArgs::Set(TInt aIndex,RHandleBase aValue)
|
|
6724 |
{
|
|
6725 |
iArgs[aIndex] = (TInt)aValue.Handle();
|
|
6726 |
iFlags |= EHandle<<(aIndex*KBitsPerType);
|
|
6727 |
}
|
|
6728 |
|
|
6729 |
|
|
6730 |
|
|
6731 |
|
|
6732 |
/**
|
|
6733 |
Sets an argument value TDesC8* type.
|
|
6734 |
|
|
6735 |
@param aIndex An index value that identifies the slot in the array of arguments
|
|
6736 |
into which the argument value is to be placed.
|
|
6737 |
This must be a value in the range 0 to 3.
|
|
6738 |
@param aValue The argument value.
|
|
6739 |
*/
|
|
6740 |
inline void TIpcArgs::Set(TInt aIndex,const TDesC8* aValue)
|
|
6741 |
{
|
|
6742 |
iArgs[aIndex] = (TInt)aValue;
|
|
6743 |
iFlags |= EDesC8<<(aIndex*KBitsPerType);
|
|
6744 |
}
|
|
6745 |
|
|
6746 |
|
|
6747 |
|
|
6748 |
|
|
6749 |
#ifndef __KERNEL_MODE__
|
|
6750 |
|
|
6751 |
/**
|
|
6752 |
Sets an argument value of TDesC16* type.
|
|
6753 |
|
|
6754 |
@param aIndex An index value that identifies the slot in the array of arguments
|
|
6755 |
into which the argument value is to be placed.
|
|
6756 |
This must be a value in the range 0 to 3.
|
|
6757 |
@param aValue The argument value.
|
|
6758 |
*/
|
|
6759 |
inline void TIpcArgs::Set(TInt aIndex,const TDesC16* aValue)
|
|
6760 |
{
|
|
6761 |
iArgs[aIndex] = (TInt)aValue;
|
|
6762 |
iFlags |= EDesC16<<(aIndex*KBitsPerType);
|
|
6763 |
}
|
|
6764 |
|
|
6765 |
#endif
|
|
6766 |
|
|
6767 |
|
|
6768 |
|
|
6769 |
|
|
6770 |
/**
|
|
6771 |
Sets an argument value of TDes8* type.
|
|
6772 |
|
|
6773 |
@param aIndex An index value that identifies the slot in the array of arguments
|
|
6774 |
into which the argument value is to be placed.
|
|
6775 |
This must be a value in the range 0 to 3.
|
|
6776 |
@param aValue The argument value.
|
|
6777 |
*/
|
|
6778 |
inline void TIpcArgs::Set(TInt aIndex,TDes8* aValue)
|
|
6779 |
{
|
|
6780 |
iArgs[aIndex] = (TInt)aValue;
|
|
6781 |
iFlags |= EDes8<<(aIndex*KBitsPerType);
|
|
6782 |
}
|
|
6783 |
|
|
6784 |
|
|
6785 |
|
|
6786 |
|
|
6787 |
#ifndef __KERNEL_MODE__
|
|
6788 |
|
|
6789 |
/**
|
|
6790 |
Sets an argument value of TDes16* type.
|
|
6791 |
|
|
6792 |
@param aIndex An index value that identifies the slot in the array of arguments
|
|
6793 |
into which the argument value is to be placed.
|
|
6794 |
This must be a value in the range 0 to 3.
|
|
6795 |
@param aValue The argument value.
|
|
6796 |
*/
|
|
6797 |
inline void TIpcArgs::Set(TInt aIndex,TDes16* aValue)
|
|
6798 |
{
|
|
6799 |
iArgs[aIndex] = (TInt)aValue;
|
|
6800 |
iFlags |= EDes16<<(aIndex*KBitsPerType);
|
|
6801 |
}
|
|
6802 |
|
|
6803 |
#endif
|
|
6804 |
|
|
6805 |
|
|
6806 |
/**
|
|
6807 |
Allows the client to specify whether each argument of the TIpcArgs object will
|
|
6808 |
be pinned before being sent to the server.
|
|
6809 |
|
|
6810 |
To pin all the arguments in the TIpcArgs object pass no parameters to this
|
|
6811 |
method.
|
|
6812 |
|
|
6813 |
@return A reference to this TIpcArgs object that can be passed as a parameter to
|
|
6814 |
one of the overloads the DSession::Send() and DSession::SendReceive() methods.
|
|
6815 |
*/
|
|
6816 |
inline TIpcArgs& TIpcArgs::PinArgs(TBool aPinArg0, TBool aPinArg1, TBool aPinArg2, TBool aPinArg3)
|
|
6817 |
{
|
|
6818 |
__ASSERT_COMPILE(!((1 << ((KBitsPerType*KMaxMessageArguments)-1)) & KPinMask));
|
|
6819 |
if (aPinArg0)
|
|
6820 |
iFlags |= KPinArg0;
|
|
6821 |
if (aPinArg1)
|
|
6822 |
iFlags |= KPinArg1;
|
|
6823 |
if (aPinArg2)
|
|
6824 |
iFlags |= KPinArg2;
|
|
6825 |
if (aPinArg3)
|
|
6826 |
iFlags |= KPinArg3;
|
|
6827 |
return *this;
|
|
6828 |
}
|
|
6829 |
|
|
6830 |
|
|
6831 |
inline TIpcArgs::TArgType TIpcArgs::Type(TNothing)
|
|
6832 |
{ return EUnspecified; }
|
|
6833 |
inline TIpcArgs::TArgType TIpcArgs::Type(TInt)
|
|
6834 |
{ return EUnspecified; }
|
|
6835 |
inline TIpcArgs::TArgType TIpcArgs::Type(const TAny*)
|
|
6836 |
{ return EUnspecified; }
|
|
6837 |
inline TIpcArgs::TArgType TIpcArgs::Type(RHandleBase)
|
|
6838 |
{ return EHandle; }
|
|
6839 |
inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC8*)
|
|
6840 |
{ return EDesC8; }
|
|
6841 |
#ifndef __KERNEL_MODE__
|
|
6842 |
inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC16*)
|
|
6843 |
{ return EDesC16; }
|
|
6844 |
#endif
|
|
6845 |
inline TIpcArgs::TArgType TIpcArgs::Type(TDes8*)
|
|
6846 |
{ return EDes8; }
|
|
6847 |
#ifndef __KERNEL_MODE__
|
|
6848 |
inline TIpcArgs::TArgType TIpcArgs::Type(TDes16*)
|
|
6849 |
{ return EDes16; }
|
|
6850 |
#endif
|
|
6851 |
inline void TIpcArgs::Assign(TInt&,TIpcArgs::TNothing)
|
|
6852 |
{}
|
|
6853 |
inline void TIpcArgs::Assign(TInt& aArg,TInt aValue)
|
|
6854 |
{ aArg = aValue; }
|
|
6855 |
inline void TIpcArgs::Assign(TInt& aArg,const TAny* aValue)
|
|
6856 |
{ aArg = (TInt)aValue; }
|
|
6857 |
inline void TIpcArgs::Assign(TInt& aArg,RHandleBase aValue)
|
|
6858 |
{ aArg = (TInt)aValue.Handle(); }
|
|
6859 |
inline void TIpcArgs::Assign(TInt& aArg,const TDesC8* aValue)
|
|
6860 |
{ aArg = (TInt)aValue; }
|
|
6861 |
#ifndef __KERNEL_MODE__
|
|
6862 |
inline void TIpcArgs::Assign(TInt& aArg,const TDesC16* aValue)
|
|
6863 |
{ aArg = (TInt)aValue; }
|
|
6864 |
#endif
|
|
6865 |
inline void TIpcArgs::Assign(TInt& aArg,TDes8* aValue)
|
|
6866 |
{ aArg = (TInt)aValue; }
|
|
6867 |
#ifndef __KERNEL_MODE__
|
|
6868 |
inline void TIpcArgs::Assign(TInt& aArg,TDes16* aValue)
|
|
6869 |
{ aArg = (TInt)aValue; }
|
|
6870 |
#endif
|
|
6871 |
|
|
6872 |
|
|
6873 |
|
|
6874 |
// Structures for passing 64 bit integers and doubles across GCC/EABI boundaries
|
|
6875 |
|
|
6876 |
inline SInt64::SInt64()
|
|
6877 |
{}
|
|
6878 |
|
|
6879 |
inline SInt64::SInt64(Int64 a)
|
|
6880 |
{
|
|
6881 |
iData[0] = (TUint32)((Uint64)a);
|
|
6882 |
iData[1] = (TUint32)(((Uint64)a)>>32);
|
|
6883 |
}
|
|
6884 |
|
|
6885 |
inline SInt64& SInt64::operator=(Int64 a)
|
|
6886 |
{
|
|
6887 |
iData[0] = (TUint32)((Uint64)a);
|
|
6888 |
iData[1] = (TUint32)(((Uint64)a)>>32);
|
|
6889 |
return *this;
|
|
6890 |
}
|
|
6891 |
|
|
6892 |
inline SInt64::operator Int64() const
|
|
6893 |
{
|
|
6894 |
Int64 x;
|
|
6895 |
TUint32* px = (TUint32*)&x;
|
|
6896 |
px[0] = iData[0];
|
|
6897 |
px[1] = iData[1];
|
|
6898 |
return x;
|
|
6899 |
}
|
|
6900 |
|
|
6901 |
inline SUint64::SUint64()
|
|
6902 |
{}
|
|
6903 |
|
|
6904 |
inline SUint64::SUint64(Uint64 a)
|
|
6905 |
{
|
|
6906 |
iData[0] = (TUint32)a;
|
|
6907 |
iData[1] = (TUint32)(a>>32);
|
|
6908 |
}
|
|
6909 |
|
|
6910 |
inline SUint64& SUint64::operator=(Uint64 a)
|
|
6911 |
{
|
|
6912 |
iData[0] = (TUint32)a;
|
|
6913 |
iData[1] = (TUint32)(a>>32);
|
|
6914 |
return *this;
|
|
6915 |
}
|
|
6916 |
|
|
6917 |
inline SUint64::operator Uint64() const
|
|
6918 |
{
|
|
6919 |
Uint64 x;
|
|
6920 |
TUint32* px = (TUint32*)&x;
|
|
6921 |
px[0] = iData[0];
|
|
6922 |
px[1] = iData[1];
|
|
6923 |
return x;
|
|
6924 |
}
|
|
6925 |
|
|
6926 |
inline SDouble::SDouble()
|
|
6927 |
{}
|
|
6928 |
|
|
6929 |
inline SDouble::SDouble(TReal a)
|
|
6930 |
{
|
|
6931 |
const TUint32* pa = (const TUint32*)&a;
|
|
6932 |
#ifdef __DOUBLE_WORDS_SWAPPED__
|
|
6933 |
iData[0] = pa[1];
|
|
6934 |
iData[1] = pa[0]; // compiler puts MS word of double first
|
|
6935 |
#else
|
|
6936 |
iData[0] = pa[0];
|
|
6937 |
iData[1] = pa[1]; // compiler puts MS word of double second
|
|
6938 |
#endif
|
|
6939 |
}
|
|
6940 |
|
|
6941 |
inline SDouble& SDouble::operator=(TReal a)
|
|
6942 |
{
|
|
6943 |
new (this) SDouble(a);
|
|
6944 |
return *this;
|
|
6945 |
}
|
|
6946 |
|
|
6947 |
inline SDouble::operator TReal() const
|
|
6948 |
{
|
|
6949 |
TReal x;
|
|
6950 |
TUint32* px = (TUint32*)&x;
|
|
6951 |
#ifdef __DOUBLE_WORDS_SWAPPED__
|
|
6952 |
px[1] = iData[0];
|
|
6953 |
px[0] = iData[1]; // compiler puts MS word of double first
|
|
6954 |
#else
|
|
6955 |
px[0] = iData[0];
|
|
6956 |
px[1] = iData[1]; // compiler puts MS word of double second
|
|
6957 |
#endif
|
|
6958 |
return x;
|
|
6959 |
}
|
|
6960 |
|
|
6961 |
//
|
|
6962 |
// TSecureId
|
|
6963 |
//
|
|
6964 |
|
|
6965 |
/** Default constructor. This leaves the object in an undefined state */
|
|
6966 |
inline TSecureId::TSecureId()
|
|
6967 |
{}
|
|
6968 |
|
|
6969 |
/** Construct 'this' using a TUint32
|
|
6970 |
@param aId The value for the ID */
|
|
6971 |
inline TSecureId::TSecureId(TUint32 aId)
|
|
6972 |
: iId(aId) {}
|
|
6973 |
|
|
6974 |
/** Convert 'this' into a TUint32
|
|
6975 |
*/
|
|
6976 |
inline TSecureId::operator TUint32() const
|
|
6977 |
{ return iId; }
|
|
6978 |
|
|
6979 |
/** Construct 'this' using a TUid
|
|
6980 |
@param aId The value for the ID */
|
|
6981 |
inline TSecureId::TSecureId(TUid aId)
|
|
6982 |
: iId(aId.iUid) {}
|
|
6983 |
|
|
6984 |
/** Convert 'this' into a TUid
|
|
6985 |
*/
|
|
6986 |
inline TSecureId::operator TUid() const
|
|
6987 |
{ return (TUid&)iId; }
|
|
6988 |
|
|
6989 |
//
|
|
6990 |
// SSecureId
|
|
6991 |
//
|
|
6992 |
inline const TSecureId* SSecureId::operator&() const
|
|
6993 |
{ return (const TSecureId*)this; }
|
|
6994 |
inline SSecureId::operator const TSecureId&() const
|
|
6995 |
{ /* coverity[return_local_addr] */ return (const TSecureId&)iId; }
|
|
6996 |
inline SSecureId::operator TUint32() const
|
|
6997 |
{ return iId; }
|
|
6998 |
inline SSecureId::operator TUid() const
|
|
6999 |
{ return (TUid&)iId; }
|
|
7000 |
|
|
7001 |
//
|
|
7002 |
// TVendorId
|
|
7003 |
//
|
|
7004 |
|
|
7005 |
/** Default constructor which leaves the object in an undefined state */
|
|
7006 |
inline TVendorId::TVendorId()
|
|
7007 |
{}
|
|
7008 |
|
|
7009 |
/** Construct 'this' using a TUint32
|
|
7010 |
@param aId The value for the ID */
|
|
7011 |
inline TVendorId::TVendorId(TUint32 aId)
|
|
7012 |
: iId(aId) {}
|
|
7013 |
|
|
7014 |
/** Convert 'this' into a TUint32
|
|
7015 |
*/
|
|
7016 |
inline TVendorId::operator TUint32() const
|
|
7017 |
{ return iId; }
|
|
7018 |
|
|
7019 |
/** Construct 'this' using a TUid
|
|
7020 |
@param aId The value for the ID */
|
|
7021 |
inline TVendorId::TVendorId(TUid aId)
|
|
7022 |
: iId(aId.iUid) {}
|
|
7023 |
|
|
7024 |
/** Convert 'this' into a TUid
|
|
7025 |
*/
|
|
7026 |
inline TVendorId::operator TUid() const
|
|
7027 |
{ return (TUid&)iId; }
|
|
7028 |
|
|
7029 |
//
|
|
7030 |
// SSecureId
|
|
7031 |
//
|
|
7032 |
inline const TVendorId* SVendorId::operator&() const
|
|
7033 |
{ return (const TVendorId*)this; }
|
|
7034 |
inline SVendorId::operator const TVendorId&() const
|
|
7035 |
{ /* coverity[return_local_addr] */ return (const TVendorId&)iId; }
|
|
7036 |
inline SVendorId::operator TUint32() const
|
|
7037 |
{ return iId; }
|
|
7038 |
inline SVendorId::operator TUid() const
|
|
7039 |
{ return (TUid&)iId; }
|
|
7040 |
|
|
7041 |
//
|
|
7042 |
// TSharedChunkBufConfigBase
|
|
7043 |
//
|
|
7044 |
inline TSharedChunkBufConfigBase::TSharedChunkBufConfigBase()
|
|
7045 |
{memset(this,0,sizeof(TSharedChunkBufConfigBase));}
|
|
7046 |
|
|
7047 |
/**
|
|
7048 |
Default constructor. This leaves the set in an undefned state.
|
|
7049 |
*/
|
|
7050 |
inline TCapabilitySet::TCapabilitySet()
|
|
7051 |
{}
|
|
7052 |
|
|
7053 |
/**
|
|
7054 |
Construct a set consisting of a single capability.
|
|
7055 |
@param aCapability The single capability
|
|
7056 |
*/
|
|
7057 |
inline TCapabilitySet::TCapabilitySet(TCapability aCapability)
|
|
7058 |
{ new (this) TCapabilitySet(aCapability, aCapability); }
|
|
7059 |
|
|
7060 |
/**
|
|
7061 |
Make this set consist of a single capability.
|
|
7062 |
@param aCapability The single capability.
|
|
7063 |
*/
|
|
7064 |
inline void TCapabilitySet::Set(TCapability aCapability)
|
|
7065 |
{ new (this) TCapabilitySet(aCapability, aCapability); }
|
|
7066 |
|
|
7067 |
/**
|
|
7068 |
Make this set consist of two capabilities.
|
|
7069 |
@param aCapability1 The first capability.
|
|
7070 |
@param aCapability2 The second capability.
|
|
7071 |
*/
|
|
7072 |
inline void TCapabilitySet::Set(TCapability aCapability1, TCapability aCapability2)
|
|
7073 |
{ new (this) TCapabilitySet(aCapability1, aCapability2); }
|
|
7074 |
|
|
7075 |
|
|
7076 |
/**
|
|
7077 |
Default constructor. This leaves the object in an undefned state.
|
|
7078 |
*/
|
|
7079 |
inline TSecurityInfo::TSecurityInfo()
|
|
7080 |
{}
|
|
7081 |
|
|
7082 |
/** Constructs a TSecurityPolicy that will always fail, irrespective of the
|
|
7083 |
checked object's attributes.
|
|
7084 |
*/
|
|
7085 |
inline TSecurityPolicy::TSecurityPolicy()
|
|
7086 |
{ new (this) TSecurityPolicy(EAlwaysFail); }
|
|
7087 |
|
|
7088 |
/**
|
|
7089 |
'Address of' operator which generates a TSecurityPolicy*
|
|
7090 |
@return A pointer of type TSecurityPolicy which refers to this object
|
|
7091 |
*/
|
|
7092 |
inline const TSecurityPolicy* TStaticSecurityPolicy::operator&() const
|
|
7093 |
{ return (const TSecurityPolicy*)this; }
|
|
7094 |
|
|
7095 |
/**
|
|
7096 |
'Reference of' operator which generates a TSecurityPolicy&
|
|
7097 |
@return A reference of type TSecurityPolicy which refers to this object
|
|
7098 |
*/
|
|
7099 |
inline TStaticSecurityPolicy::operator const TSecurityPolicy&() const
|
|
7100 |
{ return *(const TSecurityPolicy*)this; }
|
|
7101 |
|
|
7102 |
/**
|
|
7103 |
A method to explicity generate a TSecurityPolicy reference.
|
|
7104 |
@return A reference of type TSecurityPolicy which refers to this object
|
|
7105 |
*/
|
|
7106 |
inline const TSecurityPolicy& TStaticSecurityPolicy::operator()() const
|
|
7107 |
{ return *(const TSecurityPolicy*)this; }
|
|
7108 |
|
|
7109 |
#ifdef __KERNEL_MODE__
|
|
7110 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
7111 |
|
|
7112 |
/** Checks this policy against the platform security attributes of aProcess.
|
|
7113 |
|
|
7114 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
7115 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
7116 |
If PlatSecEnforcement is OFF, then this function will return ETrue even though the
|
|
7117 |
check failed.
|
|
7118 |
|
|
7119 |
@param aProcess The DProcess object to check against this TSecurityPolicy.
|
|
7120 |
@param aDiagnostic A string that will be emitted along with any diagnostic message
|
|
7121 |
that may be issued if the policy check fails.
|
|
7122 |
This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
7123 |
which enables it to be easily removed from the system.
|
|
7124 |
@return ETrue if all the requirements of this TSecurityPolicy are met by the
|
|
7125 |
platform security attributes of aProcess, EFalse otherwise.
|
|
7126 |
@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
|
|
7127 |
*/
|
|
7128 |
inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, const char* aDiagnostic) const
|
|
7129 |
{
|
|
7130 |
return DoCheckPolicy(aProcess, aDiagnostic);
|
|
7131 |
}
|
|
7132 |
|
|
7133 |
/** Checks this policy against the platform security attributes of the process
|
|
7134 |
owning aThread.
|
|
7135 |
|
|
7136 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
7137 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
7138 |
If PlatSecEnforcement is OFF, then this function will return ETrue even though the
|
|
7139 |
check failed.
|
|
7140 |
|
|
7141 |
@param aThread The thread whose owning process' platform security attributes
|
|
7142 |
are to be checked against this TSecurityPolicy.
|
|
7143 |
@param aDiagnostic A string that will be emitted along with any diagnostic message
|
|
7144 |
that may be issued if the policy check fails.
|
|
7145 |
This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
7146 |
which enables it to be easily removed from the system.
|
|
7147 |
@return ETrue if all the requirements of this TSecurityPolicy are met by the
|
|
7148 |
platform security parameters of the owning process of aThread, EFalse otherwise.
|
|
7149 |
@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
|
|
7150 |
*/
|
|
7151 |
inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, const char* aDiagnostic) const
|
|
7152 |
{
|
|
7153 |
return DoCheckPolicy(aThread, aDiagnostic);
|
|
7154 |
}
|
|
7155 |
|
|
7156 |
#else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
7157 |
|
|
7158 |
/** Checks this policy against the platform security attributes of aProcess.
|
|
7159 |
|
|
7160 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
7161 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
7162 |
If PlatSecEnforcement is OFF, then this function will return ETrue even though the
|
|
7163 |
check failed.
|
|
7164 |
|
|
7165 |
@param aProcess The DProcess object to check against this TSecurityPolicy.
|
|
7166 |
@param aDiagnostic A string that will be emitted along with any diagnostic message
|
|
7167 |
that may be issued if the policy check fails.
|
|
7168 |
This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
7169 |
which enables it to be easily removed from the system.
|
|
7170 |
@return ETrue if all the requirements of this TSecurityPolicy are met by the
|
|
7171 |
platform security attributes of aProcess, EFalse otherwise.
|
|
7172 |
@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
|
|
7173 |
*/
|
|
7174 |
inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, OnlyCreateWithNull /*aDiagnostic*/) const
|
|
7175 |
{
|
|
7176 |
return DoCheckPolicy(aProcess);
|
|
7177 |
}
|
|
7178 |
|
|
7179 |
/** Checks this policy against the platform security attributes of the process
|
|
7180 |
owning aThread.
|
|
7181 |
|
|
7182 |
When a check fails the action taken is determined by the system wide Platform Security
|
|
7183 |
configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
|
|
7184 |
If PlatSecEnforcement is OFF, then this function will return ETrue even though the
|
|
7185 |
check failed.
|
|
7186 |
|
|
7187 |
@param aThread The thread whose owning process' platform security attributes
|
|
7188 |
are to be checked against this TSecurityPolicy.
|
|
7189 |
@param aDiagnostic A string that will be emitted along with any diagnostic message
|
|
7190 |
that may be issued if the policy check fails.
|
|
7191 |
This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
|
|
7192 |
which enables it to be easily removed from the system.
|
|
7193 |
@return ETrue if all the requirements of this TSecurityPolicy are met by the
|
|
7194 |
platform security parameters of the owning process of aThread, EFalse otherwise.
|
|
7195 |
@panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
|
|
7196 |
*/
|
|
7197 |
inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, OnlyCreateWithNull /*aDiagnostic*/) const
|
|
7198 |
{
|
|
7199 |
return DoCheckPolicy(aThread);
|
|
7200 |
}
|
|
7201 |
|
|
7202 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
|
|
7203 |
#endif // __KERNEL_MODE__
|