00001 #ifndef BUFFY_MAILFOLDER_H
00002 #define BUFFY_MAILFOLDER_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <buffy/utils/consumer.h>
00025 #include <buffy/utils/smartpointer.h>
00026 #include <string>
00027 #include <vector>
00028
00029 namespace buffy {
00030
00031 class MailFolderImpl : public SmartPointerItem
00032 {
00033 public:
00034 virtual ~MailFolderImpl() {}
00035
00036 virtual const std::string& name() const throw () = 0;
00037 virtual const std::string& path() const throw () = 0;
00038 virtual std::string type() const throw () = 0;
00039
00040 virtual int getMsgTotal() const throw () = 0;
00041 virtual int getMsgUnread() const throw () = 0;
00042 virtual int getMsgNew() const throw () = 0;
00043 virtual int getMsgFlagged() const throw () = 0;
00044
00045 virtual bool changed() = 0;
00046
00047 virtual void updateStatistics() = 0;
00048 };
00049
00050 class MailFolder : public SmartPointer<MailFolderImpl>
00051 {
00052 public:
00053 MailFolder() throw () : SmartPointer<MailFolderImpl>() {}
00054 MailFolder(const MailFolder& mf) throw () : SmartPointer<MailFolderImpl>(mf) {}
00055 MailFolder(MailFolderImpl* otherimpl) throw () : SmartPointer<MailFolderImpl>(otherimpl) {}
00056
00060 bool valid() const throw () { return impl; }
00061
00065 const std::string& name() const throw () { return impl->name(); }
00066
00070 const std::string& path() const throw () { return impl->path(); }
00071
00077 std::string type() const throw () { return impl->type(); }
00078
00082 int getMsgTotal() const throw () { return impl->getMsgTotal(); }
00083
00087 int getMsgUnread() const throw () { return impl->getMsgUnread(); }
00088
00092 int getMsgNew() const throw () { return impl->getMsgNew(); }
00093
00097 int getMsgFlagged() const throw () { return impl->getMsgFlagged(); }
00098
00106 bool changed() { return impl->changed(); }
00107
00111 void updateStatistics()
00112 {
00113 impl->updateStatistics();
00114 }
00115
00122 static MailFolder accessFolder(const std::string& path);
00123
00127 static void enumerateFolders(const std::string& path, Consumer<MailFolder>& cons);
00128
00132 static std::vector<MailFolder> enumerateFolders(const std::string& path);
00133 };
00134
00135 typedef Consumer<MailFolder> MailFolderConsumer;
00136 typedef Filter<MailFolder> MailFolderFilter;
00137
00138 }
00139
00140
00141 #endif