Update contrib.
1 // Copyright (c) 2008-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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 const TUint KDefaultExpandSize = 16;
23 Aligns the supplied capacity to the nearest growth factor
25 For performance reasons the growth factor, KDefaultExpandSizeShift,
26 is expressed as an exponent of 2 so shifting can be used to achieve the
29 a KDefaultExpandSizeShift value of 4 is equivalent to 16;
30 giving newCapacity = ((newCapacity / 16) + 1) * 16
32 @param aNewCapacity The size to be aligned
34 @return The new, aligned capacity
36 static inline TInt AlignCapacity(TInt aNewCapacity)
38 const TUint KDefaultExpandSizeShift = 4;
40 return (TInt)((((TUint)aNewCapacity >> KDefaultExpandSizeShift) + 1) << KDefaultExpandSizeShift);
44 Guarantees that MaxLength() is greater than or equal to the supplied
45 capacity, reallocating the supplied capacity if necessary.
47 The actual value of MaxLength() after a call may differ from the exact
48 value requested, but if it does differ it will always be greater. This
49 flexibility allows the implementation to manage heap buffers more
52 The string descriptor's heap buffer may be reallocated in order to
53 accommodate the new size. As a
54 result, MaxLength() and Ptr() may return different values afterwards,
55 and any existing raw pointers to into the descriptor data may be
58 @param aMinRequiredCapacity The minimum value of MaxLength() required
60 @leave KErrNoMemory if the underlying buffer needs to be
61 grown and there are insufficient resources to do so
63 void LString16::ReserveL(TInt aMinRequiredCapacity)
65 if (MaxLength() < aMinRequiredCapacity)
67 ReAllocL(AlignCapacity(aMinRequiredCapacity));
73 Guarantees that MaxLength() is greater than or equal to the supplied
74 integer parameter, growing the underlying heap buffer if necessary.
76 The growth is exponential; maxLength *= 1.5
77 This is reported to give an amortised complexity of O(n) when adding
79 If the required capacity is larger than the expanded size then the
80 required capacity is used instead.
82 The actual value of MaxLength() after a call may differ from the exact
83 value requested, but if it does differ it will always be greater. This
84 flexibility allows the implementation to manage heap buffers more
87 @param aRequiredCapacity The minimum value of MaxLength() required
89 @leave KErrNoMemory if the underlying buffer needs to be
90 grown and there are insufficient resources to do so
92 void LString16::ReserveCapacityGrowExponentialL(TInt aRequiredCapacity)
94 //work in unsigned int for the appropriate shift operation
95 TUint max_length = MaxLength();
96 TUint requiredCapacity = aRequiredCapacity;
98 if (max_length < requiredCapacity)
100 // max_length *= 3/2;
101 max_length = (max_length + (max_length << 1)) >> 1;
103 // take the bigger of the extended buffer or the required capactiy
104 ReAllocL(AlignCapacity((TInt)(max_length > requiredCapacity ? max_length : requiredCapacity)));
109 Guarantees that free space in the buffer greater than or equal the
110 supplied integer parameter, growing the underlying heap buffer
113 @param aRequiredEmptySpace The minimum value of free space required
115 @leave KErrNoMemory if the underlying buffer needs to be
116 grown and there are insufficient resources to do so
118 void LString16::ReserveFreeCapacityGrowExponentialL(TInt aRequiredEmptySpace)
120 ReserveCapacityGrowExponentialL(Length() + aRequiredEmptySpace);
124 Grows the underlying buffer using the exponential growth
125 function. Guarantees that MaxLength() is greater than or
126 equal to 1.5 * the current MaxLength.
129 @leave KErrNoMemory if the underlying buffer needs to be
130 grown and there are insufficient resources to do so
132 void LString16::ReserveCapacityGrowExponentialL()
134 ReserveCapacityGrowExponentialL(MaxLength() + 1);
141 Constructs a zero-length 16-bit resizable string descriptor.
143 Note that the resulting object owns no allocated memory yet. This
144 default constructor never leaves.
146 EXPORT_C LString16::LString16()
154 Frees any heap-allocated resources owned by this string descriptor. It
155 is safe to rely on this destructor to perform all necessary cleanup;
156 it is not necessary use the cleanup stack or to call Close() manually.
160 EXPORT_C LString16::~LString16()
166 Constructor to create a 16-bit resizable string descriptor with an
169 The function allocates sufficient memory to contain descriptor data up to
170 the specified initial maximum length.
172 The current length of the descriptor is set to zero. The maximum length of
173 the descriptor is set to the specified value.
175 @param aMaxLength The maximum length of the descriptor.
177 @leave KErrNoMemory If there is insufficient memory.
181 EXPORT_C LString16::LString16(TInt aMaxLength)
184 RBuf16::CreateL(aMaxLength);
188 Constructor to create a 16-bit resizable string descriptor from a
189 pre-allocated heap descriptor.
191 Transfers ownership of the specified heap descriptor to this object.
193 @param aHBuf The heap descriptor to be transferred to this object.
194 This pointer can be NULL, which means that a zero length
195 16-bit resizable string descriptor is created.
197 @see RBuf16::RBuf16(HBufC16*)
199 EXPORT_C LString16::LString16(HBufC16* aHBuf)
203 RBuf16::Assign (aHBuf);
207 Constructor to create a 16-bit resizable string descriptor from a
208 pre-allocated raw heap buffer.
210 The allocated memory forms the buffer for this string descriptor. The
211 current length of the descriptor is set to zero.
213 @param aHeapCell The allocated memory to be assigned to this object. This
214 pointer can be NULL, which means that a zero length 16-bit
215 resizable buffer descriptor is created.
216 @param aMaxLength The maximum length of the constructed string descriptor.
218 @panic USER 8 If the specified maximum length is greater then the size of
219 the allocated heap cell, or the specified maximum length
220 is NOT zero when the pointer to the heap cell is NULL.
222 @see RBuf16::Assign()
224 EXPORT_C LString16::LString16(TUint16* aHeapCell,TInt aMaxLength)
227 RBuf16::Assign(aHeapCell, aMaxLength);
231 Constructor to create a 16-bit resizable string descriptor from a
232 pre-allocated raw heap buffer.
234 The allocated memory forms the buffer for this string descriptor. The
235 current length of the descriptor is set to the value of the second
238 @param aHeapCell The allocated memory to be assigned to this object.
239 @param aLength The length of the resulting string descriptor.
240 @param aMaxLength The maximum length of the resulting string descriptor.
242 @panic USER 8 If the specified maximum length is greater then the size of
243 the allocated heap cell, or the specified length is greater then
244 the specified maximum length, or the specified maximum length
245 is NOT zero when the pointer to the heap cell is NULL.
247 @see RBuf16::Assign()
249 EXPORT_C LString16::LString16(TUint16* aHeapCell,TInt aLength,TInt aMaxLength)
252 RBuf16::Assign(aHeapCell, aLength, aMaxLength);
256 Constructor to create a 16-bit resizable string descriptor to contain
257 a copy of the specified (source) descriptor, or leave on failure.
259 The constructor allocates sufficient memory so that this string
260 descriptor's maximum length is the same as the length of the source
261 descriptor. Both the current length and the maximum length of this
262 string descriptor are set to the length of the source descriptor.
264 The data contained in the source descriptor is copied into this string
267 @param aDes Source descriptor to be copied into this object.
269 @leave KErrNoMemory If there is insufficient memory.
271 @see RBuf16::CreateL()
273 EXPORT_C LString16::LString16(const TDesC16& aDes)
276 RBuf16::CreateL(aDes);
280 Copies data into this 16-bit string descriptor, replacing any existing
281 data, and expanding its heap buffer to accommodate if necessary.
283 The length of this descriptor is set to reflect the new data.
285 This operation may cause the target string descriptor's heap buffer to
286 be reallocated in order to accommodate the new data. As a result,
287 MaxLength() and Ptr() may return different values afterwards, and any
288 existing raw pointers to into the descriptor data may be invalidated.
290 Note that the automatic resizing performed is a change to the
291 functionality of this operation compared to other descriptor
292 classes. This change is only active on objects directly declared
293 LString16; when LString16 instances are instead manipulated via
294 references to TDes16 or TDesC16, the standard (non-resizing, panicing)
297 @param aDes A 16-bit non-modifiable descriptor.
299 @return A reference to this 16-bit string descriptor.
301 @leave KErrNoMemory If the heap buffer of the string descriptor being
302 assigned to needs to be expanded, but there is
303 insufficient memory to do so
305 @see LString16::CopyL
307 EXPORT_C LString16& LString16::operator=(const TDesC16& aDes)
315 Transfers ownership of the specified 16-bit resizable descriptor's this object.
317 @param aBuf The source 16-bit resizable buffer. The ownership of this
318 object's buffer is to be transferred.
320 @return A reference to this 16-bit string descriptor.
324 EXPORT_C LString16& LString16::operator=(HBufC16* aBuf)
332 Copies data into this 16-bit string descriptor, replacing any existing
333 data, and expanding its heap buffer to accommodate if necessary.
335 The length of this descriptor is set to reflect the new data.
337 This leaving variant of the standard, non-leaving descriptor method
338 differs in that this operation may cause the string descriptor's heap
339 buffer to be reallocated in order to accommodate the new data. As a
340 result, MaxLength() and Ptr() may return different values afterwards,
341 and any existing raw pointers to into the descriptor data may be
344 @param aDes A 16-bit non-modifiable descriptor.
346 @leave KErrNoMemory If the heap buffer of the string descriptor being
347 assigned to needs to be expanded, but there is
348 insufficient memory to do so
350 @see LString16::operator=
353 EXPORT_C void LString16::CopyL(const TDesC16& aDes)
355 ReserveL(aDes.Length());
360 Copy constructor to create a 16-bit resizable string descriptor to
361 contain a copy of the specified (source) string descriptor's data, or
364 The constructor allocates sufficient memory so that this string
365 descriptor's maximum length is the same as the length of the source
366 string descriptor. Both the current length and the maximum length of
367 this string descriptor are set to the length of the source descriptor.
369 The data contained in the source string descriptor is copied into this
372 @param aDes Source string descriptor to be copied into this object.
374 @leave KErrNoMemory If there is insufficient memory.
376 @see RBuf16::CreateL()
378 EXPORT_C LString16::LString16(const LString16& aDes)
381 RBuf16::CreateL(aDes);
386 Copies data into this 16-bit string descriptor, replacing any existing
387 data, and expanding its heap buffer to accommodate if necessary.
389 The length of this descriptor is set to reflect the new data.
391 This operation may cause the target string descriptor's heap buffer to
392 be reallocated in order to accommodate the new data. As a result,
393 MaxLength() and Ptr() may return different values afterwards, and any
394 existing raw pointers to into the descriptor data may be invalidated.
396 Note that the automatic resizing performed is a change to the
397 functionality of this operation compared to other descriptor
398 classes. This change is only active on objects directly declared
399 LString16; when LString16 instances are instead manipulated via
400 references to TDes16 or TDesC16, the standard (non-resizing, panicing)
403 @param aDes A 16-bit string descriptor.
405 @return A reference to this 16-bit string descriptor.
407 @leave KErrNoMemory If the heap buffer of the string descriptor being
408 assigned to needs to be expanded, but there is
409 insufficient memory to do so
411 @see LString16::CopyL
413 EXPORT_C LString16& LString16::operator=(const LString16& aDes)
420 Constructor to create a 16-bit resizable string descriptor containing
421 a copy of the specified (source) zero-terminated string data, or leave
424 The constructor allocates sufficient memory so that this string
425 descriptor's maximum length is the same as the length of the source
426 string. Both the current length and the maximum length of this string
427 descriptor are set to the length of the source string.
429 The data contained in the source string is copied into this string
430 descriptor. The zero terminator is not copied.
432 @param aZeroTerminatedString A pointer to a zero-terminated string
434 @leave KErrNoMemory If there is insufficient memory.
436 @see LString16::CopyL
438 EXPORT_C LString16::LString16(const TUint16* aZeroTerminatedString)
441 CopyL(aZeroTerminatedString);
445 Copies data into this 16-bit string descriptor, replacing any existing
446 data, and expanding its heap buffer to accommodate if necessary.
448 The length of this descriptor is set to reflect the new data.
450 This operation may cause the target string descriptor's heap buffer to
451 be reallocated in order to accommodate the new data. As a result,
452 MaxLength() and Ptr() may return different values afterwards, and any
453 existing raw pointers to into the descriptor data may be invalidated.
455 Note that the automatic resizing performed is a change to the
456 functionality of this operation compared to other descriptor
457 classes. This change is only active on objects directly declared
458 LString16; when LString16 instances are instead manipulated via
459 references to TDes16 or TDesC16, the standard (non-resizing, panicing)
462 @param aZeroTerminatedString A pointer to a zero-terminated string
464 @return A reference to this 16-bit string descriptor.
466 @leave KErrNoMemory If the heap buffer of the string descriptor being
467 assigned to needs to be expanded, but there is
468 insufficient memory to do so
470 @see LString16::CopyL
472 EXPORT_C LString16& LString16::operator=(const TUint16* aZeroTerminatedString)
474 CopyL(aZeroTerminatedString);
479 Copies data into this 16-bit string descriptor, replacing any existing
480 data, and expanding its heap buffer to accommodate if necessary.
482 The length of this descriptor is set to reflect the new data.
484 This leaving variant of the standard, non-leaving descriptor method
485 differs in that this operation may cause the string descriptor's heap
486 buffer to be reallocated in order to accommodate the new data. As a
487 result, MaxLength() and Ptr() may return different values afterwards,
488 and any existing raw pointers to into the descriptor data may be
491 @param aZeroTerminatedString A pointer to a zero-terminated string
493 @leave KErrNoMemory If the heap buffer of the string descriptor being
494 assigned to needs to be expanded, but there is
495 insufficient memory to do so
497 @see LString16::operator=
500 EXPORT_C void LString16::CopyL(const TUint16* aZeroTerminatedString)
502 ReserveL(User::StringLength(aZeroTerminatedString));
503 RBuf16::Copy(aZeroTerminatedString);
507 Copies 8-bit descriptor data into this 16-bit string descriptor,
508 replacing any existing data, and expanding its heap buffer to
509 accommodate if necessary.
511 The length of this descriptor is set to reflect the new data.
513 Each 8-bit character value is widened to a 16-bit character value as
514 part of the copying process.
516 This leaving variant of the standard, non-leaving descriptor method
517 differs in that this operation may cause the string descriptor's heap
518 buffer to be reallocated in order to accommodate the new data. As a
519 result, MaxLength() and Ptr() may return different values afterwards,
520 and any existing raw pointers to into the descriptor data may be
523 @param aDes An 8 bit non modifiable descriptor.
525 @leave KErrNoMemory If the heap buffer of the string descriptor being
526 assigned to needs to be expanded, but there is
527 insufficient memory to do so
529 @see LString16::operator=
532 EXPORT_C void LString16::CopyL(const TDesC8& aDes)
534 ReserveL(aDes.Length());
539 Copies data into this 16-bit string descriptor, replacing any existing
540 data, and expanding its heap buffer to accommodate if necessary.
542 The length of this descriptor is set according to the second
545 This leaving variant of the standard, non-leaving descriptor method
546 differs in that this operation may cause the string descriptor's heap
547 buffer to be reallocated in order to accommodate the new data. As a
548 result, MaxLength() and Ptr() may return different values afterwards,
549 and any existing raw pointers to into the descriptor data may be
552 @param aBuf The start address of data to be copied.
553 @param aLength The length of data to be copied.
555 @leave KErrNoMemory If the heap buffer of the string descriptor being
556 assigned to needs to be expanded, but there is
557 insufficient memory to do so
559 @panic USER 11 if aLength is negative.
563 EXPORT_C void LString16::CopyL(const TUint16* aBuf,TInt aLength)
566 RBuf16::Copy(aBuf, aLength);
571 Sets the length of the data represented by the string descriptor to
574 This leaving variant of the standard, non-leaving descriptor method
575 differs in that this operation may cause the string descriptor's heap
576 buffer to be reallocated in order to accommodate the new data. As a
577 result, MaxLength() and Ptr() may return different values afterwards,
578 and any existing raw pointers to into the descriptor data may be
581 @param aLength The new length of the descriptor.
583 @leave KErrNoMemory if the underlying buffer needs to be
584 grown and there are insufficient resources to do so
586 @panic USER 11 if aLength is negative
588 EXPORT_C void LString16::SetLengthL(TInt aLength)
591 RBuf16::SetLength(aLength);
596 Sets the storage space allocated to this descriptor to the specified
597 value by growing or compressing its buffer size.
599 If the current length of the descriptor is greater than the specified
600 max length, length is truncated to max length.
602 This leaving variant of the standard, non-leaving descriptor method
603 differs in that this operation may cause the string descriptor's heap
604 buffer to be reallocated in order to accommodate the new data. As a
605 result, MaxLength() and Ptr() may return different values afterwards,
606 and any existing raw pointers to into the descriptor data may be
609 @param aMaxLength The new maximum length of the descriptor.
611 @leave KErrNoMemory if the the buffer needs to be
612 reallocated and there are insufficient resources to do so
614 @panic USER 11 if aLength is negative
616 EXPORT_C void LString16::SetMaxLengthL(TInt aMaxLength)
618 if (MaxLength() == aMaxLength)
623 if (Length() > aMaxLength)
625 // truncate the current length
626 RBuf16::SetLength(aMaxLength);
629 ReAllocL(aMaxLength);
634 Ensures that the remaining unused space is more than the supplied value.
636 May reallocate a larger storage space to meet the requirement.
637 As a result MaxLength() and Ptr() may return different values afterwards,
638 and any existing raw pointers to into the descriptor data may be
641 Typically, you use this method to reserve a known amount of required space
642 in one go instead of relying on the automatic growth pattern.
644 @param aExtraSpaceLength The extra space required.
646 @leave KErrNoMemory if the the buffer needs to be
647 reallocated and there are insufficient resources to do so.
649 @panic USER 11 if aLength is negative
651 EXPORT_C void LString16::ReserveFreeCapacityL(TInt aExtraSpaceLength)
653 ReserveL(Length() + aExtraSpaceLength);
658 Re-initialises the descriptor destroying its payload
661 EXPORT_C void LString16::Reset()
668 Re-allocates a smaller descriptor buffer space to the current
671 This may cause the string descriptor's heap buffer to be reallocated
672 in order to accommodate the new data. As a
673 result, MaxLength() and Ptr() may return different values afterwards,
674 and any existing raw pointers to into the descriptor data may be
677 If there is insufficient memory to re-allocate the buffer then the
678 descriptor left unchanged
680 EXPORT_C void LString16::Compress()
682 TInt length = Length();
683 if (MaxLength() > length)
691 Appends data onto the end of this descriptor's data.
693 The length of this descriptor is incremented to reflect the new content.
695 This leaving variant of the standard, non-leaving descriptor method
696 differs in that this operation may cause the string descriptor's heap
697 buffer to be reallocated in order to accommodate the new data. As a
698 result, MaxLength() and Ptr() may return different values afterwards,
699 and any existing raw pointers to into the descriptor data may be
702 @param aChar A single character to be appended. The length of the descriptor
703 is incremented by one.
705 @leave KErrNoMemory if the underlying buffer needs to be
706 grown and there are insufficient resources to do so
708 @see LString16::operator+=
710 EXPORT_C void LString16::AppendL(TChar aChar)
712 ReserveFreeCapacityGrowExponentialL(1);
713 RBuf16::Append(aChar);
717 Appends data onto the end of this descriptor's data.
719 The length of this descriptor is incremented to reflect the new content.
721 This leaving variant of the standard, non-leaving descriptor method
722 differs in that this operation may cause the string descriptor's heap
723 buffer to be reallocated in order to accommodate the new data. As a
724 result, MaxLength() and Ptr() may return different values afterwards,
725 and any existing raw pointers to into the descriptor data may be
728 @param aChar A single character to be appended. The length of the descriptor
729 is incremented by one.
731 @leave KErrNoMemory if the underlying buffer needs to be
732 grown and there are insufficient resources to do so
734 @see LString16::AppendL
736 EXPORT_C LString16& LString16::operator+=(TChar aChar)
743 Appends data onto the end of this descriptor's data.
745 The length of this descriptor is incremented to reflect the new content.
747 This leaving variant of the standard, non-leaving descriptor method
748 differs in that this operation may cause the string descriptor's heap
749 buffer to be reallocated in order to accommodate the new data. As a
750 result, MaxLength() and Ptr() may return different values afterwards,
751 and any existing raw pointers to into the descriptor data may be
754 @param aDes A 16-bit non modifiable descriptor whose data is to be appended.
756 @leave KErrNoMemory if the underlying buffer needs to be
757 grown and there are insufficient resources to do so
759 EXPORT_C void LString16::AppendL(const TDesC16& aDes)
761 ReserveFreeCapacityGrowExponentialL(aDes.Length());
762 RBuf16::Append(aDes);
766 Appends data onto the end of this descriptor's data.
768 The length of this descriptor is incremented to reflect the new content.
770 This leaving variant of the standard, non-leaving descriptor method
771 differs in that this operation may cause the string descriptor's heap
772 buffer to be reallocated in order to accommodate the new data. As a
773 result, MaxLength() and Ptr() may return different values afterwards,
774 and any existing raw pointers to into the descriptor data may be
777 @param aDes A 16-bit non modifiable descriptor whose data is to be appended.
779 @leave KErrNoMemory if the underlying buffer needs to be
780 grown and there are insufficient resources to do so
782 @see LString16::AppendL
784 EXPORT_C LString16& LString16::operator+=(const TDesC16& aDes)
791 Appends data onto the end of this descriptor's data.
793 The length of this descriptor is incremented to reflect the new content.
795 This leaving variant of the standard, non-leaving descriptor method
796 differs in that this operation may cause the string descriptor's heap
797 buffer to be reallocated in order to accommodate the new data. As a
798 result, MaxLength() and Ptr() may return different values afterwards,
799 and any existing raw pointers to into the descriptor data may be
802 @param aBuf A pointer to the data to be copied.
803 @param aLength The length of data to be copied.
805 @leave KErrNoMemory if the underlying buffer needs to be
806 grown and there are insufficient resources to do so
808 @panic USER 17 if aLength is negative.
810 EXPORT_C void LString16::AppendL(const TUint16* aBuf,TInt aLength)
812 ReserveFreeCapacityGrowExponentialL(aLength);
813 RBuf16::Append(aBuf, aLength);
817 Fills the descriptor's data area with the specified character, replacing any
820 The descriptor is filled with the specified number of characters,
821 and its length is changed to reflect this.
823 This leaving variant of the standard, non-leaving descriptor method
824 differs in that this operation may cause the string descriptor's heap
825 buffer to be reallocated in order to accommodate the new data. As a
826 result, MaxLength() and Ptr() may return different values afterwards,
827 and any existing raw pointers to into the descriptor data may be
830 @param aChar The fill character.
831 @param aLength The new length of the descriptor and the number of fill characters
832 to be copied into it.
834 @leave KErrNoMemory if the underlying buffer needs to be
835 grown and there are insufficient resources to do so
837 @panic USER 11 if aLength is negative
839 EXPORT_C void LString16::FillL(TChar aChar,TInt aLength)
842 RBuf16::Fill(aChar, aLength);
846 Fills the descriptor's data area with binary zeroes, i.e. 0x0000, replacing any
847 existing data, and changes its length.
849 The descriptor is filled with the specified number of binary zeroes.
850 The descriptor's length is changed to reflect this.
852 This leaving variant of the standard, non-leaving descriptor method
853 differs in that this operation may cause the string descriptor's heap
854 buffer to be reallocated in order to accommodate the new data. As a
855 result, MaxLength() and Ptr() may return different values afterwards,
856 and any existing raw pointers to into the descriptor data may be
859 @param aLength The new length of the descriptor and the number of binary zeroes
860 to be copied into it.
862 @leave KErrNoMemory if the underlying buffer needs to be
863 grown and there are insufficient resources to do so
865 @panic USER 11 if aLength is negative
867 EXPORT_C void LString16::FillZL(TInt aLength)
870 RBuf16::FillZ(aLength);
874 Converts the specified unsigned integer into a fixed width character
875 representation based on the specified number system and copies the conversion
876 into this descriptor, replacing any existing data.
878 The length of this descriptor is set to reflect the new data.
880 The function generates the exact number of specified characters, either padding
881 to the left with character zeroes or discarding low order characters as necessary.
883 When a hexadecimal conversion is specified, hexadecimal characters are in
886 This function is equivalent to using Format() with parameters which specify:
888 1. a fixed length target field
890 2. padding with zero characters, for example "%08x".
892 When this is the case, always use NumFixedWidth() in preference
893 to Format() as it is more efficient.
895 This leaving variant of the standard, non-leaving descriptor method
896 differs in that this operation may cause the string descriptor's heap
897 buffer to be reallocated in order to accommodate the new data. As a
898 result, MaxLength() and Ptr() may return different values afterwards,
899 and any existing raw pointers to into the descriptor data may be
902 @param aVal The unsigned integer value.
903 @param aRadix The number system representation for the unsigned integer.
904 @param aWidth The number of characters: to be used to contain the conversion,
905 to be copied into this descriptor.
907 @leave KErrNoMemory if the underlying buffer needs to be
908 grown and there are insufficient resources to do so
910 EXPORT_C void LString16::NumFixedWidthL(TUint aVal,TRadix aRadix,TInt aWidth)
913 AppendNumFixedWidthL(aVal, aRadix, aWidth);
917 Converts the specified unsigned integer into a fixed width character
918 representation based on the specified number system and appends the conversion
919 onto the end of this descriptor's data.
921 The length of this descriptor is incremented to reflect the new content.
923 The function generates the exact number of specified characters, either padding
924 to the left with character zeroes or discarding low order characters as
927 When a hexadecimal conversion is specified, hexadecimal characters are in
930 This leaving variant of the standard, non-leaving descriptor method
931 differs in that this operation may cause the string descriptor's heap
932 buffer to be reallocated in order to accommodate the new data. As a
933 result, MaxLength() and Ptr() may return different values afterwards,
934 and any existing raw pointers to into the descriptor data may be
937 @param aVal The unsigned integer value.
938 @param aRadix The number system representation for the unsigned integer.
939 @param aWidth The number of characters to be used to contain the conversion,
940 and to be appended to this descriptor.
942 @leave KErrNoMemory if the underlying buffer needs to be
943 grown and there are insufficient resources to do so
945 EXPORT_C void LString16::AppendNumFixedWidthL(TUint aVal,TRadix aRadix,TInt aWidth)
947 ReserveFreeCapacityGrowExponentialL(aWidth);
948 RBuf16::AppendNumFixedWidth(aVal, aRadix, aWidth);
952 Appends a zero terminator onto the end of this descriptor's data and returns
953 a pointer to the data.
955 The length of the descriptor is not changed, but the capacity of the
956 descriptor may need to be grown to accommodate the zero terminator.
958 This leaving variant of the standard, non-leaving descriptor method
959 differs in that this operation may cause the string descriptor's heap
960 buffer to be reallocated in order to accommodate the new data. As a
961 result, MaxLength() and Ptr() may return different values afterwards,
962 and any existing raw pointers to into the descriptor data may be
965 @return A pointer to the descriptor's zero terminated data.
967 @leave KErrNoMemory if the underlying buffer needs to be
968 grown and there are insufficient resources to do so
970 EXPORT_C const TUint16 *LString16::PtrZL()
972 ReserveFreeCapacityL(1);
973 return RBuf16::PtrZ();
977 Copies and folds data from the specified descriptor into this descriptor replacing
980 The length of this descriptor is set to reflect the new
983 Note that folding is locale-independent behaviour. It is also important to
984 note that there can be no guarantee that folding is in any way culturally
985 appropriate, and should not be used when dealing with strings in natural
988 This leaving variant of the standard, non-leaving descriptor method
989 differs in that this operation may cause the string descriptor's heap
990 buffer to be reallocated in order to accommodate the new data. As a
991 result, MaxLength() and Ptr() may return different values afterwards,
992 and any existing raw pointers to into the descriptor data may be
995 @param aDes A 16-bit non-modifiable descriptor.
997 @leave KErrNoMemory if the underlying buffer needs to be
998 grown and there are insufficient resources to do so
1000 EXPORT_C void LString16::CopyFL(const TDesC16& aDes)
1002 ReserveL(aDes.Length());
1003 RBuf16::CopyF(aDes);
1007 Copies and collates data from the specified descriptor
1008 into this descriptor replacing any existing data.
1010 The length of this descriptor is set to reflect the new data.
1012 This leaving variant of the standard, non-leaving descriptor method
1013 differs in that this operation may cause the string descriptor's heap
1014 buffer to be reallocated in order to accommodate the new data. As a
1015 result, MaxLength() and Ptr() may return different values afterwards,
1016 and any existing raw pointers to into the descriptor data may be
1019 @param aDes A 16-bit non-modifiable descriptor.
1021 @leave KErrNoMemory if the underlying buffer needs to be
1022 grown and there are insufficient resources to do so
1024 EXPORT_C void LString16::CopyCL(const TDesC16& aDes)
1026 ReserveL(aDes.Length());
1027 RBuf16::CopyC(aDes);
1031 Copies text from the specified descriptor and converts it to lower case before
1032 putting it into this descriptor, replacing any existing data.
1034 The length of this descriptor is set to reflect the new data.
1036 Conversion to lower case is implemented as appropriate to the current locale.
1038 This leaving variant of the standard, non-leaving descriptor method
1039 differs in that this operation may cause the string descriptor's heap
1040 buffer to be reallocated in order to accommodate the new data. As a
1041 result, MaxLength() and Ptr() may return different values afterwards,
1042 and any existing raw pointers to into the descriptor data may be
1045 @param aDes A 16-bit non modifiable descriptor.
1047 @leave KErrNoMemory if the underlying buffer needs to be
1048 grown and there are insufficient resources to do so
1050 EXPORT_C void LString16::CopyLCL(const TDesC16& aDes)
1052 ReserveL(aDes.Length());
1053 RBuf16::CopyLC(aDes);
1057 Copies text from the specified descriptor and converts it to upper case before
1058 putting it into this descriptor, replacing any existing data.
1060 The length of this descriptor is set to reflect the new data.
1062 Conversion to upper case is implemented as appropriate to the current locale.
1064 This leaving variant of the standard, non-leaving descriptor method
1065 differs in that this operation may cause the string descriptor's heap
1066 buffer to be reallocated in order to accommodate the new data. As a
1067 result, MaxLength() and Ptr() may return different values afterwards,
1068 and any existing raw pointers to into the descriptor data may be
1071 @param aDes A 16-bit non modifiable descriptor.
1073 @leave KErrNoMemory if the underlying buffer needs to be
1074 grown and there are insufficient resources to do so
1076 EXPORT_C void LString16::CopyUCL(const TDesC16& aDes)
1078 ReserveL(aDes.Length());
1079 RBuf16::CopyUC(aDes);
1083 Copies text from the specified descriptor and capitalises it before putting
1084 it into this descriptor, replacing any existing data.
1086 The length of this descriptor is set to reflect the new data.
1088 Capitalisation is implemented as appropriate to the current locale.
1090 This leaving variant of the standard, non-leaving descriptor method
1091 differs in that this operation may cause the string descriptor's heap
1092 buffer to be reallocated in order to accommodate the new data. As a
1093 result, MaxLength() and Ptr() may return different values afterwards,
1094 and any existing raw pointers to into the descriptor data may be
1097 @param aDes A 16-bit non-modifiable descriptor.
1099 @leave KErrNoMemory if the underlying buffer needs to be
1100 grown and there are insufficient resources to do so
1102 EXPORT_C void LString16::CopyCPL(const TDesC16& aDes)
1104 ReserveL(aDes.Length());
1105 RBuf16::CopyCP(aDes);
1109 Appends and fills this descriptor with the specified character.
1111 The descriptor is appended with the specified number of characters.
1112 and its length is changed to reflect this.
1114 This leaving variant of the standard, non-leaving descriptor method
1115 differs in that this operation may cause the string descriptor's heap
1116 buffer to be reallocated in order to accommodate the new data. As a
1117 result, MaxLength() and Ptr() may return different values afterwards,
1118 and any existing raw pointers to into the descriptor data may be
1121 @param aChar The fill character.
1122 @param aLength The number of fill characters to be appended.
1124 @leave KErrNoMemory if the underlying buffer needs to be
1125 grown and there are insufficient resources to do so
1127 @panic USER 11 if aLength is negative
1129 EXPORT_C void LString16::AppendFillL(TChar aChar,TInt aLength)
1131 ReserveFreeCapacityGrowExponentialL(aLength);
1132 RBuf16::AppendFill(aChar, aLength);
1136 Appends a zero terminator onto the end of this descriptor's data.
1138 The length of the descriptor is not changed, but the capacity of the
1139 descriptor may need to be grown to accommodate the zero terminator.
1141 This leaving variant of the standard, non-leaving descriptor method
1142 differs in that this operation may cause the string descriptor's heap
1143 buffer to be reallocated in order to accommodate the new data. As a
1144 result, MaxLength() and Ptr() may return different values afterwards,
1145 and any existing raw pointers to into the descriptor data may be
1148 @leave KErrNoMemory if the underlying buffer needs to be
1149 grown and there are insufficient resources to do so
1151 EXPORT_C void LString16::ZeroTerminateL()
1153 ReserveFreeCapacityL(1);
1154 RBuf16::ZeroTerminate();
1158 Swaps the data represented by this descriptor with the data represented by
1159 the specified descriptor.
1161 The lengths of both descriptors are also swapped to reflect the change.
1163 Note that each descriptor must be capable of accommodating the contents of
1164 the other descriptor.
1166 Each descriptor must be capable of accommodating the contents of the
1167 other descriptor. If the maximum length of the descriptor parameter is
1168 smaller than the length of the target LString16, then the function
1169 raises a USER 11 panic. The target LString16 will be grown if
1170 necessary to accommodate the descriptor parameter's data.
1172 This leaving variant of the standard, non-leaving descriptor method
1173 differs in that this operation may cause the string descriptor's heap
1174 buffer to be reallocated in order to accommodate the new data. As a
1175 result, MaxLength() and Ptr() may return different values afterwards,
1176 and any existing raw pointers to into the descriptor data may be
1179 @param aDes The 16-bit modifiable descriptor whose data is to be swapped with
1180 the data of this descriptor.
1182 @leave KErrNoMemory if the underlying buffer needs to be
1183 grown and there are insufficient resources to do so
1185 @panic USER 11 if the maximum length of the descriptor parameter is smaller than the
1186 length of the target LString16
1188 EXPORT_C void LString16::SwapL(TDes16& aDes)
1190 ReserveL(aDes.Length());
1195 Swaps the data represented by this string descriptor with the data
1196 represented by the specified string descriptor.
1198 The lengths of both string descriptors are also swapped to reflect the
1199 change, and their buffers grown as necessary to accommodate the data
1202 This leaving variant of the standard, non-leaving descriptor method
1203 differs in that this operation may cause the string descriptor's heap
1204 buffer to be reallocated in order to accommodate the new data. As a
1205 result, MaxLength() and Ptr() may return different values afterwards,
1206 and any existing raw pointers to into the descriptor data may be
1209 @param aDes The 16-bit modifiable string descriptor whose data is to be swapped with
1210 the data of this descriptor.
1212 @leave KErrNoMemory if one of the underlying buffers needs to be
1213 grown and there are insufficient resources to do so
1215 EXPORT_C void LString16::SwapL(LString16& aDes)
1217 this->ReserveL(aDes.Length());
1218 aDes.ReserveL(this->Length());
1224 Inserts data into this descriptor.
1226 The length of this descriptor is changed to reflect the extra data.
1228 This leaving variant of the standard, non-leaving descriptor method
1229 differs in that this operation may cause the string descriptor's heap
1230 buffer to be reallocated in order to accommodate the new data. As a
1231 result, MaxLength() and Ptr() may return different values afterwards,
1232 and any existing raw pointers to into the descriptor data may be
1235 @param aPos The position within the data where insertion is to start. This
1236 is an offset value; a zero value refers to the leftmost data
1239 @param aDes A 16-bit non modifiable descriptor whose data is to be inserted.
1241 @leave KErrNoMemory if the underlying buffer needs to be
1242 grown and there are insufficient resources to do so
1244 @panic USER 10 if aPos is negative or is greater than the length of this
1247 EXPORT_C void LString16::InsertL(TInt aPos,const TDesC16& aDes)
1249 ReserveFreeCapacityGrowExponentialL(aDes.Length());
1250 RBuf16::Insert(aPos, aDes);
1254 Replaces data in this descriptor.
1256 The specified length can be different to the length of the replacement data.
1257 The length of this descriptor changes to reflect the change of data.
1259 This leaving variant of the standard, non-leaving descriptor method
1260 differs in that this operation may cause the string descriptor's heap
1261 buffer to be reallocated in order to accommodate the new data. As a
1262 result, MaxLength() and Ptr() may return different values afterwards,
1263 and any existing raw pointers to into the descriptor data may be
1266 @param aPos The position within the data where replacement is to start.
1267 This is an offset value; a zero value refers to the leftmost
1270 @param aLength The length of data to be replaced.
1272 @param aDes The source 16-bit non modifiable descriptor whose data is to
1273 replace the target descriptor's data at aPos.
1275 @leave KErrNoMemory if the underlying buffer needs to be
1276 grown and there are insufficient resources to do so
1278 @panic USER 8 if aLength is negative
1280 @panic USER 10 if aPos is negative or is greater than the length of this
1283 @panic USER 16 if the length of the source descriptor aDes is negative
1285 EXPORT_C void LString16::ReplaceL(TInt aPos,TInt aLength,const TDesC16& aDes)
1287 TInt delta = aDes.Length() - aLength;
1290 ReserveFreeCapacityGrowExponentialL(delta);
1292 RBuf16::Replace(aPos, aLength, aDes);
1296 Copies data into this descriptor and justifies it, replacing any existing data.
1298 The length of this descriptor is set to reflect the new data.
1300 The target area is considered to be an area of specified width positioned at
1301 the beginning of this descriptor's data area. Source data is copied into, and
1302 aligned within this target area according to the specified alignment
1305 If the length of the target area is larger than the length of the source, then
1306 spare space within the target area is padded with the fill character.
1308 This leaving variant of the standard, non-leaving descriptor method
1309 differs in that this operation may cause the string descriptor's heap
1310 buffer to be reallocated in order to accommodate the new data. As a
1311 result, MaxLength() and Ptr() may return different values afterwards,
1312 and any existing raw pointers to into the descriptor data may be
1315 @param aDes A 16-bit non-modifiable descriptor containing the source data.
1316 The length of the data to be copied is the smaller of:
1317 the length of the source descriptor, and
1318 the width of the target area (only if this is not the
1319 explicit negative value KDefaultJustifyWidth).
1321 @param aWidth The width of the target area. If this has the specific
1322 negative value KDefaultJustifyWidth, then the width is
1323 re-set to the length of the data source.
1325 @param aAlignment The alignment of the data within the target area
1327 @param aFill The fill character used to pad the target area.
1329 @leave KErrNoMemory if the underlying buffer needs to be
1330 grown and there are insufficient resources to do so
1332 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
1334 EXPORT_C void LString16::JustifyL(const TDesC16& aDes,TInt aWidth,TAlign aAlignment,TChar aFill)
1336 TInt width = (aWidth == KDefaultJustifyWidth ? aDes.Length() : aWidth);
1338 RBuf16::Justify(aDes, aWidth, aAlignment, aFill);
1342 Converts the specified unsigned integer into a fixed width character
1343 representation based on the specified number system and copies the conversion
1344 into this descriptor, replacing any existing data.
1346 The length of this descriptor is set to reflect the new data.
1348 The function generates the exact number of specified characters, either padding
1349 to the left with character zeroes or discarding low order characters as
1352 When a hexadecimal conversion is specified, hexadecimal characters are in
1355 This function is equivalent to using Format() with parameters which specify:
1357 1. a fixed length target field
1359 2. padding with zero characters, for example "%08x".
1361 When this is the case, always use NumFixedWidthUC() in
1362 preference to Format() as it is more efficient.
1364 This leaving variant of the standard, non-leaving descriptor method
1365 differs in that this operation may cause the string descriptor's heap
1366 buffer to be reallocated in order to accommodate the new data. As a
1367 result, MaxLength() and Ptr() may return different values afterwards,
1368 and any existing raw pointers to into the descriptor data may be
1371 @param aVal The unsigned integer value.
1372 @param aRadix The number system representation for the unsigned integer.
1373 @param aWidth The number of characters: to be used to contain the conversion,
1374 to be copied into this descriptor.
1376 @leave KErrNoMemory if the underlying buffer needs to be
1377 grown and there are insufficient resources to do so
1379 @see TDes16::Format()
1381 EXPORT_C void LString16::NumFixedWidthUCL(TUint aVal,TRadix aRadix,TInt aWidth)
1384 AppendNumFixedWidthUCL(aVal, aRadix, aWidth);
1388 Converts the specified 64 bit unsigned integer into a character representation
1389 based on the specified number system and copies the conversion into this
1390 descriptor, replacing any existing data.
1392 The length of this descriptor is set to reflect the new data.
1394 When a hexadecimal conversion is specified, hexadecimal characters are in
1397 This leaving variant of the standard, non-leaving descriptor method
1398 differs in that this operation may cause the string descriptor's heap
1399 buffer to be reallocated in order to accommodate the new data. As a
1400 result, MaxLength() and Ptr() may return different values afterwards,
1401 and any existing raw pointers to into the descriptor data may be
1404 @param aVal The 64 bit integer value. This is always treated as an unsigned
1405 value for all builds.
1406 @param aRadix The number system representation for the 64 bit integer. If no
1407 explicit value is specified, then EDecimal is the default.
1409 @leave KErrNoMemory if the underlying buffer needs to be
1410 grown and there are insufficient resources to do so
1412 EXPORT_C void LString16::NumUCL(TUint64 aVal, TRadix aRadix)
1415 AppendNumUCL(aVal, aRadix);
1419 Converts the specified floating point number into a character representation
1420 and copies the conversion into this descriptor, replacing any existing data.
1422 The length of this descriptor is set to reflect the new data.
1424 The character representation of the real number is dictated by the specified
1427 Note that the function leaves if the iType data member of the specified
1428 TRealFormat object has both an invalid character representation format
1429 (i.e. the format type) and invalid format flags.
1431 This leaving variant of the standard, non-leaving descriptor method
1432 differs in that this operation may cause the string descriptor's heap
1433 buffer to be reallocated in order to accommodate the new data. As a
1434 result, MaxLength() and Ptr() may return different values afterwards,
1435 and any existing raw pointers to into the descriptor data may be
1438 @param aVal The floating point number to be converted.
1439 @param aFormat The format of the conversion.
1441 @return If the conversion is successful, the length of this descriptor. If
1442 the conversion fails, a negative value indicating the cause of failure.
1443 In addition, extra information on the cause of the failure may be
1444 appended onto this descriptor. The possible values and their meaning
1447 1.KErrArgument - the supplied floating point number is not a valid
1448 number. The three characters NaN are appended to this descriptor.
1450 2.KErrOverflow - the number is too large to represent.
1451 2.1 For positive overflow, the three characters Inf are appended
1453 2.2 For negative overflow, the four characters -Inf are appended
1456 3.KErrUnderflow - the number is too small to represent.
1457 3.1 For positive underflow, the three characters Inf are appended
1459 3.2 For negative underflow, the four characters -Inf are appended
1462 4.KErrGeneral - the conversion cannot be completed. There are a
1463 number of possible reasons for this, but the most common is:
1464 4.1 The character representation format (i.e. the format type), as
1465 defined in the TRealFormat object is not recognised.
1467 @leave KErrNoMemory if the underlying buffer needs to be
1468 grown and there are insufficient resources to do so
1470 @see TRealFormat::iType
1472 EXPORT_C TInt LString16::NumL(TReal aVal,const TRealFormat &aFormat)
1475 return AppendNumL(aVal, aFormat);
1479 Converts the 64-bit signed integer into a decimal character representation
1480 and copies the conversion into this descriptor, replacing any existing data.
1482 The length of this descriptor is set to reflect the new data.
1484 If the integer is negative, the character representation is prefixed by a
1487 This leaving variant of the standard, non-leaving descriptor method
1488 differs in that this operation may cause the string descriptor's heap
1489 buffer to be reallocated in order to accommodate the new data. As a
1490 result, MaxLength() and Ptr() may return different values afterwards,
1491 and any existing raw pointers to into the descriptor data may be
1494 @param aVal The 64-bit signed integer value.
1496 @leave KErrNoMemory if the underlying buffer needs to be
1497 grown and there are insufficient resources to do so
1499 EXPORT_C void LString16::NumL(TInt64 aVal)
1506 Converts the specified 64 bit unsigned integer into a character representation
1507 based on the specified number system and copies the conversion into this
1508 descriptor, replacing any existing data.
1510 The length of this descriptor is set to reflect the new data.
1512 When a hexadecimal conversion is specified, hexadecimal characters are in
1515 This leaving variant of the standard, non-leaving descriptor method
1516 differs in that this operation may cause the string descriptor's heap
1517 buffer to be reallocated in order to accommodate the new data. As a
1518 result, MaxLength() and Ptr() may return different values afterwards,
1519 and any existing raw pointers to into the descriptor data may be
1522 @param aVal The 64 bit integer value. This is treated as an unsigned
1523 value for all builds.
1524 @param aRadix The number system representation for the 64 bit integer.
1526 @leave KErrNoMemory if the underlying buffer needs to be
1527 grown and there are insufficient resources to do so
1529 EXPORT_C void LString16::NumL(TUint64 aVal, TRadix aRadix)
1532 AppendNumL(aVal, aRadix);
1536 Formats and copies text into this descriptor, replacing any existing data.
1538 The length of this descriptor is set to reflect the new data.
1540 The function takes a format string and a variable number of arguments.
1541 The format string contains literal text embedded with directives for converting
1542 the trailing list of arguments into text.
1544 The embedded directives are character sequences prefixed with the '%' character.
1545 The literal text is simply copied into this descriptor unaltered while
1546 the '%' directives are used to convert successive arguments from the
1549 The resulting stream of literal text and converted arguments is copied into
1552 The syntax of the embedded directives follows one of four general patterns.
1554 Note that formatting of single numerical values can be achieved more
1555 conveniently using the Num() and NumUC() member functions of this class.
1557 The full description of the syntax of a format string cannot be included here.
1558 For full details, navigate to the Symbian OS guide, and follow the hierarchy of links:
1563 Using User Library (E32)
1566 How to Use Descriptors
1567 Format string syntax
1570 This leaving variant of the standard, non-leaving descriptor method
1571 differs in that this operation may cause the string descriptor's heap
1572 buffer to be reallocated in order to accommodate the new data. As a
1573 result, MaxLength() and Ptr() may return different values afterwards,
1574 and any existing raw pointers to into the descriptor data may be
1577 @param aFmt The descriptor containing the format string.
1578 The TRefByValue class provides a constructor which takes a
1581 @param ... A variable number of arguments to be converted to text as
1582 dictated by the format string.
1584 @panic USER 12 if the format string has incorrect syntax.
1586 @leave KErrNoMemory if the underlying buffer needs to be
1587 grown and there are insufficient resources to do so
1590 @see TDes16::NumUC()
1592 EXPORT_C void LString16::FormatL(TRefByValue<const TDesC16> aFmt,...)
1595 VA_START(list,aFmt);
1596 FormatListL(aFmt,list);
1600 Formats and copies text into this descriptor, replacing any existing data.
1602 The length of this descriptor is set to reflect the new data.
1604 The behaviour of this function is the same as FormatL(). In practice, it is
1605 better and easier to use FormatL(), passing a variable number of arguments
1606 as required by the format string.
1608 This leaving variant of the standard, non-leaving descriptor method
1609 differs in that this operation may cause the string descriptor's heap
1610 buffer to be reallocated in order to accommodate the new data. As a
1611 result, MaxLength() and Ptr() may return different values afterwards,
1612 and any existing raw pointers to into the descriptor data may be
1615 @param aFmt The descriptor containing the format string.
1616 @param aList A pointer to an argument list.
1618 @leave KErrNoMemory if the underlying buffer needs to be
1619 grown and there are insufficient resources to do so
1621 @see TDes16::Format()
1624 EXPORT_C void LString16::FormatListL(const TDesC16& aFmt,VA_LIST aList)
1627 AppendFormatListL(aFmt, aList);
1631 Appends data onto the end of this descriptor's data and justifies it.
1633 The source of the appended data is an existing descriptor.
1635 The target area is considered to be an area of specified width, immediately
1636 following this descriptor's existing data. Source data is copied into, and
1637 aligned within this target area according to the specified alignment instruction.
1639 If the length of the target area is larger than the length of the source,
1640 then spare space within the target area is padded with the fill character.
1642 This leaving variant of the standard, non-leaving descriptor method
1643 differs in that this operation may cause the string descriptor's heap
1644 buffer to be reallocated in order to accommodate the new data. As a
1645 result, MaxLength() and Ptr() may return different values afterwards,
1646 and any existing raw pointers to into the descriptor data may be
1649 @param aDes A 16-bit non-modifiable descriptor containing the source
1650 data. The length of the data to be copied is the smaller of:
1651 the length of the source descriptor, and
1652 the width of the target area (only if this is not the
1653 explicit negative value KDefaultJustifyWidth).
1655 @param aWidth The width of the target area. If this has the specific
1656 negative value KDefaultJustifyWidth, then the width is
1657 re-set to the length of the data source.
1659 @param aAlignment The alignment of the data within the target area.
1661 @param aFill The fill character used to pad the target area.
1663 @leave KErrNoMemory if the underlying buffer needs to be
1664 grown and there are insufficient resources to do so
1666 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
1668 EXPORT_C void LString16::AppendJustifyL(const TDesC16& Des,TInt aWidth,TAlign aAlignment,TChar aFill)
1671 TInt width = (aWidth == KDefaultJustifyWidth ? Des.Length() : aWidth);
1672 ReserveFreeCapacityGrowExponentialL(width);
1673 RBuf16::AppendJustify(Des, aWidth, aAlignment, aFill);
1677 Appends data onto the end of this descriptor's data and justifies it.
1679 The source of the appended data is an existing descriptor.
1681 The target area is considered to be an area of specified width, immediately
1682 following this descriptor's existing data. Source data is copied into, and
1683 aligned within this target area according to the specified alignment instruction.
1685 If the length of the target area is larger than the length of the source,
1686 then spare space within the target area is padded with the fill character.
1688 This leaving variant of the standard, non-leaving descriptor method
1689 differs in that this operation may cause the string descriptor's heap
1690 buffer to be reallocated in order to accommodate the new data. As a
1691 result, MaxLength() and Ptr() may return different values afterwards,
1692 and any existing raw pointers to into the descriptor data may be
1695 @param aDes An 8-bit non-modifiable descriptor containing the source data.
1697 @param aLength The length of data to be copied from the source descriptor.
1698 If this is greater than the width of the target area, then
1699 the length of data copied is limited to the width.
1700 The length of data to be copied must not be greater than
1701 the length of the source descriptor. Note that this
1702 condition is not automatically tested.
1704 @param aWidth The width of the target area. If this has the specific negative
1705 value KDefaultJustifyWidth, then the width is
1706 re-set to the length of the data source.
1708 @param aAlignment The alignment of the data within the target area.
1710 @param aFill The fill character used to pad the target area.
1712 @leave KErrNoMemory if the underlying buffer needs to be
1713 grown and there are insufficient resources to do so
1715 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
1717 EXPORT_C void LString16::AppendJustifyL(const TDesC16& Des,TInt aLength,TInt aWidth,TAlign aAlignment,TChar aFill)
1720 TInt width = (aWidth == KDefaultJustifyWidth ? aLength : aWidth);
1721 ReserveFreeCapacityGrowExponentialL(width);
1723 RBuf16::AppendJustify(Des, aLength, aWidth, aAlignment, aFill);
1727 Appends a zero terminated string onto the end of this descriptor's data and
1730 The zero terminator is not copied.
1732 The target area is considered to be an area of specified width, immediately
1733 following this descriptor's existing data. Source data is copied into, and
1734 aligned within, this target area according to the specified alignment instruction.
1736 If the length of the target area is larger than the length of the source,
1737 then spare space within the target area is padded with the fill character.
1739 This leaving variant of the standard, non-leaving descriptor method
1740 differs in that this operation may cause the string descriptor's heap
1741 buffer to be reallocated in order to accommodate the new data. As a
1742 result, MaxLength() and Ptr() may return different values afterwards,
1743 and any existing raw pointers to into the descriptor data may be
1746 @param aZeroTerminatedString A pointer to a zero terminated string The length of the data
1747 to be copied is the smaller of: the length of the string (excluding the zero
1748 terminator), the width of the target area (only if this is not the explicit
1749 negative value KDefaultJustifyWidth).
1751 @param aWidth The width of the target area. If this has the specific negative
1752 value KDefaultJustifyWidth, then the width is re-set to the length of the
1753 zero terminated string (excluding the zero terminator).
1755 @param aAlignment The alignment of the data within the target area.
1757 @param aFill The fill character used to pad the target area.
1759 @leave KErrNoMemory if the underlying buffer needs to be
1760 grown and there are insufficient resources to do so
1762 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
1764 EXPORT_C void LString16::AppendJustifyL(const TUint16* aZeroTerminatedString,TInt aWidth,TAlign aAlignment,TChar aFill)
1767 TInt width = (aWidth == KDefaultJustifyWidth ? User::StringLength(aZeroTerminatedString) : aWidth);
1768 ReserveFreeCapacityGrowExponentialL(width);
1770 RBuf16::AppendJustify(aZeroTerminatedString, aWidth, aAlignment, aFill);
1775 Appends data onto the end of this descriptor's data and justifies it.
1777 The source of the appended data is a memory location.
1779 The target area is considered to be an area of specified width, immediately
1780 following this descriptor's existing data. Source data is copied into, and
1781 aligned within, this target area according to the specified alignment instruction.
1783 If the length of the target area is larger than the length of the source,
1784 then spare space within the target area is padded with the fill character.
1786 This leaving variant of the standard, non-leaving descriptor method
1787 differs in that this operation may cause the string descriptor's heap
1788 buffer to be reallocated in order to accommodate the new data. As a
1789 result, MaxLength() and Ptr() may return different values afterwards,
1790 and any existing raw pointers to into the descriptor data may be
1793 @param aString A pointer to a source memory location.
1795 @param aLength The length of data to be copied. If this is greater than the
1796 width of the target area, then the length of data copied is
1797 limited to the width.
1799 @param aWidth The width of the target area. If this has the specific negative
1800 value KDefaultJustifyWidth, then the width is
1801 re-set to the length of the data source.
1803 @param aAlignment The alignment of the data within the target area.
1805 @param aFill The fill character used to pad the target area.
1807 @leave KErrNoMemory if the underlying buffer needs to be
1808 grown and there are insufficient resources to do so
1810 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
1812 @panic USER 17 if aLength is negative.
1814 EXPORT_C void LString16::AppendJustifyL(const TUint16* aString,TInt aLength,TInt aWidth,TAlign aAlignment,TChar aFill)
1817 TInt width = (aWidth == KDefaultJustifyWidth ? aLength : aWidth);
1818 ReserveFreeCapacityGrowExponentialL(width);
1820 RBuf16::AppendJustify(aString, aLength, aWidth, aAlignment, aFill);
1824 Converts the specified unsigned integer into a fixed width character
1825 representation based on the specified number system and appends the conversion
1826 onto the end of this descriptor's data.
1828 The length of this descriptor is incremented to reflect the new content.
1830 The function generates the exact number of specified characters, either
1831 padding to the left with character zeroes or discarding low order characters
1834 When a hexadecimal conversion is specified, hexadecimal characters are in
1837 This leaving variant of the standard, non-leaving descriptor method
1838 differs in that this operation may cause the string descriptor's heap
1839 buffer to be reallocated in order to accommodate the new data. As a
1840 result, MaxLength() and Ptr() may return different values afterwards,
1841 and any existing raw pointers to into the descriptor data may be
1844 @param aVal The unsigned integer value.
1845 @param aRadix The number system representation for the unsigned integer.
1846 @param aWidth The number of characters: to be used to contain the conversion,
1847 to be appended to this descriptor.
1849 @leave KErrNoMemory if the underlying buffer needs to be
1850 grown and there are insufficient resources to do so
1853 EXPORT_C void LString16::AppendNumFixedWidthUCL(TUint aVal,TRadix aRadix,TInt aWidth)
1855 ReserveFreeCapacityGrowExponentialL(aWidth);
1856 RBuf16::AppendNumFixedWidthUC(aVal, aRadix, aWidth);
1860 Converts the specified 64 bit integer into a character representation
1861 based on the specified number system and appends the conversion onto the end
1862 of this descriptor's data.
1864 The length of this descriptor is incremented to reflect the new content.
1866 When a hexadecimal conversion is specified, hexadecimal characters are in
1869 This leaving variant of the standard, non-leaving descriptor method
1870 differs in that this operation may cause the string descriptor's heap
1871 buffer to be reallocated in order to accommodate the new data. As a
1872 result, MaxLength() and Ptr() may return different values afterwards,
1873 and any existing raw pointers to into the descriptor data may be
1876 @param aVal The 64 bit integer value. This is always treated as an unsigned
1878 @param aRadix The number system representation for the 64 bit integer. If no
1879 explicit value is specified, then EDecimal is the default.
1881 @leave KErrNoMemory if the underlying buffer needs to be
1882 grown and there are insufficient resources to do so
1884 EXPORT_C void LString16::AppendNumUCL(TUint64 aVal, TRadix aRadix)
1886 ReserveFreeCapacityGrowExponentialL(64 + 1 + KDefaultExpandSize);
1887 RBuf16::AppendNumUC(aVal, aRadix);
1891 Converts the specified floating point number into a character representation
1892 and appends the conversion onto the end of this descriptor's data.
1894 The length of this descriptor is incremented to reflect the new content.
1896 The character representation of the real number is dictated by the specified
1899 This leaving variant of the standard, non-leaving descriptor method
1900 differs in that this operation may cause the string descriptor's heap
1901 buffer to be reallocated in order to accommodate the new data. As a
1902 result, MaxLength() and Ptr() may return different values afterwards,
1903 and any existing raw pointers to into the descriptor data may be
1906 @param aVal The floating point number to be converted.
1907 @param aFormat The format of the conversion.
1909 @return If the conversion is successful, the length of this descriptor. If
1910 the conversion fails, a negative value indicating the cause of failure.
1911 In addition, extra information on the cause of the failure may be
1912 appended onto this descriptor. The possible values and their meaning
1915 1.KErrArgument - the supplied floating point number is not a valid
1916 number. The three characters NaN are appended to this descriptor.
1918 2.KErrOverflow - the number is too large to represent.
1919 2.1 For positive overflow, the three characters Inf are appended
1921 2.2 For negative overflow, the four characters -Inf are appended
1924 3.KErrUnderflow - the number is too small to represent.
1925 3.1 For positive underflow, the three characters Inf are appended
1927 3.2 For negative underflow, the four characters -Inf are appended
1930 4.KErrGeneral - the conversion cannot be completed. There are a
1931 number of possible reasons for this, but the most common is:
1932 4.1 The character representation format (i.e. the format type), as
1933 defined in the TRealFormat object is not recognised.
1935 @leave KErrNoMemory if the underlying buffer needs to be
1936 grown and there are insufficient resources to do so
1938 EXPORT_C TInt LString16::AppendNumL(TReal aVal,const TRealFormat& aFormat)
1940 ReserveFreeCapacityGrowExponentialL(aFormat.iWidth + 1 + KDefaultExpandSize);
1941 return RBuf16::AppendNum(aVal, aFormat);
1945 Converts the 64-bit signed integer into a decimal character representation
1946 and appends the conversion onto the end of this descriptor's data.
1948 The length of this descriptor is incremented to reflect the new content.
1950 If the integer is negative, the character representation is prefixed by a
1953 This leaving variant of the standard, non-leaving descriptor method
1954 differs in that this operation may cause the string descriptor's heap
1955 buffer to be reallocated in order to accommodate the new data. As a
1956 result, MaxLength() and Ptr() may return different values afterwards,
1957 and any existing raw pointers to into the descriptor data may be
1960 @param aVal The 64-bit signed integer value.
1962 @leave KErrNoMemory if the underlying buffer needs to be
1963 grown and there are insufficient resources to do so
1965 EXPORT_C void LString16::AppendNumL(TInt64 aVal)
1967 ReserveFreeCapacityGrowExponentialL(64 + 1 + KDefaultExpandSize);
1968 RBuf16::AppendNum(aVal);
1972 Converts the specified 64 bit integer into a character representation
1973 based on the specified number system and appends the conversion onto the end
1974 of this descriptor's data.
1976 The length of this descriptor is incremented to reflect the new content.
1978 When a hexadecimal conversion is specified, hexadecimal characters are in
1981 This leaving variant of the standard, non-leaving descriptor method
1982 differs in that this operation may cause the string descriptor's heap
1983 buffer to be reallocated in order to accommodate the new data. As a
1984 result, MaxLength() and Ptr() may return different values afterwards,
1985 and any existing raw pointers to into the descriptor data may be
1988 @param aVal The 64 bit integer value. This is always treated as an unsigned
1990 @param aRadix The number system representation for the 64 bit integer.
1992 @leave KErrNoMemory if the underlying buffer needs to be
1993 grown and there are insufficient resources to do so
1995 EXPORT_C void LString16::AppendNumL(TUint64 aVal, TRadix aRadix)
1997 ReserveFreeCapacityGrowExponentialL(64 + 1 + KDefaultExpandSize);
1998 RBuf16::AppendNum(aVal, aRadix);
2002 Formats and appends text onto the end of this descriptor's data.
2004 The length of this descriptor is incremented to reflect the new content.
2006 The function takes a format string and a variable number of arguments.
2007 The format string contains literal text, embedded with directives,
2008 for converting the trailing list of arguments into text.
2010 The embedded directives are character sequences prefixed with the '%' character.
2011 The literal text is simply copied into this descriptor unaltered while
2012 the '%' directives are used to convert successive arguments from the
2013 trailing list. See the description of the Format() function.
2015 Literal text is appended on a character by character basis, and the
2016 underlying buffer is grown as necessary to accommodate it.
2018 Text converted from a trailing argument is appended as a complete
2019 string, and the underlying buffer is grown as necessary to accommodate
2022 This leaving variant of the standard, non-leaving descriptor method
2023 differs in that this operation may cause the string descriptor's heap
2024 buffer to be reallocated in order to accommodate the new data. As a
2025 result, MaxLength() and Ptr() may return different values afterwards,
2026 and any existing raw pointers to into the descriptor data may be
2029 @param aFmt The 16-bit non-modifiable descriptor containing the
2030 format string. The TRefByValue class provides a
2031 constructor which takes a TDesC16 type.
2033 @param ... A variable number of arguments to be converted to text
2034 as dictated by the format string.
2036 @leave KErrNoMemory if the underlying buffer needs to be
2037 grown and there are insufficient resources to do so
2039 @panic USER 12 if the format string has incorrect syntax.
2041 @see TDes16::Format()
2042 @see TDes16Overflow::Overflow()
2044 EXPORT_C void LString16::AppendFormatL(TRefByValue<const TDesC16> aFmt,...)
2047 VA_START(list,aFmt);
2048 AppendFormatListL(aFmt,list);
2051 class TRetryOverflow16 : public TDes16Overflow
2054 TRetryOverflow16() : iOverflow(EFalse)
2058 virtual void Overflow(TDes16& /*aDes*/)
2067 Formats and appends text onto the end of this descriptor's data.
2069 The length of this descriptor is incremented to reflect the new content.
2071 The behaviour of this function is the same as
2072 AppendFormatL(TRefByValue<const TDesC16> aFmt,TDes16Overflow *aOverflowHandler,...).
2073 In practice, it is better and easier to use AppendFormat(), passing a variable number of
2074 arguments as required by the format string.
2076 This leaving variant of the standard, non-leaving descriptor method
2077 differs in that this operation may cause the string descriptor's heap
2078 buffer to be reallocated in order to accommodate the new data. As a
2079 result, MaxLength() and Ptr() may return different values afterwards,
2080 and any existing raw pointers to into the descriptor data may be
2083 @param aFmt The descriptor containing the format string.
2084 @param aList A pointer to an argument list.
2086 @leave KErrNoMemory if the underlying buffer needs to be
2087 grown and there are insufficient resources to do so
2089 @see TDes16::AppendFormat
2092 EXPORT_C void LString16::AppendFormatListL(const TDesC16& aFmt,VA_LIST aList)
2094 ReserveFreeCapacityGrowExponentialL(aFmt.Length() + KDefaultExpandSize); // We use aFmt as a hint
2097 TInt before = Length();
2098 TRetryOverflow16 overflow;
2099 RBuf16::AppendFormatList(aFmt, aList, &overflow);
2100 if (overflow.iOverflow)
2102 SetLengthL(before); // Can't leave
2103 ReserveCapacityGrowExponentialL();
2114 Unlinks and transfers ownership of the specified 16-bit resizable descriptor's
2115 buffer to this object. The source descriptor is detached from the buffer.
2117 @param aString The source 16-bit resizable buffer. The ownership of this
2118 object's buffer is to be transferred.
2120 @see RBuf16::Close()
2122 EXPORT_C void LString16::Assign(const LString16& aString)
2124 // free any previously owned resource
2127 RBuf16::Assign(aString);
2128 // unlink buffer from original descriptor
2129 new (const_cast<LString16*>(&aString)) LString16();
2134 Transfers ownership of the specified 16-bit resizable descriptor's
2135 buffer to this object. The source descriptor is detached from the buffer.
2137 @param aRBuf The source 16-bit resizable buffer. The ownership of this
2138 object's buffer is to be transferred.
2140 @see RBuf16::Assign()
2143 EXPORT_C void LString16::Assign(const RBuf16& aRBuf)
2145 // free any previously owned resource
2148 RBuf16::Assign(aRBuf);
2151 new (const_cast<RBuf16*>(&aRBuf)) RBuf16();
2156 Transfers ownership of the specified 16-bit resizable descriptor's this object.
2158 @param aHBuf The heap descriptor to be transferred to this object.
2159 The ownership of this object's buffer is to be transferred.
2161 @see RBuf16::Assign()
2163 EXPORT_C void LString16::Assign(HBufC16* aHBuf)
2165 // free any previously owned resource
2168 RBuf16::Assign(aHBuf);
2173 Assigns ownership of the specified allocated memory to this object.
2175 @param aHeapCell The allocated memory to be assigned to this object.
2176 This pointer can be NULL, which means that a zero length
2177 16-bit resizable buffer descriptor is created.
2179 @param aMaxLength The maximum length of the descriptor.
2181 @panic USER 8 If the specified maximum length is greater then the size of the
2182 allocated heap cell, or the specified maximum length is NOT
2183 zero when the pointer to the heap cell is NULL.
2185 @see RBuf16::Close()
2186 @see RBuf16::Assign()
2188 EXPORT_C void LString16::Assign(TUint16* aHeapCell, TInt aMaxLength)
2190 // free any previously owned resource
2193 RBuf16::Assign(aHeapCell, aMaxLength);
2198 Transfers ownership of the specified 16-bit resizable descriptor's this object.
2200 @param aHeapCell The allocated memory to be assigned to this object.
2202 @param aLength The length of the descriptor.
2204 @param aMaxLength The maximum length of the descriptor.
2206 @panic USER 8 If the specified maximum length is greater then the size of the
2207 allocated heap cell, or the specified length is greater then
2208 the specified maximum length, or the specified maximum length
2209 is NOT zero when the pointer to the heap cell is NULL.
2211 @see RBuf16::Close()
2212 @see RBuf16::Assign()
2214 EXPORT_C void LString16::Assign(TUint16* aHeapCell,TInt aLength,TInt aMaxLength)
2216 // free any previously owned resource
2219 RBuf16::Assign(aHeapCell, aLength, aMaxLength);
2223 Creates a 16-bit resizable buffer descriptor that has been initialised with
2224 data from the specified read stream; leaves on failure.
2226 Data is assigned to the new descriptor from the specified stream.
2227 This variant assumes that the stream contains the length of the data followed
2230 The function is implemented by calling the HBufC16::NewL(RReadStream&,TInt)
2231 variant and then assigning the resulting heap descriptor using
2232 the RBuf16::Assign(HBufC16*) variant. The comments that describe
2233 the HBufC16::NewL() variant also apply to this RBuf16::CreateL() function.
2235 The function may leave with one of the system-wide error codes, specifically
2236 KErrOverflow, if the length of the data as read from the stream is greater than
2237 the upper limit as specified by the aMaxLength parameter.
2239 @param aStream The stream from which the data length and the data to be
2240 assigned to the new descriptor, are taken.
2241 @param aMaxLength The upper limit on the length of data that the descriptor is
2242 to represent. The value of this parameter must be non-negative
2243 otherwise the underlying function will panic.
2245 EXPORT_C void LString16::CreateL(RReadStream &aStream,TInt aMaxLength)
2248 Assign(HBufC16::NewL(aStream,aMaxLength));
2252 Appends data onto the end of this descriptor's data.
2254 The length of this descriptor is incremented to reflect the new content.
2256 This leaving variant of the standard, non-leaving descriptor method
2257 differs in that this operation may cause the string descriptor's heap
2258 buffer to be reallocated in order to accommodate the new data. As a
2259 result, MaxLength() and Ptr() may return different values afterwards,
2260 and any existing raw pointers to into the descriptor data may be
2263 @param aZeroTerminatedString A pointer to a zero terminated string .
2264 @leave KErrNoMemory if the underlying buffer needs to be
2265 grown and there are insufficient resources to do so
2267 @see LString16::AppendL
2269 EXPORT_C LString16& LString16::operator+=(const TUint16* aZeroTerminatedString)
2271 AppendL(aZeroTerminatedString,User::StringLength(aZeroTerminatedString));
2275 Appends data onto the end of this descriptor's data.
2277 The length of this descriptor is incremented to reflect the new content.
2279 This leaving variant of the standard, non-leaving descriptor method
2280 differs in that this operation may cause the string descriptor's heap
2281 buffer to be reallocated in order to accommodate the new data. As a
2282 result, MaxLength() and Ptr() may return different values afterwards,
2283 and any existing raw pointers to into the descriptor data may be
2286 @param aZeroTerminatedString A pointer to the data to be copied.
2288 @leave KErrNoMemory if the underlying buffer needs to be
2289 grown and there are insufficient resources to do so
2291 @panic USER 17 if aLength is negative.
2293 EXPORT_C void LString16::AppendL(const TUint16* aZeroTerminatedString)
2295 AppendL(aZeroTerminatedString,User::StringLength(aZeroTerminatedString));
2299 Constructor to create a 16-bit resizable string descriptor containing
2300 a copy of the specified (source) zero-terminated wide character string data, or leave
2303 The constructor allocates sufficient memory so that this string
2304 descriptor's maximum length is the same as the length of the source
2305 string. Both the current length and the maximum length of this string
2306 descriptor are set to the length of the source string.
2308 The data contained in the source string is copied into this string
2309 descriptor. The zero terminator is not copied.
2311 @param aWideCharStr A pointer to a zero-terminated wide character string
2313 @leave KErrNoMemory If there is insufficient memory.
2315 @see LString16::CopyL
2317 EXPORT_C LString16::LString16(const wchar_t* aWideCharStr)
2320 CopyL(reinterpret_cast<const TUint16*>(aWideCharStr));
2324 Copies data into this 16-bit string descriptor, replacing any existing
2325 data, and expanding its heap buffer to accommodate if necessary.
2327 The length of this descriptor is set to reflect the new data.
2329 This operation may cause the target string descriptor's heap buffer to
2330 be reallocated in order to accommodate the new data. As a result,
2331 MaxLength() and Ptr() may return different values afterwards, and any
2332 existing raw pointers to into the descriptor data may be invalidated.
2334 Note that the automatic resizing performed is a change to the
2335 functionality of this operation compared to other descriptor
2336 classes. This change is only active on objects directly declared
2337 LString16; when LString16 instances are instead manipulated via
2338 references to TDes16 or TDesC16, the standard (non-resizing, panicing)
2341 @param aWideCharStr A pointer to a wide character zero-terminated string
2343 @return A reference to this 16-bit string descriptor.
2345 @leave KErrNoMemory If the heap buffer of the string descriptor being
2346 assigned to needs to be expanded, but there is
2347 insufficient memory to do so
2349 @see LString16::CopyL
2351 EXPORT_C LString16& LString16::operator=(const wchar_t* aWideCharStr)
2353 CopyL(reinterpret_cast<const TUint16*>(aWideCharStr));
2358 Appends data onto the end of this descriptor's data.
2360 The length of this descriptor is incremented to reflect the new content.
2362 This leaving variant of the standard, non-leaving descriptor method
2363 differs in that this operation may cause the string descriptor's heap
2364 buffer to be reallocated in order to accommodate the new data. As a
2365 result, MaxLength() and Ptr() may return different values afterwards,
2366 and any existing raw pointers to into the descriptor data may be
2369 @param aWideCharStr A pointer to a wide character zero terminated string .
2370 @leave KErrNoMemory if the underlying buffer needs to be
2371 grown and there are insufficient resources to do so
2373 @see LString16::AppendL
2375 EXPORT_C LString16& LString16::operator+=(const wchar_t* aWideCharStr)
2377 AppendL(reinterpret_cast<const TUint16*>(aWideCharStr),User::StringLength(reinterpret_cast<const TUint16*>(aWideCharStr)));
2382 Copies data into this 16-bit string descriptor, replacing any existing
2383 data, and expanding its heap buffer to accommodate if necessary.
2385 This leaving variant of the standard, non-leaving descriptor method
2386 differs in that this operation may cause the string descriptor's heap
2387 buffer to be reallocated in order to accommodate the new data. As a
2388 result, MaxLength() and Ptr() may return different values afterwards,
2389 and any existing raw pointers to into the descriptor data may be
2392 @param aWideCharStr A pointer to a wide character zero terminated string to be copied.
2395 @leave KErrNoMemory If the heap buffer of the string descriptor being
2396 assigned to needs to be expanded, but there is
2397 insufficient memory to do so
2399 @panic USER 11 if aLength is negative.
2403 EXPORT_C void LString16::CopyL(const wchar_t* aWideCharStr)
2405 CopyL(reinterpret_cast<const TUint16*>(aWideCharStr));
2409 Appends data onto the end of this descriptor's data and justifies it.
2411 The source of the appended data is a memory location.
2413 The target area is considered to be an area of specified width, immediately
2414 following this descriptor's existing data. Source data is copied into, and
2415 aligned within, this target area according to the specified alignment instruction.
2417 If the length of the target area is larger than the length of the source,
2418 then spare space within the target area is padded with the fill character.
2420 This leaving variant of the standard, non-leaving descriptor method
2421 differs in that this operation may cause the string descriptor's heap
2422 buffer to be reallocated in order to accommodate the new data. As a
2423 result, MaxLength() and Ptr() may return different values afterwards,
2424 and any existing raw pointers to into the descriptor data may be
2427 @param aWideCharStr A pointer to a source memory location.
2429 @param aLength The length of data to be copied. If this is greater than the
2430 width of the target area, then the length of data copied is
2431 limited to the width.
2433 @param aWidth The width of the target area. If this has the specific negative
2434 value KDefaultJustifyWidth, then the width is
2435 re-set to the length of the data source.
2437 @param aAlignment The alignment of the data within the target area.
2439 @param aFill The fill character used to pad the target area.
2441 @leave KErrNoMemory if the underlying buffer needs to be
2442 grown and there are insufficient resources to do so
2444 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
2446 @panic USER 17 if aLength is negative.
2448 EXPORT_C void LString16::AppendJustifyL(const wchar_t* aWideCharStr,TInt aWidth,TAlign anAlignment,TChar aFill)
2450 AppendJustifyL(reinterpret_cast<const TUint16*>( aWideCharStr),aWidth,anAlignment,aFill);
2454 Appends data onto the end of this descriptor's data.
2456 The length of this descriptor is incremented to reflect the new content.
2458 This leaving variant of the standard, non-leaving descriptor method
2459 differs in that this operation may cause the string descriptor's heap
2460 buffer to be reallocated in order to accommodate the new data. As a
2461 result, MaxLength() and Ptr() may return different values afterwards,
2462 and any existing raw pointers to into the descriptor data may be
2465 @param aWideCharStr A pointer to the data to be copied.
2466 @param aLength The length of data to be copied.
2468 @leave KErrNoMemory if the underlying buffer needs to be
2469 grown and there are insufficient resources to do so
2471 @panic USER 17 if aLength is negative.
2473 EXPORT_C void LString16::AppendL(const wchar_t* aWideCharStr,TInt aLength)
2475 AppendL(reinterpret_cast<const TUint16*>(aWideCharStr),aLength);
2478 Appends data onto the end of this descriptor's data.
2480 The length of this descriptor is incremented to reflect the new content.
2482 This leaving variant of the standard, non-leaving descriptor method
2483 differs in that this operation may cause the string descriptor's heap
2484 buffer to be reallocated in order to accommodate the new data. As a
2485 result, MaxLength() and Ptr() may return different values afterwards,
2486 and any existing raw pointers to into the descriptor data may be
2489 @param aWideCharStr A pointer to the data to be copied.
2491 @leave KErrNoMemory if the underlying buffer needs to be
2492 grown and there are insufficient resources to do so
2494 @panic USER 17 if aLength is negative.
2496 EXPORT_C void LString16::AppendL(const wchar_t* aWideCharStr)
2498 AppendL(reinterpret_cast<const TUint16*>(aWideCharStr));
2501 Determines whether this Descriptor's data is equal to the specified
2504 The comparison is implemented internally using the TDesC::Compare() function.
2506 @param aWideCharStr The wide character string whose data is to be compared
2507 with this Descriptor's data.
2509 @return True if equal, false otherwise.
2513 EXPORT_C TBool LString16::operator==( const wchar_t* aWideCharStr) const
2515 return LString16::operator==(reinterpret_cast<const TUint16*>(aWideCharStr));
2519 Determines whether this Descriptor's data is equal to the specified
2522 The comparison is implemented internally using the TDesC::Compare() function.
2524 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2525 is to be compared with this Descriptor's data.
2527 @return True if equal, false otherwise.
2531 EXPORT_C TBool LString16::operator==( const TUint16* aZeroTerminatedString) const
2533 return RBuf16::operator==(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2537 Determines whether this descriptor's data is less than the specified
2540 The comparison is implemented internally using the TDesC::Compare() function.
2542 @param aWideCharStr The wide character string whose data is to be compared
2543 with this Descriptor's data.
2545 @return True if this descriptor's data is less than that of the specified string's data
2549 EXPORT_C TBool LString16::operator<( const wchar_t* aWideCharStr) const
2551 return LString16::operator<(reinterpret_cast<const TUint16*>(aWideCharStr));
2555 Determines whether this descriptor's data is less than the specified
2558 The comparison is implemented internally using the TDesC::Compare() function.
2560 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2561 is to be compared with this Descriptor's data.
2563 @return True if this descriptor's data is less than that of the specified string's data
2567 EXPORT_C TBool LString16::operator<(const TUint16* aZeroTerminatedString) const
2569 return RBuf16::operator<(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2573 Determines whether this descriptor's data is less than the specified
2576 The comparison is implemented internally using the TDesC::Compare() function.
2578 @param aWideCharStr The wide character string whose data is to be compared
2579 with this Descriptor's data.
2581 @return True if this descriptor's data is less than that of the specified string's data
2585 EXPORT_C TBool LString16::operator<=( const wchar_t* aWideCharStr) const
2587 return LString16::operator<=(reinterpret_cast<const TUint16*>(aWideCharStr));
2591 Determines whether this descriptor's data is less than/equal to the specified
2594 The comparison is implemented internally using the TDesC::Compare() function.
2596 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2597 is to be compared with this Descriptor's data.
2599 @return True if this descriptor's data is less than/equal to that of the specified string's data
2603 EXPORT_C TBool LString16::operator<=(const TUint16* aZeroTerminatedString) const
2605 return RBuf16::operator<=(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2609 Determines whether this descriptor's data is greater than the specified
2612 The comparison is implemented internally using the TDesC::Compare() function.
2614 @param aWideCharStr The wide character string whose data is to be compared
2615 with this Descriptor's data.
2617 @return True if this descriptor's data is greater than that of the specified string's data
2621 EXPORT_C TBool LString16::operator>( const wchar_t* aWideCharStr) const
2623 return LString16::operator>(reinterpret_cast<const TUint16*>(aWideCharStr));
2627 Determines whether this descriptor's data is greater than the specified
2630 The comparison is implemented internally using the TDesC::Compare() function.
2632 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2633 is to be compared with this Descriptor's data.
2635 @return True if this descriptor's data is greater than that of the specified string's data
2639 EXPORT_C TBool LString16::operator>(const TUint16* aZeroTerminatedString) const
2641 return RBuf16::operator>(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2645 Determines whether this descriptor's data is greater than/equal to the specified
2648 The comparison is implemented internally using the TDesC::Compare() function.
2650 @param aWideCharStr The wide character string whose data is to be compared
2651 with this Descriptor's data.
2653 @return True if this descriptor's data is greater than/equal to that of the specified string's data
2657 EXPORT_C TBool LString16::operator>=( const wchar_t* aWideCharStr) const
2659 return LString16::operator>=(reinterpret_cast<const TUint16*>(aWideCharStr));
2663 Determines whether this descriptor's data is greater than the specified
2666 The comparison is implemented internally using the TDesC::Compare() function.
2668 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2669 is to be compared with this Descriptor's data.
2671 @return True if this descriptor's data is greater than that of the specified string's data
2675 EXPORT_C TBool LString16::operator>=(const TUint16* aZeroTerminatedString) const
2677 return RBuf16::operator>=(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2681 Determines whether this descriptor's data is not equal to the specified
2684 The comparison is implemented internally using the TDesC::Compare() function.
2686 @param aWideCharStr The wide character string whose data is to be compared
2687 with this Descriptor's data.
2689 @return True if this descriptor's data is not equal to the specified string's data
2693 EXPORT_C TBool LString16::operator!=( const wchar_t* aWideCharStr) const
2695 return LString16::operator!=(reinterpret_cast<const TUint16*>(aWideCharStr));
2699 Determines whether this descriptor's data is not equal to the specified
2702 The comparison is implemented internally using the TDesC::Compare() function.
2704 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2705 is to be compared with this Descriptor's data.
2707 @return True if this descriptor's data is not equal to the specified string's data
2711 EXPORT_C TBool LString16::operator!=(const TUint16* aZeroTerminatedString) const
2713 return RBuf16::operator!=(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2717 Searches this descriptor's data for a match with the match pattern supplied
2718 in the specified string.
2720 The match pattern can contain the wildcard characters "*" and "?", where "*"
2721 matches zero or more consecutive occurrences of any character and "?" matches
2722 a single occurrence of any character.
2724 Note that there is no 'escape character', which means that it is not possible
2725 to match either the "*" character itself or the "?" character itself using
2728 @param aWideCharStr The wide character string whose data is to be matched
2729 with this Descriptor's data.
2731 @return If a match is found, the offset within this descriptor's data where
2732 the match first occurs. KErrNotFound, if there is no match.
2734 EXPORT_C TInt LString16::Match(const wchar_t* aWideCharStr) const
2736 return LString16::Match(reinterpret_cast<const TUint16*>(aWideCharStr));
2740 Searches this descriptor's data for a match with the match pattern supplied
2741 in the specified string.
2743 The match pattern can contain the wildcard characters "*" and "?", where "*"
2744 matches zero or more consecutive occurrences of any character and "?" matches
2745 a single occurrence of any character.
2747 Note that there is no 'escape character', which means that it is not possible
2748 to match either the "*" character itself or the "?" character itself using
2751 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2752 is to be matched with this Descriptor's data.
2754 @return If a match is found, the offset within this descriptor's data where
2755 the match first occurs. KErrNotFound, if there is no match.
2757 EXPORT_C TInt LString16::Match(const TUint16* aZeroTerminatedString) const
2759 return RBuf16::Match(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2762 Searches this descriptor's folded data for a match with the folded match
2763 pattern supplied in the specified string.
2765 The match pattern can contain the wildcard characters "*" and "?", where "*"
2766 matches zero or more consecutive occurrences of any character and "?" matches
2767 a single occurrence of any character.
2769 Note that folding is locale-independent behaviour. It is also important to
2770 note that there can be no guarantee that folding is in any way culturally
2771 appropriate, and should not be used for matching strings in natural language;
2772 use MatchC() for this.
2774 Note that there is no 'escape character', which means that it is not possible
2775 to match either the "*" character itself or the "?" character itself using
2778 @param aWideCharStr The wide character string whose data is to be matched
2779 with this Descriptor's data.
2781 @return If a match is found, the offset within this descriptor's data where
2782 the match first occurs. KErrNotFound, if there is no match.
2784 @see TDesC::MatchC()
2786 EXPORT_C TInt LString16::MatchF(const wchar_t* aWideCharStr) const
2788 return LString16::MatchF(reinterpret_cast<const TUint16*>(aWideCharStr));
2791 Searches this descriptor's folded data for a match with the folded match
2792 pattern supplied in the specified string.
2794 The match pattern can contain the wildcard characters "*" and "?", where "*"
2795 matches zero or more consecutive occurrences of any character and "?" matches
2796 a single occurrence of any character.
2798 Note that folding is locale-independent behaviour. It is also important to
2799 note that there can be no guarantee that folding is in any way culturally
2800 appropriate, and should not be used for matching strings in natural language;
2801 use MatchC() for this.
2803 Note that there is no 'escape character', which means that it is not possible
2804 to match either the "*" character itself or the "?" character itself using
2807 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2808 is to be matched with this Descriptor's data.
2810 @return If a match is found, the offset within this descriptor's data where
2811 the match first occurs. KErrNotFound, if there is no match.
2813 @see TDesC::MatchC()
2815 EXPORT_C TInt LString16::MatchF(const TUint16* aZeroTerminatedString) const
2817 return RBuf16::MatchF(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2820 Compares this descriptor's data with the specified string's data.
2822 The comparison proceeds on a byte for byte basis. The result of the comparison
2823 is based on the difference of the first bytes to disagree.
2825 @param aWideCharStr The wide character string whose data is to be compared
2826 with this Descriptor's data.
2828 @return Positive, if this descriptor is greater than the specified string.
2829 Negative, if this descriptor is less than the specified string.
2830 Zero, if both the descriptor and the string have the same length
2831 and the their contents are the same.
2833 EXPORT_C TInt LString16::Compare(const wchar_t* aWideCharStr) const
2835 return LString16::Compare(reinterpret_cast<const TUint16*>(aWideCharStr));
2839 Compares this descriptor's data with the specified string's data.
2841 The comparison proceeds on a byte for byte basis. The result of the comparison
2842 is based on the difference of the first bytes to disagree.
2844 @param aZeroTerminatedString The wide Zero TerminatedString string whose data
2845 is to be compared with this Descriptor's data.
2847 @return Positive, if this descriptor is greater than the specified string.
2848 Negative, if this descriptor is less than the specified string.
2849 Zero, if both the descriptor and the string have the same length
2850 and the their contents are the same.
2852 EXPORT_C TInt LString16::Compare(const TUint16* aZeroTerminatedString) const
2854 return RBuf16::Compare(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2857 Compares this descriptor's folded data with the specified string's folded
2860 Note that folding is locale-independent behaviour. It is also important to
2861 note that there can be no guarantee that folding is in any way culturally
2862 appropriate, and should not be used for comparing strings in natural language;
2864 @param aWideCharStr The wide character string whose data is to be compared
2865 with this Descriptor's data.
2867 @return Positive, if this descriptor is greater than the specified string.
2868 Negative, if this descriptor is less than the specified string.
2869 Zero, if the descriptor and the specified string have the same length
2870 and the their contents are the same.
2872 @see TDesC::Compare()
2874 EXPORT_C TInt LString16::CompareF(const wchar_t* aWideCharStr) const
2876 return LString16::CompareF(reinterpret_cast<const TUint16*>(aWideCharStr));
2880 Compares this descriptor's folded data with the specified string's folded
2883 Note that folding is locale-independent behaviour. It is also important to
2884 note that there can be no guarantee that folding is in any way culturally
2885 appropriate, and should not be used for comparing strings in natural language;
2887 @param aZeroTerminatedString The wide Zero Terminated String whose data
2888 is to be compared with this string's data.
2890 @return Positive, if this descriptor is greater than the specified string.
2891 Negative, if this descriptor is less than the specified string.
2892 Zero, if the descriptor and the specified string have the same length
2893 and the their contents are the same.
2895 @see TDesC::Compare()
2897 EXPORT_C TInt LString16::CompareF(const TUint16* aZeroTerminatedString) const
2899 return RBuf16::CompareF(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2903 Searches for the first occurrence of the specified data sequence within this
2906 Searching always starts at the beginning of this descriptor's data.
2908 @param aWideCharStr The wide character string whose data is to be searched for,
2909 within this Descriptor's data.
2911 @return The offset of the data sequence from the beginning of this descriptor's
2912 data. KErrNotFound, if the data sequence cannot be found.
2914 EXPORT_C TInt LString16::Find(const wchar_t* aWideCharStr) const
2916 return LString16::Find(reinterpret_cast<const TUint16*>(aWideCharStr));
2920 Searches for the first occurrence of the specified data sequence within this
2923 Searching always starts at the beginning of this descriptor's data.
2925 @param aWideCharStr The wide character string whose data is to be searched for,
2926 within this Descriptor's data.
2928 @return The offset of the data sequence from the beginning of this descriptor's
2929 data. KErrNotFound, if the data sequence cannot be found.
2931 EXPORT_C TInt LString16::Find(const TUint16* aZeroTerminatedString) const
2933 return RBuf16::Find(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
2937 Searches for the first occurrence of the specified data sequence within this
2940 Searching always starts at the beginning of this descriptor's data.
2942 @param aWideCharStr The wide character string whose data is to be searched for,
2943 within this Descriptor's data.
2944 @param aLenS The length of the data sequence to be searched for. This value
2945 must not be negative, otherwise the function raises a panic.
2947 @return The offset of the data sequence from the beginning of this descriptor's
2948 data. KErrNotFound, if the data sequence cannot be found.
2950 @panic USER 29 if aLenS is negative.
2952 EXPORT_C TInt LString16::Find(const wchar_t* aWideCharStr,TInt aLenS) const
2954 return LString16::Find(reinterpret_cast<const TUint16*>(aWideCharStr), aLenS);
2958 Searches for the first occurrence of the specified folded data sequence within
2959 this descriptor's folded data.
2961 Searching always starts at the beginning of this descriptor's data.
2963 Note that folding is locale-independent behaviour. It is also important to
2964 note that there can be no guarantee that folding is in any way culturally
2965 appropriate, and should not be used for finding strings in natural language;
2967 @param aWideCharStr The wide character string whose data is to be searched for,
2968 within this Descriptor's data.
2970 @return The offset of the data sequence from the beginning of this descriptor's
2971 data. KErrNotFound, if the data sequence cannot be found. Zero, if the
2972 length of the search data sequence is zero.
2975 EXPORT_C TInt LString16::FindF(const wchar_t* aWideCharStr) const
2977 return LString16::FindF(reinterpret_cast<const TUint16*>(aWideCharStr));
2981 Searches for the first occurrence of the specified folded data sequence within
2982 this descriptor's folded data.
2984 Searching always starts at the beginning of this descriptor's data.
2986 Note that folding is locale-independent behaviour. It is also important to
2987 note that there can be no guarantee that folding is in any way culturally
2988 appropriate, and should not be used for finding strings in natural language;
2990 @param aWideCharStr The wide character string whose data is to be searched for,
2991 within this Descriptor's data.
2993 @return The offset of the data sequence from the beginning of this descriptor's
2994 data. KErrNotFound, if the data sequence cannot be found. Zero, if the
2995 length of the search data sequence is zero.
2998 EXPORT_C TInt LString16::FindF(const TUint16* aZeroTerminatedString) const
3000 return RBuf16::FindF(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
3003 Searches for the first occurrence of the specified folded data sequence within
3004 this descriptor's folded data.
3006 Searching always starts at the beginning of this descriptor's data.
3008 Note that folding is locale-independent behaviour. It is also important to
3009 note that there can be no guarantee that folding is in any way culturally
3010 appropriate, and should not be used for finding strings in natural language;
3012 @param aWideCharStr The wide character string whose data is to be searched for,
3013 within this Descriptor's data.
3014 @param aLenS The length of the data sequence to be searched for. This value
3015 must not be negative, otherwise the function raises a panic.
3017 @return The offset of the data sequence from the beginning of this descriptor's
3018 data. KErrNotFound, if the data sequence cannot be found. Zero, if the
3019 length of the search data sequence is zero.
3021 @panic USER 29 if aLenS is negative
3024 EXPORT_C TInt LString16::FindF(const wchar_t* aWideCharStr, TInt aLen) const
3026 return RBuf16::FindF(reinterpret_cast<const TUint16*>(aWideCharStr),aLen);
3030 Copies and folds data from the specified string into this descriptor replacing
3033 The length of this descriptor is set to reflect the new
3036 Note that folding is locale-independent behaviour. It is also important to
3037 note that there can be no guarantee that folding is in any way culturally
3038 appropriate, and should not be used when dealing with strings in natural
3041 This leaving variant of the standard, non-leaving descriptor method
3042 differs in that this operation may cause the string descriptor's heap
3043 buffer to be reallocated in order to accommodate the new data. As a
3044 result, MaxLength() and Ptr() may return different values afterwards,
3045 and any existing raw pointers to into the descriptor data may be
3048 @param aWideCharStr A wide character string
3050 @leave KErrNoMemory if the underlying buffer needs to be
3051 grown and there are insufficient resources to do so
3053 EXPORT_C void LString16:: CopyFL(const wchar_t* aWideCharStr )
3055 LString16::CopyFL(reinterpret_cast<const TUint16*>(aWideCharStr));
3059 Copies and folds data from the specified string into this descriptor replacing
3062 The length of this descriptor is set to reflect the new
3065 Note that folding is locale-independent behaviour. It is also important to
3066 note that there can be no guarantee that folding is in any way culturally
3067 appropriate, and should not be used when dealing with strings in natural
3070 This leaving variant of the standard, non-leaving descriptor method
3071 differs in that this operation may cause the string descriptor's heap
3072 buffer to be reallocated in order to accommodate the new data. As a
3073 result, MaxLength() and Ptr() may return different values afterwards,
3074 and any existing raw pointers to into the descriptor data may be
3077 @param aZeroTerminatedString A wide zero terminated string
3079 @leave KErrNoMemory if the underlying buffer needs to be
3080 grown and there are insufficient resources to do so
3082 EXPORT_C void LString16:: CopyFL(const TUint16* aZeroTerminatedString )
3084 LString16::CopyFL(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
3088 Copies text from the specified string and converts it to lower case before
3089 putting it into this descriptor, replacing any existing data.
3091 The length of this descriptor is set to reflect the new data.
3093 Conversion to lower case is implemented as appropriate to the current locale.
3095 This leaving variant of the standard, non-leaving descriptor method
3096 differs in that this operation may cause the string descriptor's heap
3097 buffer to be reallocated in order to accommodate the new data. As a
3098 result, MaxLength() and Ptr() may return different values afterwards,
3099 and any existing raw pointers to into the descriptor data may be
3102 @param aWideCharStr A wide character string.
3104 @leave KErrNoMemory if the underlying buffer needs to be
3105 grown and there are insufficient resources to do so
3107 EXPORT_C void LString16:: CopyLCL(const wchar_t* aWideCharStr)
3109 LString16::CopyLCL(reinterpret_cast<const TUint16*>(aWideCharStr));
3113 Copies text from the specified string and converts it to lower case before
3114 putting it into this descriptor, replacing any existing data.
3116 The length of this descriptor is set to reflect the new data.
3118 Conversion to lower case is implemented as appropriate to the current locale.
3120 This leaving variant of the standard, non-leaving descriptor method
3121 differs in that this operation may cause the string descriptor's heap
3122 buffer to be reallocated in order to accommodate the new data. As a
3123 result, MaxLength() and Ptr() may return different values afterwards,
3124 and any existing raw pointers to into the descriptor data may be
3127 @param aZeroTerminatedString A wide zero terminated string.
3129 @leave KErrNoMemory if the underlying buffer needs to be
3130 grown and there are insufficient resources to do so
3132 EXPORT_C void LString16:: CopyLCL(const TUint16* aZeroTerminatedString)
3134 LString16::CopyLCL(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
3138 Copies text from the specified string and converts it to upper case before
3139 putting it into this descriptor, replacing any existing data.
3141 The length of this descriptor is set to reflect the new data.
3143 Conversion to upper case is implemented as appropriate to the current locale.
3145 This leaving variant of the standard, non-leaving descriptor method
3146 differs in that this operation may cause the string descriptor's heap
3147 buffer to be reallocated in order to accommodate the new data. As a
3148 result, MaxLength() and Ptr() may return different values afterwards,
3149 and any existing raw pointers to into the descriptor data may be
3152 @param aWideCharStr A wide character string.
3154 @leave KErrNoMemory if the underlying buffer needs to be
3155 grown and there are insufficient resources to do so
3157 EXPORT_C void LString16:: CopyUCL(const wchar_t* aWideCharStr)
3159 LString16::CopyUCL(reinterpret_cast<const TUint16*>(aWideCharStr));
3163 Copies text from the specified string and converts it to upper case before
3164 putting it into this descriptor, replacing any existing data.
3166 The length of this descriptor is set to reflect the new data.
3168 Conversion to upper case is implemented as appropriate to the current locale.
3170 This leaving variant of the standard, non-leaving descriptor method
3171 differs in that this operation may cause the string descriptor's heap
3172 buffer to be reallocated in order to accommodate the new data. As a
3173 result, MaxLength() and Ptr() may return different values afterwards,
3174 and any existing raw pointers to into the descriptor data may be
3177 @param aZeroTerminatedString A wide zero terminated string.
3179 @leave KErrNoMemory if the underlying buffer needs to be
3180 grown and there are insufficient resources to do so
3182 EXPORT_C void LString16:: CopyUCL(const TUint16* aZeroTerminatedString)
3184 LString16::CopyUCL(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
3188 Copies text from the specified string and capitalises it before putting
3189 it into this descriptor, replacing any existing data.
3191 The length of this descriptor is set to reflect the new data.
3193 Capitalisation is implemented as appropriate to the current locale.
3195 This leaving variant of the standard, non-leaving descriptor method
3196 differs in that this operation may cause the string descriptor's heap
3197 buffer to be reallocated in order to accommodate the new data. As a
3198 result, MaxLength() and Ptr() may return different values afterwards,
3199 and any existing raw pointers to into the descriptor data may be
3202 @param aWideCharStr A wide character string.
3204 @leave KErrNoMemory if the underlying buffer needs to be
3205 grown and there are insufficient resources to do so
3207 EXPORT_C void LString16:: CopyCPL(const wchar_t* aWideCharStr)
3209 LString16::CopyCPL(reinterpret_cast<const TUint16*>(aWideCharStr));
3213 Copies text from the specified string and capitalises it before putting
3214 it into this descriptor, replacing any existing data.
3216 The length of this descriptor is set to reflect the new data.
3218 Capitalisation is implemented as appropriate to the current locale.
3220 This leaving variant of the standard, non-leaving descriptor method
3221 differs in that this operation may cause the string descriptor's heap
3222 buffer to be reallocated in order to accommodate the new data. As a
3223 result, MaxLength() and Ptr() may return different values afterwards,
3224 and any existing raw pointers to into the descriptor data may be
3227 @param aZeroTerminatedString A wide zero terminated string.
3229 @leave KErrNoMemory if the underlying buffer needs to be
3230 grown and there are insufficient resources to do so
3232 EXPORT_C void LString16:: CopyCPL(const TUint16* aZeroTerminatedString)
3234 LString16::CopyCPL(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
3237 Inserts data into this descriptor.
3239 The length of this descriptor is changed to reflect the extra data.
3241 This leaving variant of the standard, non-leaving descriptor method
3242 differs in that this operation may cause the string descriptor's heap
3243 buffer to be reallocated in order to accommodate the new data. As a
3244 result, MaxLength() and Ptr() may return different values afterwards,
3245 and any existing raw pointers to into the descriptor data may be
3248 @param aPos The position within the data where insertion is to start. This
3249 is an offset value; a zero value refers to the leftmost data
3252 @param aWideCharStr A wide character string.
3254 @leave KErrNoMemory if the underlying buffer needs to be
3255 grown and there are insufficient resources to do so
3257 @panic USER 10 if aPos is negative or is greater than the length of this
3260 EXPORT_C void LString16:: InsertL(TInt aPos,const wchar_t* aWideCharStr)
3262 LString16::InsertL(aPos, reinterpret_cast<const TUint16*>(aWideCharStr));
3266 Inserts data into this descriptor.
3268 The length of this descriptor is changed to reflect the extra data.
3270 This leaving variant of the standard, non-leaving descriptor method
3271 differs in that this operation may cause the string descriptor's heap
3272 buffer to be reallocated in order to accommodate the new data. As a
3273 result, MaxLength() and Ptr() may return different values afterwards,
3274 and any existing raw pointers to into the descriptor data may be
3277 @param aPos The position within the data where insertion is to start. This
3278 is an offset value; a zero value refers to the leftmost data
3281 @param aZeroTerminatedString A wide null terminated string.
3283 @leave KErrNoMemory if the underlying buffer needs to be
3284 grown and there are insufficient resources to do so
3286 @panic USER 10 if aPos is negative or is greater than the length of this
3289 EXPORT_C void LString16:: InsertL(TInt aPos,const TUint16* aZeroTerminatedString)
3291 LString16::InsertL(aPos,TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
3295 Replaces data in this descriptor.
3297 The specified length can be different to the length of the replacement data.
3298 The length of this descriptor changes to reflect the change of data.
3300 This leaving variant of the standard, non-leaving descriptor method
3301 differs in that this operation may cause the string descriptor's heap
3302 buffer to be reallocated in order to accommodate the new data. As a
3303 result, MaxLength() and Ptr() may return different values afterwards,
3304 and any existing raw pointers to into the descriptor data may be
3307 @param aPos The position within the data where replacement is to start.
3308 This is an offset value; a zero value refers to the leftmost
3311 @param aLength The length of data to be replaced.
3313 @param aWideCharStr The source wide character string
3315 @leave KErrNoMemory if the underlying buffer needs to be
3316 grown and there are insufficient resources to do so
3318 @panic USER 8 if aLength is negative
3320 @panic USER 10 if aPos is negative or is greater than the length of this
3323 @panic USER 16 if the length of the source descriptor aDes is negative
3325 EXPORT_C void LString16:: ReplaceL(TInt aPos,TInt aLength,const wchar_t* aWideCharStr)
3327 LString16::ReplaceL(aPos,aLength,reinterpret_cast<const TUint16*>(aWideCharStr));
3331 Replaces data in this descriptor.
3333 The specified length can be different to the length of the replacement data.
3334 The length of this descriptor changes to reflect the change of data.
3336 This leaving variant of the standard, non-leaving descriptor method
3337 differs in that this operation may cause the string descriptor's heap
3338 buffer to be reallocated in order to accommodate the new data. As a
3339 result, MaxLength() and Ptr() may return different values afterwards,
3340 and any existing raw pointers to into the descriptor data may be
3343 @param aPos The position within the data where replacement is to start.
3344 This is an offset value; a zero value refers to the leftmost
3347 @param aLength The length of data to be replaced.
3349 @param aZeroTerminatedString The source wide null terminated character string
3351 @leave KErrNoMemory if the underlying buffer needs to be
3352 grown and there are insufficient resources to do so
3354 @panic USER 8 if aLength is negative
3356 @panic USER 10 if aPos is negative or is greater than the length of this
3359 @panic USER 16 if the length of the source descriptor aDes is negative
3361 EXPORT_C void LString16:: ReplaceL(TInt aPos,TInt aLength,const TUint16* aZeroTerminatedString)
3363 LString16::ReplaceL(aPos,aLength,TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)));
3367 Copies data into this descriptor and justifies it, replacing any existing data.
3369 The length of this descriptor is set to reflect the new data.
3371 The target area is considered to be an area of specified width positioned at
3372 the beginning of this descriptor's data area. Source data is copied into, and
3373 aligned within this target area according to the specified alignment
3376 If the length of the target area is larger than the length of the source, then
3377 spare space within the target area is padded with the fill character.
3379 This leaving variant of the standard, non-leaving descriptor method
3380 differs in that this operation may cause the string descriptor's heap
3381 buffer to be reallocated in order to accommodate the new data. As a
3382 result, MaxLength() and Ptr() may return different values afterwards,
3383 and any existing raw pointers to into the descriptor data may be
3386 @param aWideCharStr A wide character string containing the source data.
3387 The length of the data to be copied is the smaller of:
3388 the length of the source descriptor, and
3389 the width of the target area (only if this is not the
3390 explicit negative value KDefaultJustifyWidth).
3392 @param aWidth The width of the target area. If this has the specific
3393 negative value KDefaultJustifyWidth, then the width is
3394 re-set to the length of the data source.
3396 @param aAlignment The alignment of the data within the target area
3398 @param aFill The fill character used to pad the target area.
3400 @leave KErrNoMemory if the underlying buffer needs to be
3401 grown and there are insufficient resources to do so
3403 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
3405 EXPORT_C void LString16:: JustifyL(const wchar_t* aWideCharStr,TInt aWidth,TAlign anAlignment,TChar aFill)
3407 LString16::JustifyL(reinterpret_cast<const TUint16*>(aWideCharStr),aWidth,anAlignment,aFill);
3411 Copies data into this descriptor and justifies it, replacing any existing data.
3413 The length of this descriptor is set to reflect the new data.
3415 The target area is considered to be an area of specified width positioned at
3416 the beginning of this descriptor's data area. Source data is copied into, and
3417 aligned within this target area according to the specified alignment
3420 If the length of the target area is larger than the length of the source, then
3421 spare space within the target area is padded with the fill character.
3423 This leaving variant of the standard, non-leaving descriptor method
3424 differs in that this operation may cause the string descriptor's heap
3425 buffer to be reallocated in order to accommodate the new data. As a
3426 result, MaxLength() and Ptr() may return different values afterwards,
3427 and any existing raw pointers to into the descriptor data may be
3430 @param aWideCharStr A wide character string containing the source data.
3431 The length of the data to be copied is the smaller of:
3432 the length of the source descriptor, and
3433 the width of the target area (only if this is not the
3434 explicit negative value KDefaultJustifyWidth).
3436 @param aWidth The width of the target area. If this has the specific
3437 negative value KDefaultJustifyWidth, then the width is
3438 re-set to the length of the data source.
3440 @param aAlignment The alignment of the data within the target area
3442 @param aFill The fill character used to pad the target area.
3444 @leave KErrNoMemory if the underlying buffer needs to be
3445 grown and there are insufficient resources to do so
3447 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
3449 EXPORT_C void LString16:: JustifyL(const TUint16* aZeroTerminatedString,TInt aWidth,TAlign anAlignment,TChar aFill)
3451 LString16::JustifyL(TPtrC16((aZeroTerminatedString), User::StringLength(aZeroTerminatedString)),aWidth,anAlignment,aFill);
3455 Appends data onto the end of this descriptor's data and justifies it.
3457 The source of the appended data is a memory location.
3459 The target area is considered to be an area of specified width, immediately
3460 following this descriptor's existing data. Source data is copied into, and
3461 aligned within, this target area according to the specified alignment instruction.
3463 If the length of the target area is larger than the length of the source,
3464 then spare space within the target area is padded with the fill character.
3466 This leaving variant of the standard, non-leaving descriptor method
3467 differs in that this operation may cause the string descriptor's heap
3468 buffer to be reallocated in order to accommodate the new data. As a
3469 result, MaxLength() and Ptr() may return different values afterwards,
3470 and any existing raw pointers to into the descriptor data may be
3473 @param aString A pointer to a source memory location.
3475 @param aLength The length of data to be copied. If this is greater than the
3476 width of the target area, then the length of data copied is
3477 limited to the width.
3479 @param aWidth The width of the target area. If this has the specific negative
3480 value KDefaultJustifyWidth, then the width is
3481 re-set to the length of the data source.
3483 @param aAlignment The alignment of the data within the target area.
3485 @param aFill The fill character used to pad the target area.
3487 @leave KErrNoMemory if the underlying buffer needs to be
3488 grown and there are insufficient resources to do so
3490 @panic USER 11 if aWidth has a negative value other than KDefaultJustifyWidth.
3492 @panic USER 17 if aLength is negative.
3494 EXPORT_C void LString16:: AppendJustifyL(const wchar_t* aWideCharStr,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill)
3496 LString16::AppendJustifyL(reinterpret_cast<const TUint16*>(aWideCharStr),aLength, aWidth,anAlignment,aFill);