cgv
Loading...
Searching...
No Matches
number_format.h
1#pragma once
2
3#include <string>
4
5#include "lib_begin.h"
6
7namespace cgv {
8namespace utils {
9
11class CGV_API number_format {
12public:
13 std::string convert(float value) const;
14
15 void precision_from_range(float first, float last);
16
17 unsigned precision = 0;
18 bool decimal_integers = false;
19 bool fixed = true;
20 bool trailing_zeros = true;
21 int group_size = 3;
22 std::string group_separator = ",";
23 bool grouping = false;
24
25private:
26 // Can only group integer part without sign
27 std::string apply_grouping(const std::string& value) const;
28};
29
30} // namesapce utils
31} // namesapce cgv
32
33#include <cgv/config/lib_end.h>
A class to store number formatting specification and allow converting numbers to strings.
this header is dependency free
Definition print.h:11