multimediacommsengine/tsrc/mccstub/inc/MccLogs.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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 
       
    20 
       
    21 #ifndef _MCCLOGS_H
       
    22 #define _MCCLOGS_H
       
    23 
       
    24 #include <utf.h>
       
    25 #include <e32debug.h>
       
    26 _LIT( KMCCWarning, "MCC: Text contains not allowed characters, log ignored" );
       
    27 
       
    28 class TMCCLog
       
    29 	{
       
    30 	public:
       
    31 
       
    32     inline static void Print( const TDesC16& aName, const TDesC16& aStr ) 
       
    33 		{
       
    34 		TChar notAllowed('%');
       
    35 		if ( aStr.Locate( notAllowed ) == KErrNotFound )
       
    36 			{
       
    37 			TBuf<256> str;
       
    38 			_LIT( KMCC, "%S %S" );
       
    39 			str.Format( KMCC(), &aName, &aStr );
       
    40 			RDebug::Print(str);				
       
    41 			}
       
    42 		else
       
    43 			{
       
    44 			RDebug::Print( KMCCWarning );							
       
    45 			}	
       
    46 		}	
       
    47 
       
    48 	inline static void Print( 
       
    49 	    const TDesC16& aName, 
       
    50 	    const TDesC16& aStr, 
       
    51 	    TInt           aValue ) 
       
    52 		{
       
    53 		TChar notAllowed('%');
       
    54 		if ( aStr.Locate( notAllowed ) == KErrNotFound )
       
    55 			{
       
    56 			TBuf<256> str;
       
    57 			_LIT( KMCC, "%S %S %d" );
       
    58 			str.Format( KMCC(), &aName, &aStr, aValue );
       
    59 			RDebug::Print(str);				
       
    60 			}
       
    61 		else
       
    62 			{
       
    63 			RDebug::Print( KMCCWarning );							
       
    64 			}	
       
    65 		}
       
    66 		
       
    67 	inline static void Print(
       
    68 	    const TDesC16& aName, 
       
    69 	    const TDesC16& aStr1, 
       
    70 	    TInt           aValue1, 
       
    71 	    const TDesC16& aStr2, 
       
    72 	    TInt           aValue2) 
       
    73 		{
       
    74 		TChar notAllowed('%');
       
    75 		if ( aStr1.Locate( notAllowed ) == KErrNotFound &&
       
    76 		     aStr2.Locate( notAllowed ) == KErrNotFound)
       
    77 			{
       
    78 			TBuf<256> str;
       
    79 			_LIT( KMCC, "%S %S %d, %S %d" );
       
    80 			str.Format( KMCC(), &aName, &aStr1, aValue1, 
       
    81 			            &aStr2, aValue2 );
       
    82 			RDebug::Print(str);				
       
    83 			}
       
    84 		else
       
    85 			{
       
    86 			RDebug::Print( KMCCWarning );							
       
    87 			}
       
    88 		}
       
    89 
       
    90 	inline static void Print(
       
    91 	    const TDesC16& aName, 
       
    92 	    const TDesC16& aStr1, 
       
    93 	    TInt           aValue1, 
       
    94 	    TInt           aValue2) 
       
    95 		{
       
    96 		TChar notAllowed('%');
       
    97 		if ( aStr1.Locate( notAllowed ) == KErrNotFound )
       
    98 			{
       
    99 			TBuf<256> str;
       
   100 			_LIT( KMCC, "%S %S %d, %d" );
       
   101 			str.Format( KMCC(), &aName, &aStr1, aValue1, 
       
   102 			            aValue2 );
       
   103 			RDebug::Print(str);				
       
   104 			}
       
   105 		else
       
   106 			{
       
   107 			RDebug::Print( KMCCWarning );							
       
   108 			}
       
   109 		}
       
   110 
       
   111 	inline static void Print(
       
   112 		const TDesC16& aName,
       
   113 		const TDesC16& aStrA,
       
   114 		const TDesC8& aStrB) 
       
   115 		{
       
   116 		TChar notAllowed('%');
       
   117 		if ( aName.Locate( notAllowed ) == KErrNotFound  &&
       
   118 		     aStrB.Locate( notAllowed ) == KErrNotFound )
       
   119 			{
       
   120 			TBuf<100> str2;
       
   121 			CnvUtfConverter::ConvertToUnicodeFromUtf8(str2, aStrB);
       
   122 
       
   123 			TBuf<256> str;
       
   124 			_LIT(KMCC, "%S, %S %S");
       
   125 			str.Format(KMCC(), &aName, &aStrA, &str2);
       
   126 			RDebug::Print(str);
       
   127 			}
       
   128 		else
       
   129 			{
       
   130 			RDebug::Print( KMCCWarning );							
       
   131 			}	
       
   132 		}
       
   133 
       
   134     }; 
       
   135 
       
   136 #endif // end of class TMCCLog
       
   137 
       
   138 // End of File