mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
feat(Format): add support for %g and %G format specifiers
This commit is contained in:
parent
02c86d4cdd
commit
42da9b0f1e
@ -62,6 +62,8 @@ std::string Foundation_API format(const std::string& fmt, const Any& value);
|
||||
/// * e signed floating-point value in the form [-]d.dddde[<sign>]dd[d]
|
||||
/// * E signed floating-point value in the form [-]d.ddddE[<sign>]dd[d]
|
||||
/// * f signed floating-point value in the form [-]dddd.dddd
|
||||
/// * g use the shortest representation: %e or %f
|
||||
/// * G use the shortest representation: %E or %F
|
||||
/// * s std::string
|
||||
/// * v std::string_view
|
||||
/// * z std::size_t
|
||||
|
@ -128,6 +128,8 @@ namespace
|
||||
case 'e': str << std::scientific; break;
|
||||
case 'E': str << std::scientific << std::uppercase; break;
|
||||
case 'f': str << std::fixed; break;
|
||||
case 'g': str << std::defaultfloat; break;
|
||||
case 'G': str << std::defaultfloat << std::uppercase; break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,6 +214,8 @@ namespace
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'f':
|
||||
case 'g':
|
||||
case 'G':
|
||||
switch (mod)
|
||||
{
|
||||
case 'l': str << AnyCast<long double>(*itVal++); break;
|
||||
|
Loading…
Reference in New Issue
Block a user