Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Config.h

Go to the documentation of this file.
00001 #ifndef BUFFYCONFIG_H
00002 #define BUFFYCONFIG_H
00003 
00004 #pragma interface
00005 
00006 #include <buffy/Exception.h>
00007 #include <buffy/MailProgram.h>
00008 #include <libxml++/libxml++.h>
00009 
00010 class Config
00011 {
00012 protected:
00013     xmlpp::DomParser _xmlparser;
00014 
00015     // Cached elements
00016     xmlpp::Document* doc_conf;
00017     xmlpp::Element* _view_empty;
00018     xmlpp::Element* _view_read;
00019     xmlpp::Element* _view_important;
00020     xmlpp::Element* _interval;
00021 
00022     // State directory
00023     std::string rcfile;
00024 
00025     xmlpp::Element* el_root() const throw ();
00026     xmlpp::Element* el_general() const throw ();
00027     xmlpp::Element* el_view() const throw ();
00028     xmlpp::Element* el_view_empty() throw ();
00029     xmlpp::Element* el_view_read() throw ();
00030     xmlpp::Element* el_view_important() throw ();
00031     xmlpp::Element* el_locations() const throw ();
00032     xmlpp::Element* el_interval() throw ();
00033     xmlpp::Element* el_programs() const throw ();
00034     xmlpp::Element* el_mailboxes() const throw ();
00035     xmlpp::Element* el_applications() const throw ();
00036     xmlpp::Element* el_folders() const throw ();
00037     xmlpp::Element* el_app(const std::string& appname) const throw ();
00038     xmlpp::Element* el_folder(const MailFolder& folder) const throw ();
00039 
00040     void loadConfiguration(const std::string& fname) throw (SystemException, ConsistencyCheckException);
00041 
00042 public:
00043     Config() throw (SystemException, ConsistencyCheckException);
00044     Config(const std::string& fname) throw (SystemException, ConsistencyCheckException);
00045     ~Config() throw ();
00046 
00047     bool get_view_read() throw ();
00048     bool get_view_empty() throw ();
00049     bool get_view_important() throw ();
00050 
00051     void set_view_read(bool val) throw ();
00052     void set_view_empty(bool val) throw ();
00053     void set_view_important(bool val) throw ();
00054 
00055     /*
00056     bool get_view_read(const MailFolder& mf) throw ();
00057     bool get_view_empty(const MailFolder& mf) throw ();
00058     bool get_view_important(const MailFolder& mf) throw ();
00059 
00060     void set_view_read(const MailFolder& mf, bool val) throw ();
00061     void set_view_empty(const MailFolder& mf, bool val) throw ();
00062     void set_view_important(const MailFolder& mf, bool val) throw ();
00063     */
00064 
00065     int get_update_interval() throw ();
00066     void set_update_interval(int val) throw ();
00067 
00068     std::vector<std::string> get_folder_locations() throw ();
00069     void set_folder_locations(const std::vector<std::string>& locations) throw ();
00070 
00071     std::vector<MailProgram> get_mail_programs() throw ();
00072     void set_mail_programs(const std::vector<MailProgram>& programs) throw ();
00073     MailProgram get_selected_mail_program() throw ();
00074 
00075     std::string get_application_data(
00076             const std::string& app,
00077             const std::string& key,
00078             const std::string& def="") throw ();
00079 
00080     void set_application_data(
00081             const std::string& app,
00082             const std::string& key,
00083             const std::string& val) throw ();
00084 
00085     std::string get_folder_data(
00086             const MailFolder& folder,
00087             const std::string& key,
00088             const std::string& def="") throw ();
00089 
00090     void set_folder_data(
00091             const MailFolder& folder,
00092             const std::string& key,
00093             const std::string& val) throw ();
00094 
00095     void save() throw (ConsistencyCheckException);
00096     void save(const std::string& file) throw (ConsistencyCheckException);
00097 };
00098 
00099 
00100 // vim:set ts=4 sw=4:
00101 #endif

Generated on Mon Jul 25 19:53:32 2005 for libbuffy by  doxygen 1.4.3-20050530