common.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_FORMATTERS_COMMON_HPP_
13 #define ECL_FORMATTERS_COMMON_HPP_
14 
15 /*****************************************************************************
16 ** Namespaces
17 *****************************************************************************/
18 
19 namespace ecl {
20 
21 /*****************************************************************************
22 ** Format Tags
23 *****************************************************************************/
29 enum Alignment
30 {
31  NoAlign,
32  LeftAlign,
34  CentreAlign,
35 };
36 
37 /*****************************************************************************
38 ** Default precision widths
39 *****************************************************************************/
40 /*
41  * These must match the default format precisions for each fundamental type.
42  */
51 template <typename Type> struct PrecisionWidth {
52  public:
53  static const int value = 0;
54 };
55 
64 template <>
65 struct PrecisionWidth<float> {
66  public:
67  static const int value = 4;
68 };
69 
78 template <>
79 struct PrecisionWidth<double> {
80  public:
81  static const int value = 4;
82 };
83 
84 /*****************************************************************************
85 * Format Classes
86 *****************************************************************************/
98 template <typename T>
99 class Format : public T::Formatter {};
100 
101 }; // namespace ecl
102 
103 #endif /*ECL_FORMATTERS_COMMON_HPP_*/
ecl::NoAlign
@ NoAlign
No alignment used.
Definition: common.hpp:41
ecl::PrecisionWidth
Precision width trait for fundamental types.
Definition: common.hpp:55
ecl::RightAlign
@ RightAlign
Align to the right.
Definition: common.hpp:43
ecl::CentreAlign
@ CentreAlign
Align in the centre.
Definition: common.hpp:44
ecl::LeftAlign
@ LeftAlign
Align to the left.
Definition: common.hpp:42
ecl::Format
Primary template for all formatter classes.
Definition: common.hpp:103
ecl::PrecisionWidth::value
static const int value
Definition: common.hpp:59
ecl::Alignment
Alignment
Alignment tags for text formatting.
Definition: common.hpp:33
ecl
Embedded control libraries.


ecl_formatters
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:27