-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryBase.hpp
More file actions
55 lines (48 loc) · 1.02 KB
/
Copy pathQueryBase.hpp
File metadata and controls
55 lines (48 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef QUERY_BASE_H
#define QUERY_BASE_H
#include <map>
#include <vector>
#include <string>
#include "Team.hpp"
/**
* Base class for Queries
*
* Make new queries by inheriting this class.
*
* Inherited classes should set the protected variables in
* their ctors. Also, they should register themselves with
* the QueryFactory using the macro:
* REGISTER_QUERY_CLASS("queryName", queryClassName);
*/
class QueryBase
{
public:
// No. of arguments needed by query to run
unsigned int numberOfArguments()
{
return _numberOfArguments;
}
// Usage message for query
std::string usageMessage()
{
return _usageMessage;
}
// Is the query execution status ok?
bool good()
{
return _good;
}
// Get error message
std::string error()
{
return _error;
}
// Execute the query
virtual std::vector<std::string> operator()(std::map<int, Team *> teams, std::vector<std::string> arguments) = 0;
protected:
bool _good = true;
std::string _error;
unsigned int _numberOfArguments;
std::string _usageMessage;
};
#endif