diff -r d9073c13dc98 -r 37db42ad451a sources/coloredline.cpp --- a/sources/coloredline.cpp Wed Jul 20 15:03:37 2016 +0300 +++ b/sources/coloredline.cpp Wed Jul 20 17:56:40 2016 +0300 @@ -39,18 +39,18 @@ }; ColoredLine::ColoredLine() : - m_length (0), - m_final (false), - m_activeColor (DEFAULT), - m_boldActive (false), - m_colorCodeStage (0) {} + m_length(0), + m_final(false), + m_activeColor(DEFAULT), + m_boldActive(false), + m_colorCodeStage(0) {} // ------------------------------------------------------------------------------------------------- // void ColoredLine::finalize() { if (m_activeColor != DEFAULT) - set_color (m_activeColor, false); + setColor(m_activeColor, false); if (m_boldActive) m_data << RLINE_OFF_BOLD; @@ -60,7 +60,7 @@ // ------------------------------------------------------------------------------------------------- // -void ColoredLine::add_char (char ch) +void ColoredLine::addChar(char ch) { static const ColorCodeInfo colorCodes[] = { @@ -100,7 +100,7 @@ if (m_colorCodeStage == 1) { if (m_activeColor != DEFAULT) - set_color (m_activeColor, false); + setColor(m_activeColor, false); if (m_boldActive) m_data << RLINE_OFF_BOLD; @@ -114,7 +114,7 @@ if (ch >= 'a' and ch <= 'v' and ch != 'l') { const ColorCodeInfo& colorInfo = colorCodes[ch - 'a']; - activate_color(colorInfo.color, colorInfo.bold); + activateColor(colorInfo.color, colorInfo.bold); } if (ch == '[') @@ -127,13 +127,13 @@ { if (ch == ']') { - String color = m_incomingColorName.to_lowercase(); + String color = m_incomingColorName.toLowerCase(); for (const ColorCodeInfo &colorInfo : colorCodes) { - if (String(colorInfo.name).to_lowercase() == color) + if (String(colorInfo.name).toLowerCase() == color) { - activate_color(colorInfo.color, colorInfo.bold); + activateColor(colorInfo.color, colorInfo.bold); m_colorCodeStage = 0; break; } @@ -148,25 +148,25 @@ return; } - if (isprint (ch)) + if (isprint(ch)) { m_string += ch; - m_data << int (ch); + m_data << int(ch); ++m_length; } } // ------------------------------------------------------------------------------------------------- // -void ColoredLine::activate_color (Color color, bool bold) +void ColoredLine::activateColor(Color color, bool bold) { if (m_boldActive) m_data << RLINE_OFF_BOLD; m_activeColor = color; m_boldActive = bold; - assert (m_activeColor < 8); - set_color (m_activeColor, true); + assert(m_activeColor < 8); + setColor(m_activeColor, true); if (m_boldActive) m_data << RLINE_ON_BOLD; @@ -174,31 +174,31 @@ // ------------------------------------------------------------------------------------------------- // -void ColoredLine::add_string (const String& text) +void ColoredLine::addString(const String& text) { for (char a : text) - add_char (a); + addChar(a); } // ------------------------------------------------------------------------------------------------- // -void ColoredLine::set_color (Color a, bool on) +void ColoredLine::setColor(Color a, bool on) { - assert (a < 8); - m_data << (a + (on ? RLINE_ON_COLOR : RLINE_OFF_COLOR)); + assert(a < 8); + m_data << (a +(on ? RLINE_ON_COLOR : RLINE_OFF_COLOR)); } // ------------------------------------------------------------------------------------------------- // How many rows does this line take up? // -int ColoredLine::rows (int cols) const +int ColoredLine::rows(int cols) const { int rows = length() / cols; if (length() % cols != 0) rows++; - return max (rows, 1); + return max(rows, 1); } END_ZFC_NAMESPACE