Cute Chess  0.1
engineoption.h
1 /*
2  This file is part of Cute Chess.
3 
4  Cute Chess is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  Cute Chess is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef ENGINEOPTION_H
19 #define ENGINEOPTION_H
20 
21 #include <QString>
22 #include <QVariant>
23 
24 class LIB_EXPORT EngineOption
25 {
26  public:
27  explicit EngineOption(const QString& name,
28  QVariant::Type valueType,
29  const QVariant& value = QVariant(),
30  const QVariant& defaultValue = QVariant(),
31  const QString& alias = QString());
32  virtual ~EngineOption();
33 
35  virtual EngineOption* copy() const = 0;
36 
37  QVariant::Type valueType() const;
38  bool isValid() const;
39  virtual bool isValid(const QVariant& value) const = 0;
40  virtual bool isEditable() const;
41 
42  QString name() const;
43  QVariant value() const;
44  QVariant defaultValue() const;
45  QString alias() const;
46 
47  void setName(const QString& name);
48  void setValue(const QVariant& value);
49  void setDefaultValue(const QVariant& value);
50  void setAlias(const QString& alias);
51 
52  virtual QVariant toVariant() const = 0;
53 
54  private:
55  QVariant::Type m_valueType;
56  QString m_name;
57  QVariant m_value;
58  QVariant m_defaultValue;
59  QString m_alias;
60 };
61 
62 #endif // ENGINEOPTION_H
Definition: engineoption.h:24