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 
00057     const std::string& name() const throw () { return impl->name(); }
00058     const std::string& path() const throw () { return impl->path(); }
00059     std::string type() const throw () { return impl->type(); }
00060 
00061     int getMsgTotal() const throw () { return impl->getMsgTotal(); }
00062     int getMsgUnread() const throw () { return impl->getMsgUnread(); }
00063     int getMsgNew() const throw () { return impl->getMsgNew(); }
00064     int getMsgFlagged() const throw () { return impl->getMsgFlagged(); }
00065 
00067     bool changed() { return impl->changed(); }
00068 
00070     void updateStatistics()
00071     {
00072         impl->updateStatistics();
00073     }
00074 
00075 //  static void enumerateFoldersSwig(const char* path, Consumer<MailFolder>& cons);
00076     static MailFolder accessFolder(const std::string& path);
00077     static void enumerateFolders(const std::string& path, Consumer<MailFolder>& cons);
00078     static std::vector<MailFolder> enumerateFolders(const std::string& path);
00079 };
00080 
00081 typedef Consumer<MailFolder> MailFolderConsumer;
00082 typedef Filter<MailFolder> MailFolderFilter;
00083 
00084 }
00085 
00086 // vim:set ts=4 sw=4:
00087 #endif

Generated on Wed Nov 30 18:18:30 2005 for libbuffy by  doxygen 1.4.5