commsfwtools/preparedefaultcommsdatabase/Tools/ced/inc/filedump.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2003-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 #include "dbdef.h"
       
    30 
       
    31 /**
       
    32 Theoretical worst case is longest field is populated with non-ASCII data, so
       
    33 each byte expands to "\xHHHH"
       
    34 */
       
    35 const TInt KMaxExpandedFieldLen = MAX_COL_LONG_VAL_LEN * 6;
       
    36 
       
    37 
       
    38 class CFileDump : public CBase
       
    39 /**
       
    40 @internalComponent
       
    41 */
       
    42 	{
       
    43 	public:
       
    44 		static CFileDump* NewL(RFs &fsSession, TPtrC filename, TPtrC appname, TPtrC version, TBool bDebugOn, CConsoleBase* aConsole, TBool bWriteHeader);
       
    45 		void WriteTableHeader(TPtrC table);
       
    46 		void WriteSectionHeader(TInt aCommDbId);
       
    47 		void WriteColumnValue(TPtrC &column, TPtrC &setting);
       
    48 		void WriteFieldCount(TUint count);
       
    49 		void WriteErrorMessage(const TPtrC &message);
       
    50 		void WriteSectionFooter(TInt aCommDbId);
       
    51 		void Msg(TPtrC text, ...);
       
    52 		void Dbg(TPtrC text, ...);
       
    53 		void Error(TPtrC text, ...);
       
    54 		void CloseFile();
       
    55 		TPtrC GetError() { return oErr.GetMessage(); }
       
    56 		~CFileDump();
       
    57 		TBool IsInitialised() {return bInitialised;}
       
    58 		
       
    59 	protected:
       
    60 		CFileDump() 
       
    61 			{
       
    62 			}
       
    63 		void ConstructL(RFs &fsSession, TPtrC filename, TPtrC appname, TPtrC version, TBool bDebugOn, CConsoleBase* aConsole, TBool bWriteHeader);
       
    64 	private:
       
    65 		TBool bInitialised;
       
    66 		TBool bDebug;
       
    67 		RFile file;
       
    68 		CConsoleBase* pConsole;
       
    69 		EpocError oErr;
       
    70 		/** temp buffer */
       
    71 		TBuf<MAX_COL_LONG_VAL_LEN> buf;	
       
    72 		
       
    73 		TBool WriteBufferToFile(TDesC16 &buffer, RFile &handle);
       
    74 	};
       
    75 
       
    76 #endif