summaryrefslogtreecommitdiffstats
path: root/Util.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Util.hpp')
-rw-r--r--Util.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Util.hpp b/Util.hpp
new file mode 100644
index 0000000..f90e108
--- /dev/null
+++ b/Util.hpp
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <QString>
+#include <QMap>
+
+namespace Util {
+ static const QMap<QChar, QChar> unescapeChars {
+ {'n', '\n'},
+ };
+
+ QString trimQuotes(QString string, bool& trimmed);
+ QString unescape(const QString& string, const QChar escapeChar = '\\');
+ QString escape(const QString& string, const QChar escapeChar = '\\', const QString& escapeChars = "");
+ QString joinEscape(const QStringList& list, const QChar joinChar, const QChar escapeChar = '\\');
+ QStringList splitEscaped(const QString& joined, const QChar splitChar, const QChar escapeChar = '\\');
+ QString& unescapeClonkString(QString&& string);
+ int indexOfEscaped(const QString& string, const QChar subject, int startPos = 0, const QChar escapeChar = '\\');
+}