diff options
author | peterbell10 <peterbell10@live.co.uk> | 2018-01-03 18:41:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-03 18:41:16 +0100 |
commit | 757231cc6e777b8f4717d1467ef7efa01c7fde15 (patch) | |
tree | 6d1021761ad1c492700fe17560cb79520e508d60 /src/StringUtils.h | |
parent | Concrete mixing (#4096) (diff) | |
download | cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.gz cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.bz2 cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.lz cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.xz cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.zst cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.zip |
Diffstat (limited to 'src/StringUtils.h')
-rw-r--r-- | src/StringUtils.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/StringUtils.h b/src/StringUtils.h index 12227014d..a74239ec8 100644 --- a/src/StringUtils.h +++ b/src/StringUtils.h @@ -22,21 +22,24 @@ typedef std::map<AString, AString> AStringMap; -/** Add the formated string to the existing data in the string. -Returns a_Dst. */ -extern AString & AppendVPrintf(AString & a_Dst, const char * format, va_list args) FORMATSTRING(2, 0); - /** Output the formatted text into the string. Returns a_Dst. */ -extern AString & Printf (AString & a_Dst, const char * format, ...) FORMATSTRING(2, 3); +extern AString & Printf(AString & a_Dst, const char * format, fmt::ArgList args); +FMT_VARIADIC(AString &, Printf, AString &, const char *) /** Output the formatted text into string Returns the formatted string by value. */ -extern AString Printf(const char * format, ...) FORMATSTRING(1, 2); +extern AString Printf(const char * format, fmt::ArgList args); +FMT_VARIADIC(AString, Printf, const char *) -/** Add the formatted string to the existing data in the string. -Returns a_Dst */ -extern AString & AppendPrintf (AString & a_Dst, const char * format, ...) FORMATSTRING(2, 3); +/** Add the formated string to the existing data in the string. +Returns a_Dst. */ +template <typename... Args> +extern AString & AppendPrintf(AString & a_Dst, const char * format, const Args & ... args) +{ + a_Dst += Printf(format, args...); + return a_Dst; +} /** Split the string at any of the listed delimiters. Return the splitted strings as a stringvector. */ @@ -91,8 +94,7 @@ extern AString UnicodeCharToUtf8(unsigned a_UnicodeChar); /** Converts a UTF-8 string into a UTF-16 BE string. */ extern std::u16string UTF8ToRawBEUTF16(const AString & a_String); -/** Creates a nicely formatted HEX dump of the given memory block. -Max a_BytesPerLine is 120. */ +/** Creates a nicely formatted HEX dump of the given memory block. */ extern AString & CreateHexDump(AString & a_Out, const void * a_Data, size_t a_Size, size_t a_BytesPerLine); /** Returns a copy of a_Message with all quotes and backslashes escaped by a backslash. */ |