53 bool toDouble(
const std::string&
string,
double& value)
63 double value_new = std::strtod(
string.c_str(), &end);
65 if (errno != 0 || end !=
string.c_str() +
string.
length())
79 bool toFloat(
const std::string&
string,
float& value)
88 float value_new = std::strtof(
string.c_str(), &end);
90 if (errno != 0 || end !=
string.c_str() +
string.
length())
104 bool toInt32(
const std::string&
string, int32_t& value, int32_t base)
113 int64_t value_new = std::strtol(
string.c_str(), &end, base);
115 if (errno != 0 || end !=
string.c_str() +
string.
length())
120 if (value_new > std::numeric_limits<int32_t>::max() ||
121 value_new < std::numeric_limits<int32_t>::min())
126 value = (int32_t)value_new;
135 bool toUInt32(
const std::string&
string, uint32_t& value, int32_t base)
144 int64_t value_new = std::strtol(
string.c_str(), &end, base);
146 if (errno != 0 || end !=
string.c_str() +
string.
length())
151 if (value_new > std::numeric_limits<uint32_t>::max() || value_new < 0)
156 value = (uint32_t)value_new;
163 int8_t
toInt8(
const std::string&
string, int8_t& value, int32_t base)
167 int64_t value_new = std::strtol(
string.c_str(), &end, base);
169 value = (int8_t)value_new;
176 uint8_t
toUInt8(
const std::string&
string, uint8_t& value, int32_t base)
180 int64_t value_new = std::strtol(
string.c_str(), &end, base);
182 value = (uint8_t)value_new;
188 num = std::round(num * 1000);
190 std::stringstream ss;
192 ss << std::setprecision(3);
199 for (
size_t i = 0; i < str.size(); ++i)
201 if (std::isspace(str[i]))
bool toFloat(const std::string &string, float &value)
Interprets the contents of "string" as a floating point number of type float.
bool toDouble(const std::string &string, double &value)
Interprets the contents of "string" as a floating point number of type double It stores the "string"'...
uint8_t toUInt8(const std::string &string, uint8_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your...
bool containsSpace(const std::string str)
Checks if a string contains spaces.
bool toUInt32(const std::string &string, uint32_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your...
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
Declares lower-level string utility functions used when parsing messages.
std::string trimDecimalPlaces(double num)
Trims decimal places to two.
int8_t toInt8(const std::string &string, int8_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever integer type your system h...
bool toInt32(const std::string &string, int32_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever integer type your system h...