Colored string if do_colors.
More...
#include <zypp-tui/utils/ansi.h>
|
(Note that these are not member symbols.)
|
std::ostream & | operator<< (std::ostream &str, const ColorString &obj) |
| Print colored on ostream.
|
Colored string if do_colors.
Stores a plain std::string (which may have color codes embedded) along with a Color. Retrieving the string will render all uncolored (Color::nololor) parts of the string in the Color.
In contrary to a ColorStream you can change the basic color of the string without losing embedded highlights.
- Note
- Printing a ColorString renderd in Color::noclolor on a ColorStream will render the string in the ColorStreams color.
Definition at line 496 of file ansi.h.
◆ ColorString() [1/8]
ztui::ansi::ColorString::ColorString |
( |
| ) |
|
|
inline |
◆ ColorString() [2/8]
ztui::ansi::ColorString::ColorString |
( |
Color | color_r | ) |
|
|
inlineexplicit |
Ctor from color.
Definition at line 504 of file ansi.h.
◆ ColorString() [3/8]
ztui::ansi::ColorString::ColorString |
( |
const std::string & | str_r | ) |
|
|
inlineexplicit |
Ctor from string.
Definition at line 509 of file ansi.h.
◆ ColorString() [4/8]
ztui::ansi::ColorString::ColorString |
( |
std::string && | str_r | ) |
|
|
inlineexplicit |
◆ ColorString() [5/8]
ztui::ansi::ColorString::ColorString |
( |
const std::string & | str_r, |
|
|
Color | color_r ) |
|
inline |
Ctor from string and color.
Definition at line 520 of file ansi.h.
◆ ColorString() [6/8]
ztui::ansi::ColorString::ColorString |
( |
std::string && | str_r, |
|
|
Color | color_r ) |
|
inline |
◆ ColorString() [7/8]
ztui::ansi::ColorString::ColorString |
( |
Color | color_r, |
|
|
const std::string & | str_r ) |
|
inline |
Ctor from color and string.
Definition at line 531 of file ansi.h.
◆ ColorString() [8/8]
ztui::ansi::ColorString::ColorString |
( |
Color | color_r, |
|
|
std::string && | str_r ) |
|
inline |
◆ operator=() [1/3]
ColorString & ztui::ansi::ColorString::operator= |
( |
const std::string & | str_r | ) |
|
|
inline |
Assign new string.
Definition at line 543 of file ansi.h.
◆ operator=() [2/3]
ColorString & ztui::ansi::ColorString::operator= |
( |
std::string && | str_r | ) |
|
|
inline |
◆ operator<<() [1/2]
◆ operator<<() [2/2]
ColorString & ztui::ansi::ColorString::operator<< |
( |
const std::string & | str_r | ) |
|
|
inline |
Append a string.
Definition at line 567 of file ansi.h.
◆ operator=() [3/3]
◆ operator<=()
◆ operator()()
Return a copy with different color.
Definition at line 580 of file ansi.h.
◆ color()
Color ztui::ansi::ColorString::color |
( |
| ) |
const |
|
inline |
◆ empty()
bool ztui::ansi::ColorString::empty |
( |
| ) |
const |
|
inline |
Whether the underlying string is empty.
Definition at line 590 of file ansi.h.
◆ size()
std::string::size_type ztui::ansi::ColorString::size |
( |
| ) |
const |
|
inline |
Size of the underlying string.
Definition at line 594 of file ansi.h.
◆ str() [1/2]
std::string ztui::ansi::ColorString::str |
( |
| ) |
const |
|
inline |
◆ asString()
std::string ztui::ansi::ColorString::asString |
( |
| ) |
const |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 601 of file ansi.h.
◆ str() [2/2]
std::string ztui::ansi::ColorString::str |
( |
Color | color_r | ) |
const |
|
inline |
Return the string rendered in a differernt color if do_colors.
Definition at line 605 of file ansi.h.
◆ plainstr() [1/2]
const std::string & ztui::ansi::ColorString::plainstr |
( |
| ) |
const |
|
inline |
Return the underlying plain string.
Definition at line 622 of file ansi.h.
◆ plainstr() [2/2]
std::string & ztui::ansi::ColorString::plainstr |
( |
| ) |
|
|
inline |
Return the underlying plain string.
Definition at line 626 of file ansi.h.
◆ operator*() [1/2]
const std::string & ztui::ansi::ColorString::operator* |
( |
| ) |
const |
|
inline |
Access the underlying plain string via operator*
.
Definition at line 630 of file ansi.h.
◆ operator*() [2/2]
std::string & ztui::ansi::ColorString::operator* |
( |
| ) |
|
|
inline |
Access the underlying plain string via operator*
.
Definition at line 634 of file ansi.h.
◆ operator<<()
std::ostream & operator<< |
( |
std::ostream & | str, |
|
|
const ColorString & | obj ) |
|
related |
Print colored on ostream.
Definition at line 643 of file ansi.h.
◆ _str
std::string ztui::ansi::ColorString::_str |
|
private |
◆ _color
Color ztui::ansi::ColorString::_color |
|
private |
The documentation for this class was generated from the following file: