|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef __FILE_SYSTEM_ITEM_HEADER__ |
|
18 #define __FILE_SYSTEM_ITEM_HEADER__ |
|
19 #include "fatdefines.h" |
|
20 #include <time.h> |
|
21 class UTF16String; |
|
22 class TFSNode { |
|
23 public : |
|
24 TFSNode(TFSNode* aParent = 0 ,const char* aFileName = 0, TUint8 aAttrs = 0, const char* aPCSideName = 0); |
|
25 ~TFSNode() ; |
|
26 #ifdef _DEBUG |
|
27 void PrintTree(int nTab = 0); |
|
28 #endif |
|
29 inline TUint8 GetAttrs() const { return iAttrs ;} |
|
30 inline const char* GetFileName() const { return (iFileName != 0) ? iFileName : "" ;} |
|
31 inline const char* GetPCSideName() const { return (iPCSideName != 0) ? iPCSideName : "" ;} |
|
32 inline TFSNode* GetParent() const { return iParent;} |
|
33 inline TFSNode* GetFirstChild() const {return iFirstChild;} |
|
34 inline TFSNode* GetSibling() const { return iSibling ;} |
|
35 |
|
36 // return the size of memory needed to store this entry in a FAT system |
|
37 // for a file entry, it's size of file |
|
38 // for a directory entry, it's sumup of memory for subdir and files entry storage |
|
39 TUint GetSize() const ; |
|
40 |
|
41 bool IsDirectory() const ; |
|
42 |
|
43 //Except for "." and "..", every direcoty/file entry in FAT filesystem are treated as with |
|
44 //"long name", for the purpose of reserving case sensitive file name. |
|
45 // This function is for GetLongEntries() to know length of long name . |
|
46 int GetWideNameLength() const ; |
|
47 |
|
48 // To init the entry, |
|
49 // For a file entry, aSize is the known file size, |
|
50 // For a directory entry, aSize is not cared. |
|
51 void Init(time_t aCreateTime, time_t aAccessTime, time_t aWriteTime, TUint aSize ); |
|
52 |
|
53 //This function is used by TFatImgGenerator::PrepareClusters, to prepare the clusters |
|
54 // aClusterData should points to a buffer which is at least the size returns by |
|
55 // GetSize() |
|
56 void WriteDirEntries(TUint aStartIndex, TUint8* aClusterData ); |
|
57 |
|
58 static TFSNode* CreateFromFolder(const char* aPath,TFSNode* aParent = NULL); |
|
59 |
|
60 |
|
61 |
|
62 protected: |
|
63 void GenerateBasicName(); |
|
64 void MakeUniqueShortName(char rShortName[12],TUint baseNameLength) const; |
|
65 void GetShortEntry(TShortDirEntry* aEntry); |
|
66 int GetLongEntries(TLongDirEntry* aEntries) ; |
|
67 TFSNode* iParent ; |
|
68 TFSNode* iFirstChild ; |
|
69 TFSNode* iSibling ; |
|
70 TUint8 iAttrs ; |
|
71 char* iPCSideName; |
|
72 char* iFileName; |
|
73 char iShortName[12]; |
|
74 UTF16String* iWideName ; |
|
75 TTimeInteger iCrtTime ; |
|
76 TDateInteger iCrtDate ; |
|
77 TUint8 iCrtTimeTenth ; |
|
78 TDateInteger iLstAccDate ; |
|
79 TTimeInteger iWrtTime ; |
|
80 TDateInteger iWrtDate ; |
|
81 TUint iFileSize ; |
|
82 TShortDirEntry* iFATEntry ; |
|
83 }; |
|
84 |
|
85 #endif |