summaryrefslogtreecommitdiffstats
path: root/src/common/string_util.h
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-09 23:03:54 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-18 16:53:47 +0100
commitc70529c1ec1092d3317316534155344e498fa593 (patch)
tree3579cf39b113bf8f1f40d80c01a994005c1fb3c8 /src/common/string_util.h
parentsvc: Implement svcCreateTransferMemory (diff)
downloadyuzu-c70529c1ec1092d3317316534155344e498fa593.tar
yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.gz
yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.bz2
yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.lz
yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.xz
yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.zst
yuzu-c70529c1ec1092d3317316534155344e498fa593.zip
Diffstat (limited to '')
-rw-r--r--src/common/string_util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 08f96533b..95b7badaf 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -67,6 +67,14 @@ bool ComparePartialString(InIt begin, InIt end, const char* other) {
std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t max_len);
/**
+ * Creates a UTF-16 std::u16string from a fixed-size NUL-terminated char buffer. If the buffer isn't
+ * NUL-terminated, then the string ends at the greatest multiple of two less then or equal to
+ * max_len_bytes.
+ */
+std::u16string UTF16StringFromFixedZeroTerminatedBuffer(const char16_t* buffer,
+ std::size_t max_len);
+
+/**
* Attempts to trim an arbitrary prefix from `path`, leaving only the part starting at `root`. It's
* intended to be used to strip a system-specific build directory from the `__FILE__` macro,
* leaving only the path relative to the sources root.