# HG changeset patch # User Teemu Piippo # Date 1469016360 -10800 # Node ID b4f89893c7022c55ade247ba36089c9739a3275f # Parent e49aa4aa98c0a2279b279168dded5fda683f8637 Restyled parentheses in coloredline.cpp/.h diff -r e49aa4aa98c0 -r b4f89893c702 sources/coloredline.cpp --- a/sources/coloredline.cpp Wed Jul 20 15:01:26 2016 +0300 +++ b/sources/coloredline.cpp Wed Jul 20 15:06:00 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); + set_color(m_activeColor, false); if (m_boldActive) m_data << RLINE_OFF_BOLD; @@ -60,7 +60,7 @@ // ------------------------------------------------------------------------------------------------- // -void ColoredLine::add_char (char ch) +void ColoredLine::add_char(char ch) { static const ColorCodeInfo colorCodes[] = { @@ -100,7 +100,7 @@ if (m_colorCodeStage == 1) { if (m_activeColor != DEFAULT) - set_color (m_activeColor, false); + set_color(m_activeColor, false); if (m_boldActive) m_data << RLINE_OFF_BOLD; @@ -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::activate_color(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); + set_color(m_activeColor, true); if (m_boldActive) m_data << RLINE_ON_BOLD; @@ -174,31 +174,31 @@ // ------------------------------------------------------------------------------------------------- // -void ColoredLine::add_string (const String& text) +void ColoredLine::add_string(const String& text) { for (char a : text) - add_char (a); + add_char(a); } // ------------------------------------------------------------------------------------------------- // -void ColoredLine::set_color (Color a, bool on) +void ColoredLine::set_color(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 diff -r e49aa4aa98c0 -r b4f89893c702 sources/coloredline.h --- a/sources/coloredline.h Wed Jul 20 15:01:26 2016 +0300 +++ b/sources/coloredline.h Wed Jul 20 15:06:00 2016 +0300 @@ -20,10 +20,10 @@ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -32,7 +32,7 @@ #include "main.h" BEGIN_ZFC_NAMESPACE -// The order of these colors appears to differ between curses distributions (PDCurses and its +// The order of these colors appears to differ between curses distributions(PDCurses and its // win32a for instance have blue and red swapped). So we need to explicitly define the values // of the enumerators based on their curses values. enum Color @@ -68,14 +68,14 @@ const Vector& data() const { return m_data; } int length() const { return m_length; } - void add_char (char ch); - void add_string (const String& msg); + void add_char(char ch); + void add_string(const String& msg); void finalize(); - int rows (int cols) const; + int rows(int cols) const; private: - void activate_color (Color color, bool bold); - void set_color (Color a, bool on); + void activate_color(Color color, bool bold); + void set_color(Color a, bool on); Vector m_data; int m_length;