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");
79 static inline std::string
_2str(
const E*
const data) {
86 static inline std::string
_2str(
const char*
const data) {
90 return std::string(data);
97 static inline std::string
_2str(
const E*
const data,
int length) {
104 char* buf =
new char[length + 1];
106 for (i = 0; i < length; i++) {
107 if ((
int) data[i] > 255) {
110 buf[i] = (char) data[i];
114 std::string ret = buf;
122 static inline std::string
_2str(
const char*
const data,
int length) {
126 return std::string(data, length);
133 static std::string
_2strSec(
const E*
const data,
const std::string& def) {
141 static std::string
_2strSec(
const E*
const data,
int length,
const std::string& def) {
142 if (data == 0 || length == 0) {
145 return _2str(data, length);
156 static int _2int(
const E*
const data) {
157 long long int result =
_2long(data);
169 return _2int(sData.c_str());
196 static int _2intSec(
const E*
const data,
int def) {
197 if (data == 0 || data[0] == 0) {
211 static long long int _2long(
const E*
const data) {
212 if (data == 0 || data[0] == 0) {
215 long long int sgn = 1;
217 if (data[0] ==
'+') {
220 if (data[0] ==
'-') {
224 long long int ret = 0;
225 for (; data[i] != 0; i++) {
228 char akt = (char) data[i];
229 if (akt < '0' || akt >
'9') {
244 static long long int _str2long(
const std::string& sData) {
245 return _2long(sData.c_str());
254 if (data == 0 || data[0] == 0) {
257 long long int sgn = 1;
259 if (data[0] ==
'+') {
262 if (data[0] ==
'-') {
266 if (data[i] ==
'#') {
269 if (data[i] ==
'0' && (data[i + 1] ==
'x' || data[i + 1] ==
'X')) {
272 long long int ret = 0;
273 for (; data[i] != 0; i++) {
276 char akt = (char) data[i];
277 if (akt >=
'0' && akt <=
'9') {
279 }
else if (akt >=
'A' && akt <=
'F') {
280 ret += akt -
'A' + 10;
281 }
else if (akt >=
'a' && akt <=
'f') {
282 ret += akt -
'a' + 10;
297 static long long int _2longSec(
const E*
const data,
long def) {
298 if (data == 0 || data[0] == 0) {
313 if (data == 0 || data[0] == 0) {
318 if (data[0] ==
'+') {
321 if (data[0] ==
'-') {
327 int digits = std::numeric_limits<long long int>::digits10;
328 long long int ret = 0;
329 for (; data[i] != 0 && data[i] !=
'e' && data[i] !=
'E'; i++) {
330 char akt = (char) data[i];
331 if (akt < '0' || akt >
'9') {
332 if (pointPos < 0 && (akt ==
'.' || akt ==
',')) {
340 ret = ret * 10 + akt - 48;
343 int exponent = digits >= 0 ? 0 : -digits;
344 if (pointPos != -1) {
345 exponent += pointPos - i + 1;
349 return ret * sgn * (double) pow(10.0, exponent);
353 return ret * sgn * (double) pow(10.0,
_2int(data + i + 1) + exponent);
373 if (data == 0 || data[0] == 0) {
389 static bool _2bool(
const E*
const data) {
390 if (data == 0 || data[0] == 0) {
393 std::string s =
_2str(data);
394 std::transform(s.begin(), s.end(), s.begin(), ::tolower);
395 if (s ==
"1" || s ==
"yes" || s ==
"true" || s ==
"on" || s ==
"x" || s ==
"t") {
397 }
else if (s ==
"0" || s ==
"no" || s ==
"false" || s ==
"off" || s ==
"-" || s ==
"f") {
409 return _2bool(sData.c_str());
418 if (data == 0 || data[0] == 0) {
432 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 char *const data, int length)
converts a char array into std::string considering the given length
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 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