ionflux.org | Impressum

Config.hpp

Go to the documentation of this file.
00001 #ifndef IONFLUX_TOOLS_CONFIG
00002 #define IONFLUX_TOOLS_CONFIG
00003 /* ==========================================================================
00004  * Ionflux Tools
00005  * Copyright (c) 2004 Joern P. Meier
00006  * mail@ionflux.org
00007  * --------------------------------------------------------------------------
00008  * Config.hpp                    Configuration wrapper (abstract class)
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 
00036 namespace Ionflux
00037 {
00038 
00039 namespace Tools
00040 {
00041 
00054 struct ConfigOption
00055 {
00057     std::string key;
00059     std::string value;
00060 };
00061 
00066 struct ConfigLine
00067 {
00074     ConfigOption option;
00076     int type;
00078     static const int CL_INVALID;
00080     static const int CL_OPTION;
00082     static const int CL_COMMENT;
00084     static const int CL_BLANK;
00086     static const int CL_NESTED;
00088     static const int CL_ROOT_DATA;
00089 };
00090 
00096 class Config
00097 {
00098     public:
00103         Config() { };
00104         
00109         virtual ~Config() { };
00110         
00116         virtual void clear() = 0;
00117         
00125         virtual void readConfig(const std::string& configFile) = 0;
00126         
00134         virtual void writeConfig(const std::string& configFile) = 0;
00135         
00141         virtual void writeConfig() = 0;
00142         
00153         virtual std::string get(const std::string& key) = 0;
00154         
00162         virtual void set(const std::string& key, const std::string& value) = 0;
00163         
00164 };
00165 
00167 
00168 }
00169 
00170 }
00171 
00175 #endif

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