williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#if !defined(__BAUTILS_H__)
|
williamr@2
|
17 |
#define __BAUTILS_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32std.h>
|
williamr@2
|
20 |
#include <f32file.h>
|
williamr@2
|
21 |
#include <barsread.h>
|
williamr@2
|
22 |
#include <badesca.h>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
/**
|
williamr@2
|
25 |
@publishedAll
|
williamr@2
|
26 |
@released
|
williamr@2
|
27 |
*/
|
williamr@2
|
28 |
const TUint KBaflCharTruncation=0x2026; // Unicode's "horizontal ellipsis"
|
williamr@2
|
29 |
|
williamr@2
|
30 |
/**
|
williamr@2
|
31 |
There are at most 16 languages in the language downgrade path.
|
williamr@2
|
32 |
The end of the language path is marked by an ELangNone.
|
williamr@2
|
33 |
@publishedAll
|
williamr@2
|
34 |
@released
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
const TInt KMaxDowngradeLanguages = 16;
|
williamr@2
|
37 |
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
@publishedAll
|
williamr@2
|
40 |
@released
|
williamr@2
|
41 |
*/
|
williamr@2
|
42 |
typedef TLanguage TLanguagePath[KMaxDowngradeLanguages + 1];
|
williamr@2
|
43 |
|
williamr@2
|
44 |
class RFs;
|
williamr@2
|
45 |
class CBaflFileSortTable;
|
williamr@2
|
46 |
|
williamr@2
|
47 |
|
williamr@2
|
48 |
class BaflUtils
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
Provides simple-to-use file system utilities.
|
williamr@2
|
51 |
|
williamr@2
|
52 |
The functions listed in "Copying, renaming, and deleting files" create and
|
williamr@2
|
53 |
use a CFileMan object. They are useful for one-off calls, but for repeated
|
williamr@2
|
54 |
use it is more efficient to use CFileMan directly.
|
williamr@2
|
55 |
|
williamr@2
|
56 |
Note that there is a very similiar group of functions available in EikFileUtils,
|
williamr@2
|
57 |
which may be easier to use in GUI applications, as they do not require a file
|
williamr@2
|
58 |
server session to be passed.
|
williamr@2
|
59 |
|
williamr@2
|
60 |
@see CFileMan
|
williamr@2
|
61 |
@see EikFileUtils
|
williamr@2
|
62 |
@publishedAll
|
williamr@2
|
63 |
@released
|
williamr@2
|
64 |
*/
|
williamr@2
|
65 |
{
|
williamr@2
|
66 |
public:
|
williamr@2
|
67 |
IMPORT_C static void CopyWithTruncation(TDes& aDest,const TDesC& aSrc,TChar aTruncationSymbol=KBaflCharTruncation);
|
williamr@2
|
68 |
IMPORT_C static TBool FileExists(const RFs& aFs,const TDesC& aFileName);
|
williamr@2
|
69 |
IMPORT_C static void EnsurePathExistsL(RFs& aFs,const TDesC& aFileName);
|
williamr@2
|
70 |
IMPORT_C static TPtrC ExtractAppNameFromFullName(const TFullName &aName);
|
williamr@2
|
71 |
IMPORT_C static void NearestLanguageFile(const RFs& aFs,TFileName& aName);
|
williamr@2
|
72 |
IMPORT_C static void NearestLanguageFile(const RFs& aFs,TFileName& aName, TLanguage& aLanguage);
|
williamr@2
|
73 |
IMPORT_C static TInt SetIdealLanguage(TLanguage aLanguage);
|
williamr@2
|
74 |
IMPORT_C static TLanguage IdealLanguage();
|
williamr@2
|
75 |
IMPORT_C static void ReleaseIdealLanguage();
|
williamr@2
|
76 |
IMPORT_C static TInt GetSystemDrive(TDriveNumber& aDriveNumber);
|
williamr@2
|
77 |
IMPORT_C static TBool PathExists(RFs& aFs,const TDesC& aFileName);
|
williamr@2
|
78 |
IMPORT_C static TInt IsFolder(const RFs& aFs, const TDesC& aFullName, TBool& aIsFolder);
|
williamr@2
|
79 |
IMPORT_C static TBool FolderExists(RFs& aFs, const TDesC& aFolderName);
|
williamr@2
|
80 |
IMPORT_C static TFileName FolderNameFromFullName(const TDesC& aFullName);
|
williamr@2
|
81 |
IMPORT_C static TFileName DriveAndPathFromFullName(const TDesC& aFullName);
|
williamr@2
|
82 |
IMPORT_C static TFileName RootFolderPath(const TBuf<1> aDriveLetter);
|
williamr@2
|
83 |
IMPORT_C static void AbbreviateFileName(const TFileName& aOriginalFileName, TDes& aAbbreviatedFileName);
|
williamr@2
|
84 |
IMPORT_C static TBool UidTypeMatches(const TUidType& aFileUid, const TUidType& aMatchUid);
|
williamr@2
|
85 |
IMPORT_C static TInt Parse(const TDesC& aName);
|
williamr@2
|
86 |
IMPORT_C static TInt ValidateFolderNameTypedByUserL(const RFs& aFs, const TDesC& aFolderNameTypedByUser, const TDesC& aCurrentPath, TFileName& aNewFolderFullName);
|
williamr@2
|
87 |
IMPORT_C static TInt CopyFile(RFs& aFs, const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch = CFileMan::EOverWrite);
|
williamr@2
|
88 |
IMPORT_C static TInt RenameFile(RFs& aFs, const TDesC& aOldFullName, const TDesC& aNewFullName, TUint aSwitch = CFileMan::EOverWrite);
|
williamr@2
|
89 |
IMPORT_C static TInt DeleteFile(RFs& aFs, const TDesC& aSourceFullName, TUint aSwitch = 0);
|
williamr@2
|
90 |
IMPORT_C static TInt CheckWhetherFullNameRefersToFolder(const TDesC& aFullName, TBool& aIsFolder);
|
williamr@2
|
91 |
IMPORT_C static TInt MostSignificantPartOfFullName(const TDesC& aFullName, TFileName& aMostSignificantPart);
|
williamr@2
|
92 |
IMPORT_C static TInt CheckFolder(RFs& aFs, const TDesC& aFolderName);
|
williamr@2
|
93 |
IMPORT_C static TInt DiskIsReadOnly(RFs& aFs, const TDesC& aFullName, TBool& aIsReadOnly);
|
williamr@2
|
94 |
IMPORT_C static TInt DriveIsReadOnlyInternal(RFs& aFs, const TDesC& aFullName, TBool& aIsReadOnlyInternal);
|
williamr@2
|
95 |
IMPORT_C static void GetDiskListL(const RFs& aFs,CDesCArray& aArray);
|
williamr@2
|
96 |
IMPORT_C static void UpdateDiskListL(const RFs& aFs,CDesCArray& aArray,TBool aIncludeRom,TDriveNumber aDriveNumber);
|
williamr@2
|
97 |
IMPORT_C static void RemoveSystemDirectory(CDir& aDir);
|
williamr@2
|
98 |
IMPORT_C static TBool IsFirstDriveForSocket(TDriveUnit aDriveUnit);
|
williamr@2
|
99 |
IMPORT_C static TInt SortByTable(CDir& aDir,CBaflFileSortTable* aTable);
|
williamr@2
|
100 |
IMPORT_C static void GetDowngradePathL(const RFs& aFs, const TLanguage aCurrentLanguage, RArray<TLanguage>& aLanguageArray);
|
williamr@2
|
101 |
IMPORT_C static void PersistLocale();
|
williamr@2
|
102 |
IMPORT_C static TInt PersistHAL();
|
williamr@2
|
103 |
IMPORT_C static void PersistScreenCalibration(const TDigitizerCalibration& aScreenCalibration);
|
williamr@2
|
104 |
IMPORT_C static void InitialiseScreenCalibration(RFs& aFs);
|
williamr@2
|
105 |
IMPORT_C static void InitialiseHAL(RFs& aFs);
|
williamr@2
|
106 |
IMPORT_C static void InitialiseLocale(RFs& aFs);
|
williamr@2
|
107 |
private:
|
williamr@2
|
108 |
static void DoCopyFileL(RFs& aFs, const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch);
|
williamr@2
|
109 |
static void DoRenameFileL(RFs& aFs, const TDesC& aOldFullName, const TDesC& aNewFullName, TUint aSwitch);
|
williamr@2
|
110 |
static void DoDeleteFileL(RFs& aFs, const TDesC& aSourceFullName, TUint aSwitch);
|
williamr@2
|
111 |
};
|
williamr@2
|
112 |
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/**
|
williamr@2
|
115 |
* Bafl File Sort Table containing an array of UIDs.
|
williamr@2
|
116 |
* @publishedAll
|
williamr@2
|
117 |
* @released
|
williamr@2
|
118 |
*/
|
williamr@2
|
119 |
class CBaflFileSortTable : public CArrayFixFlat<TUid>
|
williamr@2
|
120 |
{
|
williamr@2
|
121 |
public:
|
williamr@2
|
122 |
IMPORT_C CBaflFileSortTable();
|
williamr@2
|
123 |
IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
|
williamr@2
|
124 |
private:
|
williamr@2
|
125 |
enum {EArrayGranularity=4};
|
williamr@2
|
126 |
};
|
williamr@2
|
127 |
|
williamr@2
|
128 |
#endif
|