1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: String conversion utility functions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AISTRCNV_H |
|
20 #define AISTRCNV_H |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 namespace AiUtility |
|
25 { |
|
26 /** |
|
27 * Parses an integer value from string. The string may contain |
|
28 * the integer value either in hexadecimal or decimal format. |
|
29 * |
|
30 * @param aResult the result integer value |
|
31 * @param aSourceString the source string |
|
32 * @return KErrNone if aStringValue is parsed to aValue. |
|
33 */ |
|
34 IMPORT_C TInt ParseInt( TInt32& aResult, const TDesC8& aSourceString ); |
|
35 |
|
36 /** |
|
37 * Parses an integer value from string. The string may contain |
|
38 * the integer value either in hexadecimal or decimal format. |
|
39 * |
|
40 * @param aResult the result integer value |
|
41 * @param aSourceString the source string |
|
42 * @return KErrNone if aStringValue is parsed to aValue. |
|
43 */ |
|
44 IMPORT_C TInt ParseInt( TInt32& aResult, const TDesC16& aSourceString ); |
|
45 |
|
46 /** |
|
47 * Copies aText to aBuffer. |
|
48 * |
|
49 * @param aTargetBuffer a buffer to hold text. If aBuffer is NULL or |
|
50 * insufficient, the function allocates a buffer. |
|
51 * @param aSourceText the text to copy. |
|
52 * @return pointer to result buffer. |
|
53 */ |
|
54 IMPORT_C HBufC16* CopyToBufferL(HBufC16* aTargetBuffer, const TDesC16& aSourceText); |
|
55 |
|
56 /** |
|
57 * Copies and converts aText to aBuffer. UTF-8 to UCS-2 conversion |
|
58 * is applied to aText. |
|
59 * |
|
60 * @param aTargetBuffer a buffer to hold text. If aBuffer is NULL or |
|
61 * insufficient, the function allocates a buffer. |
|
62 * @param aSourceText the text to copy. |
|
63 * @return pointer to result buffer. |
|
64 */ |
|
65 IMPORT_C HBufC16* CopyToBufferL(HBufC16* aTargetBuffer, const TDesC8& aSourceText); |
|
66 |
|
67 /** |
|
68 * Copies aText to aBuffer. |
|
69 * |
|
70 * @param aTargetBuffer a buffer to hold text. If aBuffer is NULL or |
|
71 * insufficient, the function allocates a buffer. |
|
72 * @param aSourceText the text to copy. |
|
73 * @return pointer to result buffer. |
|
74 */ |
|
75 IMPORT_C HBufC8* CopyToBufferL(HBufC8* aTargetBuffer, const TDesC8& aSourceText); |
|
76 |
|
77 /** |
|
78 * Copies and converts aText to aBuffer. UCS-2 to UTF-8 conversion |
|
79 * is applied to aText. |
|
80 * |
|
81 * @param aTargetBuffer a buffer to hold text. If aBuffer is NULL or |
|
82 * insufficient, the function allocates a buffer. |
|
83 * @param aSourceText the text to copy. |
|
84 * @return pointer to result buffer. |
|
85 */ |
|
86 IMPORT_C HBufC8* CopyToBufferL(HBufC8* aTargetBuffer, const TDesC16& aSourceText); |
|
87 |
|
88 /** |
|
89 * Ensures the buffer maximum length to be at least given number of characters. |
|
90 * This function checks the maximum length of given buffer and reallocates a |
|
91 * new buffer if the maximum length is not at least given number of characters. |
|
92 * |
|
93 * @param aBuffer refence to pointer to buffer to be checked. |
|
94 * @param aMaxLength new maximum length |
|
95 * @return modifiable pointer descriptor to the buffer |
|
96 * |
|
97 */ |
|
98 IMPORT_C TPtr16 EnsureBufMaxLengthL(HBufC16*& aBuffer, TInt aMaxLength ); |
|
99 |
|
100 } |
|
101 |
|
102 #endif // AISTRCNV_H |
|