MailProgram.h

Go to the documentation of this file.
00001 #ifndef MAILPROGRAM_H
00002 #define MAILPROGRAM_H
00003 
00004 /*
00005  * Mail program interface
00006  *
00007  * Copyright (C) 2004  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 <string>
00025 #include <buffy/SmartPointer.h>
00026 #include <buffy/Exception.h>
00027 #include <buffy/MailFolder.h>
00028 
00029 namespace buffy {
00030 
00031 class MailProgram;
00032 
00033 class MailProgramImpl : public SmartPointerItem
00034 {
00035 protected:
00036     std::string _name;
00037     std::string _command;
00038     bool _selected;
00039 
00040     //void on_exit();
00041     
00042 public:
00043     MailProgramImpl(const std::string& name, const std::string& command) throw ()
00044         : _name(name), _command(command), _selected(false) {}
00045     MailProgramImpl(const std::string& name, const std::string& command, bool selected) throw ()
00046         : _name(name), _command(command), _selected(selected) {}
00047     ~MailProgramImpl() throw () {}
00048 
00055     void run(const MailFolder& folder) throw (SystemException, ConsistencyCheckException);
00056 
00057     friend class MailProgram;
00058 };
00059 
00060 class MailProgram : public SmartPointer<MailProgramImpl>
00061 {
00062 public:
00063     MailProgram() throw () : SmartPointer<MailProgramImpl>() {}
00064     MailProgram(const MailProgram& mf) throw () : SmartPointer<MailProgramImpl>(mf) {}
00065     //MailProgram(MailProgramImpl* otherimpl) throw () : SmartPointer<MailProgramImpl>(otherimpl) {}
00066     MailProgram(const std::string& name, const std::string& command) throw ()
00067         : SmartPointer<MailProgramImpl>(new MailProgramImpl(name, command)) {}
00068     MailProgram(const std::string& name, const std::string& command, bool selected) throw ()
00069         : SmartPointer<MailProgramImpl>(new MailProgramImpl(name, command, selected)) {}
00070     
00071     const std::string& name() const throw () { return impl->_name; }
00072     const std::string& command() const throw () { return impl->_command; }
00073     bool selected() const throw () { return impl->_selected; }
00074 
00075     void setName(const std::string& name) throw () { impl->_name = name; }
00076     void setCommand(const std::string& command) throw () { impl->_command = command; }
00077     void setSelected(bool selected) throw () { impl->_selected = selected; }
00078 
00085     void run(const MailFolder& folder) throw (SystemException, ConsistencyCheckException)
00086     {
00087         impl->run(folder);
00088     }
00089 };
00090 
00091 }
00092 
00093 // vim:set ts=4 sw=4:
00094 #endif

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