56 static inline std::string
_2str(
const int var) {
58 std::ostringstream convert;
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') {
234 if (data == 0 || data[0] == 0) {
237 long long int sgn = 1;
239 if (data[0] ==
'+') {
242 if (data[0] ==
'-') {
246 if (data[i] ==
'#') {
249 if (data[i] ==
'0' && (data[i + 1] ==
'x' || data[i + 1] ==
'X')) {
252 long long int ret = 0;
253 for (; data[i] != 0; i++) {
256 char akt = (char) data[i];
257 if (akt >=
'0' && akt <=
'9') {
259 }
else if (akt >=
'A' && akt <=
'F') {
260 ret += akt -
'A' + 10;
261 }
else if (akt >=
'a' && akt <=
'f') {
262 ret += akt -
'a' + 10;
276 static long long int _2longSec(
const E*
const data,
long def) {
277 if (data == 0 || data[0] == 0) {
291 if (data == 0 || data[0] == 0) {
296 if (data[0] ==
'+') {
299 if (data[0] ==
'-') {
305 int digits = std::numeric_limits<long long int>::digits10;
306 long long int ret = 0;
307 for (; data[i] != 0 && data[i] !=
'e' && data[i] !=
'E'; i++) {
308 char akt = (char) data[i];
309 if (akt < '0' || akt >
'9') {
310 if (pointPos < 0 && (akt ==
'.' || akt ==
',')) {
318 ret = ret * 10 + akt - 48;
321 int exponent = digits >= 0 ? 0 : -digits;
322 if (pointPos != -1) {
323 exponent += pointPos - i + 1;
327 return ret * sgn * (
SUMOReal) pow(10.0, exponent);
331 return ret * sgn * (
SUMOReal) pow(10.0,
_2int(data + i + 1) + exponent);
349 if (data == 0 || data[0] == 0) {
364 static bool _2bool(
const E*
const data) {
365 if (data == 0 || data[0] == 0) {
368 std::string s =
_2str(data);
369 std::transform(s.begin(), s.end(), s.begin(), ::tolower);
370 if (s ==
"1" || s ==
"yes" || s ==
"true" || s ==
"on" || s ==
"x" || s ==
"t") {
372 }
else if (s ==
"0" || s ==
"no" || s ==
"false" || s ==
"off" || s ==
"-" || s ==
"f") {
383 return _2bool(sData.c_str());
392 if (data == 0 || data[0] == 0) {
406 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 SUMOReal _str2SUMOReal(const std::string &sData)
converts a string into the SUMOReal value described by it by calling the char-type converter ...
static std::string _2str(const bool var)
convert bool to string
*static bool _2boolSec(const E *const data, bool def)
converts a 0-terminated char-type array into the SUMOReal value described by it
static SUMOReal _2SUMOReal(const E *const data)
converts a char-type array into the SUMOReal 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 SUMOReal _2SUMORealSec(const E *const data, SUMOReal def)
converts a 0-terminated char-type array into the SUMOReal 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 std::string _2str(const E *const data, int length)
converts a char-type array into std::string considering the given length
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 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 SUMOReal var)
convert SUMOReal to string
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