sources/coloredline.cpp

branch
protocol5
changeset 195
be953e1621d9
parent 150
37db42ad451a
parent 190
90bf9049e5eb
--- a/sources/coloredline.cpp	Wed Jan 27 12:41:50 2021 +0200
+++ b/sources/coloredline.cpp	Wed Jan 27 19:48:41 2021 +0200
@@ -1,5 +1,5 @@
 /*
-	Copyright 2014 - 2016 Teemu Piippo
+	Copyright 2014 - 2021 Teemu Piippo
 	All rights reserved.
 
 	Redistribution and use in source and binary forms, with or without
@@ -53,7 +53,7 @@
 		setColor(m_activeColor, false);
 
 	if (m_boldActive)
-		m_data << RLINE_OFF_BOLD;
+		m_data.push_back(RLINE_OFF_BOLD);
 
 	m_final = true;
 }
@@ -103,7 +103,7 @@
 			setColor(m_activeColor, false);
 
 		if (m_boldActive)
-			m_data << RLINE_OFF_BOLD;
+			m_data.push_back(RLINE_OFF_BOLD);
 
 		m_boldActive = false;
 
@@ -127,11 +127,11 @@
 	{
 		if (ch == ']')
 		{
-			String color = m_incomingColorName.toLowerCase();
+			std::string color = to_lowercase(m_incomingColorName);
 
 			for (const ColorCodeInfo &colorInfo : colorCodes)
 			{
-				if (String(colorInfo.name).toLowerCase() == color)
+				if (to_lowercase(colorInfo.name) == color)
 				{
 					activateColor(colorInfo.color, colorInfo.bold);
 					m_colorCodeStage = 0;
@@ -151,7 +151,7 @@
 	if (isprint(ch))
 	{
 		m_string += ch;
-		m_data << int(ch);
+		m_data.push_back(static_cast<int>(ch));
 		++m_length;
 	}
 }
@@ -161,20 +161,22 @@
 void ColoredLine::activateColor(Color color, bool bold)
 {
 	if (m_boldActive)
-		m_data << RLINE_OFF_BOLD;
-
+	{
+		m_data.push_back(RLINE_OFF_BOLD);
+	}
 	m_activeColor = color;
 	m_boldActive = bold;
 	assert(m_activeColor < 8);
 	setColor(m_activeColor, true);
-
 	if (m_boldActive)
-		m_data << RLINE_ON_BOLD;
+	{
+		m_data.push_back(RLINE_ON_BOLD);
+	}
 }
 
 // -------------------------------------------------------------------------------------------------
 //
-void ColoredLine::addString(const String& text)
+void ColoredLine::addString(const std::string& text)
 {
 	for (char a : text)
 		addChar(a);
@@ -185,7 +187,7 @@
 void ColoredLine::setColor(Color a, bool on)
 {
 	assert(a < 8);
-	m_data << (a +(on ? RLINE_ON_COLOR : RLINE_OFF_COLOR));
+	m_data.push_back(a + (on ? RLINE_ON_COLOR : RLINE_OFF_COLOR));
 }
 
 // -------------------------------------------------------------------------------------------------

mercurial