Documentation of CSL
floatFormatter.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #ifndef FLOATFORMATTER_H_INCLUDED
24 #define FLOATFORMATTER_H_INCLUDED
25 
26 #include <iostream>
27 #include <optional>
28 #include <string>
29 #include <map>
30 
31 namespace csl {
32 
33 class format {
34 
35  public:
36 
37  format() {}
38 
39  format(std::string t_format);
40 
41  bool isScientific() const;
42 
43  int getMaxDigits() const;
44 
45  private:
46 
47  bool scientific = true;
48 
49  int maxDigits = 15;
50 };
51 
52 class Formatter {
53 
54  public:
55 
56  Formatter() = delete;
57 
58  static format getFormat();
59 
60  static void setFormat(format const& t_f);
61 
62  private:
63 
64  static std::optional<format> f;
65 };
66 
67 }
68 
69 #endif
Namespace for csl library.
Definition: abreviation.h:34
Definition: floatFormatter.h:33
Definition: floatFormatter.h:52