mpx/tsrc/public/basic/common/testviewframework/src/testutility.cpp
changeset 62 b276843a15ba
equal deleted inserted replaced
58:c76ea6caa649 62:b276843a15ba
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  Help tools
       
    15 *
       
    16 */
       
    17 
       
    18 #include <stiflogger.h>
       
    19 #include <aknlists.h>
       
    20 #include "testutility.h"
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // Convert string to decemial
       
    24 // -----------------------------------------------------------------------------
       
    25 EXPORT_C TInt TestUtility::ConvertStrToDecL(const TDesC& aStr)
       
    26     {
       
    27     TInt result = 0;
       
    28     for(TInt i=0; i<aStr.Length(); i++)
       
    29         {
       
    30         TUint16 ch = aStr[i];
       
    31         if(ch < 48 || ch > 57)
       
    32             User::Leave(KErrArgument);
       
    33         ch -= 48;
       
    34         result *= 10;
       
    35         result += ch;
       
    36         }
       
    37     return result;
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // Log message
       
    42 // -----------------------------------------------------------------------------
       
    43 EXPORT_C void TestUtility::TestLog(CStifLogger* aLogger,
       
    44                                    TRefByValue< const TDesC > aFmt, 
       
    45                                    ...)
       
    46     {
       
    47     VA_LIST list;
       
    48     VA_START(list, aFmt);
       
    49     RDebug::Print( aFmt, list );
       
    50     if(aLogger)
       
    51         {
       
    52         TBuf<KMaxLogData> logData;
       
    53         logData.FormatList( aFmt, list );
       
    54         aLogger->Log(logData);
       
    55         }
       
    56     VA_END(list);
       
    57     }
       
    58