00001 #ifndef MAILFOLDER_H 00002 #define MAILFOLDER_H 00003 00004 /* 00005 * Abstract interface to mail folders 00006 * 00007 * Copyright (C) 2003 Enrico Zini <enrico@debian.org> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 #pragma interface 00025 00026 #include <buffy/Consumer.h> 00027 #include <buffy/SmartPointer.h> 00028 #include <string> 00029 #include <vector> 00030 00031 class MailFolderImpl : public SmartPointerItem 00032 { 00033 public: 00034 virtual const std::string& name() const throw () = 0; 00035 virtual const std::string& path() const throw () = 0; 00036 virtual std::string type() const throw () = 0; 00037 00038 virtual int getMsgTotal() const throw () = 0; 00039 virtual int getMsgUnread() const throw () = 0; 00040 virtual int getMsgNew() const throw () = 0; 00041 virtual int getMsgFlagged() const throw () = 0; 00042 00043 virtual bool changed() = 0; 00044 00045 virtual void updateStatistics() = 0; 00046 }; 00047 00048 class MailFolder : public SmartPointer<MailFolderImpl> 00049 { 00050 public: 00051 MailFolder() throw () : SmartPointer<MailFolderImpl>() {} 00052 MailFolder(const MailFolder& mf) throw () : SmartPointer<MailFolderImpl>(mf) {} 00053 MailFolder(MailFolderImpl* otherimpl) throw () : SmartPointer<MailFolderImpl>(otherimpl) {} 00054 00055 const std::string& name() const throw () { return impl->name(); } 00056 const std::string& path() const throw () { return impl->path(); } 00057 std::string type() const throw () { return impl->type(); } 00058 00059 int getMsgTotal() const throw () { return impl->getMsgTotal(); } 00060 int getMsgUnread() const throw () { return impl->getMsgUnread(); } 00061 int getMsgNew() const throw () { return impl->getMsgNew(); } 00062 int getMsgFlagged() const throw () { return impl->getMsgFlagged(); } 00063 00065 bool changed() { return impl->changed(); } 00066 00068 void updateStatistics() 00069 { 00070 impl->updateStatistics(); 00071 } 00072 00073 // static void enumerateFoldersSwig(const char* path, Consumer<MailFolder>& cons); 00074 static void enumerateFolders(const std::string& path, Consumer<MailFolder>& cons); 00075 static std::vector<MailFolder> enumerateFolders(const std::string& path); 00076 }; 00077 00078 typedef Consumer<MailFolder> MailFolderConsumer; 00079 typedef Filter<MailFolder> MailFolderFilter; 00080 00081 // vim:set ts=4 sw=4: 00082 #endif