mmshplugins/mmcctranscoder/inc/mcctranscoderlogs.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MCCTRANSCODERLOGS_H
       
    20 #define MCCTRANSCODERLOGS_H
       
    21 
       
    22 #ifdef _DEBUG
       
    23 
       
    24 #include <utf.h>
       
    25 #include <e32debug.h>
       
    26 
       
    27 class TMccTranscoderLog;
       
    28 
       
    29 _LIT( KAnyFormat, "Mcc/Transcoder:" );
       
    30 _LIT( KMccTranscoderLogWarning, "Mcc: Text contains not allowed characters, log ignored" );
       
    31 
       
    32 #define __TRANSCODER( a ) \
       
    33 	{  _LIT( KStr, a ); TMccTranscoderLog::Print( KAnyFormat, KStr ); }
       
    34 #define __TRANSCODER_INT1( a, b ) \
       
    35 	{  _LIT( KStr, a ); TMccTranscoderLog::Print( KAnyFormat, KStr, b ); }
       
    36 
       
    37 class TMccTranscoderLog
       
    38 	{
       
    39 	public:
       
    40 
       
    41     inline static void Print( const TDesC16& aName, const TDesC16& aStr ) 
       
    42 		{
       
    43 		TChar notAllowed('%');
       
    44 		if ( aStr.Locate( notAllowed ) == KErrNotFound )
       
    45 			{
       
    46 			TBuf<256> str;
       
    47 			_LIT( KMcc, "%S %S" );
       
    48 			str.Format( KMcc(), &aName, &aStr );
       
    49 			RDebug::Print(str);				
       
    50 			}
       
    51 		else
       
    52 			{
       
    53 			RDebug::Print( KMccTranscoderLogWarning );							
       
    54 			}	
       
    55 		}	
       
    56 
       
    57 	inline static void Print( 
       
    58 	    const TDesC16& aName, 
       
    59 	    const TDesC16& aStr, 
       
    60 	    TInt           aValue ) 
       
    61 		{
       
    62 		TChar notAllowed('%');
       
    63 		if ( aStr.Locate( notAllowed ) == KErrNotFound )
       
    64 			{
       
    65 			TBuf<256> str;
       
    66 			_LIT( KMcc, "%S %S %d" );
       
    67 			str.Format( KMcc(), &aName, &aStr, aValue );
       
    68 			RDebug::Print(str);				
       
    69 			}
       
    70 		else
       
    71 			{
       
    72 			RDebug::Print( KMccTranscoderLogWarning );							
       
    73 			}	
       
    74 		}
       
    75 
       
    76     }; 
       
    77     
       
    78 #else
       
    79 
       
    80 #define __TRANSCODER( a )
       
    81 #define __TRANSCODER_INT1( a, b )
       
    82 
       
    83 #endif
       
    84 
       
    85 #endif // End of define MCCTRANSCODERLOGS_H
       
    86 
       
    87 // end of file