imgtools/imgcheck/libimgutils/inc/utils.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2007-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 the License "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 * @internalComponent
       
    16 * @released
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef UTILS_H
       
    22 #define UTILS_H
       
    23 
       
    24 /**
       
    25 Macro to check and delete the pointer.
       
    26 
       
    27 @internalComponent
       
    28 @released
       
    29 */
       
    30 #define DELETE(aPtr) if(aPtr != NULL) delete aPtr; aPtr = 0;
       
    31 
       
    32 typedef std::string String;
       
    33 
       
    34 /**
       
    35 To support large integer values, 64 bit integers are used.
       
    36 "__int64" is for MSVC compiler and "long long int" is for GCC compilers
       
    37 
       
    38 @internalComponent
       
    39 @released
       
    40 */
       
    41 
       
    42 #ifdef _MSC_VER
       
    43 	typedef __int64 Long64;
       
    44 #else
       
    45 	typedef long long int Long64;
       
    46 #endif
       
    47 
       
    48 /**
       
    49 Constants for Ascii values
       
    50 
       
    51 @internalComponent
       
    52 @released
       
    53 */
       
    54 const int KUpperCaseAsciiValOfCharA = 65;
       
    55 const int KUpperCaseAsciiValOfCharZ = 90;
       
    56 const int KUpperAndLowerAsciiDiff = 32;
       
    57 const int KAsciiValueOfZero = 48;
       
    58 
       
    59 /**
       
    60 Enum for different base
       
    61 
       
    62 @internalComponent
       
    63 @released
       
    64 */
       
    65 enum
       
    66 {
       
    67 	EBase2 = 2,
       
    68 	EBase10 = 10,
       
    69 	EBase16 = 16
       
    70 };
       
    71 
       
    72 /**
       
    73 Enums for different executable type
       
    74 
       
    75 @internalComponent
       
    76 @released
       
    77 */
       
    78 enum
       
    79 {
       
    80 	EAll = 0,
       
    81 	EExe = 1,
       
    82 	EDll = 2
       
    83 };
       
    84 
       
    85 /**
       
    86 class ReaderUtil
       
    87 
       
    88 @internalComponent
       
    89 @released
       
    90 */
       
    91 class ReaderUtil
       
    92 {
       
    93 public:
       
    94 	static bool IsExecutable(unsigned char* aUids1, int aType = EAll);
       
    95 	static bool IsExe(unsigned long* Uids1);
       
    96 	static bool IsDll(unsigned long* Uids1);
       
    97 	static const String& ToLower(String& aString);
       
    98 	static const String IntToAscii(const int aValue, const int aBase);
       
    99 	static Long64 DecStrToInt(String& aString);
       
   100 	static unsigned int HexStrToInt(String& aStringVal);
       
   101 };
       
   102 #endif //UTILS_H