imgtools/imglib/filesystem/include/filesystemclass.h
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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 * Base file system class for FileSystem component
       
    16 * @internalComponent
       
    17 * @released
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef FIlESYSTEMCLASS_H
       
    23 #define FIlESYSTEMCLASS_H
       
    24 
       
    25 #include "cluster.h"
       
    26 #include "fat16bootsector.h"
       
    27 #include "fat32bootsector.h"
       
    28 #include "filesysteminterface.h"
       
    29 
       
    30 #include<map>
       
    31 #include <fstream>
       
    32 
       
    33 
       
    34 
       
    35 //default root cluster number 
       
    36 const int KDefaultRootCluster=2;
       
    37 const int KDefaultSectorSizeinBytes=512;
       
    38 const int KDefaultRootDirEntrySize=32;
       
    39 
       
    40 
       
    41 
       
    42 typedef	TClustersPerEntryMap::iterator Iterator;
       
    43 /**
       
    44 Class representing base class  of all FAT type 
       
    45 
       
    46 @internalComponent
       
    47 @released
       
    48 */
       
    49 class CFileSystem
       
    50 {
       
    51 protected:
       
    52 	//Pointer to dynamically allocated array for containing the boot sector values of a FAT volume
       
    53 	unsigned char* iData;
       
    54 	//cluster size in bytes
       
    55 	unsigned long int iClusterSize;
       
    56 	//number of sectors occupied by a root directory
       
    57 	unsigned long iRootDirSectors;	
       
    58 	//total number of clusters in data segment
       
    59 	unsigned long int iTotalClusters;
       
    60 	unsigned int iBytesPerSector;
       
    61 
       
    62 public:
       
    63 	//constructor
       
    64 	CFileSystem();
       
    65 	// virtual destructor
       
    66 	virtual ~CFileSystem();
       
    67 	virtual void CreateBootSector(Long64 aPartitionSize,ConfigurableFatAttributes* aConfigurableFatAttributes)=0 ;
       
    68 	virtual void WriteBootSector(ofstream& aOutPutStream)=0 ;
       
    69 	virtual void CreateFatTable(ofstream& aOutPutStream)=0;
       
    70 	virtual void ComputeClusterSizeInBytes()=0;
       
    71 	virtual void ComputeRootDirSectors()=0;
       
    72 	virtual void ComputeTotalClusters(Long64 aPartitionSize)=0;
       
    73 	virtual void Execute(Long64 aPartitionSize,EntryList aNodeList,ofstream& aOutPutStream,
       
    74 						ConfigurableFatAttributes* aConfigurableFatAttributes)=0;
       
    75 	unsigned long int  GetTotalCluster() const;
       
    76 	unsigned long GetRootDirSectors() const;
       
    77 	unsigned long int GetClusterSize() const;
       
    78 	unsigned int GetBytesPerSector() const;
       
    79 };
       
    80 
       
    81 #endif //FIlESYSTEMCLASS_H