mailfolder.h
Go to the documentation of this file.
#ifndef BUFFY_MAILFOLDER_H
#define BUFFY_MAILFOLDER_H
/*
* Abstract interface to mail folders
*
* Copyright (C) 2003--2008 Enrico Zini <enrico@debian.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <buffy/utils/consumer.h>
#include <buffy/utils/smartpointer.h>
#include <string>
#include <vector>
namespace buffy {
class MailFolderImpl : public SmartPointerItem
{
public:
virtual ~MailFolderImpl() {}
virtual const std::string& name() const throw () = 0;
virtual const std::string& path() const throw () = 0;
virtual std::string type() const throw () = 0;
virtual int getMsgTotal() const throw () = 0;
virtual int getMsgUnread() const throw () = 0;
virtual int getMsgNew() const throw () = 0;
virtual int getMsgFlagged() const throw () = 0;
virtual bool changed() = 0;
virtual void updateStatistics() = 0;
};
class MailFolder : public SmartPointer<MailFolderImpl>
{
public:
MailFolder() throw () : SmartPointer<MailFolderImpl>() {}
MailFolder(const MailFolder& mf) throw () : SmartPointer<MailFolderImpl>(mf) {}
MailFolder(MailFolderImpl* otherimpl) throw () : SmartPointer<MailFolderImpl>(otherimpl) {}
bool valid() const throw () { return impl; }
const std::string& name() const throw () { return impl->name(); }
const std::string& path() const throw () { return impl->path(); }
std::string type() const throw () { return impl->type(); }
int getMsgTotal() const throw () { return impl->getMsgTotal(); }
int getMsgUnread() const throw () { return impl->getMsgUnread(); }
int getMsgNew() const throw () { return impl->getMsgNew(); }
int getMsgFlagged() const throw () { return impl->getMsgFlagged(); }
bool changed() { return impl->changed(); }
void updateStatistics()
{
impl->updateStatistics();
}
static MailFolder accessFolder(const std::string& path);
static void enumerateFolders(const std::string& path, Consumer<MailFolder>& cons);
static std::vector<MailFolder> enumerateFolders(const std::string& path);
};
typedef Consumer<MailFolder> MailFolderConsumer;
typedef Filter<MailFolder> MailFolderFilter;
}
// vim:set ts=4 sw=4:
#endif
buffy::MailFolderImpl::getMsgUnread
virtual int getMsgUnread() const =0
buffy::MailFolderImpl::getMsgFlagged
virtual int getMsgFlagged() const =0
buffy::MailFolderImpl::~MailFolderImpl
virtual ~MailFolderImpl()
Definition: mailfolder.h:34
buffy::MailFolder::path
const std::string & path() const
Return the path to this mail folder.
Definition: mailfolder.h:70
buffy::MailFolder::MailFolder
MailFolder(const MailFolder &mf)
Definition: mailfolder.h:54
buffy::MailFolderImpl::changed
virtual bool changed()=0
buffy::MailFolderImpl::getMsgTotal
virtual int getMsgTotal() const =0
buffy::MailFolder::valid
bool valid() const
Return true if this MailFolder is not a null mail folder.
Definition: mailfolder.h:60
buffy::MailFolderImpl::updateStatistics
virtual void updateStatistics()=0
std
buffy::MailFolder
Definition: mailfolder.h:50
buffy::MailFolder::changed
bool changed()
Return true if the folder has been changed since the last updateStatistics.
Definition: mailfolder.h:106
buffy::MailFolder::type
std::string type() const
Return the name of the type of this mail folder.
Definition: mailfolder.h:77
buffy::MailFolder::updateStatistics
void updateStatistics()
Rescan the folder to update its statistics.
Definition: mailfolder.h:111
buffy::MailFolder::name
const std::string & name() const
Return the presentation name of this mail folder.
Definition: mailfolder.h:65
buffy::MailFolderImpl::name
virtual const std::string & name() const =0
buffy::MailFolder::getMsgUnread
int getMsgUnread() const
Get the number of unread messages.
Definition: mailfolder.h:87
buffy::MailFolderConsumer
Consumer< MailFolder > MailFolderConsumer
Definition: mailfolder.h:135
buffy::MailFolder::MailFolder
MailFolder(MailFolderImpl *otherimpl)
Definition: mailfolder.h:55
buffy::MailFolderImpl::getMsgNew
virtual int getMsgNew() const =0
buffy::MailFolder::MailFolder
MailFolder()
Definition: mailfolder.h:53
buffy::MailFolderFilter
Filter< MailFolder > MailFolderFilter
Definition: mailfolder.h:136
buffy::MailFolderImpl::type
virtual std::string type() const =0
buffy::MailFolder::getMsgTotal
int getMsgTotal() const
Get the total number of messages.
Definition: mailfolder.h:82
buffy
Definition: mailfolder.h:29
buffy::MailFolderImpl
Definition: mailfolder.h:31
buffy::MailFolder::getMsgFlagged
int getMsgFlagged() const
Get the number of messages flagged 'important'.
Definition: mailfolder.h:97
buffy::MailFolder::getMsgNew
int getMsgNew() const
Get the number of new messages.
Definition: mailfolder.h:92
buffy::MailFolderImpl::path
virtual const std::string & path() const =0