12 #ifndef ECL_FORMATTERS_STRINGS_HPP_ 13 #define ECL_FORMATTERS_STRINGS_HPP_ 126 template <
typename OutputStream>
friend OutputStream& operator << (OutputStream& ostream, Format<std::string>& formatter);
145 template <
typename OutputStream>
void pad(
int n, OutputStream &ostream)
const;
151 template <
typename OutputStream>
void prePad(
int n, OutputStream &ostream)
const;
157 template <
typename OutputStream>
void postPad(
int n, OutputStream &ostream)
const;
166 template <
typename OutputStream>
void format(OutputStream &ostream)
const;
173 template <
typename OutputStream>
178 prePad(width_ - (size),ostream);
180 postPad(width_ - (size),ostream);
183 template <
typename OutputStream>
186 if ( n <= 0 ) {
return; }
187 switch ( alignment_ )
191 case (
RightAlign ) : { pad(n,ostream);
break; }
192 case (
CentreAlign ) : { pad(n/2+ n%2,ostream);
break; }
196 template <
typename OutputStream>
199 if ( n <= 0 ) {
return; }
200 switch ( alignment_ )
203 case (
LeftAlign ) : { pad(n,ostream);
break; }
205 case (
CentreAlign ) : { pad(n/2,ostream);
break; }
209 template <
typename OutputStream>
212 for (
int i = n; i > 0; --i )
222 template <
typename OutputStream>
223 OutputStream& operator << (OutputStream &ostream, Format<std::string>& formatter )
225 bool ready = formatter.ready_to_format;
228 "either there is no data available, or you have tried to use the " 229 "formatter more than once in a single streaming operation. " 230 "C++ produces unspecified results when functors are used multiply " 231 "in the same stream sequence, so this is not permitted here.") );
234 formatter.format(ostream);
235 formatter.ready_to_format =
false;
Embedded control libraries.
Common formatting definitions.
#define ecl_assert_throw(expression, exception)
Macros for ecl formatters.
#define ecl_formatters_PUBLIC
Alignment
Alignment tags for text formatting.