ScummVM API documentation
endblockcommand.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MUTATIONOFJB_ENDBLOCKCOMMAND_H
23 #define MUTATIONOFJB_ENDBLOCKCOMMAND_H
24 
25 #include "mutationofjb/commands/command.h"
26 
27 #include "common/scummsys.h"
28 #include "common/array.h"
29 #include "common/str.h"
30 
31 namespace MutationOfJB {
32 
33 struct ActionInfo;
34 
36 public:
37  EndBlockCommandParser() : _elseFound(false), _hashFound(false), _ifTag(0) {}
38 
39  bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override;
40  void transition(ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser) override;
41  void finish(ScriptParseContext &parseCtx) override;
42 private:
43  bool _elseFound;
44  bool _hashFound;
45  char _ifTag;
46 
47  Common::Array<uint> _pendingActionInfos;
48  struct NameAndCommand {
49  Common::String _name;
50  Command *_command;
51  };
52  struct IdAndCommand {
53  uint8 _id;
54  Command *_command;
55  };
58  NameAndCommandArray _foundMacros;
59  IdAndCommandArray _foundStartups;
60  NameAndCommandArray _foundExtras;
61 };
62 
63 class EndBlockCommand : public Command {
64 public:
65  EndBlockCommand() : _nextCmd(nullptr) {}
66  static bool ParseFunc(const Common::String &line, ScriptParseContext &parseContext, Command *&command);
67 
68  ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
69  Command *next() const override;
70  Common::String debugString() const override;
71 private:
72  Command *_nextCmd;
73 };
74 
75 }
76 
77 #endif
Definition: endblockcommand.h:35
Definition: endblockcommand.h:63
Definition: str.h:59
Definition: script.h:106
void transition(ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser) override
Definition: command.h:40
Definition: script.h:71
Definition: command.h:85
Definition: animationdecoder.h:36
bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override
void finish(ScriptParseContext &parseCtx) override