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