31#ifndef TEXT_DECORATOR_H_
32#define TEXT_DECORATOR_H_
38#include <drain/TextStyle.h>
40#include "EnumFlagger.h"
58 std::string separator;
97 std::ostream & begin(std::ostream & ostr)
const {
102 std::ostream & begin(std::ostream & ostr,
const std::string & conf){
109 std::ostream & end(std::ostream & ostr)
const {
114 void setSeparator(
const std::string & separator){
115 this->separator = separator;
125 template<
typename T,
typename ... TT>
126 void set(T arg,
const TT &... args) {
146 template<
typename ... TT>
148 void add(
const std::string & keys,
const TT &... args){
155 template<
typename ... TT>
157 void add(
const char *keys,
const TT &... args){
164 template<
typename ... TT>
166 void add(
char *keys,
const TT &... args){
173 template<
typename T,
typename ... TT>
174 void add(T arg,
const TT &... args) {
182 void add(TextStyle::Colour c){
188 void add(TextStyle::Line l){
194 void add(TextStyle::Style s){
201 void debug(std::ostream & ostr)
const;
209 std::ostream & _begin(std::ostream & ostr)
const {
214 std::ostream & _end(std::ostream & ostr)
const {
225 void addKey(
const std::string & key);
227 void addKeys(
const std::string & keys);
234std::ostream & operator<<(std::ostream & ostr,
const TextDecorator & decorator){
236 ostr << decorator.style <<
'=' << decorator.style.getValue();
238 ostr << decorator.color <<
'=' << decorator.color.getValue();
240 ostr << decorator.line <<
'=' << decorator.line.getValue();
260 template <
typename F>
268 std::ostream &
_begin(std::ostream & ostr)
const;
271 std::ostream & _end(std::ostream & ostr)
const;
281 std::list<typename EnumFlagger<F>::value_t> l;
285 for (
typename EnumFlagger<F>::value_t v: l){
Flagger accepting values of enum type E.
Definition EnumFlagger.h:56
static void valuesToList(ivalue_t value, const drain::Dictionary< key_t, T > &dict, std::list< V > &container)
Given a bit vector (integer value), extracts separate flag values to a list.
Definition FlagBase.h:311
void add(const V &arg, const VV &... args)
Add bit values.
Definition Flags.h:293
Definition TextDecorator.h:246
virtual std::ostream & _begin(std::ostream &ostr) const
Export style to VT100 numeric codes.
Definition TextDecorator.cpp:161
static void appendCodes(const EnumFlagger< F > &styleFlags, std::list< int > &codes)
Internal utility: convert given abstract style to numeric VT100 codes.
Definition TextDecorator.h:277
Utility for ...
Definition TextDecorator.h:53
void add(TextStyle::Line l)
Change the current line setting.
Definition TextDecorator.h:188
void add(const std::string &keys, const TT &... args)
Sets given keys.
Definition TextDecorator.h:148
void add(T arg, const TT &... args)
Adds several keys.
Definition TextDecorator.h:174
ColourFlag color
Read input stream until any char in endChars is encountered. The end char will not be included,...
Definition TextDecorator.h:76
void add(char *keys, const TT &... args)
Third case of strings...
Definition TextDecorator.h:166
void addKey(const std::string &key)
Definition TextDecorator.cpp:102
void add(const char *keys, const TT &... args)
Second case of strings...
Definition TextDecorator.h:157
void add(TextStyle::Colour c)
Change the current color setting.
Definition TextDecorator.h:182
void add(TextStyle::Style s)
Change the current current style setting.
Definition TextDecorator.h:194
static int getIntCode(const E &enumCode)
Given an enum value, returns the corresponding numeric VT100 code.
Definition TextStyleVT100.h:101
Utility for scanning text segments.
Definition TextStyle.h:49
Definition DataSelector.cpp:1277