605
|
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 |
|
647
|
58 |
|
605
|
59 |
|
|
60 |
protected:
|
|
61 |
void GenerateBasicName();
|
|
62 |
void MakeUniqueShortName(char rShortName[12],TUint baseNameLength) const;
|
|
63 |
void GetShortEntry(TShortDirEntry* aEntry);
|
|
64 |
int GetLongEntries(TLongDirEntry* aEntries) ;
|
|
65 |
TFSNode* iParent ;
|
|
66 |
TFSNode* iFirstChild ;
|
|
67 |
TFSNode* iSibling ;
|
|
68 |
TUint8 iAttrs ;
|
|
69 |
char* iPCSideName;
|
|
70 |
char* iFileName;
|
|
71 |
char iShortName[12];
|
|
72 |
UTF16String* iWideName ;
|
|
73 |
TTimeInteger iCrtTime ;
|
|
74 |
TDateInteger iCrtDate ;
|
|
75 |
TUint8 iCrtTimeTenth ;
|
|
76 |
TDateInteger iLstAccDate ;
|
|
77 |
TTimeInteger iWrtTime ;
|
|
78 |
TDateInteger iWrtDate ;
|
|
79 |
TUint iFileSize ;
|
|
80 |
TShortDirEntry* iFATEntry ;
|
|
81 |
};
|
|
82 |
|
|
83 |
#endif
|