1 /* |
|
2 * Copyright (c) 2008 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: Utils methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef FACTSETCHUTILS_H |
|
20 #define FACTSETCHUTILS_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 // CLASS DECLARATION |
|
26 class CGECODefaultObject; |
|
27 class MXCFWNode; |
|
28 |
|
29 /** |
|
30 * Common utils methods. |
|
31 * |
|
32 * @lib aspafactorysettings.lib |
|
33 * @since Series 60 3.1 |
|
34 */ |
|
35 class FactSetCHUtils |
|
36 { |
|
37 public: |
|
38 // New functions |
|
39 |
|
40 /** |
|
41 * Extracts a TUint from the given string. |
|
42 * @since Series 60 3.1 |
|
43 * @param aStr A string defining the uint. |
|
44 * @return TUint Object. |
|
45 */ |
|
46 static TUint Str2Uint( const TDesC& aStr ); |
|
47 |
|
48 /** |
|
49 * Extracts a TInt from the given string. |
|
50 * @since Series 60 3.1 |
|
51 * @param aStr A string defining the int. |
|
52 * @return TInt Object. |
|
53 */ |
|
54 static TInt Str2Int( const TDesC& aStr ); |
|
55 |
|
56 /** |
|
57 * Extracts a TBool from the given string. |
|
58 * @since Series 60 3.1 |
|
59 * @param aStr A string defining the bool. |
|
60 * @return TBool Object. |
|
61 */ |
|
62 static TBool Str2Bool( const TDesC& aStr ); |
|
63 |
|
64 /** |
|
65 * Extracts a TUid from the given string. |
|
66 * @since Series 60 3.1 |
|
67 * @param aStr A string defining the uid. |
|
68 * @return Uid Object. |
|
69 */ |
|
70 static TUid Str2Uid( const TDesC& aStr ); |
|
71 |
|
72 /** |
|
73 * Creates HBufC8* from the given string. |
|
74 * @since Series 60 3.1 |
|
75 * @param aStr A string to convert to HBufC8*. |
|
76 * @return HBufC8* Pointer. |
|
77 */ |
|
78 static HBufC8* Str2Str8LC( const TDesC& aStr ); |
|
79 |
|
80 /** |
|
81 * Extracts a TReal from the given string. |
|
82 * @since Series 60 3.1 |
|
83 * @param aStr A string defining the real value. |
|
84 * @return Real Object. |
|
85 */ |
|
86 static TReal Str2Real( const TDesC& aStr ); |
|
87 |
|
88 /** |
|
89 * Extracts a TInt from the given string. |
|
90 * @since Series 60 3.1 |
|
91 * @param aStr A string defining the real value. |
|
92 * @return Real Object. |
|
93 */ |
|
94 static TInt32 Str2Int32( const TDesC& aStr ); |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Extracts an integer from the given hex string. |
|
100 * @since Series 60 3.1 |
|
101 * @param aStr A hex string containg an integer number. |
|
102 * @return Integer value of the number. |
|
103 */ |
|
104 static TUint StrHex2Uint( const TDesC& aStr ); |
|
105 |
|
106 /** |
|
107 * Extracts an integer from the given string. |
|
108 * @since Series 60 3.1 |
|
109 * @param aStr A string containg an integer number. |
|
110 * @return Integer value of the number. |
|
111 */ |
|
112 static TUint StrDec2Uint( const TDesC& aStr ); |
|
113 |
|
114 /** |
|
115 * Handles bad argument passed into utility function |
|
116 * @since Series 60 3.1 |
|
117 * @param aCategory describes bad argument |
|
118 * @param aArgument bad argument |
|
119 * @param aReason bad argument code |
|
120 */ |
|
121 static void BadArgument( const TDesC& aCategory, const TDesC& aArgument, |
|
122 TInt aReason ); |
|
123 static void BadArgumentL( const TDesC& aCategory, const TDesC& aArgument, |
|
124 TInt aReason ); |
|
125 |
|
126 /** |
|
127 * Handles bad argument passed into utility function |
|
128 * @since Series 60 3.1 |
|
129 * @param aCategory describes bad argument |
|
130 * @param aArgument bad argument |
|
131 * @param aReason bad argument code |
|
132 */ |
|
133 static void BadArgument( const TDesC& aCategory, TInt aArgument, |
|
134 TInt aReason ); |
|
135 |
|
136 /** |
|
137 * Handles bad argument passed into utility function |
|
138 * @since Series 60 3.1 |
|
139 * @param aCategory describes bad argument |
|
140 * @param aReason bad argument code |
|
141 */ |
|
142 static void BadArgument( const TDesC& aCategory, TInt aReason ); |
|
143 |
|
144 }; |
|
145 |
|
146 #endif // FACTSETCHUTILS_H |
|
147 // End of File |
|