mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 05:29:18 +02:00
Projekt się buduje, ale ma 3k warningów.
This commit is contained in:
98
Globals.cpp
98
Globals.cpp
@@ -927,103 +927,5 @@ double Global::CutValueToRange(double min, double value, double max)
|
||||
return value;
|
||||
};
|
||||
|
||||
std::string to_string(int _Val)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_string(unsigned int _Val)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_string(double _Val)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_string(int _Val, int precision)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << std::fixed << std::setprecision(precision);
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_string(double _Val, int precision)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << std::fixed << std::setprecision(precision);
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_string(int _Val, int precision, int width)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o.width(width);
|
||||
o << std::fixed << std::setprecision(precision);
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_string(double _Val, int precision, int width)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o.width(width);
|
||||
o << std::fixed << std::setprecision(precision);
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
std::string to_hex_str(double _Val, int precision, int width)
|
||||
{
|
||||
std::ostringstream o;
|
||||
if (width)
|
||||
o.width(width);
|
||||
o << std::fixed << std::hex;
|
||||
if (precision)
|
||||
o << std::setprecision(precision);
|
||||
o << _Val;
|
||||
return o.str();
|
||||
};
|
||||
|
||||
int stol_def(const std::string &str, const int &DefaultValue)
|
||||
{
|
||||
// this function was developed iteratively on Codereview.stackexchange
|
||||
// with the assistance of @Corbin
|
||||
std::size_t len = str.size();
|
||||
while (std::isspace(str[len - 1]))
|
||||
len--;
|
||||
if (len == 0)
|
||||
return DefaultValue;
|
||||
errno = 0;
|
||||
char *s = new char[len + 1];
|
||||
std::strncpy(s, str.c_str(), len);
|
||||
char *p;
|
||||
int result = strtol(s, &p, 0);
|
||||
if ((*p != '\0') || (errno != 0))
|
||||
{
|
||||
return DefaultValue;
|
||||
}
|
||||
delete s;
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string ToLower(std::string text)
|
||||
{
|
||||
std::transform(text.begin(), text.end(), text.begin(), ::tolower);
|
||||
}
|
||||
|
||||
std::string ToUpper(std::string text)
|
||||
{
|
||||
std::transform(text.begin(), text.end(), text.begin(), ::toupper);
|
||||
}
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
Reference in New Issue
Block a user