sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\sfat\inc\fat_dir_entry.h sl@0: // FAT directory entry related stuff definitions. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #if !defined(FAT_DIR_ENTRY_H) sl@0: #define FAT_DIR_ENTRY_H sl@0: sl@0: sl@0: //------------------------------------------------------------------------------------------------------------------- sl@0: sl@0: sl@0: const TInt KFatDirNameSize = 11; ///< Dos directory/File name length sl@0: const TInt KVFatEntryAttribute = 0x0F; ///< VFat entry attribute setting sl@0: const TUint8 KDotEntryByte = 0x2e; ///< Dot value for self and parent pointer directory entries sl@0: const TUint8 KBlankSpace = 0x20; ///< Blank space in a directory entry sl@0: const TInt KSizeOfFatDirEntryLog2 = 5; ///< Log2 of size in bytes of a Fat directry entry sl@0: const TUint KSizeOfFatDirEntry = 1 << KSizeOfFatDirEntryLog2; ///< Size in bytes of a Fat directry entry sl@0: sl@0: const TUint16 KReservedIdOldEntry = 1; ///< Rugged FAT "OldEntry" id sl@0: const TUint16 KReservedIdNewEntry = 0; ///< Rugged FAT "ReservedIdNewEntry" id sl@0: sl@0: sl@0: typedef TBuf8 TShortName; ///< Buffer type fot short names in dos entries sl@0: sl@0: //------------------------------------------------------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Fat DOS directory entry structure sl@0: */ sl@0: struct SFatDirEntry sl@0: { sl@0: TUint8 iName[KFatDirNameSize]; ///< :0 File/Directory name sl@0: TUint8 iAttributes; ///< :11 File/Directory attributes sl@0: TUint8 iReserved1[2]; ///< :12 2 reserved bytes(in our implementation), some versions of Windows may use them sl@0: TUint16 iTimeC; ///< :14 Creation time sl@0: TUint16 iDateC; ///< :16 Creation date sl@0: TUint16 iReserved2; ///< :18 2 reserved bytes(in our implementation), FAT specs say that this is "last access date". Rugged FAT uses them as a special entry ID sl@0: TUint16 iStartClusterHi; ///< :20 High 16 bits of the File/Directory cluster number (Fat32 only) sl@0: TUint16 iTime; ///< :22 last write access time sl@0: TUint16 iDate; ///< :24 last write access date sl@0: TUint16 iStartClusterLo; ///< :26 Low 16 bits of the File/Directory cluster number sl@0: TUint32 iSize; ///< :28 File/Directory size in bytes sl@0: }; sl@0: sl@0: sl@0: //------------------------------------------------------------------------------------------------------------------- sl@0: sl@0: /** sl@0: Provides access to the Fat directory entry parameters sl@0: */ sl@0: class TFatDirEntry sl@0: { sl@0: public: sl@0: inline TFatDirEntry(); sl@0: inline void InitZ(); sl@0: sl@0: inline const TPtrC8 Name() const; sl@0: inline TInt Attributes() const; sl@0: inline TTime Time(TTimeIntervalSeconds aOffset) const; sl@0: inline TInt StartCluster() const; sl@0: inline TUint32 Size() const; sl@0: inline TBool IsErased() const; sl@0: inline TBool IsCurrentDirectory() const; sl@0: inline TBool IsParentDirectory() const; sl@0: inline TBool IsEndOfDirectory() const; sl@0: inline TBool IsGarbage() const; sl@0: inline void SetName(const TDesC8& aDes); sl@0: inline void SetAttributes(TInt anAtt); sl@0: inline void SetTime(TTime aTime, TTimeIntervalSeconds aOffset); sl@0: inline void SetCreateTime(TTime aTime, TTimeIntervalSeconds aOffset); sl@0: inline void SetStartCluster(TInt aStartCluster); sl@0: inline void SetSize(TUint32 aFilesize); sl@0: inline void SetErased(); sl@0: inline void SetCurrentDirectory(); sl@0: inline void SetParentDirectory(); sl@0: inline void SetEndOfDirectory(); sl@0: inline TUint RuggedFatEntryId() const; sl@0: inline void SetRuggedFatEntryId(TUint16 aId); sl@0: sl@0: public: sl@0: void InitializeAsVFat(TUint8 aCheckSum); sl@0: void SetVFatEntry(const TDesC& aName,TInt aRemainderLen); sl@0: void ReadVFatEntry(TDes16& aVBuf) const; sl@0: inline TBool IsLongNameStart() const; sl@0: inline TBool IsVFatEntry() const; sl@0: inline TInt NumFollowing() const; sl@0: inline TUint8 CheckSum() const; sl@0: sl@0: sl@0: public: sl@0: TUint8 iData[KSizeOfFatDirEntry]; ///< The directory entry data sl@0: }; sl@0: sl@0: sl@0: sl@0: #endif //FAT_DIR_ENTRY_H sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: