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