libzypp 17.37.17
|
Colored stream output if do_colors. More...
#include <zypp-tui/utils/ansi.h>
Classes | |
struct | nullDeleter |
Public Member Functions | |
ColorStream () | |
Default Ctor (Color::Default) | |
ColorStream (Color color_r) | |
Ctor taking a Color. | |
ColorStream (std::ostream &direct_r) | |
Ctor directly printing to a std::ostream (Color::Default) | |
ColorStream (std::ostream &direct_r, Color color_r) | |
Ctor directly printing to a std::ostream in Color. | |
ColorStream (const ColorStream &)=delete | |
non copyable | |
ColorStream (ColorStream &&)=default | |
movable | |
ColorStream & | operator= (const ColorStream &)=delete |
ColorStream & | operator= (ColorStream &&)=default |
ColorStream & | operator= (Color color_r) |
Change the streams Color. | |
~ColorStream () | |
operator std::ostream & () | |
Explicit conversion to std::ostream (creates buffer if not direct) | |
ColorStream & | operator<= (Color color_r) |
Update the streams Color. | |
Color | color () const |
Return streams Color. | |
std::string | str () const |
Return a buffered streams content as (colored) string. | |
ColorStream & | operator<< (Color color_r) |
Printing a Color (also via enum) updates the streams Color. | |
ColorStream & | operator<< (const ColorString &val_r) |
Printing a ColorString using his Color. | |
ColorStream & | operator<< (const ColorStream &val_r) |
Printing another ColorStream using his Color. | |
template<class Tp_, typename = DisableIfCustomColorCtor<Tp_>> | |
ColorStream & | operator<< (const Tp_ &val_r) |
All other types are printed via std::ostream. | |
ColorStream & | operator<< (std::ostream &(*omanip)(std::ostream &)) |
Private Member Functions | |
bool | hasStream () const |
Direct or non-empty buffer. | |
std::ostream & | stream () const |
Reference to the underlying ostream (direct or auto-created buffer) | |
bool | hasContent () const |
Non-empty buffer (implies direct) | |
std::string | content () const |
Content of a non-empty buffered stream or empty. |
Private Attributes | |
std::unique_ptr< std::ostream, nullDeleter > | _directP |
std::unique_ptr< std::ostringstream > | _bufferP |
Color | _color |
Related Symbols | |
(Note that these are not member symbols.) | |
std::ostream & | operator<< (std::ostream &str, const ColorStream &obj) |
Print colored on ostream. |
Colored stream output if do_colors.
handling via an enum type.
If an ostream&
is passed to the constructor, we directly print to this steam. Otherwise an ostringstream is used as buffer until the buffered ColorStream itself is printed. Printing an unbuffered steam prints an empty string.
|
inline |
Default Ctor (Color::Default)
|
inlineexplicit |
|
inlineexplicit |
Ctor directly printing to a std::ostream (Color::Default)
|
inline |
|
delete |
non copyable
|
default |
movable
|
delete |
|
default |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Printing a ColorString using his Color.
|
inline |
Printing another ColorStream using his Color.
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
friend |
|
private |
|
mutableprivate |