Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

PlainAbuseAddiesCache.h

Go to the documentation of this file.
00001 #ifndef PLAINABUSEADDIESCACHE_H
00002 #define PLAINABUSEADDIESCACHE_H
00003 
00004 #include <abuse/AbuseAddiesCache.h>
00005 #include <abuse/UrlRange.h>
00006 
00007 class PlainAbuseAddiesCache: public AbuseAddiesCache
00008 {
00009 public:
00010         PlainAbuseAddiesCache(const std::string& filename)throw(std::runtime_error);
00011         virtual ~PlainAbuseAddiesCache();
00012         virtual std::list<std::string> query(const std::string& domain)const throw(std::runtime_error);
00013         virtual std::list<std::string> query(const Url& url)const throw(std::runtime_error);
00014         virtual void add(const UrlRange& range,const std::list<std::string>& addies)throw(std::runtime_error);
00015 private:
00016         std::string m_filename;
00017         struct Entry
00018         {
00019                 UrlRange range;
00020                 std::list<std::string> addies;
00021                 bool operator==(const Url& url)const
00022                 {return Url::inNet(url,range);}
00023                 bool operator<(const Entry& entry)const
00024                 {
00025                         if(range.from<entry.range.from)
00026                                 return true;
00027                         else if(entry.range.from<range.from)
00028                                 return false;
00029                         return (range.to>entry.range.to);
00030                 }
00031                 Entry():range(Url("0.0.0.0"),Url("0.0.0.0")){}
00032         };
00033         typedef std::list<Entry> List;
00034         List m_list;
00035         void init(const std::string& buf)throw(std::runtime_error);
00036         void save()throw(std::runtime_error);
00037 };
00038 
00039 #endif

Generated on Thu Jun 16 00:13:24 2005 for Abuse! by  doxygen 1.4.3