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