00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2005, 2006, 2008 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see 00017 // <http://www.gnu.org/licenses/>. 00018 // 00019 00020 #ifndef LIBAEGIS_RFC822_H 00021 #define LIBAEGIS_RFC822_H 00022 00023 #include <common/symtab/template.h> 00024 #include <libaegis/output.h> 00025 00026 class input; // forward 00027 00034 class rfc822 00035 { 00036 public: 00040 virtual ~rfc822(); 00041 00045 rfc822(); 00046 00050 rfc822(const rfc822 &arg); 00051 00055 rfc822 &operator=(const rfc822 &arg); 00056 00065 void set(const nstring &name, const nstring &value); 00066 00077 void set_minimalist(const nstring &name, const nstring &value); 00078 00088 void set(const nstring &name, long value); 00089 00099 void set(const nstring &name, unsigned long value); 00100 00110 void set(const nstring &name, bool value); 00111 00120 bool is_set(const nstring &name) const; 00121 00132 const nstring &get(const nstring &name); 00133 00143 nstring get(const nstring &name) const; 00144 00157 long get_long(const nstring &name); 00158 00171 unsigned long get_ulong(const nstring &name); 00172 00181 void load(input &src, bool maybe_not = false); 00182 00190 void load_from_file(const nstring &filename); 00191 00199 void store(output::pointer dst); 00200 00208 void store_to_file(const nstring &filename); 00209 00214 bool empty() const { return database.empty(); } 00215 00220 static nstring date(); 00221 00225 void keys(nstring_list &result) { database.keys(result); } 00226 00230 void clear(); 00231 00232 private: 00237 symtab<nstring> database; 00238 00247 static nstring sanitize_name(const nstring &name); 00248 }; 00249 00250 #endif // LIBAEGIS_RFC822_H