31 #ifndef TEXT_DECORATOR_H_
32 #define TEXT_DECORATOR_H_
39 #include <drain/TextStyle.h>
40 #include <drain/TypeUtils.h>
60 std::string separator;
99 std::ostream & begin(std::ostream & ostr)
const {
104 std::ostream & begin(std::ostream & ostr,
const std::string & conf){
111 std::ostream & end(std::ostream & ostr)
const {
116 void setSeparator(
const std::string & separator){
117 this->separator = separator;
127 template<
typename T,
typename ... TT>
128 void set(T arg,
const TT &... args) {
148 template<
typename ... TT>
150 void add(
const std::string & keys,
const TT &... args){
157 template<
typename ... TT>
159 void add(
const char *keys,
const TT &... args){
166 template<
typename ... TT>
168 void add(
char *keys,
const TT &... args){
175 template<
typename T,
typename ... TT>
176 void add(T arg,
const TT &... args) {
184 void add(TextStyle::Colour c){
190 void add(TextStyle::Line l){
196 void add(TextStyle::Style s){
203 void debug(std::ostream & ostr)
const;
211 std::ostream & _begin(std::ostream & ostr)
const {
216 std::ostream & _end(std::ostream & ostr)
const {
227 void addKey(
const std::string & key);
229 void addKeys(
const std::string & keys);
236 std::ostream & operator<<(std::ostream & ostr,
const TextDecorator & decorator){
238 ostr << decorator.style <<
'=' << decorator.style.getValue();
240 ostr << decorator.color <<
'=' << decorator.color.getValue();
242 ostr << decorator.line <<
'=' << decorator.line.getValue();
262 template <
typename F>
270 std::ostream &
_begin(std::ostream & ostr)
const;
273 std::ostream & _end(std::ostream & ostr)
const;
278 template <
typename F>
283 std::list<typename EnumFlagger<F>::value_t> l;
287 for (
typename EnumFlagger<F>::value_t v: l){
Flagger accepting values of enum type E.
Definition: Flags.h:763
virtual const FlaggerBase< value_t >::dict_t & getDict() const
Returns the static dictionary created for this value_t .
Definition: Flags.h:794
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: Flags.h:306
void add(const T &arg, const TT &... args)
Add bit values.
Definition: Flags.h:647
Definition: TextDecorator.h:248
virtual std::ostream & _begin(std::ostream &ostr) const
Export style to VT100 numeric codes.
Definition: TextDecorator.cpp:162
static void appendCodes(const EnumFlagger< F > &styleFlags, std::list< int > &codes)
Internal utility: convert given abstract style to numeric VT100 codes.
Definition: TextDecorator.h:279
Utility for ...
Definition: TextDecorator.h:55
void add(TextStyle::Line l)
Change the current line setting.
Definition: TextDecorator.h:190
void add(const std::string &keys, const TT &... args)
Sets given keys.
Definition: TextDecorator.h:150
void add(T arg, const TT &... args)
Adds several keys.
Definition: TextDecorator.h:176
ColourFlag color
Read input stream until any char in endChars is encountered. The end char will not be included,...
Definition: TextDecorator.h:78
void add(char *keys, const TT &... args)
Third case of strings...
Definition: TextDecorator.h:168
void addKey(const std::string &key)
Definition: TextDecorator.cpp:103
void add(const char *keys, const TT &... args)
Second case of strings...
Definition: TextDecorator.h:159
void add(TextStyle::Colour c)
Change the current color setting.
Definition: TextDecorator.h:184
void add(TextStyle::Style s)
Change the current current style setting.
Definition: TextDecorator.h:196
static int getIntCode(const E &enumCode)
Given an enum value, returns the corresponding numeric VT100 code.
Definition: TextStyleVT100.h:102
Utility for scanning text segments.
Definition: TextStyle.h:50
Definition: DataSelector.cpp:1277