Read a value from the string, which must be trimmed to the value (ie, no leading/trailing whitespace).
More...
|
| bool | c4::from_chars (csubstr buf, uint8_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, uint16_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, uint32_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, uint64_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, int8_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, int16_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, int32_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, int64_t *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, float *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, double *v) noexcept |
| |
| template<class T > |
| auto | c4::from_chars (csubstr buf, T *v) noexcept -> bool ::type |
| |
| template<class T > |
| bool | c4::from_chars (csubstr buf, T **v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, bool *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, char *v) noexcept |
| | extract a single character from a substring More...
|
| |
| bool | c4::from_chars (csubstr buf, csubstr *v) noexcept |
| |
| bool | c4::from_chars (csubstr buf, substr *v) noexcept |
| |
| template<class T > |
| bool | c4::from_chars (csubstr s, fmt::overflow_checked_< T > wrapper) |
| | read an integer type, detecting overflow (returns false on overflow) More...
|
| |
| template<class T > |
| bool | c4::from_chars (csubstr s, fmt::overflow_checked_< T > *wrapper) |
| | read an integer type, detecting overflow (returns false on overflow) More...
|
| |
| bool | c4::from_chars (csubstr buf, fmt::raw_wrapper *r) |
| | read a variable in raw binary format, using memcpy More...
|
| |
| bool | c4::from_chars (csubstr buf, fmt::raw_wrapper r) |
| | read a variable in raw binary format, using memcpy More...
|
| |
| size_t | c4::from_chars (csubstr buf, fmt::base64_wrapper *b) |
| | read a variable in base64 format More...
|
| |
| size_t | c4::from_chars (csubstr buf, fmt::base64_wrapper const &b) |
| | read a variable in base64 format More...
|
| |
Read a value from the string, which must be trimmed to the value (ie, no leading/trailing whitespace).
return true if the conversion succeeded. There is no check for overflow; the value wraps around in a way similar to the standard C/C++ overflow behavior. For example, from_chars<int8_t>("128", &val) returns true and val will be set tot 0. See overflows: does a number string overflow a type and Check read for overflow for facilities enforcing no-overflow.
Dispatches to the most appropriate and efficient conversion function
- See also
- from_chars_first: generalized chars to value, atou, atoi, atof, atod
◆ from_chars() [1/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
uint8_t * |
v |
|
) |
| |
|
inlinenoexcept |
Definition at line 2366 of file charconv.hpp.
2366 {
return atou(buf, v); }
bool atou(csubstr str, T *v) noexcept
Convert a trimmed string to an unsigned integral value.
References c4::atou().
◆ from_chars() [2/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
uint16_t * |
v |
|
) |
| |
|
inlinenoexcept |
◆ from_chars() [3/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
uint32_t * |
v |
|
) |
| |
|
inlinenoexcept |
◆ from_chars() [4/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
uint64_t * |
v |
|
) |
| |
|
inlinenoexcept |
◆ from_chars() [5/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
int8_t * |
v |
|
) |
| |
|
inlinenoexcept |
Definition at line 2370 of file charconv.hpp.
2370 {
return atoi(buf, v); }
bool atoi(csubstr str, T *v) noexcept
Convert a trimmed string to a signed integral value.
References c4::atoi().
◆ from_chars() [6/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
int16_t * |
v |
|
) |
| |
|
inlinenoexcept |
◆ from_chars() [7/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
int32_t * |
v |
|
) |
| |
|
inlinenoexcept |
◆ from_chars() [8/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
int64_t * |
v |
|
) |
| |
|
inlinenoexcept |
◆ from_chars() [9/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
float * |
v |
|
) |
| |
|
inlinenoexcept |
Definition at line 2374 of file charconv.hpp.
2374 {
return atof(buf, v); }
bool atof(csubstr str, float *v) noexcept
Convert a string to a single precision real number.
References c4::atof().
◆ from_chars() [10/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
double * |
v |
|
) |
| |
|
inlinenoexcept |
Definition at line 2375 of file charconv.hpp.
2375 {
return atod(buf, v); }
bool atod(csubstr str, double *v) noexcept
Convert a string to a double precision real number.
References c4::atod().
◆ from_chars() [11/22]
template<class T >
| auto c4::from_chars |
( |
csubstr |
buf, |
|
|
T * |
v |
|
) |
| -> bool ::type |
|
inlinenoexcept |
◆ from_chars() [12/22]
template<class T >
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
T ** |
v |
|
) |
| |
|
inlinenoexcept |
Definition at line 2380 of file charconv.hpp.
2380 { intptr_t tmp;
bool ret =
from_chars(buf, &tmp);
if(ret) { *v = (T*)tmp; }
return ret; }
bool from_chars(csubstr buf, substr *v) noexcept
References c4::from_chars().
◆ from_chars() [13/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
bool * |
v |
|
) |
| |
|
inlinenoexcept |
Definition at line 2449 of file charconv.hpp.
2453 *v =
false;
return true;
2457 *v =
true;
return true;
2459 else if(buf ==
"false")
2461 *v =
false;
return true;
2463 else if(buf ==
"true")
2465 *v =
true;
return true;
2467 else if(buf ==
"False")
2469 *v =
false;
return true;
2471 else if(buf ==
"True")
2473 *v =
true;
return true;
2475 else if(buf ==
"FALSE")
2477 *v =
false;
return true;
2479 else if(buf ==
"TRUE")
2481 *v =
true;
return true;
References c4::from_chars().
◆ from_chars() [14/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
char * |
v |
|
) |
| |
|
inlinenoexcept |
extract a single character from a substring
- Note
- to extract a string instead and not just a single character, use the csubstr overload
Definition at line 2521 of file charconv.hpp.
2525 C4_XASSERT(buf.str);
◆ from_chars() [15/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
csubstr * |
v |
|
) |
| |
|
inlinenoexcept |
◆ from_chars() [16/22]
| bool c4::from_chars |
( |
csubstr |
buf, |
|
|
substr * |
v |
|
) |
| |
|
inlinenoexcept |
Definition at line 2599 of file charconv.hpp.
2601 C4_ASSERT(!buf.overlaps(*v));
2603 if(v->len >= buf.len)
2610 C4_ASSERT(buf.str !=
nullptr);
2611 C4_ASSERT(v->str !=
nullptr);
2612 memcpy(v->str, buf.str, buf.len);
◆ from_chars() [17/22]
◆ from_chars() [18/22]
◆ from_chars() [19/22]
read a variable in raw binary format, using memcpy
◆ from_chars() [20/22]
read a variable in raw binary format, using memcpy
Definition at line 473 of file format.hpp.
bool from_chars(csubstr buf, fmt::raw_wrapper r)
read a variable in raw binary format, using memcpy
References c4::from_chars().
◆ from_chars() [21/22]
◆ from_chars() [22/22]