17 #include "../../include/ecl/formatters/common.hpp" 18 #include "../../include/ecl/formatters/floats.hpp" 19 #include "../../include/ecl/formatters/number.hpp" 20 #include "../../include/ecl/formatters/strings.hpp" 45 std::cout << std::endl;
46 std::cout <<
"***********************************************************" << std::endl;
47 std::cout <<
" Temporary Formatting [Number]" << std::endl;
48 std::cout <<
"***********************************************************" << std::endl;
49 std::cout << std::endl;
51 std::cout <<
"NoAlign : " << format(c,8,
NoAlign,
Hex) << std::endl;
52 std::cout <<
"LeftAlign : " << format(c,8,
LeftAlign,
Hex) << std::endl;
53 std::cout <<
"CentreAlign: " << format(c,8,
CentreAlign,
Hex) << std::endl;
54 std::cout <<
"RightAlign : " << format(c,8,
RightAlign,
Hex) << std::endl;
56 std::cout << std::endl;
57 std::cout <<
"***********************************************************" << std::endl;
58 std::cout <<
" Temporary Formatting [Number]" << std::endl;
59 std::cout <<
"***********************************************************" << std::endl;
60 std::cout << std::endl;
62 std::cout <<
"NoAlign : " << format(c,8,
NoAlign,
Hex) << std::endl;
63 std::cout <<
"LeftAlign : " << format(c,8,
LeftAlign,
Hex) << std::endl;
64 std::cout <<
"CentreAlign: " << format(c,8,
CentreAlign,
Hex) << std::endl;
65 std::cout <<
"RightAlign : " << format(c,8,
RightAlign,
Hex) << std::endl;
67 std::cout << std::endl;
68 std::cout <<
"***********************************************************" << std::endl;
69 std::cout <<
" Permanent Formatting [Number]" << std::endl;
70 std::cout <<
"***********************************************************" << std::endl;
71 std::cout << std::endl;
73 std::cout <<
"NoAlign : " << format(8,
NoAlign,
Hex)(c) << std::endl;
74 std::cout <<
"LeftAlign : " << format(8,
LeftAlign,
Hex)(c) << std::endl;
75 std::cout <<
"CentreAlign: " << format(8,
CentreAlign,
Hex)(c) << std::endl;
76 std::cout <<
"RightAlign : " << format(8,
RightAlign,
Hex)(c) << std::endl;
78 std::cout << std::endl;
79 std::cout <<
"***********************************************************" << std::endl;
80 std::cout <<
" Single Parameter Formatting [Number]" << std::endl;
81 std::cout <<
"***********************************************************" << std::endl;
82 std::cout << std::endl;
84 std::cout <<
"Width : " << format.width(14)(c) << std::endl;
85 std::cout <<
"Align : " << format.align(
CentreAlign)(c) << std::endl;
86 std::cout <<
"Base : " << format.base(
Dec)(c) << std::endl;
88 std::cout << std::endl;
89 std::cout <<
"***********************************************************" << std::endl;
90 std::cout <<
" Integral Types" << std::endl;
91 std::cout <<
"***********************************************************" << std::endl;
92 std::cout << std::endl;
102 std::cout << std::endl;
103 std::cout <<
"***********************************************************" << std::endl;
104 std::cout <<
" String Formats" << std::endl;
105 std::cout <<
"***********************************************************" << std::endl;
106 std::cout << std::endl;
109 std::cout <<
"Strings: " << sformat(
string(
"Dude")) << std::endl;
110 std::cout <<
"Strings: " << sformat(
string(
"Dudette")) << std::endl;
111 std::cout <<
"Strings: " << sformat(
string(
"Dudonimous")) << std::endl;
112 std::cout <<
"CString: " << sformat(
"Dude") << std::endl;
113 std::cout <<
"TmpFrmt: " << sformat(
"Dude",10,
CentreAlign) << std::endl;
114 std::cout <<
"PrmFrmt: " << sformat(10,
CentreAlign)(
"Dude") << std::endl;
116 std::cout << std::endl;
117 std::cout <<
"***********************************************************" << std::endl;
118 std::cout <<
" Float Formats" << std::endl;
119 std::cout <<
"***********************************************************" << std::endl;
120 std::cout << std::endl;
123 float f = -12235.135;
126 fformat.precision(3);
129 fformat.align(RightAlign);
130 fformat(2,15,RightAlign,
Fixed);
133 std::cout <<
"TmpFrmt: " << fformat(f,2,15) << std::endl;
134 std::cout <<
"Format : " << fformat(f) << std::endl;
136 std::cout << std::endl;
137 std::cout <<
"***********************************************************" << std::endl;
138 std::cout <<
" Double Formats" << std::endl;
139 std::cout <<
"***********************************************************" << std::endl;
140 std::cout << std::endl;
146 dformat.precision(3);
149 dformat.align(RightAlign);
150 dformat(2,15,RightAlign,
Fixed);
153 std::cout <<
"TmpFrmt: " << dformat(d,3,15) << std::endl;
154 std::cout <<
"Format : " << dformat(d) << std::endl;
156 std::cout << std::endl;
157 std::cout <<
"***********************************************************" << std::endl;
158 std::cout <<
" Passed" << std::endl;
159 std::cout <<
"***********************************************************" << std::endl;
160 std::cout << std::endl;
Hex representation for integral types.
Fixed formatting for floats (i.e. normal decimal representation).
void f(int i) ecl_debug_throw_decl(StandardException)
Decimal (i.e. normal) representation for integral types.