56 static inline std::string
_2str(
const int var) {
58 std::ostringstream convert;
64 static inline std::string
_2str(
const double var) {
65 std::ostringstream convert;
71 static inline std::string
_2str(
const bool var) {
72 return (var ==
true ?
"true" :
"false");
78 static inline std::string
_2str(
const E*
const data) {
84 static inline std::string
_2str(
const char*
const data) {
88 return std::string(data);
94 static inline std::string
_2str(
const E*
const data,
int length) {
101 char* buf =
new char[length + 1];
103 for (i = 0; i < length; i++) {
104 if ((
int) data[i] > 255) {
107 buf[i] = (char) data[i];
111 std::string ret = buf;
118 static inline std::string
_2str(
const char*
const data,
int length) {
122 return std::string(data, length);
128 static std::string
_2strSec(
const E*
const data,
const std::string& def) {
135 static std::string
_2strSec(
const E*
const data,
int length,
const std::string& def) {
136 if (data == 0 || length == 0) {
139 return _2str(data, length);
149 static int _2int(
const E*
const data) {
150 long long int result =
_2long(data);
161 return _2int(sData.c_str());
186 static int _2intSec(
const E*
const data,
int def) {
187 if (data == 0 || data[0] == 0) {
200 static long long int _2long(
const E*
const data) {
201 if (data == 0 || data[0] == 0) {
204 long long int sgn = 1;
206 if (data[0] ==
'+') {
209 if (data[0] ==
'-') {
213 long long int ret = 0;
214 for (; data[i] != 0; i++) {
217 char akt = (char) data[i];
218 if (akt < '0' || akt >
'9') {
232 static long long int _str2long(
const std::string& sData) {
233 return _2long(sData.c_str());
241 if (data == 0 || data[0] == 0) {
244 long long int sgn = 1;
246 if (data[0] ==
'+') {
249 if (data[0] ==
'-') {
253 if (data[i] ==
'#') {
256 if (data[i] ==
'0' && (data[i + 1] ==
'x' || data[i + 1] ==
'X')) {
259 long long int ret = 0;
260 for (; data[i] != 0; i++) {
263 char akt = (char) data[i];
264 if (akt >=
'0' && akt <=
'9') {
266 }
else if (akt >=
'A' && akt <=
'F') {
267 ret += akt -
'A' + 10;
268 }
else if (akt >=
'a' && akt <=
'f') {
269 ret += akt -
'a' + 10;
283 static long long int _2longSec(
const E*
const data,
long def) {
284 if (data == 0 || data[0] == 0) {
298 if (data == 0 || data[0] == 0) {
303 if (data[0] ==
'+') {
306 if (data[0] ==
'-') {
312 int digits = std::numeric_limits<long long int>::digits10;
313 long long int ret = 0;
314 for (; data[i] != 0 && data[i] !=
'e' && data[i] !=
'E'; i++) {
315 char akt = (char) data[i];
316 if (akt < '0' || akt >
'9') {
317 if (pointPos < 0 && (akt ==
'.' || akt ==
',')) {
325 ret = ret * 10 + akt - 48;
328 int exponent = digits >= 0 ? 0 : -digits;
329 if (pointPos != -1) {
330 exponent += pointPos - i + 1;
334 return ret * sgn * (double) pow(10.0, exponent);
338 return ret * sgn * (double) pow(10.0,
_2int(data + i + 1) + exponent);
356 if (data == 0 || data[0] == 0) {
371 static bool _2bool(
const E*
const data) {
372 if (data == 0 || data[0] == 0) {
375 std::string s =
_2str(data);
376 std::transform(s.begin(), s.end(), s.begin(), ::tolower);
377 if (s ==
"1" || s ==
"yes" || s ==
"true" || s ==
"on" || s ==
"x" || s ==
"t") {
379 }
else if (s ==
"0" || s ==
"no" || s ==
"false" || s ==
"off" || s ==
"-" || s ==
"f") {
390 return _2bool(sData.c_str());
399 if (data == 0 || data[0] == 0) {
413 while (data[i] != 0) {
static bool _str2Bool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter ...
static int _hex2int(const E *const data)
converts a char-type array with a hex value into the integer value described by it ...
static std::string _2str(const bool var)
convert bool to string
static double _2doubleSec(const E *const data, double def)
converts a 0-terminated char-type array into the double value described by it
*static bool _2boolSec(const E *const data, bool def)
converts a 0-terminated char-type array into the double value described by it
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
static long long int _2longSec(const E *const data, long def)
converts a 0-terminated char-type array into the long value described by it
static int getLength(const E *const data)
returns the length of the string (the position of the 0-character)
static long long int _hex2long(const E *const data)
converts a char-type array with a hex value into the long value described by it
static std::string _2str(const char *const data)
converts a 0-terminated char array into std::string
static long long int _2long(const E *const data)
converts a char-type array into the long value described by it
static long long int _str2long(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter, which
static std::string _2str(const E *const data, int length)
converts a char-type array into std::string considering the given length
static double _str2double(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
static std::string _2str(const double var)
convert double to string
static std::string _2str(const E *const data)
converts a 0-terminated char-type array into std::string
static int _str2int(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
static double _2double(const E *const data)
converts a char-type array into the double value described by it
*static std::string _2str(const char *const data, int length)
converts a char array into std::string considering the given length
static int _strHex2int(const std::string &sData)
converts a string with a hex value into the integer value described by it by calling the char-type co...
static int _2intSec(const E *const data, int def)
converts a 0-terminated char-type array into the integer value described by it
static std::string _2str(const int var)
convert int to string
static std::string _2strSec(const E *const data, const std::string &def)
converts a 0-terminated char-type array into std::string
static std::string _2strSec(const E *const data, int length, const std::string &def)
converts a char-type array into std::string considering the given length