55 template <
typename ... T>
64 template <
typename ... TT>
65 void write(std::ostream & ostr,
const TT &... args)
const{
67 append(ostr, args...);
73 void startWrite(std::ostream & )
const {
77 void endWrite(std::ostream & ostr)
const {
81 template <
typename ... TT>
82 void append(std::ostream & ostr,
const TT &... args)
const{
87 typedef std::map<drain::TextStyle::Colour,int> color_codemap_t;
88 typedef std::map<drain::TextStyle::Style,int> style_codemap_t;
89 typedef std::map<drain::TextStyle::Line,int> line_codemap_t;
92 const color_codemap_t color_codemap;
95 const style_codemap_t style_codemap;
98 const line_codemap_t line_codemap;
102 const std::map<T,int> & getCodeMap();
110 typedef std::map<E,int> codemap_t;
112 const codemap_t & map = getCodeMap<E>();
114 typename codemap_t::const_iterator it = map.find(enumCode);
115 if (it != map.end()){
120 for (
const auto & entry: map){
121 std::cerr << entry.first <<
'=' << (int)entry.first <<
" VT100=" << entry.second << std::endl;
125 std::cerr << StringBuilder<>(
TypeName<E>::str(),
": no such enumCode: ", enumCode) << std::endl;
127 std::cerr << __FILE__ <<
'/' << __FUNCTION__ <<
": no such enumCode: " << enumCode << std::endl;
128 throw std::runtime_error(
"No such enumCode: ");
139 template <
typename T,
typename ... TT>
141 void _append(std::ostream & ostr,
bool INIT,
const T & arg,
const TT &... args)
const{
143 _appendControlSuffix(ostr);
149 template <
typename ... TT>
151 void _append(std::ostream & ostr,
bool START,
const Colour & colour,
const TT &... args)
const{
152 _appendControlPrefix(ostr, START);
157 template <
typename ... TT>
159 void _append(std::ostream & ostr,
bool START,
const Line & line,
const TT &... args)
const{
160 _appendControlPrefix(ostr, START);
165 template <
typename ... TT>
166 void _append(std::ostream & ostr,
bool START,
const Style & style,
const TT &... args)
const {
167 _appendControlPrefix(ostr, START);
172 template <
typename ... TT>
173 void _append(std::ostream & ostr,
bool START,
const Control & ctrl)
const {
174 _appendControlSuffix(ostr);
178 void _append(std::ostream & ostr,
bool init)
const{
180 _appendControlSuffix(ostr);
185 void _appendControlPrefix(std::ostream & ostr,
bool START)
const {
195 void _appendControlSuffix(std::ostream & ostr)
const {
Definition TextStyleVT100.h:51
void _append(std::ostream &ostr, bool INIT, const T &arg, const TT &... args) const
Definition TextStyleVT100.h:141
static int getIntCode(const E &enumCode)
Given an enum value, returns the corresponding numeric VT100 code.
Definition TextStyleVT100.h:108
Utility for scanning text segments.
Definition TextStyle.h:49