added: macro TTMATH_DONT_USE_WCHAR
if defined then the library does not use wide characters (wchar_t, std::wstring, ...) this is a workaround for some compilers git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@294 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
aeadb8a04a
commit
1b7e13a9fd
|
@ -1,3 +1,9 @@
|
|||
Version 0.9.2 prerelease (2009.03.01):
|
||||
* added: macro TTMATH_DONT_USE_WCHAR
|
||||
if defined then the library does not use wide characters
|
||||
(wchar_t, std::wstring, ...) this is a workaround for some compilers
|
||||
|
||||
|
||||
Version 0.9.1 (2010.02.07):
|
||||
* fixed: the parser didn't use characters for changing the base (# and &)
|
||||
those characters were skipped
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CC = g++
|
||||
CFLAGS = -Wall -pedantic -s -O2 -I..
|
||||
CFLAGS = -Wall -pedantic -s -O2 -I.. -DTTMATH_DONT_USE_WCHAR
|
||||
|
||||
|
||||
.SUFFIXES: .cpp .o
|
||||
|
|
|
@ -3062,7 +3062,7 @@ public:
|
|||
sint scient_from = 15,
|
||||
sint round = -1,
|
||||
bool trim_zeroes = true,
|
||||
wchar_t comma = '.' ) const
|
||||
char comma = '.' ) const
|
||||
{
|
||||
Conv conv;
|
||||
|
||||
|
@ -3077,6 +3077,45 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
*/
|
||||
uint ToString(std::string & result, const Conv & conv) const
|
||||
{
|
||||
return ToStringBase<std::string, char>(result, conv);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
*/
|
||||
std::string ToString(const Conv & conv) const
|
||||
{
|
||||
std::string result;
|
||||
ToStringBase<std::string, char>(result, conv);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
*/
|
||||
std::string ToString() const
|
||||
{
|
||||
Conv conv;
|
||||
|
||||
return ToString(conv);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
|
@ -3102,16 +3141,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
*/
|
||||
uint ToString(std::string & result, const Conv & conv) const
|
||||
{
|
||||
return ToStringBase<std::string, char>(result, conv);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
|
@ -3122,31 +3151,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
*/
|
||||
std::string ToString(const Conv & conv) const
|
||||
{
|
||||
std::string result;
|
||||
ToStringBase<std::string, char>(result, conv);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
*/
|
||||
std::string ToString() const
|
||||
{
|
||||
Conv conv;
|
||||
|
||||
return ToString(conv);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a method for converting into a string
|
||||
struct Conv is defined in ttmathtypes.h, look there for more information about parameters
|
||||
|
@ -3171,6 +3175,9 @@ public:
|
|||
return ToWString(conv);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -4255,18 +4262,20 @@ public:
|
|||
/*!
|
||||
a method for converting a string into its value
|
||||
*/
|
||||
uint FromString(const std::wstring & string, uint base = 10, const wchar_t ** after_source = 0, bool * value_read = 0)
|
||||
uint FromString(const std::string & string, const Conv & conv, const wchar_t ** after_source = 0, bool * value_read = 0)
|
||||
{
|
||||
return FromString(string.c_str(), base, after_source, value_read);
|
||||
return FromString(string.c_str(), conv, after_source, value_read);
|
||||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
a method for converting a string into its value
|
||||
*/
|
||||
uint FromString(const std::string & string, const Conv & conv, const wchar_t ** after_source = 0, bool * value_read = 0)
|
||||
uint FromString(const std::wstring & string, uint base = 10, const wchar_t ** after_source = 0, bool * value_read = 0)
|
||||
{
|
||||
return FromString(string.c_str(), conv, after_source, value_read);
|
||||
return FromString(string.c_str(), base, after_source, value_read);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4278,6 +4287,9 @@ public:
|
|||
return FromString(string.c_str(), conv, after_source, value_read);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
@ -4593,15 +4605,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string into this class
|
||||
*/
|
||||
Big(const wchar_t * string)
|
||||
{
|
||||
FromString( string );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string into this class
|
||||
*/
|
||||
|
@ -4611,15 +4614,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string into this class
|
||||
*/
|
||||
Big(const std::wstring & string)
|
||||
{
|
||||
FromString( string.c_str() );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
an operator= for converting a string into its value
|
||||
*/
|
||||
|
@ -4634,20 +4628,41 @@ public:
|
|||
/*!
|
||||
an operator= for converting a string into its value
|
||||
*/
|
||||
Big<exp, man> & operator=(const wchar_t * string)
|
||||
Big<exp, man> & operator=(const std::string & string)
|
||||
{
|
||||
FromString( string );
|
||||
FromString( string.c_str() );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
a constructor for converting a string into this class
|
||||
*/
|
||||
Big(const wchar_t * string)
|
||||
{
|
||||
FromString( string );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string into this class
|
||||
*/
|
||||
Big(const std::wstring & string)
|
||||
{
|
||||
FromString( string.c_str() );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
an operator= for converting a string into its value
|
||||
*/
|
||||
Big<exp, man> & operator=(const std::string & string)
|
||||
Big<exp, man> & operator=(const wchar_t * string)
|
||||
{
|
||||
FromString( string.c_str() );
|
||||
FromString( string );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -4664,6 +4679,9 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
*
|
||||
|
@ -5126,6 +5144,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
output to standard streams
|
||||
*/
|
||||
|
@ -5134,6 +5154,9 @@ public:
|
|||
return OutputToStream<std::wostream, std::wstring>(s, l);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -5220,6 +5243,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
input from standard streams
|
||||
*/
|
||||
|
@ -5228,6 +5253,8 @@ public:
|
|||
return InputFromStream<std::wistream, std::wstring, wchar_t>(s, l);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* Copyright (c) 2006-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -886,6 +886,17 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string to this class (with the base=10)
|
||||
*/
|
||||
Int(const std::string & s)
|
||||
{
|
||||
FromString( s.c_str() );
|
||||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
a constructor for converting string to this class (with the base=10)
|
||||
*/
|
||||
|
@ -895,15 +906,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string to this class (with the base=10)
|
||||
*/
|
||||
Int(const std::string & s)
|
||||
{
|
||||
FromString( s.c_str() );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string to this class (with the base=10)
|
||||
*/
|
||||
|
@ -912,6 +914,8 @@ public:
|
|||
FromString( s.c_str() );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
a default constructor
|
||||
|
@ -976,15 +980,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts the value to a string with a base equal 'b'
|
||||
*/
|
||||
void ToString(std::wstring & result, uint b = 10) const
|
||||
{
|
||||
return ToStringBase(result, b);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts the value to a string with a base equal 'b'
|
||||
*/
|
||||
|
@ -997,6 +992,17 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
this method converts the value to a string with a base equal 'b'
|
||||
*/
|
||||
void ToString(std::wstring & result, uint b = 10) const
|
||||
{
|
||||
return ToStringBase(result, b);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts the value to a string with a base equal 'b'
|
||||
*/
|
||||
|
@ -1008,6 +1014,9 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1111,16 +1120,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts a string into its value
|
||||
it returns carry=1 if the value will be too big or an incorrect base 'b' is given
|
||||
*/
|
||||
uint FromString(const std::wstring & s, uint b = 10)
|
||||
{
|
||||
return FromString( s.c_str(), b );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
|
@ -1132,6 +1131,19 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
|
||||
/*!
|
||||
this method converts a string into its value
|
||||
it returns carry=1 if the value will be too big or an incorrect base 'b' is given
|
||||
*/
|
||||
uint FromString(const std::wstring & s, uint b = 10)
|
||||
{
|
||||
return FromString( s.c_str(), b );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
|
@ -1143,6 +1155,19 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
Int<value_size> & operator=(const std::wstring & s)
|
||||
{
|
||||
FromString( s.c_str() );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
|
@ -1154,16 +1179,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
Int<value_size> & operator=(const std::wstring & s)
|
||||
{
|
||||
FromString( s.c_str() );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
*
|
||||
|
@ -1472,6 +1487,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
output to standard streams
|
||||
*/
|
||||
|
@ -1480,6 +1497,8 @@ public:
|
|||
return OutputToStream<std::wostream, std::wstring>(s, l);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
@ -1532,6 +1551,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
input from standard streams
|
||||
*/
|
||||
|
@ -1539,6 +1560,8 @@ public:
|
|||
{
|
||||
return InputFromStream<std::wistream, std::wstring, wchar_t>(s, l);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* Copyright (c) 2006-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -75,6 +75,8 @@ static void AssignString(std::string & result, const char * str)
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
result = str
|
||||
*/
|
||||
|
@ -116,6 +118,8 @@ static void AssignString(std::string & result, const std::wstring & str)
|
|||
return AssignString(result, str.c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -134,6 +138,8 @@ static void AddString(std::string & result, const char * str)
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
result += str
|
||||
*/
|
||||
|
@ -143,6 +149,7 @@ static void AddString(std::wstring & result, const char * str)
|
|||
result += *str;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* Copyright (c) 2006-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
if 'can_be_digit' is true that means when the 'c' is a digit this
|
||||
method returns true otherwise it returns false
|
||||
*/
|
||||
static bool CorrectCharacter(wchar_t c, bool can_be_digit)
|
||||
static bool CorrectCharacter(int c, bool can_be_digit)
|
||||
{
|
||||
if( (c>='a' && c<='z') || (c>='A' && c<='Z') )
|
||||
return true;
|
||||
|
@ -148,6 +148,9 @@ public:
|
|||
}
|
||||
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
this method returns true if such an object is defined (name exists)
|
||||
*/
|
||||
|
@ -163,6 +166,8 @@ public:
|
|||
return IsDefined(str_tmp1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method adds one object (variable of function) into the table
|
||||
|
@ -184,6 +189,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
this method adds one object (variable of function) into the table
|
||||
*/
|
||||
|
@ -200,6 +207,8 @@ public:
|
|||
return Add(str_tmp1, str_tmp2, param);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method returns 'true' if the table is empty
|
||||
|
@ -258,6 +267,9 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
|
||||
/*!
|
||||
this method changes the value and the number of parameters for a specific object
|
||||
*/
|
||||
|
@ -274,6 +286,8 @@ public:
|
|||
return EditValue(str_tmp1, str_tmp2, param);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method changes the name of a specific object
|
||||
|
@ -306,6 +320,10 @@ public:
|
|||
}
|
||||
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
|
||||
/*!
|
||||
this method changes the name of a specific object
|
||||
*/
|
||||
|
@ -322,6 +340,8 @@ public:
|
|||
return EditName(str_tmp1, str_tmp2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method deletes an object
|
||||
|
@ -342,6 +362,9 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
|
||||
/*!
|
||||
this method deletes an object
|
||||
*/
|
||||
|
@ -357,7 +380,9 @@ public:
|
|||
return Delete(str_tmp1);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method gets the value of a specific object
|
||||
*/
|
||||
|
@ -380,6 +405,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
this method gets the value of a specific object
|
||||
*/
|
||||
|
@ -397,6 +424,8 @@ public:
|
|||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method gets the value of a specific object
|
||||
|
@ -421,6 +450,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
this method gets the value of a specific object
|
||||
(this version is used for not copying the whole string)
|
||||
|
@ -437,6 +468,8 @@ public:
|
|||
return GetValue(str_tmp1, value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method gets the value and the number of parameters
|
||||
|
@ -463,6 +496,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
this method gets the value and the number of parameters
|
||||
of a specific object
|
||||
|
@ -481,6 +516,8 @@ public:
|
|||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method sets the value and the number of parameters
|
||||
|
@ -508,6 +545,9 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
|
||||
/*!
|
||||
this method sets the value and the number of parameters
|
||||
of a specific object
|
||||
|
@ -527,6 +567,9 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method returns a pointer into the table
|
||||
*/
|
||||
|
|
|
@ -317,8 +317,6 @@ ErrorCode error;
|
|||
|
||||
/*!
|
||||
pointer to the currently reading char
|
||||
it's either char* or wchar_t*
|
||||
|
||||
when an error has occured it may be used to count the index of the wrong character
|
||||
*/
|
||||
const char * pstring;
|
||||
|
@ -1416,7 +1414,7 @@ void Frac(int sindex, int amount_of_args, ValueType & result)
|
|||
*/
|
||||
void Sprintf(char * buffer, int par)
|
||||
{
|
||||
char buf[30]; // char, not wchar_t etc.
|
||||
char buf[30]; // char, not wchar_t
|
||||
int i;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -2708,6 +2706,8 @@ ErrorCode Parse(const std::string & str)
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
the main method using for parsing string
|
||||
*/
|
||||
|
@ -2727,6 +2727,8 @@ ErrorCode Parse(const std::wstring & str)
|
|||
return Parse(str.c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
this method returns true is something was calculated
|
||||
|
|
|
@ -64,8 +64,8 @@
|
|||
*/
|
||||
#define TTMATH_MAJOR_VER 0
|
||||
#define TTMATH_MINOR_VER 9
|
||||
#define TTMATH_REVISION_VER 1
|
||||
#define TTMATH_PRERELEASE_VER 0
|
||||
#define TTMATH_REVISION_VER 2
|
||||
#define TTMATH_PRERELEASE_VER 1
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -371,7 +371,7 @@ namespace ttmath
|
|||
|
||||
/*!
|
||||
used only in Big::ToString()
|
||||
if scient is false then the value will be print in the scientific mode
|
||||
if scient is false then the value will be printed in the scientific mode
|
||||
only if the exponent is greater than scien_from
|
||||
default: 15
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* Copyright (c) 2006-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -2658,6 +2658,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
a constructor for converting a string to this class (with the base=10)
|
||||
*/
|
||||
|
@ -2670,16 +2672,18 @@ public:
|
|||
/*!
|
||||
a constructor for converting a string to this class (with the base=10)
|
||||
*/
|
||||
UInt(const std::string & s)
|
||||
UInt(const std::wstring & s)
|
||||
{
|
||||
FromString( s.c_str() );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
a constructor for converting a string to this class (with the base=10)
|
||||
*/
|
||||
UInt(const std::wstring & s)
|
||||
UInt(const std::string & s)
|
||||
{
|
||||
FromString( s.c_str() );
|
||||
}
|
||||
|
@ -2793,10 +2797,6 @@ public:
|
|||
return ToStringBase(result, b);
|
||||
}
|
||||
|
||||
void ToString(std::wstring & result, uint b = 10) const
|
||||
{
|
||||
return ToStringBase(result, b);
|
||||
}
|
||||
|
||||
std::string ToString(uint b = 10) const
|
||||
{
|
||||
|
@ -2806,6 +2806,14 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
void ToString(std::wstring & result, uint b = 10) const
|
||||
{
|
||||
return ToStringBase(result, b);
|
||||
}
|
||||
|
||||
std::wstring ToWString(uint b = 10) const
|
||||
{
|
||||
std::wstring result;
|
||||
|
@ -2814,6 +2822,9 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -2891,15 +2902,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts a string into its value
|
||||
*/
|
||||
uint FromString(const wchar_t * s, uint b = 10, const wchar_t ** after_source = 0, bool * value_read = 0)
|
||||
{
|
||||
return FromStringBase(s, b, after_source, value_read);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts a string into its value
|
||||
|
||||
|
@ -2911,17 +2913,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts a string into its value
|
||||
|
||||
(it returns carry=1 if the value will be too big or an incorrect base 'b' is given)
|
||||
*/
|
||||
uint FromString(const std::wstring & s, uint b = 10)
|
||||
{
|
||||
return FromString( s.c_str(), b );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
|
@ -2936,20 +2927,43 @@ public:
|
|||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
UInt<value_size> & operator=(const wchar_t * s)
|
||||
UInt<value_size> & operator=(const std::string & s)
|
||||
{
|
||||
FromString(s);
|
||||
FromString( s.c_str() );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
this method converts a string into its value
|
||||
*/
|
||||
uint FromString(const wchar_t * s, uint b = 10, const wchar_t ** after_source = 0, bool * value_read = 0)
|
||||
{
|
||||
return FromStringBase(s, b, after_source, value_read);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method converts a string into its value
|
||||
|
||||
(it returns carry=1 if the value will be too big or an incorrect base 'b' is given)
|
||||
*/
|
||||
uint FromString(const std::wstring & s, uint b = 10)
|
||||
{
|
||||
return FromString( s.c_str(), b );
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this operator converts a string into its value (with base = 10)
|
||||
*/
|
||||
UInt<value_size> & operator=(const std::string & s)
|
||||
UInt<value_size> & operator=(const wchar_t * s)
|
||||
{
|
||||
FromString( s.c_str() );
|
||||
FromString(s);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -2965,6 +2979,8 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
*
|
||||
|
@ -3371,6 +3387,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
output to standard streams
|
||||
*/
|
||||
|
@ -3379,6 +3397,9 @@ public:
|
|||
return OutputToStream<std::wostream, std::wstring>(s, l);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -3424,6 +3445,8 @@ public:
|
|||
}
|
||||
|
||||
|
||||
#ifndef TTMATH_DONT_USE_WCHAR
|
||||
|
||||
/*!
|
||||
input from standard streams
|
||||
*/
|
||||
|
@ -3432,6 +3455,8 @@ public:
|
|||
return InputFromStream<std::wistream, std::wstring, wchar_t>(s, l);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
following methods are defined in:
|
||||
|
|
Loading…
Reference in New Issue