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