imgtools/imglib/filesystem/include/utils.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2006-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 * UTILSH
       
    16 * Contains common utilitied required for filesystem component.
       
    17 * @internalComponent
       
    18 * @released
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef UTILS_H
       
    24 #define UTILS_H
       
    25 
       
    26 #include <string>
       
    27 
       
    28 /* While generating FAT32 image, user may specify the larger partition size (say 128GB),
       
    29  * Hence to support large integer values 64 bit integers are used.
       
    30  * "__int64" is for MSVC compiler and "long long int" is for GCC compilers
       
    31  */
       
    32 #ifdef _MSC_VER
       
    33 	typedef __int64 Long64;
       
    34 #else
       
    35 	typedef long long int Long64;
       
    36 #endif
       
    37 
       
    38 typedef std::string String;
       
    39 
       
    40 /**
       
    41 Function responsible to convert given string into upper case.
       
    42 Note: In FAT iamge regular entry names are need to be mentioned in Upper case.
       
    43 
       
    44 @internalComponent
       
    45 @released
       
    46 
       
    47 @param aString - input string 
       
    48 @return returns the string, were string alphabets are changed to uppercase
       
    49 */
       
    50 inline String& ToUpper(String& aString)
       
    51 {
       
    52 	unsigned int stringLength = aString.length();
       
    53 	for(unsigned int stringIndex = 0; stringIndex < stringLength; stringIndex++)
       
    54 	{
       
    55 		unsigned char stringChar = aString.at(stringIndex);
       
    56 		//Lower case alphabets ASCII value used here, 97 is for 'a' 122 is for 'z'
       
    57 		if( stringChar >= 97 && stringChar <= 122 )
       
    58 		{
       
    59 			stringChar -= 32; //Lower case alphabets case changed to upper case
       
    60 		}
       
    61 		aString[stringIndex] = stringChar;
       
    62 	}
       
    63 	return aString;
       
    64 }
       
    65 
       
    66 #endif //UTILS_H