bintools/rcomp/inc/NUMVAL.H
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 1997-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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __NUMVAL_H__
       
    20 #define __NUMVAL_H__
       
    21 
       
    22 #include "DATATYPE.H"
       
    23 
       
    24 class String;
       
    25 class ResourceDataStream;
       
    26 
       
    27 class NumericValue
       
    28 	{
       
    29     friend class String;
       
    30     friend RCBinaryStream& operator<<(RCBinaryStream& os,NumericValue aValue);
       
    31 public:
       
    32 	NumericValue(const String & Source, DataType NumericValueType);
       
    33 	NumericValue(DataType NumericValueType);
       
    34 	NumericValue(unsigned long ValueToSet, DataType NumericValueType);
       
    35 	~NumericValue();
       
    36 	NumericValue(const NumericValue & Source);
       
    37 	const unsigned char* Data() const;
       
    38 	unsigned long Size() const;
       
    39 	DataType NumericValueType() const;
       
    40 	unsigned long GetULong() const;
       
    41 	long GetLong() const;
       
    42 	NumericValue& operator=(unsigned long aValueToSet);
       
    43 	static String ltoa(long aValue);
       
    44 	static bool CheckSigned(unsigned long aValue,DataType NumericValueType);
       
    45 	void StreamOut(ResourceDataStream& aStream) const;
       
    46 private:
       
    47 	void AllocateSpace();
       
    48 	void ConvertToNumber(const String& aSource);
       
    49 	void ConvertToDouble(const String& aSource);
       
    50 	void ConvertToNatural(const String& aSource);
       
    51 	void StoreValue(unsigned long aLongValue);
       
    52 private:	
       
    53 	unsigned long iSize;
       
    54 	DataType iNumericValueType;
       
    55 	unsigned char* iData;
       
    56 	unsigned long iULongValue;
       
    57 	long iSignedValue;
       
    58 	double iDoubleValue;
       
    59 	};
       
    60 
       
    61 #endif