Aegis  4.25.D505
/home/archives/aegis/branch.4/branch.25/delta28933.505/libaegis/rfc822.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 2005, 2006, 2008, 2009, 2012 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/ac/sys/types.h>
00024 
00025 #include <common/symtab/template.h>
00026 #include <libaegis/output.h>
00027 
00028 class input; // forward
00029 
00036 class rfc822
00037 {
00038 public:
00042     virtual ~rfc822();
00043 
00047     rfc822();
00048 
00052     rfc822(const rfc822 &arg);
00053 
00057     rfc822 &operator=(const rfc822 &arg);
00058 
00067     void set(const nstring &name, const char *value);
00068 
00077     void set(const nstring &name, const nstring &value);
00078 
00089     void set_minimalist(const nstring &name, const nstring &value);
00090 
00100     void set(const nstring &name, long value);
00101 
00111     void set(const nstring &name, unsigned long value);
00112 
00128     void set_off_t(const nstring &name, off_t value);
00129 
00139     void set(const nstring &name, bool value);
00140 
00149     bool is_set(const nstring &name) const;
00150 
00161     const nstring &get(const nstring &name);
00162 
00172     nstring get(const nstring &name) const;
00173 
00186     long get_long(const nstring &name);
00187 
00200     unsigned long get_ulong(const nstring &name);
00201 
00214     off_t get_off_t(const nstring &name);
00215 
00216 
00228     void load(input &src, bool maybe_not = false);
00229 
00237     void load_from_file(const nstring &filename);
00238 
00246     void store(output::pointer dst);
00247 
00255     void store_to_file(const nstring &filename);
00256 
00261     bool empty() const { return database.empty(); }
00262 
00267     static nstring date();
00268 
00272     void keys(nstring_list &result) { database.keys(result); }
00273 
00277     void clear();
00278 
00279 private:
00284     symtab<nstring> database;
00285 
00294     static nstring sanitize_name(const nstring &name);
00295 };
00296 
00297 #endif // LIBAEGIS_RFC822_H
00298 // vim: set ts=8 sw=4 et :