MCPcopy Create free account
hub / github.com/cwida/FastLanes / Ruler

Method Ruler

src/printer/output.cpp:50–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 rgt = m_mid_rgt;
49 mid = m_mid_mid;
50 lft = m_mid_lft;
51 break;
52 case POS::BOT:
53 rgt = m_bot_rgt;
54 mid = m_bot_mid;
55 lft = m_bot_lft;
56 break;
57 }
58
59 result += lft;
60 for (; i < m_width.size() - 1; ++i) {
61 result += repeat(m_width[i], m_horizontal);
62 result += mid;
63 }
64
65 result += repeat(m_width[i], m_horizontal);
66 result += rgt;
67
68 return result;
69}
70
71unsigned TerminalOutput::Width(unsigned int i) const { return m_width[i]; }
72
73unsigned TerminalOutput::CorrectDistance(const std::string& string_to_correct) const {
74 return static_cast<unsigned>(string_to_correct.size() - glyph_length(string_to_correct));
75}
76
77bool TerminalOutput::HasRuler() const { return m_has_ruler; }
78
79std::string TerminalOutput::repeat(unsigned int times, const std::string& c) {
80 std::string result;
81 for (; times > 0; --times) {
82 result += c;
83 }
84
85 return result;
86}

Callers 1

output.cppFile · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected