Files
pokerth/src/config/configfile.h
T

67 lines
2.2 KiB
C++
Raw Normal View History

2007-01-21 16:01:37 +00:00
/***************************************************************************
* Copyright (C) 2006 by Felix Hammer *
* f.hammer@web.de *
* *
* This program 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 2 of the License, or *
* (at your option) any later version. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef CONFIGFILE_H
#define CONFIGFILE_H
#include "tinyxml.h"
#include <string>
2007-05-08 20:54:36 +00:00
#include <iostream>
#include <sstream>
enum ConfigState { NONEXISTING, OLD };
enum ConfigType { CONFIG_TYPE_INT, CONFIG_TYPE_STRING };
2007-01-21 16:01:37 +00:00
2007-04-21 20:42:50 +00:00
2007-01-21 16:01:37 +00:00
class ConfigFile{
public:
2007-05-05 19:02:11 +00:00
ConfigFile(bool configFirstStart =0);
2007-01-21 16:01:37 +00:00
~ConfigFile();
2007-05-05 20:11:49 +00:00
2007-05-08 20:54:36 +00:00
void updateConfig(ConfigState);
2007-04-20 08:18:18 +00:00
2007-02-03 22:47:16 +00:00
std::string readConfigString(std::string varName);
2007-01-22 21:29:51 +00:00
void writeConfigString(std::string varName, std::string varCont);
2007-01-21 22:44:11 +00:00
2007-02-03 22:47:16 +00:00
int readConfigInt(std::string varName);
2007-01-22 21:29:51 +00:00
void writeConfigInt(std::string varName, int varCont);
2007-01-21 22:44:11 +00:00
2007-04-18 00:11:24 +00:00
2007-04-20 23:14:08 +00:00
private:
2007-05-08 20:54:36 +00:00
struct ConfigInfo
{
ConfigInfo(const std::string &n, ConfigType t, const std::string &d) : name(n), type(t), defaultValue(d) {}
std::string name;
ConfigType type;
std::string defaultValue;
};
2007-04-20 23:14:08 +00:00
std::string configFileName;
std::string logDir;
std::string dataDir;
2007-04-20 08:18:18 +00:00
int configRev;
2007-05-05 20:11:49 +00:00
2007-05-08 20:54:36 +00:00
ConfigState myConfigState;
2007-01-21 16:01:37 +00:00
};
#endif