imgtools/romtools/readimage/inc/image_reader.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2005-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
       
    16 * @released
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __IMAGE_READER__
       
    22 #define __IMAGE_READER__
       
    23 
       
    24 #if defined(__VC32__) && (_MSC_VER < 1300)
       
    25 #pragma warning(disable:4786) // std::map etc overflow debug symbol length :(
       
    26 #endif
       
    27 
       
    28 
       
    29 #include "common.h"
       
    30 #include <direct.h>
       
    31 #include <map>
       
    32 
       
    33 typedef struct tag_FILEINFO
       
    34 {
       
    35 	TUint32 iOffset;
       
    36 	TUint32 iSize;
       
    37 }FILEINFO, *PFILEINFO;
       
    38 
       
    39 typedef std::map<std::string, PFILEINFO> FILEINFOMAP;
       
    40 
       
    41 class ImageReader
       
    42 {
       
    43 public:
       
    44 	ImageReader(const char* aFile);
       
    45 	virtual ~ImageReader();
       
    46 	
       
    47 	virtual void ReadImage()	= 0;
       
    48 	virtual void ProcessImage() = 0;
       
    49 	virtual void Validate()		= 0;
       
    50 	virtual void Dump()			= 0;
       
    51 	
       
    52 	virtual void ExtractImageContents(){}
       
    53 	void DumpData(TUint* aData, TUint aLength);
       
    54 
       
    55 	void SetDisplayOptions(TUint32);
       
    56 	bool DisplayOptions(TUint32);
       
    57 
       
    58 	void ExtractFile(TUint aOffset, TInt aSize, const char* aFileName, const char* aPath, char* aFilePath,char* aData = NULL);
       
    59 	void FindAndInsertString(string& aSrcStr,string& aDelimiter,string& aAppStr);
       
    60 	void FindAndReplaceString(string& aSrcStr, string& aDelimiter, string& aReplStr);
       
    61 	void CreateSpecifiedDir(char* aSrcPath,const char* aDelimiter);
       
    62 	TBool IsDrive(char* aStr);
       
    63 
       
    64 	virtual void GetFileInfo(FILEINFOMAP& /*fileInfoMap */){}
       
    65 	void ExtractFileSet(char* aData);
       
    66 	int FileNameMatch(string aPattern, string aFileName, int aRecursiveFlag);
       
    67 
       
    68 	TUint32	iDisplayOptions;
       
    69 	string	iImgFileName;
       
    70 	static string  iZdrivePath;
       
    71 	static string  iLogFileName;
       
    72 	static string  iE32ImgFileName;
       
    73 	static string  iPattern;
       
    74 };
       
    75 
       
    76 #endif //__IMAGE_READER__