55 static inline std::string
_2str(
const int var) {
57 std::ostringstream convert;
63 static inline std::string
_2str(
const double var) {
64 std::ostringstream convert;
70 static inline std::string
_2str(
const bool var) {
71 return (var ==
true ?
"true" :
"false");
78 static inline std::string
_2str(
const E*
const data) {
85 static inline std::string
_2str(
const char*
const data) {
89 return std::string(data);
96 static inline std::string
_2str(
const E*
const data,
int length) {
103 char* buf =
new char[length + 1];
105 for (i = 0; i < length; i++) {
106 if ((
int) data[i] > 255) {
109 buf[i] = (char) data[i];
113 std::string ret = buf;
121 static inline std::string
_2str(
const char*
const data,
int length) {
125 return std::string(data, length);
132 static std::string
_2strSec(
const E*
const data,
const std::string& def) {
140 static std::string
_2strSec(
const E*
const data,
int length,
const std::string& def) {
141 if (data == 0 || length == 0) {
144 return _2str(data, length);
155 static int _2int(
const E*
const data) {
156 long long int result =
_2long(data);
157 if (result > std::numeric_limits<int>::max() || result < std::numeric_limits<int>::min()) {
168 return _2int(sData.c_str());
178 if (result > std::numeric_limits<int>::max() || result < std::numeric_limits<int>::min()) {
195 static int _2intSec(
const E*
const data,
int def) {
196 if (data == 0 || data[0] == 0) {
210 static long long int _2long(
const E*
const data) {
211 if (data == 0 || data[0] == 0) {
214 long long int sgn = 1;
216 if (data[0] ==
'+') {
219 if (data[0] ==
'-') {
223 long long int ret = 0;
224 for (; data[i] != 0; i++) {
227 char akt = (char) data[i];
228 if (akt < '0' || akt >
'9') {
243 static long long int _str2long(
const std::string& sData) {
244 return _2long(sData.c_str());
253 if (data == 0 || data[0] == 0) {
256 long long int sgn = 1;
258 if (data[0] ==
'+') {
261 if (data[0] ==
'-') {
265 if (data[i] ==
'#') {
268 if (data[i] ==
'0' && (data[i + 1] ==
'x' || data[i + 1] ==
'X')) {
271 long long int ret = 0;
272 for (; data[i] != 0; i++) {
275 char akt = (char) data[i];
276 if (akt >=
'0' && akt <=
'9') {
278 }
else if (akt >=
'A' && akt <=
'F') {
279 ret += akt -
'A' + 10;
280 }
else if (akt >=
'a' && akt <=
'f') {
281 ret += akt -
'a' + 10;
296 static long long int _2longSec(
const E*
const data,
long def) {
297 if (data == 0 || data[0] == 0) {
312 if (data == 0 || data[0] == 0) {
317 if (data[0] ==
'+') {
320 if (data[0] ==
'-') {
326 int digits = std::numeric_limits<long long int>::digits10;
327 long long int ret = 0;
328 for (; data[i] != 0 && data[i] !=
'e' && data[i] !=
'E'; i++) {
329 char akt = (char) data[i];
330 if (akt < '0' || akt >
'9') {
331 if (pointPos < 0 && (akt ==
'.' || akt ==
',')) {
339 ret = ret * 10 + akt - 48;
342 int exponent = digits >= 0 ? 0 : -digits;
343 if (pointPos != -1) {
344 exponent += pointPos - i + 1;
348 return ret * sgn * (double) pow(10.0, exponent);
352 return ret * sgn * (double) pow(10.0,
_2int(data + i + 1) + exponent);
372 if (data == 0 || data[0] == 0) {
388 static bool _2bool(
const E*
const data) {
389 if (data == 0 || data[0] == 0) {
392 std::string s =
_2str(data);
394 for (
int i = 0; i < (int)s.length(); i++) {
395 s[i] = (char)::tolower((
char)s[i]);
397 if (s ==
"1" || s ==
"yes" || s ==
"true" || s ==
"on" || s ==
"x" || s ==
"t") {
399 }
else if (s ==
"0" || s ==
"no" || s ==
"false" || s ==
"off" || s ==
"-" || s ==
"f") {
411 return _2bool(sData.c_str());
420 if (data == 0 || data[0] == 0) {
434 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