diff -r 000000000000 -r dfb7c4ff071f commsfwtools/preparedefaultcommsdatabase/Tools/cdbtest/inc/testlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commsfwtools/preparedefaultcommsdatabase/Tools/cdbtest/inc/testlog.h Thu Dec 17 09:22:25 2009 +0200 @@ -0,0 +1,73 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file testlog.h + @internalComponent +*/ + + +#ifndef TESTLOG_H +#define TESTLOG_H + +#include +#include +#include +#include "epocerror.h" + + +#define MAX_BUF_LENGTH 1024 +#define MAX_FILENAME_LENGTH 64 + +class CTestLog : public CBase +/** +@internalComponent +*/ + { + public: + static CTestLog* NewLC(RFs &aFsSession, TPtrC aFilename, TBool aDebugOn, CConsoleBase* aConsole); + void Msg(TPtrC aText, ...); + void Dbg(TPtrC aText, ...); + void CloseFile(); + inline TPtrC GetError(); + void WriteErrorMessage(const TPtrC &aMessage); + ~CTestLog(); + + void DiagPrint(const TText8* aFile, TInt aLine, TPtrC aSeverity, TPtrC aText, ...); + + protected: + CTestLog() + { + } + void ConstructL(RFs &aFsSession, TPtrC aFilename, TBool aDebugOn, CConsoleBase* aConsole); + private: + TBool iInitialised; + TBool iDebug; + RFile iFile; + CConsoleBase* iConsole; + CEpocError iErr; + // temp buffer + TBuf iBuf; + + TBool WriteBufferToFile(TDesC16 &aBuffer, RFile &aHandle); + }; + +inline TPtrC CTestLog::GetError() + { + return iErr.LastErrorMessage(); + } + + +#endif