|
1 // Copyright (c) 2004-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // All rights reserved. |
|
15 // This component and the accompanying materials are made available |
|
16 // under the terms of the License "Symbian Foundation License v1.0" |
|
17 // which accompanies this distribution, and is available |
|
18 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
19 // Initial Contributors: |
|
20 // Nokia Corporation - initial contribution. |
|
21 // Contributors: |
|
22 // All rights reserved. |
|
23 // This component and the accompanying materials are made available |
|
24 // under the terms of the License "Symbian Foundation License v1.0" |
|
25 // which accompanies this distribution, and is available |
|
26 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
27 // Initial Contributors: |
|
28 // Nokia Corporation - initial contribution. |
|
29 // Contributors: |
|
30 // |
|
31 |
|
32 |
|
33 #ifndef __H_UTL_H__ |
|
34 #define __H_UTL_H__ |
|
35 |
|
36 #include "e32defwrap.h" |
|
37 #include <e32err.h> |
|
38 #include <iostream> |
|
39 |
|
40 #ifdef __TOOLS2__ |
|
41 #include <sstream> |
|
42 #include <fstream> |
|
43 using namespace std; |
|
44 #else |
|
45 #include <strstream.h> |
|
46 #endif |
|
47 |
|
48 /** |
|
49 Convert string to number. |
|
50 @internalComponent |
|
51 @released |
|
52 */ |
|
53 template <class T> |
|
54 TInt Val(T& aVal, char* aStr) |
|
55 { |
|
56 |
|
57 |
|
58 T x; |
|
59 #ifdef __TOOLS2__ |
|
60 istringstream val(aStr); |
|
61 #else |
|
62 istrstream val(aStr,strlen(aStr)); |
|
63 #endif |
|
64 val >> x; |
|
65 if (!val.eof() || val.fail()) |
|
66 return KErrGeneral; |
|
67 aVal=x; |
|
68 return KErrNone; |
|
69 |
|
70 /*T x; |
|
71 istrstream val(aStr,strlen(aStr)); |
|
72 val >> x; |
|
73 if (!val.eof() || val.fail()) |
|
74 return KErrGeneral; |
|
75 aVal=x; |
|
76 return KErrNone;*/ |
|
77 } |
|
78 |
|
79 |
|
80 //enum for decompose flag |
|
81 enum TDecomposeFlag |
|
82 { |
|
83 EUidPresent=1, |
|
84 EVerPresent=2 |
|
85 }; |
|
86 |
|
87 /** |
|
88 class for FileNameInfo |
|
89 @internalComponent |
|
90 @released |
|
91 */ |
|
92 class TFileNameInfo |
|
93 { |
|
94 public: |
|
95 TFileNameInfo(const char* aFileName, TBool aLookForUid); |
|
96 public: |
|
97 const char* iFileName; |
|
98 TInt iTotalLength; |
|
99 TInt iBaseLength; |
|
100 TInt iExtPos; |
|
101 TUint32 iUid3; |
|
102 TUint32 iModuleVersion; |
|
103 TUint32 iFlags; |
|
104 }; |
|
105 |
|
106 extern char* NormaliseFileName(const char* aName); |
|
107 |
|
108 |
|
109 |
|
110 #ifdef __LINUX__ |
|
111 // Case insensitive comparison functions are named differently on Linux |
|
112 #define stricmp strcasecmp |
|
113 #define strnicmp strncasecmp |
|
114 |
|
115 // Convert the provided string to Uppercase |
|
116 char* strupr(char *a); |
|
117 #endif // __LINUX__ |
|
118 |
|
119 #endif // __H_UTL_H__ |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |