commsfwtools/preparedefaultcommsdatabase/Tools/ceddump/inc/filedump.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file filedump.h
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef FILEDUMP_H
       
    23 #define FILEDUMP_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <f32file.h>
       
    27 #include <e32cons.h>
       
    28 #include "epocerror.h"
       
    29 
       
    30 
       
    31 /**
       
    32 Theoretical worst case is longest field is populated with non-ASCII data, so
       
    33 each byte expands to "\xHHHH"
       
    34 */
       
    35 #define MAX_COL_LONG_VAL_LEN 1024
       
    36 const TInt KMaxExpandedFieldLen = MAX_COL_LONG_VAL_LEN * 6;
       
    37 
       
    38 
       
    39 class CFileDump : public CBase
       
    40 /**
       
    41 @internalComponent
       
    42 */
       
    43 	{
       
    44 	public:
       
    45 		static CFileDump* NewL(TPtrC aFilename, TPtrC aAppname, TPtrC aVersion, TBool aDebugOn=EFalse, CConsoleBase* aConsole=NULL, TBool aWriteHeader=ETrue);
       
    46 		void ConstructL(TPtrC aFilename, TPtrC aAppname, TPtrC version, TBool aWriteHeader);
       
    47 		~CFileDump();
       
    48 		void WriteTableHeader(TPtrC aTable);
       
    49 		void WriteSectionHeader(TInt aCommDbId);
       
    50 		TBool WriteColumnValue(TPtrC &aColumn, TPtrC &aSetting);
       
    51 		void WriteFieldCount(TUint aCount);
       
    52 		void WriteErrorMessage(const TPtrC &aMessage);
       
    53 		void WriteSectionFooter(TInt aCommDbId);
       
    54 		void Msg(TPtrC aText, ...);
       
    55 		void Dbg(TPtrC aText, ...);
       
    56 		void CloseFile();
       
    57 		TPtrC GetError() { return iError.GetMessage(); }
       
    58 		void WriteAttributeSectionHeader();
       
    59 		void WriteAttributes(TPtrC &aColumn);
       
    60 		void WriteAttributesToFile(TUint32 aAttributes, TInt aType);
       
    61 		TBool IsInitialised() {return iInitialised;};
       
    62 
       
    63 	protected:
       
    64 		CFileDump(TInt aDebugOn, CConsoleBase* aConsole);
       
    65 			
       
    66 	private:
       
    67 		TBool WriteBufferToFile(TDesC16 &aBuffer, RFile &aHandle);
       
    68 		
       
    69 	private:
       
    70 		RFs iFsSession;
       
    71 		TBool iInitialised;
       
    72 		TBool iDebug;
       
    73 		RFile iFile;
       
    74 		CConsoleBase* iConsole;
       
    75 		EpocError iError;
       
    76 		/** temp buffer */
       
    77 		TBuf<MAX_COL_LONG_VAL_LEN> iBuffer;	
       
    78 	};
       
    79 
       
    80 
       
    81 
       
    82 #endif