SilentEye 0.4.1
|
00001 // This file is part of SilentEye. 00002 // 00003 // SilentEye is free software: you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation, either version 3 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // SilentEye is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with SilentEye. If not, see <http://www.gnu.org/licenses/>. 00015 00016 #ifndef CONFIG_H_ 00017 #define CONFIG_H_ 00018 00019 #include <QtCore> 00020 #include <QDomDocument> 00021 #include <QDomElement> 00022 00023 #include "logger.h" 00024 00025 namespace SilentEyeFramework { 00026 00028 class Config : QObject 00029 { 00030 private: 00031 bool m_isLoaded; 00032 QString m_filename; 00033 QString m_filepath; 00034 QString m_content; 00035 QMap<QString, QString> m_valueMap; 00036 QPointer<Logger> m_logger; 00037 00038 public: 00039 Config(QObject* parent=0); 00040 Config(QString filePath, QString filename, bool=false, QObject* parent=0); 00041 Config(const QString& content, QObject* parent=0); 00042 Config(const Config& config); 00043 ~Config(); 00044 00045 QString filename() const; 00046 QString filepath() const; 00047 QMap<QString, QString> values() const; 00048 00049 void set(const QString name, const QString value); 00050 QString get(const QString name) const; 00051 bool contains(const QString name) const; 00052 00053 void save(); 00054 bool isLoaded() const; 00055 00056 Config& operator=(const Config& config); 00057 00058 private: 00059 bool load(); 00060 00061 //public: 00062 // static QString path(){ return "config/"; }; 00063 }; 00064 00065 } 00066 00067 #endif