sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of the License "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // msdebug.cpp
sl@0: // 
sl@0: //
sl@0: 
sl@0: 
sl@0: 
sl@0: /**
sl@0:  @file
sl@0:  @internalTechnology
sl@0: */
sl@0: 
sl@0: #ifndef MSDEBUG_H
sl@0: #define MSDEBUG_H
sl@0: 
sl@0: //#define _MSFN_DEBUG_PRINT_
sl@0: 
sl@0: #if defined(_MSFN_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
sl@0: #define MSFN_TRACE_ENABLED
sl@0: #endif
sl@0: 
sl@0: #ifdef MSFN_TRACE_ENABLED
sl@0: #include <e32debug.h>
sl@0: 
sl@0: 
sl@0: /**
sl@0: Logging function to be used with static functions. Prints the function string on
sl@0: function entry and exit.
sl@0: */
sl@0: class TMsLogStaticFn
sl@0:     {
sl@0: public:
sl@0:     static const TInt KLogBufferSize = 0xFF;
sl@0: 
sl@0:     TMsLogStaticFn(const TDesC8& aFunctionName);
sl@0: 
sl@0: 	~TMsLogStaticFn();
sl@0: 
sl@0: protected:
sl@0:     TBuf8<KLogBufferSize> buf;
sl@0: 	TPtrC8 iFunctionName;
sl@0:     };
sl@0: 
sl@0: 
sl@0: /**
sl@0: Logging function which prints the function string on function entry and exit.
sl@0: */
sl@0: class TMsLogFn
sl@0:     {
sl@0: public:
sl@0:     static const TInt KLogBufferSize = 0xFF;
sl@0: 	TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer);
sl@0: 
sl@0: 	~TMsLogFn();
sl@0: 
sl@0: private:
sl@0:     TBuf8<KLogBufferSize> buf;
sl@0: 	TPtrC8 iFunctionName;
sl@0: 	void* iThisPointer;
sl@0:     };
sl@0: 
sl@0: 
sl@0: 
sl@0: #define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this);
sl@0: #define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
sl@0: #else
sl@0: #define __MSFNSLOG
sl@0: #define __MSFNLOG
sl@0: #endif
sl@0: 
sl@0: #endif // MSDEBUG_H