symport/symutil/src/errortranslator.cpp
changeset 1 0a7b44b10206
child 2 806186ab5e14
equal deleted inserted replaced
0:c55016431358 1:0a7b44b10206
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32std.h>
       
    17 
       
    18 const TInt KMaxErrorStringLength = 100;
       
    19 static const TText8 KErrorMessages[][KMaxErrorStringLength+1]=
       
    20 	{
       
    21 #define ERRORSTRING(s) #s
       
    22 #include "errorstrings.h"
       
    23 #undef ERRORSTRING
       
    24 	};
       
    25 
       
    26 
       
    27 void TranslateError(TInt aErrorCode, TDes8& aTarget)
       
    28 	{
       
    29 	aErrorCode = - aErrorCode;
       
    30 	if ( aErrorCode > 46 )
       
    31 		{
       
    32 		_LIT8(KNoTranslationAvailable, "");
       
    33 		aTarget.Copy(KNoTranslationAvailable);
       
    34 		aTarget.Append(' ');
       
    35 		aTarget.Append('-');
       
    36 		aTarget.AppendNum(aErrorCode);
       
    37 		}
       
    38 	else if ( aErrorCode >= 0 )
       
    39 		{
       
    40 		aTarget.Copy(KErrorMessages[aErrorCode]);
       
    41 		}
       
    42 	else
       
    43 		{
       
    44 		_LIT8(KNoTranslationAvailable, "");
       
    45 		aTarget.Copy(KNoTranslationAvailable);
       
    46 		aTarget.Append(' ');
       
    47 		aTarget.AppendNum(aErrorCode);
       
    48 		}
       
    49 	}
       
    50 
       
    51 // end of file