Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

presenceDB.hh

00001 // presenceDB.hh
00002 // Jabber client library
00003 //
00004 // Original Code Copyright (C) 1999-2001 Dave Smith (dave@jabber.org)
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 // Contributor(s): Julian Missig
00021 //
00022 // This Original Code has been modified by IBM Corporation. Modifications 
00023 // made by IBM described herein are Copyright (c) International Business 
00024 // Machines Corporation, 2002.
00025 //
00026 // Date             Modified by     Description of modification
00027 // 01/20/2002       IBM Corp.       Updated to libjudo 1.1.1
00028 // 2002-03-05       IBM Corp.       Updated to libjudo 1.1.5
00029 // 2002-07-09       IBM Corp.       Added Roster::getSession()
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 } // namespace jabberoo
00126 
00127 #endif // PRESENCEDB_HH 1

Generated on Thu Jul 24 13:31:51 2003 for jabberoo by doxygen1.3-rc3