Renamed the methods of ColoredLine

Wed, 20 Jul 2016 15:07:03 +0300

author
Teemu Piippo <teemu@compsta2.com>
date
Wed, 20 Jul 2016 15:07:03 +0300
changeset 143
b9993733952a
parent 142
b4f89893c702
child 144
e8d58327cd7f

Renamed the methods of ColoredLine

sources/coloredline.cpp file | annotate | diff | comparison | revisions
sources/coloredline.h file | annotate | diff | comparison | revisions
sources/interface.cpp file | annotate | diff | comparison | revisions
--- a/sources/coloredline.cpp	Wed Jul 20 15:06:00 2016 +0300
+++ b/sources/coloredline.cpp	Wed Jul 20 15:07:03 2016 +0300
@@ -50,7 +50,7 @@
 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 == '[')
@@ -133,7 +133,7 @@
 			{
 				if (String(colorInfo.name).to_lowercase() == color)
 				{
-					activate_color(colorInfo.color, colorInfo.bold);
+					activateColor(colorInfo.color, colorInfo.bold);
 					m_colorCodeStage = 0;
 					break;
 				}
@@ -158,7 +158,7 @@
 
 // -------------------------------------------------------------------------------------------------
 //
-void ColoredLine::activate_color(Color color, bool bold)
+void ColoredLine::activateColor(Color color, bool bold)
 {
 	if (m_boldActive)
 		m_data << RLINE_OFF_BOLD;
@@ -166,7 +166,7 @@
 	m_activeColor = color;
 	m_boldActive = bold;
 	assert(m_activeColor < 8);
-	set_color(m_activeColor, true);
+	setColor(m_activeColor, true);
 
 	if (m_boldActive)
 		m_data << RLINE_ON_BOLD;
@@ -174,15 +174,15 @@
 
 // -------------------------------------------------------------------------------------------------
 //
-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));
--- a/sources/coloredline.h	Wed Jul 20 15:06:00 2016 +0300
+++ b/sources/coloredline.h	Wed Jul 20 15:07:03 2016 +0300
@@ -68,14 +68,14 @@
 
 	const Vector<int>& data() const { return m_data; }
 	int length() const { return m_length; }
-	void add_char(char ch);
-	void add_string(const String& msg);
+	void addChar(char ch);
+	void addString(const String& msg);
 	void finalize();
 	int rows(int cols) const;
 
 private:
-	void activate_color(Color color, bool bold);
-	void set_color(Color a, bool on);
+	void activateColor(Color color, bool bold);
+	void setColor(Color a, bool on);
 
 	Vector<int> m_data;
 	int m_length;
--- a/sources/interface.cpp	Wed Jul 20 15:06:00 2016 +0300
+++ b/sources/interface.cpp	Wed Jul 20 15:07:03 2016 +0300
@@ -976,14 +976,14 @@
 			strftime(timestamp, sizeof timestamp, "[%H:%M:%S] ", localtime(&now));
 
 			for (char ch : String(timestamp))
-				m_outputLines.last().add_char(ch);
+				m_outputLines.last().addChar(ch);
 		}
 
 		// Remove some lines if there's too many of them. 20,000 should be enough, I hope.
 		while (m_outputLines.size() > 20000)
 			m_outputLines.remove_at(0);
 
-		m_outputLines.last().add_char(ch);
+		m_outputLines.last().addChar(ch);
 	}
 
 	m_needOutputRender = true;
@@ -1020,7 +1020,7 @@
 	for (const String& name : names)
 	{
 		ColoredLine coloredname;
-		coloredname.add_string(name);
+		coloredname.addString(name);
 		coloredname.finalize();
 		m_playerNames.append(coloredname);
 	}

mercurial