ScummVM API documentation
commands.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 PHOENIXVR_COMMANDS_H
23
#define PHOENIXVR_COMMANDS_H
24
25
#include "common/array.h"
26
#include "common/ptr.h"
27
#include "common/str.h"
28
29
namespace
PhoenixVR
{
30
31
struct
Scope;
32
33
struct
ExecutionContext
{
34
bool
running =
true
;
35
bool
subroutine =
false
;
36
const
Scope
*scope =
nullptr
;
37
const
Scope
*rootScope =
nullptr
;
38
};
39
40
struct
Command
{
41
virtual
~
Command
() {}
42
virtual
void
exec(
ExecutionContext
&ctx)
const
= 0;
43
44
static
int
valueOf(
const
Common::String
&value);
45
};
46
using
CommandPtr
=
Common::SharedPtr<Command>
;
47
48
struct
Scope
:
public
Command
{
49
Common::Array<CommandPtr>
commands;
50
51
struct
Label
{
52
Common::String
name;
53
uint offset;
54
};
55
Common::Array<Label>
labels;
56
57
const
Label
*findLabel(
const
Common::String
&name)
const
{
58
auto
it =
Common::find_if
(labels.
begin
(), labels.
end
(), [&](
const
Label
&label) {
return
label.name.equalsIgnoreCase(name); });
59
return
it != labels.
end
() ? &*it :
nullptr
;
60
}
61
62
void
exec(
ExecutionContext
&ctx)
const override
;
63
void
exec(
ExecutionContext
&ctx, uint offset)
const
;
64
};
65
using
ScopePtr
=
Common::SharedPtr<Scope>
;
66
67
}
// namespace PhoenixVR
68
69
#endif
PhoenixVR::Scope::Label
Definition:
commands.h:51
Common::String
Definition:
str.h:59
Common::Array
Definition:
array.h:52
Common::Array::end
iterator end()
Definition:
array.h:380
Common::Array::begin
iterator begin()
Definition:
array.h:375
PhoenixVR::ExecutionContext
Definition:
commands.h:33
PhoenixVR
Definition:
angle.h:33
PhoenixVR::Command
Definition:
commands.h:40
Common::find_if
In find_if(In first, In last, Pred p)
Definition:
algorithm.h:239
Common::SharedPtr< Command >
PhoenixVR::Scope
Definition:
commands.h:48
engines
phoenixvr
commands.h
Generated on Sun Aug 23 2026 09:16:51 for ScummVM API documentation by
1.8.13