diff options
| author | Adam <Adam@anope.org> | 2014-06-26 19:30:28 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2014-06-26 19:30:28 -0400 |
| commit | d492923610d9c9146b2a2b63de38deab2cfd4ca7 (patch) | |
| tree | 5a3663883bd8247e10eeae4f334c4c6a36ccef96 /include | |
| parent | ee3289029d61da12013e0f5a3e4faf2d07543a0e (diff) | |
Change NumberList to take std::function's and use lambda closures
instead of having to create full classes in order to process number
lists.
Diffstat (limited to 'include')
| -rw-r--r-- | include/lists.h | 31 |
1 files changed, 4 insertions, 27 deletions
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<unsigned> numbers; + std::function<void(void)> 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<void(unsigned int)> nf, std::function<void(void)> 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. |
