summaryrefslogtreecommitdiffstats
path: root/src/common/string_util.h
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
commitdc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch)
tree569a7f13128450bbab973236615587ff00bced5f /src/common/string_util.h
parentTravis: Import Dolphin’s clang-format hook. (diff)
downloadyuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.bz2
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.lz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.zst
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip
Diffstat (limited to '')
-rw-r--r--src/common/string_util.h56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 89d9f133e..6ffd735f4 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -25,9 +25,8 @@ std::string StringFromFormat(const char* format, ...);
// Cheap!
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
-template<size_t Count>
-inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
-{
+template <size_t Count>
+inline void CharArrayFromFormat(char (&out)[Count], const char* format, ...) {
va_list args;
va_start(args, format);
CharArrayFromFormatV(out, Count, format, args);
@@ -35,15 +34,14 @@ inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
}
// Good
-std::string ArrayToString(const u8 *data, u32 size, int line_len = 20, bool spaces = true);
+std::string ArrayToString(const u8* data, u32 size, int line_len = 20, bool spaces = true);
-std::string StripSpaces(const std::string &s);
-std::string StripQuotes(const std::string &s);
+std::string StripSpaces(const std::string& s);
+std::string StripQuotes(const std::string& s);
// Thousand separator. Turns 12345678 into 12,345,678
template <typename I>
-std::string ThousandSeparate(I value, int spaces = 0)
-{
+std::string ThousandSeparate(I value, int spaces = 0) {
std::ostringstream oss;
// std::locale("") seems to be broken on many platforms
@@ -57,35 +55,34 @@ std::string ThousandSeparate(I value, int spaces = 0)
std::string StringFromBool(bool value);
-bool TryParse(const std::string &str, bool *output);
-bool TryParse(const std::string &str, u32 *output);
+bool TryParse(const std::string& str, bool* output);
+bool TryParse(const std::string& str, u32* output);
template <typename N>
-static bool TryParse(const std::string &str, N *const output)
-{
+static bool TryParse(const std::string& str, N* const output) {
std::istringstream iss(str);
N tmp = 0;
- if (iss >> tmp)
- {
+ if (iss >> tmp) {
*output = tmp;
return true;
- }
- else
+ } else
return false;
}
// TODO: kill this
bool AsciiToHex(const char* _szValue, u32& result);
-std::string TabsToSpaces(int tab_size, const std::string &in);
+std::string TabsToSpaces(int tab_size, const std::string& in);
void SplitString(const std::string& str, char delim, std::vector<std::string>& output);
// "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe"
-bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
+bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename,
+ std::string* _pExtension);
-void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename);
+void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path,
+ const std::string& _Filename);
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest);
std::string UTF16ToUTF8(const std::u16string& input);
@@ -99,17 +96,21 @@ std::string UTF16ToUTF8(const std::wstring& input);
std::wstring UTF8ToUTF16W(const std::string& str);
#ifdef _UNICODE
-inline std::string TStrToUTF8(const std::wstring& str)
-{ return UTF16ToUTF8(str); }
+inline std::string TStrToUTF8(const std::wstring& str) {
+ return UTF16ToUTF8(str);
+}
-inline std::wstring UTF8ToTStr(const std::string& str)
-{ return UTF8ToUTF16W(str); }
+inline std::wstring UTF8ToTStr(const std::string& str) {
+ return UTF8ToUTF16W(str);
+}
#else
-inline std::string TStrToUTF8(const std::string& str)
-{ return str; }
+inline std::string TStrToUTF8(const std::string& str) {
+ return str;
+}
-inline std::string UTF8ToTStr(const std::string& str)
-{ return str; }
+inline std::string UTF8ToTStr(const std::string& str) {
+ return str;
+}
#endif
#endif
@@ -134,5 +135,4 @@ bool ComparePartialString(InIt begin, InIt end, const char* other) {
* NUL-terminated then the string ends at max_len characters.
*/
std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len);
-
}