summaryrefslogtreecommitdiff
path: root/library/globalFunctions.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 16:48:05 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 16:48:05 +0200
commite7ceb20f1d6497f28054dc111260be8ba8d8b5aa (patch)
tree0d21c616743626435afd9e14922a27c45ceba772 /library/globalFunctions.cpp
parent1.4 (diff)
downloadFreeFileSync-e7ceb20f1d6497f28054dc111260be8ba8d8b5aa.tar.gz
FreeFileSync-e7ceb20f1d6497f28054dc111260be8ba8d8b5aa.tar.bz2
FreeFileSync-e7ceb20f1d6497f28054dc111260be8ba8d8b5aa.zip
1.5
Diffstat (limited to 'library/globalFunctions.cpp')
-rw-r--r--library/globalFunctions.cpp33
1 files changed, 10 insertions, 23 deletions
diff --git a/library/globalFunctions.cpp b/library/globalFunctions.cpp
index d0aad7a4..db7211ef 100644
--- a/library/globalFunctions.cpp
+++ b/library/globalFunctions.cpp
@@ -7,29 +7,6 @@ int globalFunctions::round(const double d)
return static_cast<int>(d<0?d-.5:d+.5);
}
-inline
-int globalFunctions::abs(const int d)
-{
- return(d<0?-d:d);
-}
-
-inline
-unsigned int globalFunctions::abs(const unsigned int d)
-{
- return(d<0?-d:d);
-}
-
-inline
-float globalFunctions::abs(const float d)
-{
- return(d<0?-d:d);
-};
-
-inline
-double globalFunctions::abs(const double d)
-{
- return(d<0?-d:d);
-}
string globalFunctions::numberToString(const unsigned int number)
{
@@ -38,6 +15,7 @@ string globalFunctions::numberToString(const unsigned int number)
return string(result);
}
+
string globalFunctions::numberToString(const int number)
{
char result[100];
@@ -45,6 +23,7 @@ string globalFunctions::numberToString(const int number)
return string(result);
}
+
string globalFunctions::numberToString(const float number)
{
char result[100];
@@ -52,33 +31,39 @@ string globalFunctions::numberToString(const float number)
return string(result);
}
+
wxString globalFunctions::numberToWxString(const unsigned int number)
{
return wxString::Format(wxT("%u"), number);
}
+
wxString globalFunctions::numberToWxString(const int number)
{
return wxString::Format(wxT("%i"), number);
}
+
wxString globalFunctions::numberToWxString(const float number)
{
return wxString::Format(wxT("%f"), number);
}
+
inline
int globalFunctions::stringToInt(const string& number)
{
return atoi(number.c_str());
}
+
inline
double globalFunctions::stringToDouble(const string& number)
{
return atof(number.c_str());
}
+
inline
int globalFunctions::wxStringToInt(const wxString& number)
{
@@ -89,6 +74,7 @@ int globalFunctions::wxStringToInt(const wxString& number)
throw std::runtime_error("Error when converting number to long");
}
+
inline
double globalFunctions::wxStringToDouble(const wxString& number)
{
@@ -99,6 +85,7 @@ double globalFunctions::wxStringToDouble(const wxString& number)
throw std::runtime_error("Error when converting number to double");
}
+
wxString& globalFunctions::includeNumberSeparator(wxString& number)
{
for (int i = number.size() - 3; i > 0; i-= 3)
bgstack15