mirror-chatterino2/src/util/irchelpers.hpp
fourtf 10850c0ec7 I BROKE EVERYTHING
refactored the rendering process
2018-01-11 20:17:41 +01:00

58 lines
1.1 KiB
C++

#pragma once
#include <QString>
namespace chatterino {
namespace util {
QString ParseTagString(const QString &input)
{
QString output = input;
output.detach();
bool changed = false;
for (int i = 0; i < output.length() - 1; i++) {
if (output[i] == '\\') {
QChar c = output[i + 1];
switch (c.cell()) {
case 'n': {
output[i] = '\n';
} break;
case 'r': {
output[i] = '\r';
} break;
case 's': {
output[i] = ' ';
} break;
case '\\': {
output[i] = '\\';
} break;
case ':': {
output[i] = ';';
} break;
default: {
output[i] = output[i + 1];
} break;
}
output[i + 1] = '\0';
changed = true;
i++;
}
}
if (changed) {
return output.replace("\0", "");
} else {
return output;
}
}
}
} // namespace chatterino