presage  0.8.7
configuration.h
Go to the documentation of this file.
00001 
00002 /******************************************************
00003  *  Presage, an extensible predictive text entry system
00004  *  ---------------------------------------------------
00005  *
00006  *  Copyright (C) 2008  Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License along
00019     with this program; if not, write to the Free Software Foundation, Inc.,
00020     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00021                                                                              *
00022                                                                 **********(*)*/
00023 
00024 
00025 #ifndef PRESAGE_CONFIGURATION
00026 #define PRESAGE_CONFIGURATION
00027 
00028 #include <map>
00029 
00030 #include "variable.h"
00031 #include "../presageException.h"
00032 
00036 class Configuration {
00037 public:
00038     Configuration();
00039     ~Configuration();
00040 
00041     Variable* find (const std::string& variable) const;
00042     void insert (const std::string& variable, const std::string& value);
00043     void remove (const std::string& variable);
00044 
00045     Variable* operator[](const std::string& variable) const;
00046 
00047     void print() const;
00048 
00049     std::map<std::string, Variable*>::const_iterator begin () const;
00050     std::map<std::string, Variable*>::const_iterator end   () const;
00051 
00052     class ConfigurationException : public PresageException {
00053     public:
00054         ConfigurationException(presage_error_code_t error_code, const std::string& desc) throw() : PresageException(error_code, desc) { }
00055         virtual ~ConfigurationException() throw() { }
00056 
00057     private:
00058         ConfigurationException() throw() : PresageException (PRESAGE_ERROR, "") { }
00059 
00060     };
00061 
00062 private:
00063     std::map<std::string, Variable*>* configuration;
00064 
00065 };
00066 
00067 #endif // PRESAGE_CONFIGURATION