userver: userver/decimal64/format_options.hpp Source File
Loading...
Searching...
No Matches
format_options.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/decimal64/format_options.hpp
4/// @brief Structure storing format options for decimal
5/// @ingroup userver_universal
6
7#include <optional>
8#include <string>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace decimal64 {
13
14/// @brief Parameters for flexible decimal formatting
16 /// separator of fractional and integer parts
17 std::string decimal_point = ".";
18
19 /// separator of groups in the integer part
20 std::string thousands_sep;
21
22 /// rule of grouping in the integer part
23 /// https://en.cppreference.com/w/cpp/locale/numpunct/grouping
24 std::string grouping;
25
26 /// for negative numbers, the specified string will be inserted at beginning
27 std::string negative_sign = "-";
28
29 /// for non-negative(>=0) numbers will be inserted at beginning
30 std::string positive_sign;
31
32 /// maximum number of digits in the fractional part
33 /// if `nullopt`, then the value is taken from the template argument
34 std::optional<int> precision;
35
36 /// if true, then the fractional part will have the maximum number of digits
37 bool is_fixed = false;
38};
39
40} // namespace decimal64
41
42USERVER_NAMESPACE_END