aboutsummaryrefslogtreecommitdiff
path: root/include/clientprotocol.h
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-11-11 22:19:54 +0000
committerGravatar Sadie Powell2020-11-12 12:41:43 +0000
commita16bac5e05cfde6dac1665612b84117fa2909d6a (patch)
treee1435e607fa51d29e4c31d6b5f352d69cc27c9b9 /include/clientprotocol.h
parentUse references instead of pointers for aliases. (diff)
Convert IRCv3::Replies::Reply#Send[IfCap] to variadic functions.
Diffstat (limited to 'include/clientprotocol.h')
-rw-r--r--include/clientprotocol.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/clientprotocol.h b/include/clientprotocol.h
index a162472f5..91bc0d0b4 100644
--- a/include/clientprotocol.h
+++ b/include/clientprotocol.h
@@ -355,6 +355,26 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
*/
void PushParam(const std::string& str) { params.push_back(Param(0, str)); }
+ /** Add a non-string parameter to the parameter list.
+ * @param arg1 Non-string to add, will be copied.
+ */
+ template<typename T>
+ void PushParam(T&& param)
+ {
+ PushParam(ConvToStr(param));
+ }
+
+ /** Adds a variable number of parameters to the parameter list.
+ * @param arg1 The first argument to push.
+ * @param args A variable number of arguments to push.
+ */
+ template<typename FirstArg, typename... FwdArgs>
+ void PushParam(FirstArg&& arg1, FwdArgs&&... args)
+ {
+ PushParam(arg1);
+ PushParam(std::forward<FwdArgs>(args)...);
+ }
+
/** Add a parameter to the parameter list.
* @param str String to add.
* The string will NOT be copied, it must remain alive until ClearParams() is called or until the object is destroyed.