49 static inline std::string
_2str(
const int var) {
51 std::ostringstream convert;
57 static inline std::string
_2str(
const double var) {
58 std::ostringstream convert;
64 static inline std::string
_2str(
const bool var) {
65 return (var ==
true ?
"true" :
"false");
72 static inline std::string
_2str(
const E*
const data) {
79 static inline std::string
_2str(
const char*
const data) {
83 return std::string(data);
90 static inline std::string
_2str(
const E*
const data,
int length) {
97 char* buf =
new char[length + 1];
99 for (i = 0; i < length; i++) {
100 if ((
int) data[i] > 255) {
103 buf[i] = (char) data[i];
107 std::string ret = buf;
115 static inline std::string
_2str(
const char*
const data,
int length) {
119 return std::string(data, length);
126 static std::string
_2strSec(
const E*
const data,
const std::string& def) {
134 static std::string
_2strSec(
const E*
const data,
int length,
const std::string& def) {
135 if (data == 0 || length == 0) {
138 return _2str(data, length);
149 static int _2int(
const E*
const data) {
150 long long int result =
_2long(data);
151 if (result > std::numeric_limits<int>::max() || result < std::numeric_limits<int>::min()) {
162 return _2int(sData.c_str());
172 if (result > std::numeric_limits<int>::max() || result < std::numeric_limits<int>::min()) {
189 static int _2intSec(
const E*
const data,
int def) {
190 if (data == 0 || data[0] == 0) {
204 static long long int _2long(
const E*
const data) {
205 if (data == 0 || data[0] == 0) {
208 long long int sgn = 1;
210 if (data[0] ==
'+') {
213 if (data[0] ==
'-') {
217 long long int ret = 0;
218 for (; data[i] != 0; i++) {
221 char akt = (char) data[i];
222 if (akt < '0' || akt >
'9') {
237 static long long int _str2long(
const std::string& sData) {
238 return _2long(sData.c_str());
247 if (data == 0 || data[0] == 0) {
250 long long int sgn = 1;
252 if (data[0] ==
'+') {
255 if (data[0] ==
'-') {
259 if (data[i] ==
'#') {
262 if (data[i] ==
'0' && (data[i + 1] ==
'x' || data[i + 1] ==
'X')) {
265 long long int ret = 0;
266 for (; data[i] != 0; i++) {
269 char akt = (char) data[i];
270 if (akt >=
'0' && akt <=
'9') {
272 }
else if (akt >=
'A' && akt <=
'F') {
273 ret += akt -
'A' + 10;
274 }
else if (akt >=
'a' && akt <=
'f') {
275 ret += akt -
'a' + 10;
290 static long long int _2longSec(
const E*
const data,
long def) {
291 if (data == 0 || data[0] == 0) {
306 if (data == 0 || data[0] == 0) {
311 if (data[0] ==
'+') {
314 if (data[0] ==
'-') {
320 int digits = std::numeric_limits<long long int>::digits10;
321 long long int ret = 0;
322 for (; data[i] != 0 && data[i] !=
'e' && data[i] !=
'E'; i++) {
323 char akt = (char) data[i];
324 if (akt < '0' || akt >
'9') {
325 if (pointPos < 0 && (akt ==
'.' || akt ==
',')) {
333 ret = ret * 10 + akt - 48;
336 int exponent = digits >= 0 ? 0 : -digits;
337 if (pointPos != -1) {
338 exponent += pointPos - i + 1;
342 return ret * sgn * (double) pow(10.0, exponent);
346 return ret * sgn * (double) pow(10.0,
_2int(data + i + 1) + exponent);
366 if (data == 0 || data[0] == 0) {
382 static bool _2bool(
const E*
const data) {
383 if (data == 0 || data[0] == 0) {
386 std::string s =
_2str(data);
388 for (
int i = 0; i < (int)s.length(); i++) {
389 s[i] = (char)::tolower((
char)s[i]);
391 if (s ==
"1" || s ==
"yes" || s ==
"true" || s ==
"on" || s ==
"x" || s ==
"t") {
393 }
else if (s ==
"0" || s ==
"no" || s ==
"false" || s ==
"off" || s ==
"-" || s ==
"f") {
405 return _2bool(sData.c_str());
414 if (data == 0 || data[0] == 0) {
428 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