Frobby 0.10.0
Loading...
Searching...
No Matches
Action.h
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3
4 This program 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 2 of the License, or
7 (at your option) any later version.
8
9 This program 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 this program. If not, see http://www.gnu.org/licenses/.
16*/
17#ifndef ACTION_GUARD
18#define ACTION_GUARD
19
20#include "BoolParameter.h"
21#include "CliParams.h"
22
23class Parameter;
24
25class Action {
26 public:
27 Action(const char* name,
28 const char* shortDescription,
29 const char* description,
30 bool acceptsNonParameter);
31 virtual ~Action();
32
33 const char* getName() const;
34 const char* getShortDescription() const;
35 const char* getDescription() const;
36
37 // processNonParameter() can be called at most once, and only if
38 // acceptsNonParameter() returns true.
39 bool acceptsNonParameter() const;
40 virtual void processNonParameter(const char* str);
41
42 virtual void obtainParameters(vector<Parameter*>& parameters);
43
44 virtual void parseCommandLine(unsigned int tokenCount,
45 const char** tokens);
46
47 virtual void perform() = 0;
48
51 virtual bool displayAction() const;
52
53 const Parameter& getParam(const string& name) const;
54
55 static void getActionNames(vector<string>& names);
56 static unique_ptr<Action> createActionWithPrefix(const string& prefix);
57
58 protected:
59 CliParams _params;
60
61
62
63 const char* _name;
64 const char* _shortDescription;
65 const char* _description;
66 bool _acceptsNonParameter;
67
68 BoolParameter _printActions;
69
70};
71
72#endif
virtual bool displayAction() const
Definition Action.cpp:97
Definition BoolParameter.h:24
Definition CliParams.h:28
Definition Parameter.h:24