mmshplugins/mmcctranscoder/inc/mcctranscoderlogs.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:36:18 +0300
changeset 22 496ad160a278
parent 0 f0cf47e981f9
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2005 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:  
*
*/


#ifndef MCCTRANSCODERLOGS_H
#define MCCTRANSCODERLOGS_H

#ifdef _DEBUG

#include <utf.h>
#include <e32debug.h>

class TMccTranscoderLog;

_LIT( KAnyFormat, "Mcc/Transcoder:" );
_LIT( KMccTranscoderLogWarning, "Mcc: Text contains not allowed characters, log ignored" );

#define __TRANSCODER( a ) \
	{  _LIT( KStr, a ); TMccTranscoderLog::Print( KAnyFormat, KStr ); }
#define __TRANSCODER_INT1( a, b ) \
	{  _LIT( KStr, a ); TMccTranscoderLog::Print( KAnyFormat, KStr, b ); }

class TMccTranscoderLog
	{
	public:

    inline static void Print( const TDesC16& aName, const TDesC16& aStr ) 
		{
		TChar notAllowed('%');
		if ( aStr.Locate( notAllowed ) == KErrNotFound )
			{
			TBuf<256> str;
			_LIT( KMcc, "%S %S" );
			str.Format( KMcc(), &aName, &aStr );
			RDebug::Print(str);				
			}
		else
			{
			RDebug::Print( KMccTranscoderLogWarning );							
			}	
		}	

	inline static void Print( 
	    const TDesC16& aName, 
	    const TDesC16& aStr, 
	    TInt           aValue ) 
		{
		TChar notAllowed('%');
		if ( aStr.Locate( notAllowed ) == KErrNotFound )
			{
			TBuf<256> str;
			_LIT( KMcc, "%S %S %d" );
			str.Format( KMcc(), &aName, &aStr, aValue );
			RDebug::Print(str);				
			}
		else
			{
			RDebug::Print( KMccTranscoderLogWarning );							
			}	
		}

    }; 
    
#else

#define __TRANSCODER( a )
#define __TRANSCODER_INT1( a, b )

#endif

#endif // End of define MCCTRANSCODERLOGS_H

// end of file