imgtools/romtools/rofsbuild/r_driveimage.h
changeset 0 044383f39525
child 590 360bd6b35136
child 606 30b30f9da0b7
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 * @internalComponent * @released
       
    16 * DriveImage class declaration.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __R_DRIVEIMAGE_H__
       
    22 #define __R_DRIVEIMAGE_H__
       
    23 
       
    24 #if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
       
    25 	#include <fstream>
       
    26 #else //!__MSVCDOTNET__
       
    27 	#include <fstream.h>
       
    28 #endif 
       
    29 
       
    30 #include "filesysteminterface.h" 
       
    31 #include <vector>
       
    32 
       
    33 typedef std::vector<void*> EntryReferenceVector;
       
    34 typedef	std::list<CDirectory*> EntryList; 
       
    35 
       
    36 const TInt KMaxGenBuffer=0x14;  
       
    37 
       
    38 // Node Type.
       
    39 enum KNodeType
       
    40 	{
       
    41 	KNodeTypeNone=0,		
       
    42 	KNodeTypeRoot,
       
    43 	KNodeTypeChild,
       
    44 	KNodeTypeSibling
       
    45 	};
       
    46 
       
    47 // File Format Supported.
       
    48 struct DriveFileFormatSupported
       
    49 	{
       
    50 	const char* iDriveFileFormat;
       
    51 	enum TFileSystem iFileSystem;
       
    52 	};
       
    53 
       
    54 // Image creation class.
       
    55 class CDriveImage
       
    56 	{
       
    57 public:
       
    58 	CDriveImage(CObeyFile *aObey);
       
    59 	~CDriveImage();
       
    60 	TInt CreateImage(TText* alogfile);
       
    61 	static TBool FormatTranslation(TText* aUserFileFormat,enum TFileSystem& aDriveFileFormat);
       
    62 
       
    63 private:
       
    64 
       
    65 	TInt CreateList();
       
    66 	TInt GenTreeTraverse(TRomNode* anode,enum KNodeType anodeType);    
       
    67 	TInt CreateDirOrFileEntry(TRomNode* atempnode,enum KNodeType aType);   
       
    68 	TInt ConstructOptions();
       
    69 	TInt PlaceFileTemporary(const TInt afileSize,TRomNode* acurrentNode); 
       
    70 	TInt DeleteTempFolder(char* aTempDirName);
       
    71 
       
    72 private:
       
    73 
       
    74 	// Holds the address of CObeyFile object. used to get the object information.
       
    75 	CObeyFile *iObey;
       
    76 	// Container required for file sysem module.
       
    77 	EntryList iNodeList;
       
    78 	// Pointer for nested Container.
       
    79 	EntryList *iParentInnerList;
       
    80 
       
    81 	// For temp storge of Container address.
       
    82 	EntryReferenceVector iNodeAddStore;
       
    83 
       
    84 	// For file format support.
       
    85 	static DriveFileFormatSupported iFormatType[];
       
    86 	// Reference variable used for converting tree to list.
       
    87 	TInt iListReference;
       
    88 	// Holds temp folder name. 
       
    89 	char *iTempDirName;
       
    90 	// Pointer to buffer, which will be used for compression/un-compression purpose.
       
    91 	char *iData;
       
    92 	};
       
    93 
       
    94 #endif