Add JSON RFC to the See Also section
[sloppygui.git] / projects / lib / src / engineconfiguration.h
blob4c14b22ab8adb9f93b0e8c0d30abb7445a05cebc
1 /*
2 This file is part of Cute Chess.
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.
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.
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/>.
18 #ifndef ENGINE_CONFIGURATION_H
19 #define ENGINE_CONFIGURATION_H
21 #include <QString>
22 #include <QStringList>
24 class EngineOption;
26 /*!
27 * \brief The EngineConfiguration class defines a chess engine configuration.
29 * \sa EngineConfigurationModel
31 class LIB_EXPORT EngineConfiguration
33 public:
34 /*!
35 * The modes that determine whether the engine
36 * will be restarted between games.
38 enum RestartMode
40 RestartAuto, //!< The engine decides whether to restart
41 RestartOn, //!< The engine is always restarted between games
42 RestartOff //!< The engine is never restarted between games
45 /*! Creates an empty chess engine configuration. */
46 EngineConfiguration();
47 /*!
48 * Creates a new chess engine configuration with specified name,
49 * command and protocol settings.
51 EngineConfiguration(const QString& name,
52 const QString& command,
53 const QString& protocol);
54 /*! Creates a new chess engine configuration from a QVariant. */
55 EngineConfiguration(const QVariant& variant);
56 /*! Creates a new chess engine configuration from \a other. */
57 EngineConfiguration(const EngineConfiguration& other);
59 /*! Destroys the engine configuration. */
60 ~EngineConfiguration();
62 /*!
63 * Converts the object into a QVariant.
65 * This makes it easy to serialize EngineConfiguration
66 * objects with QJson.
68 QVariant toVariant() const;
70 /*!
71 * Sets the engine's name.
73 * \sa name()
75 void setName(const QString& name);
76 /*!
77 * Sets the command which is used to launch the engine.
79 * \sa command()
81 void setCommand(const QString& command);
82 /*!
83 * Sets the working directory the engine uses.
85 * \sa workingDirectory()
87 void setWorkingDirectory(const QString& workingDir);
88 /*!
89 * Sets the communication protocol the engine uses.
91 * \sa protocol()
93 void setProtocol(const QString& protocol);
95 /*!
96 * Returns the engine's name.
98 * \sa setName()
100 QString name() const;
102 * Returns the command which is used to launch the engine.
104 * \sa setCommand()
106 QString command() const;
108 * Returns the working directory the engine uses.
110 * \sa setWorkingDirectory()
112 QString workingDirectory() const;
114 * Returns the communication protocol the engine uses.
116 * \sa setProtocol()
118 QString protocol() const;
120 /*! Returns the command line arguments sent to the engine. */
121 QStringList arguments() const;
122 /*! Sets the command line arguments sent to the engine. */
123 void setArguments(const QStringList& arguments);
124 /*! Adds new command line argument. */
125 void addArgument(const QString& argument);
127 /*! Returns the initialization strings sent to the engine. */
128 QStringList initStrings() const;
129 /*! Sets the initialization strings sent to the engine. */
130 void setInitStrings(const QStringList& initStrings);
131 /*! Adds new initialization string. */
132 void addInitString(const QString& initString);
135 * Returns a list of the chess variants the engine can play.
137 * Returns a list containing variant \a "standard" by default.
139 QStringList supportedVariants() const;
140 /*! Sets the list of supported variants to \a variants. */
141 void setSupportedVariants(const QStringList& variants);
143 /*! Returns the options sent to the engine. */
144 QList<EngineOption*> options() const;
145 /*! Sets the options sent to the engine. */
146 void setOptions(const QList<EngineOption*>& options);
147 /*! Adds new option. */
148 void addOption(EngineOption* option);
150 /*! Returns true if evaluation is from white's point of view. */
151 bool whiteEvalPov() const;
152 /*! Sets white evaluation point of view. */
153 void setWhiteEvalPov(bool whiteEvalPov);
156 * Returns the restart mode.
157 * The default value is \a RestartAuto.
159 RestartMode restartMode() const;
160 /*! Sets the restart mode to \a mode. */
161 void setRestartMode(RestartMode mode);
164 * Assigns \a other to this engine configuration and returns
165 * a reference to this object.
167 EngineConfiguration& operator=(const EngineConfiguration& other);
169 private:
170 QString m_name;
171 QString m_command;
172 QString m_workingDirectory;
173 QString m_protocol;
174 QStringList m_arguments;
175 QStringList m_initStrings;
176 QStringList m_variants;
177 QList<EngineOption*> m_options;
178 bool m_whiteEvalPov;
179 RestartMode m_restartMode;
182 #endif // ENGINE_CONFIGURATION_H