diff options
| author | 2014-12-12 23:20:01 -0500 | |
|---|---|---|
| committer | 2014-12-12 23:20:01 -0500 | |
| commit | af1cd769e7b407af71496e788e218add31f8b2b0 (patch) | |
| tree | 1e3fd71256c04a15970b09abd3f7280f8b1ff678 /src/common/string_util.h | |
| parent | Merge pull request #267 from bunnei/apt-shared-font (diff) | |
| parent | Remove old logging system (diff) | |
| download | yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.gz yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.tar.xz yuzu-af1cd769e7b407af71496e788e218add31f8b2b0.zip | |
Merge pull request #258 from yuriks/log-ng
New logging system
Diffstat (limited to 'src/common/string_util.h')
| -rw-r--r-- | src/common/string_util.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/string_util.h b/src/common/string_util.h index ae5bbadad..7d75691b1 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -115,4 +115,19 @@ inline std::string UTF8ToTStr(const std::string& str) | |||
| 115 | 115 | ||
| 116 | #endif | 116 | #endif |
| 117 | 117 | ||
| 118 | /** | ||
| 119 | * Compares the string defined by the range [`begin`, `end`) to the null-terminated C-string | ||
| 120 | * `other` for equality. | ||
| 121 | */ | ||
| 122 | template <typename InIt> | ||
| 123 | bool ComparePartialString(InIt begin, InIt end, const char* other) { | ||
| 124 | for (; begin != end && *other != '\0'; ++begin, ++other) { | ||
| 125 | if (*begin != *other) { | ||
| 126 | return false; | ||
| 127 | } | ||
| 128 | } | ||
| 129 | // Only return true if both strings finished at the same point | ||
| 130 | return (begin == end) == (*other == '\0'); | ||
| 131 | } | ||
| 132 | |||
| 118 | } | 133 | } |