memspyui/source/MemSpyUiUtils.cpp
branchRCL_3
changeset 21 b3cee849fa46
parent 20 48060abbbeaf
child 22 fad26422216a
equal deleted inserted replaced
20:48060abbbeaf 21:b3cee849fa46
     1 /*
       
     2 * Copyright (c) 2009 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 #include "MemSpyUiUtils.h"
       
    19 
       
    20 // System includes
       
    21 #include <coemain.h>
       
    22 #include <memspyui.rsg>
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 void MemSpyUiUtils::Format( TDes& aBuf, TInt aResourceId, ...)
       
    28     {
       
    29 	VA_LIST list;
       
    30     VA_START(list,aResourceId);
       
    31 	TBuf<128> format;
       
    32 	CCoeEnv::Static()->ReadResource( format, aResourceId );
       
    33 	aBuf.FormatList( format, list );
       
    34     }
       
    35 
       
    36 
       
    37 void MemSpyUiUtils::GetErrorText( TDes& aBuf, TInt aError )
       
    38     {
       
    39     if  ( aError == KErrNotSupported )
       
    40         {
       
    41         _LIT( KMemSpyErrorText, "Not Supported" );
       
    42         aBuf = KMemSpyErrorText;
       
    43         }
       
    44     else if ( aError == KErrNotReady )
       
    45         {
       
    46         _LIT( KMemSpyErrorText, "Not Ready" );
       
    47         aBuf = KMemSpyErrorText;
       
    48         }
       
    49     else if ( aError == KErrNotFound )
       
    50         {
       
    51         _LIT( KMemSpyErrorText, "Missing" );
       
    52         aBuf = KMemSpyErrorText;
       
    53         }
       
    54     else if ( aError == KErrGeneral )
       
    55         {
       
    56         _LIT( KMemSpyErrorText, "General Error" );
       
    57         aBuf = KMemSpyErrorText;
       
    58         }
       
    59     else
       
    60         {
       
    61         _LIT( KMemSpyItemValueError, "Error: %d" );
       
    62         aBuf.Format( KMemSpyItemValueError, aError );
       
    63         }
       
    64     }
       
    65