summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.h
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2020-05-05 23:52:14 +0200
committerGitHub <noreply@github.com>2020-05-05 23:52:14 +0200
commit57952505e522be868a5a8270d8670163b55ebade (patch)
treecf3c5544612b8a51075b498fa14dba8fe758d656 /src/StringUtils.h
parentRequire semi-colon at end of function-like macros (#4719) (diff)
downloadcuberite-57952505e522be868a5a8270d8670163b55ebade.tar
cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.gz
cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.bz2
cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.lz
cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.xz
cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.zst
cuberite-57952505e522be868a5a8270d8670163b55ebade.zip
Diffstat (limited to 'src/StringUtils.h')
-rw-r--r--src/StringUtils.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/StringUtils.h b/src/StringUtils.h
index 428578c03..0013762a2 100644
--- a/src/StringUtils.h
+++ b/src/StringUtils.h
@@ -23,21 +23,29 @@ typedef std::map<AString, AString> AStringMap;
/** Output the formatted text into the string.
Returns a_Dst. */
-extern AString & Printf(AString & a_Dst, const char * format, fmt::ArgList args);
-FMT_VARIADIC(AString &, Printf, AString &, const char *)
+extern AString & vPrintf(AString & a_Dst, const char * format, fmt::printf_args args);
+template <typename... Args>
+AString & Printf(AString & a_Dst, const char * a_Format, const Args & ... args)
+{
+ return vPrintf(a_Dst, a_Format, fmt::make_printf_args(args...));
+}
/** Output the formatted text into string
Returns the formatted string by value. */
-extern AString Printf(const char * format, fmt::ArgList args);
-FMT_VARIADIC(AString, Printf, const char *)
+extern AString vPrintf(const char * format, fmt::printf_args args);
+template <typename... Args>
+AString Printf(const char * a_Format, const Args & ... args)
+{
+ return vPrintf(a_Format, fmt::make_printf_args(args...));
+}
/** Add the formated string to the existing data in the string.
Returns a_Dst. */
+extern AString & vAppendPrintf(AString & a_Dst, const char * a_Format, fmt::printf_args args);
template <typename... Args>
-extern AString & AppendPrintf(AString & a_Dst, const char * format, const Args & ... args)
+extern AString & AppendPrintf(AString & a_Dst, const char * a_Format, const Args & ... a_Args)
{
- a_Dst += Printf(format, args...);
- return a_Dst;
+ return vAppendPrintf(a_Dst, a_Format, fmt::make_printf_args(a_Args...));
}
/** Split the string at any of the listed delimiters.