MCPcopy Create free account
hub / github.com/p-ranav/tabulate / print_content_right_aligned

Method print_content_right_aligned

include/tabulate/printer.hpp:134–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132 }
133
134 static void print_content_right_aligned(std::ostream &stream, const std::string &cell_content,
135 const Format &format, size_t text_with_padding_size,
136 size_t column_width) {
137 if (text_with_padding_size < column_width) {
138 for (size_t j = 0; j < (column_width - text_with_padding_size); ++j) {
139 stream << " ";
140 }
141 }
142
143 // Apply font style
144 apply_element_style(stream, *format.font_color_, *format.font_background_color_,
145 *format.font_style_);
146 stream << cell_content;
147 // Only apply font_style to the font
148 // Not the padding. So calling apply_element_style with font_style = {}
149 reset_element_style(stream);
150 apply_element_style(stream, *format.font_color_, *format.font_background_color_, {});
151 }
152
153 static void apply_font_style(std::ostream &stream, FontStyle style) {
154 switch (style) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected