00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef PRESENCEDB_HH
00034 #define PRESENCEDB_HH
00035
00036 #include <sigc++/object.h>
00037 #include <XCP.hh>
00038
00039 #include <string>
00040 #include <list>
00041 #include <map>
00042 #include <jabberoofwd.h>
00043 #include <jutil.hh>
00044
00045 namespace jabberoo
00046 {
00054 class PresenceDB
00055 : public SigC::Object
00056 {
00057 public:
00058 typedef std::list<Presence>::iterator iterator;
00059 typedef std::list<Presence>::const_iterator const_iterator;
00060 typedef std::pair<const_iterator, const_iterator> range;
00067 class XCP_InvalidJID : public XCP{};
00068
00075 PresenceDB(Session& s);
00076 public:
00081 void insert(const Presence& p);
00088 void remove(const std::string& jid);
00092 void clear();
00098 range equal_range(const std::string& jid) const;
00104 const_iterator find(const std::string& jid) const;
00110 Presence findExact(const std::string& jid) const;
00114 bool contains(const std::string& jid) const;
00118 bool available(const std::string& jid) const;
00119 private:
00120 typedef std::map<std::string, std::list<Presence>, jutil::CaseInsensitiveCmp > db;
00121 db::const_iterator find_or_throw(const std::string& jid) const;
00122 Session& _Owner;
00123 db _DB;
00124 };
00125 }
00126
00127 #endif // PRESENCEDB_HH 1