Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
671 | werner | 1 | /******************************************************************************************** |
2 | ** iLand - an individual based forest landscape and disturbance model |
||
3 | ** http://iland.boku.ac.at |
||
4 | ** Copyright (C) 2009- Werner Rammer, Rupert Seidl |
||
5 | ** |
||
6 | ** This program is free software: you can redistribute it and/or modify |
||
7 | ** it under the terms of the GNU General Public License as published by |
||
8 | ** the Free Software Foundation, either version 3 of the License, or |
||
9 | ** (at your option) any later version. |
||
10 | ** |
||
11 | ** This program is distributed in the hope that it will be useful, |
||
12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
14 | ** GNU General Public License for more details. |
||
15 | ** |
||
16 | ** You should have received a copy of the GNU General Public License |
||
17 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
18 | ********************************************************************************************/ |
||
19 | |||
86 | Werner | 20 | #ifndef SettingMetaData_H |
21 | #define SettingMetaData_H |
||
22 | |||
23 | /** This helper class holds meta data (description, Urls, etc) about model settings. |
||
24 | Various types of settings (species, model, ...) are stored together. |
||
25 | */ |
||
26 | class SettingMetaData |
||
27 | { |
||
28 | public: |
||
29 | /// type of the setting |
||
30 | enum Type { SettingInvalid, SpeciesSetting, ModelSetting }; |
||
31 | SettingMetaData(); |
||
32 | SettingMetaData(const Type type, const QString &name, const QString &description, const QString &url, const QVariant defaultValue); |
||
87 | Werner | 33 | void setValues(const Type type, const QString &name, const QString &description, const QString &url, const QVariant defaultValue); |
86 | Werner | 34 | /// converts a string to a setting Type |
94 | Werner | 35 | static SettingMetaData::Type typeFromName(const QString &settingName); |
86 | Werner | 36 | /// convert a Type to a string. |
87 | Werner | 37 | const QString typeName(const Type type) const; |
88 | Werner | 38 | // getters |
39 | QVariant defaultValue() const { return mDefaultValue; } |
||
40 | const QString &url() const { return mUrl; } |
||
41 | const QString &name() const { return mName; } |
||
42 | const QString &description() const { return mDescription; } |
||
87 | Werner | 43 | /// dump content of meta data to a String |
44 | QString dump() const; |
||
86 | Werner | 45 | private: |
88 | Werner | 46 | //SettingMetaData(const SettingMetaData &other); // private copoy ctor |
86 | Werner | 47 | static const QStringList mTypeNames; |
48 | Type mType; |
||
49 | QString mName; |
||
50 | QString mDescription; |
||
51 | QString mUrl; |
||
87 | Werner | 52 | QVariant mDefaultValue; |
86 | Werner | 53 | }; |
54 | |||
89 | Werner | 55 | typedef QHash<QString, SettingMetaData*> SettingMetaDataList; |
86 | Werner | 56 | |
57 | #endif // SettingMetaData_H |