/* Copyright (C) 2008 John Hobbs - john@velvetcache.org This file is part of libvcconfig. libvcconfig is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. libvcconfig is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with libvcconfig. If not, see . */ #ifndef VCCONFIG_H #define VCCONFIG_H #include #include #include #include using std::string; using std::map; using std::pair; using std::stringstream; using std::fstream; class vcConfig; /* Todo: Move to new data structure map> - Char is the data type, string (in pair) is the representation, other string is key Support comments? Support order? (non-alphabetic) Check for keys by vector Throw exceptions. */ /*! Very simple config file handler. Uses basic KEY=value Skips blank lines and lines starting with # */ class vcConfig { public: vcConfig(); ~vcConfig(); vcConfig(const vcConfig &); bool loadFile(string); bool saveFile(string); void set(string, string); void set(string, bool); void set(string, int); string getString(string); bool getBool(string); int getInt(string); string toString(); void fromString(string); void clear(); int size(); bool isSet(string); bool areSet(string [], int); static string getVersion(); void operator = (vcConfig); private: map items; map::iterator it; void setReal(string,string); }; #endif