From d492923610d9c9146b2a2b63de38deab2cfd4ca7 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 26 Jun 2014 19:30:28 -0400 Subject: Change NumberList to take std::function's and use lambda closures instead of having to create full classes in order to process number lists. --- include/lists.h | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/include/lists.h b/include/lists.h index c40d97e7d..2ca681453 100644 --- a/include/lists.h +++ b/include/lists.h @@ -24,39 +24,16 @@ */ class CoreExport NumberList { - private: - bool is_valid; - - std::set numbers; + std::function endf; - bool desc; public: /** Processes a numbered list * @param list The list - * @param descending True to make HandleNumber get called with numbers in descending order - */ - NumberList(const Anope::string &list, bool descending); - - /** Destructor, does nothing - */ - virtual ~NumberList(); - - /** Should be called after the constructors are done running. This calls the callbacks. - */ - void Process(); - - /** Called with a number from the list - * @param number The number + * @param descending True to call the number handler callback with the numbers in descending order */ - virtual void HandleNumber(unsigned number); + NumberList(const Anope::string &list, bool descending, std::function nf, std::function ef); - /** Called when there is an error with the numbered list - * Return false to immediatly stop processing the list and return - * This is all done before we start calling HandleNumber, so no numbers will have been processed yet - * @param list The list - * @return false to stop processing - */ - virtual bool InvalidRange(const Anope::string &list); + ~NumberList(); }; /** This class handles formatting LIST/VIEW replies. -- cgit