aboutsummaryrefslogtreecommitdiff
path: root/common/str.h
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-09 21:59:49 +0100
committerEugene Sandulenko2019-12-10 00:32:54 +0100
commit6b6dc218133f406c89ca6446dcaa5ba68f464c2a (patch)
treed372a18a2a86c0cad25ff650d7fe3c1f03cb1dac /common/str.h
parent3d86a5c09d4caa6ba3aaaa77cdc9400d5a7ff847 (diff)
downloadscummvm-rg350-6b6dc218133f406c89ca6446dcaa5ba68f464c2a.tar.gz
scummvm-rg350-6b6dc218133f406c89ca6446dcaa5ba68f464c2a.tar.bz2
scummvm-rg350-6b6dc218133f406c89ca6446dcaa5ba68f464c2a.zip
COMMON: Added helper function to produce printable strings
Diffstat (limited to 'common/str.h')
-rw-r--r--common/str.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/str.h b/common/str.h
index 2c6c142a73..811214bac6 100644
--- a/common/str.h
+++ b/common/str.h
@@ -491,6 +491,15 @@ size_t strnlen(const char *src, size_t maxSize);
*/
#define tag2str(x) Common::tag2string(x).c_str()
+/**
+ * Converts string with all non-printable characters properly escaped
+ * with use of C++ escape sequences
+ *
+ * @param src The source string.
+ * @param keepNewLines Whether keep newlines or convert them to '\n', default: true.
+ * @return The converted string.
+ */
+String toPrintable(const String &src, bool keepNewLines = true);
} // End of namespace Common