MailFolder.h

Go to the documentation of this file.
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 #include <buffy/Consumer.h>
00025 #include <buffy/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 // vim:set ts=4 sw=4:
00141 #endif

Generated on Fri Aug 25 14:17:12 2006 for libbuffy by  doxygen 1.4.7