ionflux.org | Impressum

ConfigMap.hpp

Go to the documentation of this file.
00001 #ifndef IONFLUX_TOOLS_CONFIG_MAP
00002 #define IONFLUX_TOOLS_CONFIG_MAP
00003 /* ==========================================================================
00004  * Ionflux Tools
00005  * Copyright (c) 2004 Joern P. Meier
00006  * mail@ionflux.org
00007  * --------------------------------------------------------------------------
00008  * ConfigMap.hpp                    Configuration map.
00009  * ==========================================================================
00010  * 
00011  * This file is part of Ionflux Tools.
00012  * 
00013  * Ionflux Tools is free software; you can redistribute it and/or modify it 
00014  * under the terms of the GNU General Public License as published by the Free
00015  * Software Foundation; either version 2 of the License, or (at  your option)
00016  * any later version.
00017  * 
00018  * Ionflux Tools is distributed in the hope that it will be useful, but 
00019  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00020  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00021  * for more details.
00022  * 
00023  * You should have received a copy of the GNU General Public License
00024  * along with Ionflux Tools; if not, write to the Free Software Foundation, 
00025  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00026  * 
00027  * ========================================================================== */
00028 
00029 #include <pcre.h>
00030 #include <string>
00031 #include <iostream>
00032 #include <fstream>
00033 #include <map>
00034 #include <vector>
00035 #include "ionflux/Config.hpp"
00036 
00037 namespace Ionflux
00038 {
00039 
00040 namespace Tools
00041 {
00042 
00048 class ConfigMap
00049 : public Config
00050 {
00051     protected:
00053         std::vector<std::string> configInput;
00055         std::string inputFile;
00057         std::map<std::string, std::string> config;
00059         std::vector<std::string> newKeys;
00061         pcre *configRE;
00063         pcre *commentRE;
00064         
00070         virtual void init();
00071         
00080         virtual ConfigOption parseConfigLine(const std::string& configLine);
00081         
00088         virtual void updateInputData();
00089         
00090     public:
00092         static const std::string CONFIG_PATTERN; 
00094         static const std::string COMMENT_PATTERN;
00095         
00100         ConfigMap();
00101         
00106         virtual ~ConfigMap();
00107         
00113         virtual void clear();
00114         
00122         virtual void readConfig(const std::string& configFile);
00123         
00131         virtual void writeConfig(const std::string& configFile);
00132         
00138         virtual void writeConfig();
00139         
00150         virtual std::string get(const std::string& key);
00151         
00159         virtual void set(const std::string& key, const std::string& value);
00160         
00161 };
00162 
00163 }
00164 
00165 }
00166 
00170 #endif

Generated on Tue Mar 14 20:58:29 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6