diff options
| author | 2019-01-25 15:17:37 +0000 | |
|---|---|---|
| committer | 2019-01-25 15:17:37 +0000 | |
| commit | 0fab643858dfd2183cb545243d230d3ff84446b2 (patch) | |
| tree | c50161f9e2539255132b90301b6f6ad01ef2224c /include/modules | |
| parent | Remove support for the deprecated rfc1459 casemapping, (diff) | |
Convert repetitive functions to use C++11 variadic templates.
Diffstat (limited to 'include/modules')
| -rw-r--r-- | include/modules/stats.h | 90 | ||||
| -rw-r--r-- | include/modules/whois.h | 40 |
2 files changed, 6 insertions, 124 deletions
diff --git a/include/modules/stats.h b/include/modules/stats.h index e69070c9f..0d82f9f9a 100644 --- a/include/modules/stats.h +++ b/include/modules/stats.h @@ -97,95 +97,11 @@ class Stats::Context */ void AddRow(const Row& row) { rows.push_back(row); } - template <typename T1> - void AddRow(unsigned int numeric, T1 p1) + template <typename... Param> + void AddRow(unsigned int numeric, Param... p) { Row n(numeric); - n.push(p1); - AddRow(n); - } - - template <typename T1, typename T2> - void AddRow(unsigned int numeric, T1 p1, T2 p2) - { - Row n(numeric); - n.push(p1); - n.push(p2); - AddRow(n); - } - - template <typename T1, typename T2, typename T3> - void AddRow(unsigned int numeric, T1 p1, T2 p2, T3 p3) - { - Row n(numeric); - n.push(p1); - n.push(p2); - n.push(p3); - AddRow(n); - } - - template <typename T1, typename T2, typename T3, typename T4> - void AddRow(unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4) - { - Row n(numeric); - n.push(p1); - n.push(p2); - n.push(p3); - n.push(p4); - AddRow(n); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5> - void AddRow(unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5) - { - Row n(numeric); - n.push(p1); - n.push(p2); - n.push(p3); - n.push(p4); - n.push(p5); - AddRow(n); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> - void AddRow(unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6) - { - Row n(numeric); - n.push(p1); - n.push(p2); - n.push(p3); - n.push(p4); - n.push(p5); - n.push(p6); - AddRow(n); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> - void AddRow(unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7) - { - Row n(numeric); - n.push(p1); - n.push(p2); - n.push(p3); - n.push(p4); - n.push(p5); - n.push(p6); - n.push(p7); - AddRow(n); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> - void AddRow(unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8) - { - Row n(numeric); - n.push(p1); - n.push(p2); - n.push(p3); - n.push(p4); - n.push(p5); - n.push(p6); - n.push(p7); - n.push(p8); + n.push(std::forward<Param>(p)...); AddRow(n); } }; diff --git a/include/modules/whois.h b/include/modules/whois.h index 4f09d268b..6cde7b29c 100644 --- a/include/modules/whois.h +++ b/include/modules/whois.h @@ -97,45 +97,11 @@ class Whois::Context /** Send a line of WHOIS data to the source of the WHOIS */ - template <typename T1> - void SendLine(unsigned int numeric, T1 p1) + template <typename... Param> + void SendLine(unsigned int numeric, Param... p) { Numeric::Numeric n(numeric); - n.push(target->nick); - n.push(p1); - SendLine(n); - } - - template <typename T1, typename T2> - void SendLine(unsigned int numeric, T1 p1, T2 p2) - { - Numeric::Numeric n(numeric); - n.push(target->nick); - n.push(p1); - n.push(p2); - SendLine(n); - } - - template <typename T1, typename T2, typename T3> - void SendLine(unsigned int numeric, T1 p1, T2 p2, T3 p3) - { - Numeric::Numeric n(numeric); - n.push(target->nick); - n.push(p1); - n.push(p2); - n.push(p3); - SendLine(n); - } - - template <typename T1, typename T2, typename T3, typename T4> - void SendLine(unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4) - { - Numeric::Numeric n(numeric); - n.push(target->nick); - n.push(p1); - n.push(p2); - n.push(p3); - n.push(p4); + n.push(std::forward<Param>(p)...); SendLine(n); } |
