imgtools/imgcheck/src/common.cpp
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2008-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 * Generally used functions written here
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23  @released
       
    24 */
       
    25 
       
    26 #include "common.h"
       
    27 #include <sstream>
       
    28 
       
    29 /** 
       
    30 Function to convert Integer to string
       
    31 
       
    32 @internalComponent
       
    33 @released
       
    34 
       
    35 @param aValue - The value needs to be converted
       
    36 
       
    37 @return - return the converted string
       
    38 */
       
    39 String Common::IntToString(unsigned int aValue)
       
    40 {
       
    41     OStringStream outStrStream;
       
    42     outStrStream << aValue;
       
    43     return outStrStream.str();
       
    44 }
       
    45 
       
    46 /** 
       
    47 Function to convert string to integer
       
    48 
       
    49 @internalComponent
       
    50 @released
       
    51 
       
    52 @param aValue - The string needs to be converted
       
    53 
       
    54 @return - return the converted value
       
    55 */
       
    56 unsigned int Common::StringToInt(String& aStringVal)
       
    57 {
       
    58     std::istringstream iss(aStringVal);
       
    59     unsigned int intVal;
       
    60     iss >> std::dec >> intVal;
       
    61     return intVal;
       
    62 }