00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef IXLIB_NUMCONV
00011 #define IXLIB_NUMCONV
00012
00013
00014
00015
00016 #include <ixlib_base.hh>
00017 #include <ixlib_string.hh>
00018
00019
00020
00021
00022
00023 #define IXLIB_NUMCHARS "0123456789ABCDEF"
00024
00025
00026
00027
00028
00029 namespace ixion {
00030 std::string float2dec(double value);
00031 std::string float2dec(double value,unsigned int precision);
00032 std::string unsigned2base(unsigned long value,char digits = 0,char radix = 10);
00033 inline std::string unsigned2dec(unsigned long value,char digits = 0)
00034 { return unsigned2base(value,digits,10); }
00035 inline std::string unsigned2hex(unsigned long value,char digits = 0)
00036 { return unsigned2base(value,digits,16); }
00037 inline std::string unsigned2bin(unsigned long value,char digits = 0)
00038 { return unsigned2base(value,digits,2); }
00039 inline std::string unsigned2oct(unsigned long value,char digits = 0)
00040 { return unsigned2base(value,digits,8); }
00041 std::string signed2base(signed long value,char digits = 0,char radix = 10);
00042 inline std::string signed2dec(signed long value,char digits = 0)
00043 { return signed2base(value,digits,10); }
00044 inline std::string signed2hex(signed long value,char digits = 0)
00045 { return signed2base(value,digits,16); }
00046 inline std::string signed2bin(signed long value,char digits = 0)
00047 { return signed2base(value,digits,2); }
00048 inline std::string signed2oct(signed long value,char digits = 0)
00049 { return signed2base(value,digits,8); }
00050
00051 std::string bytes2dec(TSize bytes);
00052
00053 unsigned long evalNumeral(std::string const &numeral,unsigned radix = 10);
00054 double evalFloat(std::string const &numeral);
00055 unsigned long evalUnsigned(std::string const &numeral,unsigned default_base = 10);
00056 signed long evalSigned(std::string const &numeral,unsigned default_base = 10);
00057 }
00058
00059
00060
00061
00062 #endif