lists.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * (C) 2003-2013 Anope Team
00004  * Contact us at team@anope.org
00005  *
00006  * Please read COPYING and README for further details.
00007  *
00008  * Based on the original code of Epona by Lara.
00009  * Based on the original code of Services by Andy Church.
00010  *
00011  */
00012 
00013 #ifndef LISTS_H
00014 #define LISTS_H
00015 
00016 #include "services.h"
00017 #include "anope.h"
00018 
00026 class CoreExport NumberList
00027 {
00028  private:
00029         bool is_valid;
00030 
00031         std::set<unsigned> numbers;
00032 
00033         bool desc;
00034  public:
00039         NumberList(const Anope::string &list, bool descending);
00040 
00043         virtual ~NumberList();
00044 
00047         void Process();
00048 
00052         virtual void HandleNumber(unsigned number);
00053 
00060         virtual bool InvalidRange(const Anope::string &list);
00061 };
00062 
00065 class CoreExport ListFormatter
00066 {
00067  public:
00068         typedef std::map<Anope::string, Anope::string> ListEntry;
00069  private:
00070         std::vector<Anope::string> columns;
00071         std::vector<ListEntry> entries;
00072  public:
00073         ListFormatter &AddColumn(const Anope::string &name);
00074         void AddEntry(const ListEntry &entry);
00075         bool IsEmpty() const;
00076         void Process(std::vector<Anope::string> &);
00077 };
00078 
00081 class CoreExport InfoFormatter
00082 {
00083         NickCore *nc;
00084         std::vector<std::pair<Anope::string, Anope::string> > replies;
00085         unsigned longest;
00086  public:
00087         InfoFormatter(NickCore *nc);
00088         void Process(std::vector<Anope::string> &);
00089         Anope::string &operator[](const Anope::string &key);
00090 };
00091 
00092 #endif // LISTS_H
00093