sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef ESTRING_H
|
sl@0
|
17 |
#define ESTRING_H
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32std.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
// this macro is defined only if the target is WINSCW and wchar_t is ON
|
sl@0
|
22 |
// (i.e OPTION CW -wchar_t on)
|
sl@0
|
23 |
// and if the target is any thing other than WINSCW
|
sl@0
|
24 |
// it is being assumed that wchar_t is ON(OPTION CW -wchar_t on by
|
sl@0
|
25 |
// default or other wise)
|
sl@0
|
26 |
#define NATIVE_WCHAR // most platforms do wchar_t properly
|
sl@0
|
27 |
#if defined __cplusplus && defined __WINSCW__
|
sl@0
|
28 |
#if !__option(wchar_type) // without the wchar_type option
|
sl@0
|
29 |
typedef unsigned short wchar_t; // needs a typedef
|
sl@0
|
30 |
#undef NATIVE_WCHAR // which is not native
|
sl@0
|
31 |
#endif
|
sl@0
|
32 |
#endif
|
sl@0
|
33 |
|
sl@0
|
34 |
// Since the LStrings can leave in their constructors, we have to make
|
sl@0
|
35 |
// sure to avoid the operator new/delete ELeave mismatch problem that
|
sl@0
|
36 |
// can result in the top level LString object heap being
|
sl@0
|
37 |
// leaked. These operator delete overloads match the global operator
|
sl@0
|
38 |
// new overloads applicable to the LString classes (which are
|
sl@0
|
39 |
// non-CBase derived).
|
sl@0
|
40 |
//
|
sl@0
|
41 |
// Note that when allocating a native C++ array of LStrings, only the
|
sl@0
|
42 |
// default constructor is invoked which cannot leave. So there are no
|
sl@0
|
43 |
// issues related to the array case.
|
sl@0
|
44 |
|
sl@0
|
45 |
#define LSTRING_CONSTRUCTORS_MAY_LEAVE \
|
sl@0
|
46 |
static void operator delete(TAny* aPtr) __NO_THROW \
|
sl@0
|
47 |
{ \
|
sl@0
|
48 |
return ::operator delete(aPtr); \
|
sl@0
|
49 |
} \
|
sl@0
|
50 |
\
|
sl@0
|
51 |
static void operator delete(TAny* aPtr, TLeave) __NO_THROW \
|
sl@0
|
52 |
{ \
|
sl@0
|
53 |
return ::operator delete(aPtr); \
|
sl@0
|
54 |
} \
|
sl@0
|
55 |
\
|
sl@0
|
56 |
static void operator delete(TAny*, TAny*) __NO_THROW \
|
sl@0
|
57 |
{ \
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
@file
|
sl@0
|
62 |
|
sl@0
|
63 |
A self-managing descriptor class
|
sl@0
|
64 |
|
sl@0
|
65 |
@publishedAll
|
sl@0
|
66 |
@released
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
|
sl@0
|
69 |
/**
|
sl@0
|
70 |
@class LString8
|
sl@0
|
71 |
|
sl@0
|
72 |
LString8 is a convenient, general-purpose 8 bit string class derived
|
sl@0
|
73 |
from RBuf8. LString8 adds automatic cleanup and on-demand buffer
|
sl@0
|
74 |
resize facilities.
|
sl@0
|
75 |
|
sl@0
|
76 |
@par L-Classes
|
sl@0
|
77 |
|
sl@0
|
78 |
Note: The L prefix denotes that construction, copying, passing and
|
sl@0
|
79 |
returning by value, assignment, and manipulation via operators should
|
sl@0
|
80 |
all be considered potentially leaving operations unless otherwise
|
sl@0
|
81 |
explicitly documented. Code that uses LString8 should be written
|
sl@0
|
82 |
accordingly, in leave-safe style.
|
sl@0
|
83 |
|
sl@0
|
84 |
@par Descriptor Relationships
|
sl@0
|
85 |
|
sl@0
|
86 |
Like an RBuf8, an LString8 can be passed to any function that is
|
sl@0
|
87 |
prototyped to take a TDes8 or a TDesC8 reference. Again like an
|
sl@0
|
88 |
RBuf8, an LString8 maintains its string data in a heap buffer.
|
sl@0
|
89 |
|
sl@0
|
90 |
@par Value-Type Behaviour
|
sl@0
|
91 |
|
sl@0
|
92 |
Unlike RBuf8, an LString8 may be used much like a simple T class;
|
sl@0
|
93 |
LString8 typed variables will automatically clean up after themselves
|
sl@0
|
94 |
when they go out of scope, and LString8 typed fields will similarly
|
sl@0
|
95 |
automatically release all owned resources when their containing object
|
sl@0
|
96 |
is destroyed.
|
sl@0
|
97 |
|
sl@0
|
98 |
For example, where:
|
sl@0
|
99 |
|
sl@0
|
100 |
@code
|
sl@0
|
101 |
RBuf8 buf;
|
sl@0
|
102 |
buf.CleanupClosePushL();
|
sl@0
|
103 |
...
|
sl@0
|
104 |
CleanupStack::PopAndDestroy();
|
sl@0
|
105 |
@endcode
|
sl@0
|
106 |
|
sl@0
|
107 |
would be required, with LString8:
|
sl@0
|
108 |
|
sl@0
|
109 |
@code
|
sl@0
|
110 |
LString8 buf;
|
sl@0
|
111 |
...
|
sl@0
|
112 |
@endcode
|
sl@0
|
113 |
|
sl@0
|
114 |
will suffice. Pushing an LString8 onto the cleanup stack is not
|
sl@0
|
115 |
necessary or recommended, but the effects of doing so are
|
sl@0
|
116 |
benign. LString8 instances can also be passed and returned by value,
|
sl@0
|
117 |
but note that doing so may trigger implicit heap allocation and cause
|
sl@0
|
118 |
a leave with KErrNoMemory.
|
sl@0
|
119 |
|
sl@0
|
120 |
@code
|
sl@0
|
121 |
void TakeString(LString8 aString)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
// ...
|
sl@0
|
124 |
}
|
sl@0
|
125 |
|
sl@0
|
126 |
LString8 ReturnString(LString8 aString)
|
sl@0
|
127 |
{
|
sl@0
|
128 |
TakeString(aString); // Statement may leave with KErrNoMemory
|
sl@0
|
129 |
return aString; // Statement may leave with KErrNoMemory
|
sl@0
|
130 |
}
|
sl@0
|
131 |
@endcode
|
sl@0
|
132 |
|
sl@0
|
133 |
As with other descriptors, passing by reference when possible is more
|
sl@0
|
134 |
efficient.
|
sl@0
|
135 |
|
sl@0
|
136 |
@par On-Demand Growth
|
sl@0
|
137 |
|
sl@0
|
138 |
In addition to the value-type semantics described above, LString8
|
sl@0
|
139 |
also supports automatic in-place resizing. All standard descriptor
|
sl@0
|
140 |
methods are available, but for any non-leaving descriptor method that
|
sl@0
|
141 |
may panic due to buffer overflow, LString8 adds a corresponding
|
sl@0
|
142 |
leaving method that automatically expands the underlying buffer
|
sl@0
|
143 |
on-demand. For example, Append() will panic if the new data overflows
|
sl@0
|
144 |
available buffer space, while AppendL() will attempt to realloc the
|
sl@0
|
145 |
buffer as necessary. The new leaving variants may therefore leave with
|
sl@0
|
146 |
KErrNoMemory, may invalidate any existing raw pointers into the data
|
sl@0
|
147 |
buffer (e.g. those previously returned by Ptr()), and may change the
|
sl@0
|
148 |
value returned by MaxLength().
|
sl@0
|
149 |
|
sl@0
|
150 |
@code
|
sl@0
|
151 |
LString8 message; // Zero length
|
sl@0
|
152 |
message.FormatL(_L("This is message %n from %S"), n, &s); // FormatL automatically grows the buffer
|
sl@0
|
153 |
User::InfoPrint(message);
|
sl@0
|
154 |
@endcode
|
sl@0
|
155 |
|
sl@0
|
156 |
It is important to note that LString8 only supports automatic growth
|
sl@0
|
157 |
when being manipulated directly as an LString8. When an LString8 is
|
sl@0
|
158 |
passed to a function accepting a TDes8, that function will operate on
|
sl@0
|
159 |
it as if it is a fixed-max-length descriptor. In that case, adequate
|
sl@0
|
160 |
capacity must be reserved within the LString8 prior to calling the
|
sl@0
|
161 |
function. This can either be achieved using the appropriate constructor or ReserveFreeCapacityL().
|
sl@0
|
162 |
|
sl@0
|
163 |
@code
|
sl@0
|
164 |
extern void GetLastQuery(TDes8& aQuery);
|
sl@0
|
165 |
extern void GetLastAuxQuery(TDes8& aQuery);
|
sl@0
|
166 |
|
sl@0
|
167 |
LString8 query(KMaxQuerySize); // Guarantees query.MaxLength() >= KMaxQuerySize
|
sl@0
|
168 |
GetLastQuery(query);
|
sl@0
|
169 |
|
sl@0
|
170 |
// ...
|
sl@0
|
171 |
|
sl@0
|
172 |
previousQueryMaxLength = query.MaxLength();
|
sl@0
|
173 |
|
sl@0
|
174 |
query.ReserveFreeCapacityL(KExtraRequiredSize); // Guarantees query.MaxLength() >= KExtraRequiredSize + previousQueryMaxLength;
|
sl@0
|
175 |
GetLastAuxQuery(query);
|
sl@0
|
176 |
|
sl@0
|
177 |
@endcode
|
sl@0
|
178 |
|
sl@0
|
179 |
@par Relationship with TDes and RBuf
|
sl@0
|
180 |
|
sl@0
|
181 |
LString8 derives from RBuf8 in order to achieve maximum
|
sl@0
|
182 |
interoperability with existing descriptor-accepting APIs. This
|
sl@0
|
183 |
derivation forces some unusual API compromises, however, due to the
|
sl@0
|
184 |
unique characteristics of LString8 compared to other descriptors.
|
sl@0
|
185 |
|
sl@0
|
186 |
Some of the mutating methods on the base classes, TDes8 and RBuf8,
|
sl@0
|
187 |
panic when called with insufficient buffer space. Sufficient space is
|
sl@0
|
188 |
a precondition of these base classes which LString8 relaxes with
|
sl@0
|
189 |
its capability to start with zero length. LString8 defines new
|
sl@0
|
190 |
leaving variants of these methods with auto-growth behaviour
|
sl@0
|
191 |
(e.g. AppendL), but at the same time inherits the original methods
|
sl@0
|
192 |
(e.g. Append). This makes it too easy for developers to call the
|
sl@0
|
193 |
wrong method inadvertently. In order to address this, the original
|
sl@0
|
194 |
non-leaving methods have been made private in LString8. Developers
|
sl@0
|
195 |
should use the leaving LString8 versions.
|
sl@0
|
196 |
|
sl@0
|
197 |
Note that, if required for any reason, the non-leaving method variants
|
sl@0
|
198 |
may be accessed by explicitly qualifying the method name to the
|
sl@0
|
199 |
appropriate parent type. For example: aString.TDes::Append(...). When
|
sl@0
|
200 |
working with an LString8 but doing so via a TDes& typed variable, all
|
sl@0
|
201 |
TDes8 APIs are directly available.
|
sl@0
|
202 |
|
sl@0
|
203 |
Hiding these methods does not remove the problem entirely. The same
|
sl@0
|
204 |
problem can happen if an LString object of insufficient size in passed
|
sl@0
|
205 |
into a any API accepting a TDes. The advice is that developers always
|
sl@0
|
206 |
ensure there is sufficient space before passing LString as a TDes.
|
sl@0
|
207 |
|
sl@0
|
208 |
@par Performance Concerns
|
sl@0
|
209 |
|
sl@0
|
210 |
While being simpler to use than existing descriptors in many cases,
|
sl@0
|
211 |
LString8's use of heap allocation and its resizing variant methods
|
sl@0
|
212 |
clearly come with associated costs. Their use in performance-critical
|
sl@0
|
213 |
code should be carefully considered. On the other hand, LString8's
|
sl@0
|
214 |
small stack footprint and ability to better-handle inputs of
|
sl@0
|
215 |
unpredictable size may make them a better choice when the alternative
|
sl@0
|
216 |
is a large, fixed-max-size TBuf or HBufC.
|
sl@0
|
217 |
|
sl@0
|
218 |
@par Buffer Ownership
|
sl@0
|
219 |
|
sl@0
|
220 |
Typically an LString8 will automatically allocate its own buffer, but
|
sl@0
|
221 |
like RBuf8 it can also take ownership of a pre-existing raw memory
|
sl@0
|
222 |
buffer or heap descriptor.
|
sl@0
|
223 |
|
sl@0
|
224 |
The class is intended for instantiation.
|
sl@0
|
225 |
|
sl@0
|
226 |
@see RBuf8
|
sl@0
|
227 |
@see TBuf8
|
sl@0
|
228 |
@see TPtr8
|
sl@0
|
229 |
@see HBufC8
|
sl@0
|
230 |
@see TDesC8
|
sl@0
|
231 |
@see TDes8
|
sl@0
|
232 |
@see LString
|
sl@0
|
233 |
|
sl@0
|
234 |
*/
|
sl@0
|
235 |
class LString8 : public RBuf8
|
sl@0
|
236 |
{
|
sl@0
|
237 |
public:
|
sl@0
|
238 |
/*
|
sl@0
|
239 |
* We add leaving (auto-resizing) variants of the standard TDes
|
sl@0
|
240 |
* methods where appropriate, and enhance the behaviour of the
|
sl@0
|
241 |
* corresponding operators to match
|
sl@0
|
242 |
*/
|
sl@0
|
243 |
|
sl@0
|
244 |
LSTRING_CONSTRUCTORS_MAY_LEAVE
|
sl@0
|
245 |
|
sl@0
|
246 |
IMPORT_C LString8();
|
sl@0
|
247 |
IMPORT_C ~LString8();
|
sl@0
|
248 |
|
sl@0
|
249 |
// Construct with initial capacity
|
sl@0
|
250 |
IMPORT_C explicit LString8(TInt aInitialCapacity);
|
sl@0
|
251 |
|
sl@0
|
252 |
// Construct by data copying
|
sl@0
|
253 |
IMPORT_C LString8(const TDesC8& aDes);
|
sl@0
|
254 |
IMPORT_C LString8(const TUint8* aZeroTerminatedString);
|
sl@0
|
255 |
IMPORT_C LString8(const LString8& aDes);
|
sl@0
|
256 |
|
sl@0
|
257 |
// Construction thru transfer of ownership
|
sl@0
|
258 |
IMPORT_C explicit LString8(HBufC8* aHBuf);
|
sl@0
|
259 |
IMPORT_C explicit LString8(TUint8 *aHeapCell,TInt aMaxLength);
|
sl@0
|
260 |
IMPORT_C explicit LString8(TUint8 *aHeapCell,TInt aLength,TInt aMaxLength);
|
sl@0
|
261 |
|
sl@0
|
262 |
// Assignment thru payload copying
|
sl@0
|
263 |
IMPORT_C LString8& operator=(const TDesC8& aDes);
|
sl@0
|
264 |
IMPORT_C LString8& operator=(const LString8& aDes);
|
sl@0
|
265 |
IMPORT_C LString8& operator=(const TUint8* aZeroTerminatedString);
|
sl@0
|
266 |
|
sl@0
|
267 |
// Assignment by transfer of payload to this object;
|
sl@0
|
268 |
// supplied object is destroyed or zeroed.
|
sl@0
|
269 |
IMPORT_C LString8& operator=(HBufC8* aHBuf);
|
sl@0
|
270 |
|
sl@0
|
271 |
// Assign by transfer of payload ownership to this object;
|
sl@0
|
272 |
// supplied object is destroyed or zeroed.
|
sl@0
|
273 |
IMPORT_C void Assign(const LString8& aString);
|
sl@0
|
274 |
IMPORT_C void Assign(const RBuf8& aRBuf);
|
sl@0
|
275 |
IMPORT_C void Assign(HBufC8* aHBuf);
|
sl@0
|
276 |
IMPORT_C void Assign(TUint8 *aHeapCell,TInt aMaxLength);
|
sl@0
|
277 |
IMPORT_C void Assign(TUint8 *aHeapCell,TInt aLength,TInt aMaxLength);
|
sl@0
|
278 |
|
sl@0
|
279 |
IMPORT_C void CreateL(RReadStream& aStream,TInt aMaxLength);
|
sl@0
|
280 |
|
sl@0
|
281 |
IMPORT_C LString8& operator+=(TChar aChar);
|
sl@0
|
282 |
IMPORT_C LString8& operator+=(const TDesC8 &aDes);
|
sl@0
|
283 |
|
sl@0
|
284 |
IMPORT_C void CopyL(const TDesC8 &aDes);
|
sl@0
|
285 |
IMPORT_C void CopyL(const TDesC16 &aDes);
|
sl@0
|
286 |
IMPORT_C void CopyL(const TUint8 *aZeroTerminatedString);
|
sl@0
|
287 |
IMPORT_C void CopyL(const TUint8 *aBuf,TInt aLength);
|
sl@0
|
288 |
|
sl@0
|
289 |
IMPORT_C void SetLengthL(TInt aLength);
|
sl@0
|
290 |
IMPORT_C void SetMaxLengthL(TInt aMaxLength);
|
sl@0
|
291 |
IMPORT_C void Compress(); // deprecated; to be removed
|
sl@0
|
292 |
IMPORT_C void ReserveFreeCapacityL(TInt aExtraSpaceLength);
|
sl@0
|
293 |
IMPORT_C void Reset();
|
sl@0
|
294 |
|
sl@0
|
295 |
IMPORT_C void AppendL(TChar aChar);
|
sl@0
|
296 |
IMPORT_C void AppendL(const TDesC8 &aDes);
|
sl@0
|
297 |
IMPORT_C void AppendL(const TUint8 *aBuf,TInt aLength);
|
sl@0
|
298 |
|
sl@0
|
299 |
IMPORT_C void FillL(TChar aChar,TInt aLength);
|
sl@0
|
300 |
IMPORT_C void FillZL(TInt aLength);
|
sl@0
|
301 |
|
sl@0
|
302 |
IMPORT_C void NumFixedWidthL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
303 |
IMPORT_C void AppendNumFixedWidthL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
304 |
IMPORT_C const TUint8 *PtrZL();
|
sl@0
|
305 |
IMPORT_C void CopyFL(const TDesC8 &aDes);
|
sl@0
|
306 |
IMPORT_C void CopyCL(const TDesC8 &aDes);
|
sl@0
|
307 |
IMPORT_C void CopyLCL(const TDesC8 &aDes);
|
sl@0
|
308 |
IMPORT_C void CopyUCL(const TDesC8 &aDes);
|
sl@0
|
309 |
IMPORT_C void CopyCPL(const TDesC8 &aDes);
|
sl@0
|
310 |
IMPORT_C void AppendFillL(TChar aChar,TInt aLength);
|
sl@0
|
311 |
IMPORT_C void ZeroTerminateL();
|
sl@0
|
312 |
IMPORT_C void SwapL(TDes8 &aDes);
|
sl@0
|
313 |
IMPORT_C void SwapL(LString8 &aDes); // Added overload
|
sl@0
|
314 |
IMPORT_C void InsertL(TInt aPos,const TDesC8 &aDes);
|
sl@0
|
315 |
IMPORT_C void ReplaceL(TInt aPos,TInt aLength,const TDesC8 &aDes);
|
sl@0
|
316 |
IMPORT_C void JustifyL(const TDesC8 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
317 |
IMPORT_C void NumFixedWidthUCL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
318 |
IMPORT_C void NumUCL(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
319 |
IMPORT_C TInt NumL(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
320 |
IMPORT_C void NumL(TInt64 aVal);
|
sl@0
|
321 |
IMPORT_C void NumL(TUint64 aVal, TRadix aRadix);
|
sl@0
|
322 |
IMPORT_C void FormatL(TRefByValue<const TDesC8> aFmt,...);
|
sl@0
|
323 |
IMPORT_C void FormatListL(const TDesC8 &aFmt,VA_LIST aList);
|
sl@0
|
324 |
IMPORT_C void AppendJustifyL(const TDesC8 &Des,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
325 |
IMPORT_C void AppendJustifyL(const TDesC8 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
326 |
IMPORT_C void AppendJustifyL(const TUint8 *aZeroTerminatedString,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
327 |
IMPORT_C void AppendJustifyL(const TUint8 *aString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
328 |
IMPORT_C void AppendNumFixedWidthUCL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
329 |
IMPORT_C void AppendNumUCL(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
330 |
IMPORT_C TInt AppendNumL(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
331 |
IMPORT_C void AppendNumL(TInt64 aVal);
|
sl@0
|
332 |
IMPORT_C void AppendNumL(TUint64 aVal, TRadix aRadix);
|
sl@0
|
333 |
IMPORT_C void AppendFormatL(TRefByValue<const TDesC8> aFmt,...);
|
sl@0
|
334 |
IMPORT_C void AppendFormatListL(const TDesC8 &aFmt,VA_LIST aList);
|
sl@0
|
335 |
|
sl@0
|
336 |
using RBuf8::operator==;
|
sl@0
|
337 |
IMPORT_C TBool operator==( const TUint8* aZeroTerminatedString) const;
|
sl@0
|
338 |
using RBuf8::operator<;
|
sl@0
|
339 |
IMPORT_C TBool operator<( const TUint8* aZeroTerminatedString) const;
|
sl@0
|
340 |
using RBuf8::operator<=;
|
sl@0
|
341 |
IMPORT_C TBool operator<=( const TUint8* aZeroTerminatedString) const;
|
sl@0
|
342 |
using RBuf8::operator>;
|
sl@0
|
343 |
IMPORT_C TBool operator>( const TUint8* aZeroTerminatedString) const;
|
sl@0
|
344 |
using RBuf8::operator>=;
|
sl@0
|
345 |
IMPORT_C TBool operator>=( const TUint8* aZeroTerminatedString) const;
|
sl@0
|
346 |
using RBuf8::operator!=;
|
sl@0
|
347 |
IMPORT_C TBool operator!=( const TUint8* aZeroTerminatedString) const;
|
sl@0
|
348 |
using RBuf8::Compare;
|
sl@0
|
349 |
IMPORT_C TInt Compare(const TUint8* aZeroTerminatedString) const;
|
sl@0
|
350 |
using RBuf8::CompareF;
|
sl@0
|
351 |
IMPORT_C TInt CompareF(const TUint8* aZeroTerminatedString) const;
|
sl@0
|
352 |
using RBuf8::Match;
|
sl@0
|
353 |
IMPORT_C TInt Match(const TUint8* aZeroTerminatedString) const;
|
sl@0
|
354 |
using RBuf8::MatchF;
|
sl@0
|
355 |
IMPORT_C TInt MatchF(const TUint8* aZeroTerminatedString) const;
|
sl@0
|
356 |
using RBuf8::Find;
|
sl@0
|
357 |
IMPORT_C TInt Find(const TUint8* aZeroTerminatedString) const;
|
sl@0
|
358 |
using RBuf8::FindF;
|
sl@0
|
359 |
IMPORT_C TInt FindF(const TUint8* aZeroTerminatedString) const;
|
sl@0
|
360 |
|
sl@0
|
361 |
IMPORT_C void CopyFL(const TUint8* aZeroTerminatedString);
|
sl@0
|
362 |
IMPORT_C void CopyLCL(const TUint8* aZeroTerminatedString);
|
sl@0
|
363 |
IMPORT_C void CopyUCL(const TUint8* aZeroTerminatedString);
|
sl@0
|
364 |
IMPORT_C void CopyCPL(const TUint8* aZeroTerminatedString);
|
sl@0
|
365 |
IMPORT_C void InsertL(TInt aPos,const TUint8* aZeroTerminatedString);
|
sl@0
|
366 |
IMPORT_C void ReplaceL(TInt aPos,TInt aLength,const TUint8* aZeroTerminatedString);
|
sl@0
|
367 |
IMPORT_C void JustifyL(const TUint8* aZeroTerminatedString,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
368 |
IMPORT_C void AppendL(const TUint8* aZeroTerminatedString);
|
sl@0
|
369 |
IMPORT_C LString8& operator+=(const TUint8* aZeroTerminatedString);
|
sl@0
|
370 |
|
sl@0
|
371 |
IMPORT_C LString8(const char* aCharStr);
|
sl@0
|
372 |
|
sl@0
|
373 |
IMPORT_C TBool operator==( const char* aCharStr) const;
|
sl@0
|
374 |
IMPORT_C TBool operator<( const char* aCharStr) const;
|
sl@0
|
375 |
IMPORT_C TBool operator<=( const char* aCharStr) const;
|
sl@0
|
376 |
IMPORT_C TBool operator>( const char* aCharStr) const;
|
sl@0
|
377 |
IMPORT_C TBool operator>=( const char* aCharStr) const;
|
sl@0
|
378 |
IMPORT_C TBool operator!=( const char* aCharStr) const;
|
sl@0
|
379 |
IMPORT_C TInt Compare(const char* aCharStr) const;
|
sl@0
|
380 |
IMPORT_C TInt CompareF(const char* aCharStr) const;
|
sl@0
|
381 |
IMPORT_C TInt Match(const char* aCharStr) const;
|
sl@0
|
382 |
IMPORT_C TInt MatchF(const char* aCharStr) const;
|
sl@0
|
383 |
IMPORT_C TInt Find(const char* aCharStr) const;
|
sl@0
|
384 |
IMPORT_C TInt Find(const char* aCharStr,TInt aLenS ) const;
|
sl@0
|
385 |
IMPORT_C TInt FindF(const char* aCharStr) const;
|
sl@0
|
386 |
IMPORT_C TInt FindF(const char* aCharStr,TInt aLenS) const;
|
sl@0
|
387 |
|
sl@0
|
388 |
IMPORT_C LString8& operator=(const char* aCharStr);
|
sl@0
|
389 |
IMPORT_C LString8& operator+=(const char* aCharStr);
|
sl@0
|
390 |
IMPORT_C void CopyL(const char* aCharStr);
|
sl@0
|
391 |
IMPORT_C void CopyFL(const char* aCharStr);
|
sl@0
|
392 |
IMPORT_C void CopyLCL(const char* aCharStr);
|
sl@0
|
393 |
IMPORT_C void CopyUCL(const char* aCharStr);
|
sl@0
|
394 |
IMPORT_C void CopyCPL(const char* aCharStr);
|
sl@0
|
395 |
IMPORT_C void InsertL(TInt aPos,const char* aCharStr);
|
sl@0
|
396 |
IMPORT_C void ReplaceL(TInt aPos,TInt aLength,const char* aCharStr);
|
sl@0
|
397 |
IMPORT_C void AppendL(const char* aCharStr, TInt aLength);
|
sl@0
|
398 |
IMPORT_C void AppendL(const char *aCharStr );
|
sl@0
|
399 |
IMPORT_C void JustifyL(const char* aCharStr,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
400 |
IMPORT_C void AppendJustifyL(const char* aCharStr,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
401 |
IMPORT_C void AppendJustifyL(const char* aCharStr,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
402 |
|
sl@0
|
403 |
protected:
|
sl@0
|
404 |
|
sl@0
|
405 |
private:
|
sl@0
|
406 |
/*
|
sl@0
|
407 |
* capacity management methods
|
sl@0
|
408 |
*/
|
sl@0
|
409 |
void ReserveL(TInt aMinRequiredCapacity);
|
sl@0
|
410 |
void ReserveCapacityGrowExponentialL(TInt aRequiredCapacity);
|
sl@0
|
411 |
void ReserveCapacityGrowExponentialL();
|
sl@0
|
412 |
void ReserveFreeCapacityGrowExponentialL(TInt aRequiredEmptySpace);
|
sl@0
|
413 |
|
sl@0
|
414 |
|
sl@0
|
415 |
//----------------------------------------------------------
|
sl@0
|
416 |
// These mutable TDes8 methods panic when called with an insufficient
|
sl@0
|
417 |
// buffer space.
|
sl@0
|
418 |
// A precondition for TDes8 use is that a sufficient
|
sl@0
|
419 |
// sufficient buffer is allocated before making calls that write to the
|
sl@0
|
420 |
// buffer. LString invalidates this precondition.
|
sl@0
|
421 |
// LString inheriting these TDes methods makes it easy
|
sl@0
|
422 |
// for developers to call them inadvertently. They have been made
|
sl@0
|
423 |
// private to ensure the misunderstanding never happens. Developers should
|
sl@0
|
424 |
// use the leaving (L suffixed) LString equivalents.
|
sl@0
|
425 |
void SetLength(TInt aLength);
|
sl@0
|
426 |
void SetMax();
|
sl@0
|
427 |
void Copy(const TDesC8 &aDes);
|
sl@0
|
428 |
void Copy(const TDesC16 &aDes);
|
sl@0
|
429 |
void Copy(const TUint8 *aBuf,TInt aLength);
|
sl@0
|
430 |
void Copy(const TUint8 *aString);
|
sl@0
|
431 |
void Append(TChar aChar);
|
sl@0
|
432 |
void Append(const TDesC8 &aDes);
|
sl@0
|
433 |
void Append(const TUint8 *aBuf,TInt aLength);
|
sl@0
|
434 |
void Fill(TChar aChar,TInt aLength);
|
sl@0
|
435 |
void FillZ(TInt aLength);
|
sl@0
|
436 |
void NumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
437 |
void AppendNumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
438 |
const TUint8 *PtrZ();
|
sl@0
|
439 |
void CopyF(const TDesC8 &aDes);
|
sl@0
|
440 |
void CopyC(const TDesC8 &aDes);
|
sl@0
|
441 |
void CopyLC(const TDesC8 &aDes);
|
sl@0
|
442 |
void CopyUC(const TDesC8 &aDes);
|
sl@0
|
443 |
void CopyCP(const TDesC8 &aDes);
|
sl@0
|
444 |
void AppendFill(TChar aChar,TInt aLength);
|
sl@0
|
445 |
void ZeroTerminate();
|
sl@0
|
446 |
void Swap(TDes8 &aDes);
|
sl@0
|
447 |
void Insert(TInt aPos,const TDesC8 &aDes);
|
sl@0
|
448 |
void Replace(TInt aPos,TInt aLength,const TDesC8 &aDes);
|
sl@0
|
449 |
void Justify(const TDesC8 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
450 |
void NumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
451 |
void NumUC(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
452 |
TInt Num(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
453 |
void Num(TInt64 aVal);
|
sl@0
|
454 |
void Num(TUint64 aVal, TRadix aRadix);
|
sl@0
|
455 |
void Format(TRefByValue<const TDesC8> aFmt,...);
|
sl@0
|
456 |
void FormatList(const TDesC8 &aFmt,VA_LIST aList);
|
sl@0
|
457 |
void AppendJustify(const TDesC8 &Des,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
458 |
void AppendJustify(const TDesC8 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
459 |
void AppendJustify(const TUint8 *aZeroTerminatedString,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
460 |
void AppendJustify(const TUint8 *aZeroTerminatedString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
461 |
void AppendNumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
462 |
void AppendNumUC(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
463 |
TInt AppendNum(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
464 |
void AppendNum(TInt64 aVal);
|
sl@0
|
465 |
void AppendNum(TUint64 aVal, TRadix aRadix);
|
sl@0
|
466 |
void AppendFormat(TRefByValue<const TDesC8> aFmt,TDes8Overflow *aOverflowHandler,...);
|
sl@0
|
467 |
void AppendFormat(TRefByValue<const TDesC8> aFmt,...);
|
sl@0
|
468 |
void AppendFormatList(const TDesC8 &aFmt,VA_LIST aList,TDes8Overflow *aOverflowHandler=NULL);
|
sl@0
|
469 |
// end of TDes8 methods
|
sl@0
|
470 |
//---------------------------------------------------
|
sl@0
|
471 |
|
sl@0
|
472 |
//----------------------------------------------------------
|
sl@0
|
473 |
// These mutable RBuf8 methods have been privatised because
|
sl@0
|
474 |
// they make assumptions which are incompatible with the
|
sl@0
|
475 |
// general use pattern of LString16.
|
sl@0
|
476 |
void Swap(RBuf8& aRBuf);
|
sl@0
|
477 |
TInt Create(TInt aMaxLength);
|
sl@0
|
478 |
void CreateL(TInt aMaxLength);
|
sl@0
|
479 |
TInt CreateMax(TInt aMaxLength);
|
sl@0
|
480 |
void CreateMaxL(TInt aMaxLength);
|
sl@0
|
481 |
TInt Create(const TDesC8& aDes);
|
sl@0
|
482 |
void CreateL(const TDesC8& aDes);
|
sl@0
|
483 |
TInt Create(const TDesC8& aDes,TInt aMaxLength);
|
sl@0
|
484 |
void CreateL(const TDesC8& aDes,TInt aMaxLength);
|
sl@0
|
485 |
void Close();
|
sl@0
|
486 |
void CleanupClosePushL();
|
sl@0
|
487 |
// end of privated RBuf16 methods
|
sl@0
|
488 |
//---------------------------------------------------
|
sl@0
|
489 |
|
sl@0
|
490 |
void EnsureCapacityIncrementL(TInt aLengthIncrement);
|
sl@0
|
491 |
void IncreaseCapacityL();
|
sl@0
|
492 |
|
sl@0
|
493 |
private:
|
sl@0
|
494 |
//reserved data member for future-proofing
|
sl@0
|
495 |
TInt iReserved;
|
sl@0
|
496 |
};
|
sl@0
|
497 |
|
sl@0
|
498 |
/**
|
sl@0
|
499 |
This is the 16-bit version of LString8. All the comments on LString8 apply equally.
|
sl@0
|
500 |
|
sl@0
|
501 |
@see LString8
|
sl@0
|
502 |
@see RBuf16
|
sl@0
|
503 |
@see TBuf16
|
sl@0
|
504 |
@see TPtr16
|
sl@0
|
505 |
@see HBufC16
|
sl@0
|
506 |
@see TDesC16
|
sl@0
|
507 |
@see TDes16
|
sl@0
|
508 |
@see LString
|
sl@0
|
509 |
*/
|
sl@0
|
510 |
class LString16 : public RBuf16
|
sl@0
|
511 |
{
|
sl@0
|
512 |
public:
|
sl@0
|
513 |
/*
|
sl@0
|
514 |
* We add leaving (auto-resizing) variants of the standard TDes
|
sl@0
|
515 |
* methods where appropriate, and enhance the behaviour of the
|
sl@0
|
516 |
* corresponding operators to match
|
sl@0
|
517 |
*/
|
sl@0
|
518 |
|
sl@0
|
519 |
LSTRING_CONSTRUCTORS_MAY_LEAVE
|
sl@0
|
520 |
|
sl@0
|
521 |
IMPORT_C LString16();
|
sl@0
|
522 |
IMPORT_C ~LString16();
|
sl@0
|
523 |
|
sl@0
|
524 |
// Construct with initial capacity
|
sl@0
|
525 |
IMPORT_C explicit LString16(TInt aInitialCapacity);
|
sl@0
|
526 |
|
sl@0
|
527 |
// Construct by data copying
|
sl@0
|
528 |
IMPORT_C LString16(const TDesC16& aDes);
|
sl@0
|
529 |
IMPORT_C LString16(const TUint16* aZeroTerminatedString);
|
sl@0
|
530 |
IMPORT_C LString16(const LString16& aDes);
|
sl@0
|
531 |
|
sl@0
|
532 |
// Construction thru transfer of ownership
|
sl@0
|
533 |
IMPORT_C explicit LString16(HBufC16* aHBuf);
|
sl@0
|
534 |
IMPORT_C explicit LString16(TUint16 *aHeapCell,TInt aMaxLength);
|
sl@0
|
535 |
IMPORT_C explicit LString16(TUint16 *aHeapCell,TInt aLength,TInt aMaxLength);
|
sl@0
|
536 |
|
sl@0
|
537 |
// Assignment thru payload copying
|
sl@0
|
538 |
IMPORT_C LString16& operator=(const TDesC16& aDes);
|
sl@0
|
539 |
IMPORT_C LString16& operator=(const LString16& aDes);
|
sl@0
|
540 |
IMPORT_C LString16& operator=(const TUint16* aZeroTerminatedString);
|
sl@0
|
541 |
|
sl@0
|
542 |
// Assignment by transfer of payload to this object;
|
sl@0
|
543 |
// supplied object is destroyed or zeroed.
|
sl@0
|
544 |
IMPORT_C LString16& operator=(HBufC16* aHBuf);
|
sl@0
|
545 |
|
sl@0
|
546 |
// Assign by transfer of payload ownership to this object;
|
sl@0
|
547 |
// supplied object is destroyed or zeroed.
|
sl@0
|
548 |
IMPORT_C void Assign(const LString16& aString);
|
sl@0
|
549 |
IMPORT_C void Assign(const RBuf16& aRBuf);
|
sl@0
|
550 |
IMPORT_C void Assign(HBufC16* aHBuf);
|
sl@0
|
551 |
IMPORT_C void Assign(TUint16 *aHeapCell,TInt aMaxLength);
|
sl@0
|
552 |
IMPORT_C void Assign(TUint16 *aHeapCell,TInt aLength,TInt aMaxLength);
|
sl@0
|
553 |
|
sl@0
|
554 |
IMPORT_C void CreateL(RReadStream& aStream,TInt aMaxLength);
|
sl@0
|
555 |
|
sl@0
|
556 |
IMPORT_C LString16& operator+=(TChar aChar);
|
sl@0
|
557 |
IMPORT_C LString16& operator+=(const TDesC16 &aDes);
|
sl@0
|
558 |
|
sl@0
|
559 |
IMPORT_C void CopyL(const TDesC16 &aDes);
|
sl@0
|
560 |
IMPORT_C void CopyL(const TUint16 *aZeroTerminatedString);
|
sl@0
|
561 |
IMPORT_C void CopyL(const TDesC8 &aDes);
|
sl@0
|
562 |
IMPORT_C void CopyL(const TUint16 *aBuf,TInt aLength);
|
sl@0
|
563 |
|
sl@0
|
564 |
IMPORT_C void SetLengthL(TInt aLength);
|
sl@0
|
565 |
IMPORT_C void SetMaxLengthL(TInt aMaxLength);
|
sl@0
|
566 |
IMPORT_C void Compress(); // deprecated; to be removed
|
sl@0
|
567 |
IMPORT_C void ReserveFreeCapacityL(TInt aExtraSpaceLength);
|
sl@0
|
568 |
IMPORT_C void Reset();
|
sl@0
|
569 |
|
sl@0
|
570 |
IMPORT_C void AppendL(TChar aChar);
|
sl@0
|
571 |
IMPORT_C void AppendL(const TDesC16 &aDes);
|
sl@0
|
572 |
IMPORT_C void AppendL(const TUint16 *aBuf,TInt aLength);
|
sl@0
|
573 |
|
sl@0
|
574 |
IMPORT_C void FillL(TChar aChar,TInt aLength);
|
sl@0
|
575 |
IMPORT_C void FillZL(TInt aLength);
|
sl@0
|
576 |
|
sl@0
|
577 |
IMPORT_C void NumFixedWidthL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
578 |
IMPORT_C void AppendNumFixedWidthL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
579 |
IMPORT_C const TUint16 *PtrZL();
|
sl@0
|
580 |
IMPORT_C void CopyFL(const TDesC16 &aDes);
|
sl@0
|
581 |
IMPORT_C void CopyCL(const TDesC16 &aDes);
|
sl@0
|
582 |
IMPORT_C void CopyLCL(const TDesC16 &aDes);
|
sl@0
|
583 |
IMPORT_C void CopyUCL(const TDesC16 &aDes);
|
sl@0
|
584 |
IMPORT_C void CopyCPL(const TDesC16 &aDes);
|
sl@0
|
585 |
IMPORT_C void AppendFillL(TChar aChar,TInt aLength);
|
sl@0
|
586 |
IMPORT_C void ZeroTerminateL();
|
sl@0
|
587 |
IMPORT_C void SwapL(TDes16 &aDes);
|
sl@0
|
588 |
IMPORT_C void SwapL(LString16 &aDes); // Added overload
|
sl@0
|
589 |
IMPORT_C void InsertL(TInt aPos,const TDesC16 &aDes);
|
sl@0
|
590 |
IMPORT_C void ReplaceL(TInt aPos,TInt aLength,const TDesC16 &aDes);
|
sl@0
|
591 |
IMPORT_C void JustifyL(const TDesC16 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
592 |
IMPORT_C void NumFixedWidthUCL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
593 |
IMPORT_C void NumUCL(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
594 |
IMPORT_C TInt NumL(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
595 |
IMPORT_C void NumL(TInt64 aVal);
|
sl@0
|
596 |
IMPORT_C void NumL(TUint64 aVal, TRadix aRadix);
|
sl@0
|
597 |
IMPORT_C void FormatL(TRefByValue<const TDesC16> aFmt,...);
|
sl@0
|
598 |
IMPORT_C void FormatListL(const TDesC16 &aFmt,VA_LIST aList);
|
sl@0
|
599 |
IMPORT_C void AppendJustifyL(const TDesC16 &Des,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
600 |
IMPORT_C void AppendJustifyL(const TDesC16 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
601 |
IMPORT_C void AppendJustifyL(const TUint16 *aZeroTerminatedString,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
602 |
IMPORT_C void AppendJustifyL(const TUint16 *aString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
603 |
IMPORT_C void AppendNumFixedWidthUCL(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
604 |
IMPORT_C void AppendNumUCL(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
605 |
IMPORT_C TInt AppendNumL(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
606 |
IMPORT_C void AppendNumL(TInt64 aVal);
|
sl@0
|
607 |
IMPORT_C void AppendNumL(TUint64 aVal, TRadix aRadix);
|
sl@0
|
608 |
IMPORT_C void AppendFormatL(TRefByValue<const TDesC16> aFmt,...);
|
sl@0
|
609 |
IMPORT_C void AppendFormatListL(const TDesC16 &aFmt,VA_LIST aList);
|
sl@0
|
610 |
|
sl@0
|
611 |
using RBuf16::operator==;
|
sl@0
|
612 |
IMPORT_C TBool operator==( const TUint16* aZeroTerminatedString) const;
|
sl@0
|
613 |
using RBuf16::operator<;
|
sl@0
|
614 |
IMPORT_C TBool operator<( const TUint16* aZeroTerminatedString) const;
|
sl@0
|
615 |
using RBuf16::operator<=;
|
sl@0
|
616 |
IMPORT_C TBool operator<=( const TUint16* aZeroTerminatedString) const;
|
sl@0
|
617 |
using RBuf16::operator>;
|
sl@0
|
618 |
IMPORT_C TBool operator>( const TUint16* aZeroTerminatedString) const;
|
sl@0
|
619 |
using RBuf16::operator>=;
|
sl@0
|
620 |
IMPORT_C TBool operator>=( const TUint16* aZeroTerminatedString) const;
|
sl@0
|
621 |
using RBuf16::operator!=;
|
sl@0
|
622 |
IMPORT_C TBool operator!=( const TUint16* aZeroTerminatedString) const;
|
sl@0
|
623 |
using RBuf16::Compare;
|
sl@0
|
624 |
IMPORT_C TInt Compare(const TUint16* aZeroTerminatedString) const;
|
sl@0
|
625 |
using RBuf16::CompareF;
|
sl@0
|
626 |
IMPORT_C TInt CompareF(const TUint16* aZeroTerminatedString) const;
|
sl@0
|
627 |
using RBuf16::Match;
|
sl@0
|
628 |
IMPORT_C TInt Match(const TUint16* aZeroTerminatedString) const;
|
sl@0
|
629 |
using RBuf16::MatchF;
|
sl@0
|
630 |
IMPORT_C TInt MatchF(const TUint16* aZeroTerminatedString) const;
|
sl@0
|
631 |
using RBuf16::Find;
|
sl@0
|
632 |
IMPORT_C TInt Find(const TUint16* aZeroTerminatedString) const;
|
sl@0
|
633 |
using RBuf16::FindF;
|
sl@0
|
634 |
IMPORT_C TInt FindF(const TUint16* aZeroTerminatedString) const;
|
sl@0
|
635 |
|
sl@0
|
636 |
IMPORT_C void CopyFL(const TUint16* aZeroTerminatedString);
|
sl@0
|
637 |
IMPORT_C void CopyLCL(const TUint16* aZeroTerminatedString);
|
sl@0
|
638 |
IMPORT_C void CopyUCL(const TUint16* aZeroTerminatedString);
|
sl@0
|
639 |
IMPORT_C void CopyCPL(const TUint16* aZeroTerminatedString);
|
sl@0
|
640 |
IMPORT_C void InsertL(TInt aPos,const TUint16* aZeroTerminatedString);
|
sl@0
|
641 |
IMPORT_C void ReplaceL(TInt aPos,TInt aLength,const TUint16* aZeroTerminatedString);
|
sl@0
|
642 |
IMPORT_C void JustifyL(const TUint16* aZeroTerminatedString,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
643 |
IMPORT_C void AppendL(const TUint16* aZeroTerminatedString);
|
sl@0
|
644 |
IMPORT_C LString16& operator+=(const TUint16* aZeroTerminatedString);
|
sl@0
|
645 |
|
sl@0
|
646 |
#ifdef NATIVE_WCHAR
|
sl@0
|
647 |
IMPORT_C LString16(const wchar_t* aWideCharStr);
|
sl@0
|
648 |
|
sl@0
|
649 |
IMPORT_C TBool operator==( const wchar_t* aWideCharStr) const;
|
sl@0
|
650 |
IMPORT_C TBool operator<( const wchar_t* aWideCharStr) const;
|
sl@0
|
651 |
IMPORT_C TBool operator<=( const wchar_t* aWideCharStr) const;
|
sl@0
|
652 |
IMPORT_C TBool operator>( const wchar_t* aWideCharStr) const;
|
sl@0
|
653 |
IMPORT_C TBool operator>=( const wchar_t* aWideCharStr) const;
|
sl@0
|
654 |
IMPORT_C TBool operator!=( const wchar_t* aWideCharStr) const;
|
sl@0
|
655 |
IMPORT_C TInt Compare(const wchar_t* aWideCharStr) const;
|
sl@0
|
656 |
IMPORT_C TInt CompareF(const wchar_t* aWideCharStr) const;
|
sl@0
|
657 |
IMPORT_C TInt Match(const wchar_t* aWideCharStr) const;
|
sl@0
|
658 |
IMPORT_C TInt MatchF(const wchar_t* aWideCharStr) const;
|
sl@0
|
659 |
IMPORT_C TInt Find(const wchar_t* aWideCharStr) const;
|
sl@0
|
660 |
IMPORT_C TInt Find(const wchar_t* aWideCharStr,TInt aLenS ) const;
|
sl@0
|
661 |
IMPORT_C TInt FindF(const wchar_t* aWideCharStr) const;
|
sl@0
|
662 |
IMPORT_C TInt FindF(const wchar_t* aWideCharStr,TInt aLenS) const;
|
sl@0
|
663 |
|
sl@0
|
664 |
IMPORT_C LString16& operator=(const wchar_t* aWideCharStr);
|
sl@0
|
665 |
IMPORT_C LString16& operator+=(const wchar_t* aWideCharStr);
|
sl@0
|
666 |
IMPORT_C void CopyL(const wchar_t* aWideCharStr);
|
sl@0
|
667 |
IMPORT_C void CopyFL(const wchar_t* aWideCharStr);
|
sl@0
|
668 |
IMPORT_C void CopyLCL(const wchar_t* aWideCharStr);
|
sl@0
|
669 |
IMPORT_C void CopyUCL(const wchar_t* aWideCharStr);
|
sl@0
|
670 |
IMPORT_C void CopyCPL(const wchar_t* aWideCharStr);
|
sl@0
|
671 |
IMPORT_C void InsertL(TInt aPos,const wchar_t* aWideCharStr);
|
sl@0
|
672 |
IMPORT_C void ReplaceL(TInt aPos,TInt aLength,const wchar_t* aWideCharStr);
|
sl@0
|
673 |
IMPORT_C void AppendL(const wchar_t* aWideCharStr, TInt aLength);
|
sl@0
|
674 |
IMPORT_C void AppendL(const wchar_t* aWideCharStr);
|
sl@0
|
675 |
IMPORT_C void JustifyL(const wchar_t* aWideCharStr,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
676 |
IMPORT_C void AppendJustifyL(const wchar_t* aWideCharStr,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
677 |
IMPORT_C void AppendJustifyL(const wchar_t* aWideCharStr,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
678 |
|
sl@0
|
679 |
#endif// NATIVE_WCHAR
|
sl@0
|
680 |
|
sl@0
|
681 |
|
sl@0
|
682 |
protected:
|
sl@0
|
683 |
|
sl@0
|
684 |
private:
|
sl@0
|
685 |
/*
|
sl@0
|
686 |
* New capacity management API
|
sl@0
|
687 |
*/
|
sl@0
|
688 |
void ReserveL(TInt aMinRequiredCapacity);
|
sl@0
|
689 |
void ReserveCapacityGrowExponentialL(TInt aRequiredCapacity);
|
sl@0
|
690 |
void ReserveCapacityGrowExponentialL();
|
sl@0
|
691 |
void ReserveFreeCapacityGrowExponentialL(TInt aRequiredEmptySpace);
|
sl@0
|
692 |
|
sl@0
|
693 |
|
sl@0
|
694 |
//----------------------------------------------------------
|
sl@0
|
695 |
// These mutable TDes16 methods panic when called with an insufficient
|
sl@0
|
696 |
// buffer space.
|
sl@0
|
697 |
// A precondition for TDes16 use is that a sufficient
|
sl@0
|
698 |
// sufficient buffer is allocated before making calls that write to the
|
sl@0
|
699 |
// buffer. LString invalidates this precondition.
|
sl@0
|
700 |
// LString inheriting these TDes methods makes it easy
|
sl@0
|
701 |
// for developers to call them inadvertently. They have been made
|
sl@0
|
702 |
// private to ensure the misunderstanding never happens. Developers should
|
sl@0
|
703 |
// use the leaving (L suffixed) LString equivalents.
|
sl@0
|
704 |
void SetLength(TInt aLength);
|
sl@0
|
705 |
void SetMax();
|
sl@0
|
706 |
void Copy(const TDesC8 &aDes);
|
sl@0
|
707 |
void Copy(const TDesC16 &aDes);
|
sl@0
|
708 |
void Copy(const TUint16 *aBuf,TInt aLength);
|
sl@0
|
709 |
void Copy(const TUint16 *aString);
|
sl@0
|
710 |
void Append(TChar aChar);
|
sl@0
|
711 |
void Append(const TDesC16 &aDes);
|
sl@0
|
712 |
void Append(const TUint16 *aBuf,TInt aLength);
|
sl@0
|
713 |
void Fill(TChar aChar,TInt aLength);
|
sl@0
|
714 |
void FillZ(TInt aLength);
|
sl@0
|
715 |
void NumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
716 |
void AppendNumFixedWidth(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
717 |
const TUint16 *PtrZ();
|
sl@0
|
718 |
void CopyF(const TDesC16 &aDes);
|
sl@0
|
719 |
void CopyC(const TDesC16 &aDes);
|
sl@0
|
720 |
void CopyLC(const TDesC16 &aDes);
|
sl@0
|
721 |
void CopyUC(const TDesC16 &aDes);
|
sl@0
|
722 |
void CopyCP(const TDesC16 &aDes);
|
sl@0
|
723 |
void AppendFill(TChar aChar,TInt aLength);
|
sl@0
|
724 |
void ZeroTerminate();
|
sl@0
|
725 |
void Swap(TDes16 &aDes);
|
sl@0
|
726 |
void Insert(TInt aPos,const TDesC16 &aDes);
|
sl@0
|
727 |
void Replace(TInt aPos,TInt aLength,const TDesC16 &aDes);
|
sl@0
|
728 |
void Justify(const TDesC16 &aDes,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
729 |
void NumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
730 |
void NumUC(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
731 |
TInt Num(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
732 |
void Num(TInt64 aVal);
|
sl@0
|
733 |
void Num(TUint64 aVal, TRadix aRadix);
|
sl@0
|
734 |
void Format(TRefByValue<const TDesC16> aFmt,...);
|
sl@0
|
735 |
void FormatList(const TDesC16 &aFmt,VA_LIST aList);
|
sl@0
|
736 |
void AppendJustify(const TDesC16 &Des,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
737 |
void AppendJustify(const TDesC16 &Des,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
738 |
void AppendJustify(const TUint16 *aZeroTerminatedString,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
739 |
void AppendJustify(const TUint16 *aZeroTerminatedString,TInt aLength,TInt aWidth,TAlign anAlignment,TChar aFill);
|
sl@0
|
740 |
void AppendNumFixedWidthUC(TUint aVal,TRadix aRadix,TInt aWidth);
|
sl@0
|
741 |
void AppendNumUC(TUint64 aVal, TRadix aRadix=EDecimal);
|
sl@0
|
742 |
TInt AppendNum(TReal aVal,const TRealFormat &aFormat) __SOFTFP;
|
sl@0
|
743 |
void AppendNum(TInt64 aVal);
|
sl@0
|
744 |
void AppendNum(TUint64 aVal, TRadix aRadix);
|
sl@0
|
745 |
void AppendFormat(TRefByValue<const TDesC16> aFmt,TDes16Overflow *aOverflowHandler,...);
|
sl@0
|
746 |
void AppendFormat(TRefByValue<const TDesC16> aFmt,...);
|
sl@0
|
747 |
void AppendFormatList(const TDesC16 &aFmt,VA_LIST aList,TDes16Overflow *aOverflowHandler=NULL);
|
sl@0
|
748 |
// end of TDes16 methods
|
sl@0
|
749 |
//---------------------------------------------------
|
sl@0
|
750 |
|
sl@0
|
751 |
//----------------------------------------------------------
|
sl@0
|
752 |
// These mutable RBuf16 methods have been privatised because
|
sl@0
|
753 |
// they make assumptions which are incompatible with the
|
sl@0
|
754 |
// general use pattern of LString16.
|
sl@0
|
755 |
void Swap(RBuf16& aRBuf);
|
sl@0
|
756 |
TInt Create(TInt aMaxLength);
|
sl@0
|
757 |
void CreateL(TInt aMaxLength);
|
sl@0
|
758 |
TInt CreateMax(TInt aMaxLength);
|
sl@0
|
759 |
void CreateMaxL(TInt aMaxLength);
|
sl@0
|
760 |
TInt Create(const TDesC16& aDes);
|
sl@0
|
761 |
void CreateL(const TDesC16& aDes);
|
sl@0
|
762 |
TInt Create(const TDesC16& aDes,TInt aMaxLength);
|
sl@0
|
763 |
void CreateL(const TDesC16& aDes,TInt aMaxLength);
|
sl@0
|
764 |
void Close();
|
sl@0
|
765 |
void CleanupClosePushL();
|
sl@0
|
766 |
// end of privated RBuf16 methods
|
sl@0
|
767 |
//---------------------------------------------------
|
sl@0
|
768 |
|
sl@0
|
769 |
void EnsureCapacityIncrementL(TInt aLengthIncrement);
|
sl@0
|
770 |
void IncreaseCapacityL();
|
sl@0
|
771 |
|
sl@0
|
772 |
private:
|
sl@0
|
773 |
//reserved data member for future-proofing
|
sl@0
|
774 |
TInt iReserved;
|
sl@0
|
775 |
};
|
sl@0
|
776 |
|
sl@0
|
777 |
|
sl@0
|
778 |
/**
|
sl@0
|
779 |
Type alias for LString16.
|
sl@0
|
780 |
|
sl@0
|
781 |
LString is typically used in preference to LString16 when manipulating
|
sl@0
|
782 |
Unicode text, in the same way that TDesC is typically used in
|
sl@0
|
783 |
preference to TDesC16.
|
sl@0
|
784 |
*/
|
sl@0
|
785 |
typedef LString16 LString;
|
sl@0
|
786 |
|
sl@0
|
787 |
/**
|
sl@0
|
788 |
Type alias for LString8.
|
sl@0
|
789 |
|
sl@0
|
790 |
LData can be used to better express intent when using an LString8 to
|
sl@0
|
791 |
manipulate raw binary (non character) data.
|
sl@0
|
792 |
*/
|
sl@0
|
793 |
typedef LString8 LData;
|
sl@0
|
794 |
|
sl@0
|
795 |
#undef LSTRING_CONSTRUCTORS_MAY_LEAVE
|
sl@0
|
796 |
|
sl@0
|
797 |
#endif // !ESTRING_H
|