sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32\sfat\inc\fat_dir_entry.h
|
sl@0
|
15 |
// FAT directory entry related stuff definitions.
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalTechnology
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#if !defined(FAT_DIR_ENTRY_H)
|
sl@0
|
25 |
#define FAT_DIR_ENTRY_H
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
//-------------------------------------------------------------------------------------------------------------------
|
sl@0
|
29 |
|
sl@0
|
30 |
|
sl@0
|
31 |
const TInt KFatDirNameSize = 11; ///< Dos directory/File name length
|
sl@0
|
32 |
const TInt KVFatEntryAttribute = 0x0F; ///< VFat entry attribute setting
|
sl@0
|
33 |
const TUint8 KDotEntryByte = 0x2e; ///< Dot value for self and parent pointer directory entries
|
sl@0
|
34 |
const TUint8 KBlankSpace = 0x20; ///< Blank space in a directory entry
|
sl@0
|
35 |
const TInt KSizeOfFatDirEntryLog2 = 5; ///< Log2 of size in bytes of a Fat directry entry
|
sl@0
|
36 |
const TUint KSizeOfFatDirEntry = 1 << KSizeOfFatDirEntryLog2; ///< Size in bytes of a Fat directry entry
|
sl@0
|
37 |
|
sl@0
|
38 |
const TUint16 KReservedIdOldEntry = 1; ///< Rugged FAT "OldEntry" id
|
sl@0
|
39 |
const TUint16 KReservedIdNewEntry = 0; ///< Rugged FAT "ReservedIdNewEntry" id
|
sl@0
|
40 |
|
sl@0
|
41 |
|
sl@0
|
42 |
typedef TBuf8<KFatDirNameSize> TShortName; ///< Buffer type fot short names in dos entries
|
sl@0
|
43 |
|
sl@0
|
44 |
//-------------------------------------------------------------------------------------------------------------------
|
sl@0
|
45 |
|
sl@0
|
46 |
/**
|
sl@0
|
47 |
Fat DOS directory entry structure
|
sl@0
|
48 |
*/
|
sl@0
|
49 |
struct SFatDirEntry
|
sl@0
|
50 |
{
|
sl@0
|
51 |
TUint8 iName[KFatDirNameSize]; ///< :0 File/Directory name
|
sl@0
|
52 |
TUint8 iAttributes; ///< :11 File/Directory attributes
|
sl@0
|
53 |
TUint8 iReserved1[2]; ///< :12 2 reserved bytes(in our implementation), some versions of Windows may use them
|
sl@0
|
54 |
TUint16 iTimeC; ///< :14 Creation time
|
sl@0
|
55 |
TUint16 iDateC; ///< :16 Creation date
|
sl@0
|
56 |
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
|
57 |
TUint16 iStartClusterHi; ///< :20 High 16 bits of the File/Directory cluster number (Fat32 only)
|
sl@0
|
58 |
TUint16 iTime; ///< :22 last write access time
|
sl@0
|
59 |
TUint16 iDate; ///< :24 last write access date
|
sl@0
|
60 |
TUint16 iStartClusterLo; ///< :26 Low 16 bits of the File/Directory cluster number
|
sl@0
|
61 |
TUint32 iSize; ///< :28 File/Directory size in bytes
|
sl@0
|
62 |
};
|
sl@0
|
63 |
|
sl@0
|
64 |
|
sl@0
|
65 |
//-------------------------------------------------------------------------------------------------------------------
|
sl@0
|
66 |
|
sl@0
|
67 |
/**
|
sl@0
|
68 |
Provides access to the Fat directory entry parameters
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
class TFatDirEntry
|
sl@0
|
71 |
{
|
sl@0
|
72 |
public:
|
sl@0
|
73 |
inline TFatDirEntry();
|
sl@0
|
74 |
inline void InitZ();
|
sl@0
|
75 |
|
sl@0
|
76 |
inline const TPtrC8 Name() const;
|
sl@0
|
77 |
inline TInt Attributes() const;
|
sl@0
|
78 |
inline TTime Time(TTimeIntervalSeconds aOffset) const;
|
sl@0
|
79 |
inline TInt StartCluster() const;
|
sl@0
|
80 |
inline TUint32 Size() const;
|
sl@0
|
81 |
inline TBool IsErased() const;
|
sl@0
|
82 |
inline TBool IsCurrentDirectory() const;
|
sl@0
|
83 |
inline TBool IsParentDirectory() const;
|
sl@0
|
84 |
inline TBool IsEndOfDirectory() const;
|
sl@0
|
85 |
inline TBool IsGarbage() const;
|
sl@0
|
86 |
inline void SetName(const TDesC8& aDes);
|
sl@0
|
87 |
inline void SetAttributes(TInt anAtt);
|
sl@0
|
88 |
inline void SetTime(TTime aTime, TTimeIntervalSeconds aOffset);
|
sl@0
|
89 |
inline void SetCreateTime(TTime aTime, TTimeIntervalSeconds aOffset);
|
sl@0
|
90 |
inline void SetStartCluster(TInt aStartCluster);
|
sl@0
|
91 |
inline void SetSize(TUint32 aFilesize);
|
sl@0
|
92 |
inline void SetErased();
|
sl@0
|
93 |
inline void SetCurrentDirectory();
|
sl@0
|
94 |
inline void SetParentDirectory();
|
sl@0
|
95 |
inline void SetEndOfDirectory();
|
sl@0
|
96 |
inline TUint RuggedFatEntryId() const;
|
sl@0
|
97 |
inline void SetRuggedFatEntryId(TUint16 aId);
|
sl@0
|
98 |
|
sl@0
|
99 |
public:
|
sl@0
|
100 |
void InitializeAsVFat(TUint8 aCheckSum);
|
sl@0
|
101 |
void SetVFatEntry(const TDesC& aName,TInt aRemainderLen);
|
sl@0
|
102 |
void ReadVFatEntry(TDes16& aVBuf) const;
|
sl@0
|
103 |
inline TBool IsLongNameStart() const;
|
sl@0
|
104 |
inline TBool IsVFatEntry() const;
|
sl@0
|
105 |
inline TInt NumFollowing() const;
|
sl@0
|
106 |
inline TUint8 CheckSum() const;
|
sl@0
|
107 |
|
sl@0
|
108 |
|
sl@0
|
109 |
public:
|
sl@0
|
110 |
TUint8 iData[KSizeOfFatDirEntry]; ///< The directory entry data
|
sl@0
|
111 |
};
|
sl@0
|
112 |
|
sl@0
|
113 |
|
sl@0
|
114 |
|
sl@0
|
115 |
#endif //FAT_DIR_ENTRY_H
|
sl@0
|
116 |
|
sl@0
|
117 |
|
sl@0
|
118 |
|
sl@0
|
119 |
|
sl@0
|
120 |
|
sl@0
|
121 |
|
sl@0
|
122 |
|
sl@0
|
123 |
|
sl@0
|
124 |
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
|
sl@0
|
129 |
|