43 [[nodiscard]]
size_t numChars()
const;
45 [[nodiscard]]
const std::string&
str()
const {
return line; }
49 [[nodiscard]]
size_t numChunks()
const {
return chunks.size(); }
53 [[nodiscard]] std::string_view
chunkText(
size_t i)
const;
55 [[nodiscard]]
const auto&
getChunks()
const {
return chunks; }
60 std::string_view::size_type
pos;
65 std::vector<Chunk> chunks;
This class represents a single text line in the console.
ConsoleLine splitAtColumn(unsigned column)
Split this line at a given column number.
void addLine(const ConsoleLine &ln)
Append another line (possibly containing multiple chunks).
std::string_view chunkText(size_t i) const
Get the text for the i-th chunk.
const std::string & str() const
Get the total string, ignoring color differences.
imColor chunkColor(size_t i) const
Get the color for the i-th chunk.
ConsoleLine()=default
Construct empty line.
void addChunk(std::string_view text, imColor color=imColor::TEXT)
Append a chunk with a (different) color.
void clear()
Reinitialize to an empty line.
const auto & getChunks() const
size_t numChars() const
Get the number of UTF8 characters in this line.
size_t numChunks() const
Get the number of different chunks.
This file implemented 3 utility functions:
std::string_view::size_type pos