epoc32/include/bautils.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 bautils.h
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 
       
    47 
       
    48 class BaflUtils
       
    49 /** 
       
    50 Provides simple-to-use file system utilities.
       
    51 
       
    52 The functions listed in "Copying, renaming, and deleting files" create and 
       
    53 use a CFileMan object. They are useful for one-off calls, but for repeated 
       
    54 use it is more efficient to use CFileMan directly.
       
    55 
       
    56 Note that there is a very similiar group of functions available in EikFileUtils, 
       
    57 which may be easier to use in GUI applications, as they do not require a file 
       
    58 server session to be passed.
       
    59 
       
    60 @see CFileMan
       
    61 @see EikFileUtils 
       
    62 @publishedAll
       
    63 @released
       
    64 */
       
    65 	{
       
    66 public:
       
    67 	IMPORT_C static void CopyWithTruncation(TDes& aDest,const TDesC& aSrc,TChar aTruncationSymbol=KBaflCharTruncation);
       
    68 	IMPORT_C static TBool FileExists(const RFs& aFs,const TDesC& aFileName);
       
    69 	IMPORT_C static void EnsurePathExistsL(RFs& aFs,const TDesC& aFileName);
       
    70 	IMPORT_C static TPtrC ExtractAppNameFromFullName(const TFullName &aName);
       
    71 	IMPORT_C static void NearestLanguageFile(const RFs& aFs,TFileName& aName);
       
    72 	IMPORT_C static void NearestLanguageFile(const RFs& aFs,TFileName& aName, TLanguage& aLanguage);
       
    73 	IMPORT_C static TInt SetIdealLanguage(TLanguage aLanguage);
       
    74 	IMPORT_C static TLanguage IdealLanguage();
       
    75 	IMPORT_C static void ReleaseIdealLanguage();
       
    76 	IMPORT_C static TInt GetSystemDrive(TDriveNumber& aDriveNumber);
       
    77 	IMPORT_C static TBool PathExists(RFs& aFs,const TDesC& aFileName);
       
    78 	IMPORT_C static TInt IsFolder(const RFs& aFs, const TDesC& aFullName, TBool& aIsFolder);
       
    79 	IMPORT_C static TBool FolderExists(RFs& aFs, const TDesC& aFolderName);
       
    80 	IMPORT_C static TFileName FolderNameFromFullName(const TDesC& aFullName);
       
    81 	IMPORT_C static TFileName DriveAndPathFromFullName(const TDesC& aFullName);
       
    82 	IMPORT_C static TFileName RootFolderPath(const TBuf<1> aDriveLetter);
       
    83 	IMPORT_C static void AbbreviateFileName(const TFileName& aOriginalFileName, TDes& aAbbreviatedFileName);
       
    84 	IMPORT_C static TBool UidTypeMatches(const TUidType& aFileUid, const TUidType& aMatchUid);
       
    85 	IMPORT_C static TInt Parse(const TDesC& aName);
       
    86 	IMPORT_C static TInt ValidateFolderNameTypedByUserL(const RFs& aFs, const TDesC& aFolderNameTypedByUser, const TDesC& aCurrentPath, TFileName& aNewFolderFullName);
       
    87 	IMPORT_C static TInt CopyFile(RFs& aFs, const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch = CFileMan::EOverWrite);
       
    88 	IMPORT_C static TInt RenameFile(RFs& aFs, const TDesC& aOldFullName, const TDesC& aNewFullName, TUint aSwitch = CFileMan::EOverWrite);
       
    89 	IMPORT_C static TInt DeleteFile(RFs& aFs, const TDesC& aSourceFullName, TUint aSwitch = 0);
       
    90 	IMPORT_C static TInt CheckWhetherFullNameRefersToFolder(const TDesC& aFullName, TBool& aIsFolder);
       
    91 	IMPORT_C static TInt MostSignificantPartOfFullName(const TDesC& aFullName, TFileName& aMostSignificantPart);
       
    92 	IMPORT_C static TInt CheckFolder(RFs& aFs, const TDesC& aFolderName);
       
    93 	IMPORT_C static TInt DiskIsReadOnly(RFs& aFs, const TDesC& aFullName, TBool& aIsReadOnly);
       
    94 	IMPORT_C static TInt DriveIsReadOnlyInternal(RFs& aFs, const TDesC& aFullName, TBool& aIsReadOnlyInternal);
       
    95 	IMPORT_C static void GetDiskListL(const RFs& aFs,CDesCArray& aArray);
       
    96 	IMPORT_C static void UpdateDiskListL(const RFs& aFs,CDesCArray& aArray,TBool aIncludeRom,TDriveNumber aDriveNumber);
       
    97 	IMPORT_C static void RemoveSystemDirectory(CDir& aDir);
       
    98 	IMPORT_C static TBool IsFirstDriveForSocket(TDriveUnit aDriveUnit);
       
    99 	IMPORT_C static TInt SortByTable(CDir& aDir,CBaflFileSortTable* aTable);
       
   100 	IMPORT_C static void GetDowngradePathL(const RFs& aFs, const TLanguage aCurrentLanguage, RArray<TLanguage>& aLanguageArray);
       
   101 	IMPORT_C static void PersistLocale();
       
   102 	IMPORT_C static TInt PersistHAL();
       
   103 	IMPORT_C static void PersistScreenCalibration(const TDigitizerCalibration& aScreenCalibration);
       
   104 	IMPORT_C static void InitialiseScreenCalibration(RFs& aFs);
       
   105 	IMPORT_C static void InitialiseHAL(RFs& aFs);
       
   106 	IMPORT_C static void InitialiseLocale(RFs& aFs);
       
   107 private:
       
   108 	static void DoCopyFileL(RFs& aFs, const TDesC& aSourceFullName, const TDesC& aTargetFullName, TUint aSwitch);
       
   109 	static void DoRenameFileL(RFs& aFs, const TDesC& aOldFullName, const TDesC& aNewFullName, TUint aSwitch);
       
   110 	static void DoDeleteFileL(RFs& aFs, const TDesC& aSourceFullName, TUint aSwitch);
       
   111 	};
       
   112 
       
   113 
       
   114 /**
       
   115  * Bafl File Sort Table containing an array of UIDs.
       
   116  * @publishedAll
       
   117  * @released
       
   118  */	
       
   119 class CBaflFileSortTable : public CArrayFixFlat<TUid>
       
   120  	{
       
   121 public:
       
   122 	IMPORT_C CBaflFileSortTable();
       
   123 	IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
       
   124 private:
       
   125 	enum {EArrayGranularity=4};
       
   126 	};
       
   127 
       
   128 #endif