summaryrefslogtreecommitdiff
path: root/library/globalFunctions.cpp
diff options
context:
space:
mode:
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