Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
commandreader.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------+
2 * File: commandreader.h
3 * Project: part of belofte - A Promising Chess Program
4 * Author: yves
5 * SPDX-License-Identifier: GPL-2.0-only
6+----------------------------------------------------------------------*/
7
8#if !defined(COMMANDREADER_H)
9#define COMMANDREADER_H
10
11//-----------------------------------------------------------------------
12
13class noCommandException : public std::exception
14{
15 const char * what () const noexcept override
16 { return "No command"; }
17};
18
19//-----------------------------------------------------------------------
20
21#if defined(__GNUC__)
22#pragma GCC diagnostic push
23#pragma GCC diagnostic ignored "-Weffc++"
24#endif
25
27public:
29 : m_filename{}
30 {}
32
33 // no copy or move ctor nor assignment defined
34 commandReader(commandReader const&) = delete;
38
39 bool attach(std::string const& ifile);
40 void detach();
41 bool isFileAttached();
42 bool isBatchMode();
43 void setBatchMode();
44 void clearBatchMode();
45
47
48 void runner(void);
49
50private:
51 std::string readLine();
52
53 std::string m_filename;
54 std::ifstream m_inputfile;
55 bool m_isBatch = true;
56};
57
58#if defined(__GNUC__)
59#pragma GCC diagnostic pop
60#endif
61
62//-----------------------------------------------------------------------
63
64#endif // defined COMMANDREADER_H
65
66// eof
command and parameters
Definition usercmd.h:41
bool isBatchMode()
no interactive input, mainly during start and '@' execute
commandReader & operator=(commandReader const &)=delete
commandReader(commandReader const &)=delete
void runner(void)
cmdParam getCommand()
bool attach(std::string const &ifile)
commandReader(commandReader &&)=delete
commandReader & operator=(commandReader &&)=delete