00001 #ifndef MAILPROGRAM_H
00002 #define MAILPROGRAM_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
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
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
00094 #endif