|
1 /* |
|
2 * Copyright (c) 2005-2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef __OSINTERFACE_H__ |
|
25 #define __OSINTERFACE_H__ |
|
26 #pragma warning(disable: 4786) |
|
27 |
|
28 #include "symbiantypes.h" |
|
29 |
|
30 #include <string> |
|
31 #include <vector> |
|
32 #include <tchar.h> |
|
33 using namespace std; |
|
34 |
|
35 #ifndef UNICODE |
|
36 #undef _T |
|
37 #undef _TCHAR |
|
38 #define _T(S) S |
|
39 #define _TCHAR char |
|
40 #endif // UNICODE |
|
41 |
|
42 |
|
43 |
|
44 /** |
|
45 * This class acts as an interface for different OS platform.This is used in order to support |
|
46 * portability between linux and windows platform.The current implementation supports windows |
|
47 * platform. |
|
48 */ |
|
49 |
|
50 class OSInterface |
|
51 { |
|
52 public: |
|
53 |
|
54 /** |
|
55 This method extracts all the files present within a specified directory. |
|
56 @param aRootDir Reference of the directory from which the files are to be extracted. |
|
57 @param aExtension Extension of the file to be extracted. |
|
58 @return string vector containing the files in the root directory (aRootDir) specified. |
|
59 */ |
|
60 |
|
61 static const std::vector<STRING> ExtractFilesFromDirectory(const STRING& aRootDir , const STRING& aExtension = _T("")) ; |
|
62 |
|
63 /** |
|
64 This method which deletes the files of a particular extension present within a specified directory, |
|
65 @param aRootDir Reference of the directory from which the files are to be deleted. |
|
66 @param aExtension Extension of the file to be deleted. |
|
67 */ |
|
68 |
|
69 static void DeleteFilesFromDirectory(const STRING& aRootDir , const STRING& aExtension); |
|
70 |
|
71 /** |
|
72 Checks whether the directory passed is C: Based or not. Since the files within the C: based |
|
73 are numbered,check is made to see that the the string passed can be converted into integer . |
|
74 @param aFileName Reference of the filename within the specified writable certstore to be verified. |
|
75 */ |
|
76 static bool IsInteger(const STRING& aFileName) ; |
|
77 |
|
78 |
|
79 /** |
|
80 Checks whether it is a valid directory . |
|
81 */ |
|
82 |
|
83 static int CheckIfDirectory(const STRING& aName) ; |
|
84 |
|
85 static int DeleteDirectory(STRING& aDirectory) ; |
|
86 |
|
87 /** |
|
88 Reads the value from the key value pair specified in the section from an file. |
|
89 @param aSectionLabel section name in the file whose key value pair is to be read. |
|
90 @param aRootLabel The key whose value is to be read. |
|
91 @param aCertstoreFile The file containing the section and key value pair. |
|
92 @param aBuf To be populated with the value of the key. |
|
93 */ |
|
94 |
|
95 static void ReadPrivateProfile(const STRING& aSectionLabel , const STRING& aRootLabel , const STRING& aCertstoreFile , _TCHAR* aBuf); |
|
96 }; |
|
97 |
|
98 #endif //__OSINTERFACE_H__ |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |