Loading...
Searching...
No Matches
SetCondition.hpp
1#pragma once
2#include <State/Expression.hpp>
3
4#include <Scenario/Commands/ScenarioCommandFactory.hpp>
5#include <Scenario/Document/Event/EventModel.hpp>
6#include <Scenario/Document/Event/ExecutionStatus.hpp>
7
8#include <score/command/AggregateCommand.hpp>
9#include <score/command/Command.hpp>
10#include <score/command/PropertyCommand.hpp>
11#include <score/model/path/Path.hpp>
12
13struct DataStreamInput;
14struct DataStreamOutput;
15
16namespace Scenario
17{
18class EventModel;
19namespace Command
20{
21using EventModel = Scenario::EventModel;
22
23class SCORE_PLUGIN_SCENARIO_EXPORT SetCondition final : public score::Command
24{
25 SCORE_COMMAND_DECL(CommandFactoryName(), SetCondition, "Set an Event's condition")
26public:
27 SetCondition(const EventModel& event, State::Expression&& condition);
28 void undo(const score::DocumentContext& ctx) const override;
29 void redo(const score::DocumentContext& ctx) const override;
30
31protected:
32 void serializeImpl(DataStreamInput&) const override;
33 void deserializeImpl(DataStreamOutput&) override;
34
35private:
36 Path<EventModel> m_path;
37 State::Expression m_condition;
38 State::Expression m_previousCondition;
39};
40
42{
43 SCORE_COMMAND_DECL(
44 CommandFactoryName(), SetEventScriptableMacro, "Set condition scriptable")
45};
46
49SCORE_PLUGIN_SCENARIO_EXPORT void setEventScriptable(
50 const EventModel& event, bool scriptable, const score::DocumentContext& ctx);
51
53{
54 SCORE_COMMAND_DECL(CommandFactoryName(), SetOffsetBehavior, "Set offset behavior")
55public:
56 SetOffsetBehavior(const EventModel& event, OffsetBehavior newval);
57};
58}
59}
60
61PROPERTY_COMMAND_T(
62 Scenario::Command, SetEventScriptable, EventModel::p_scriptable,
63 "Set condition scriptable")
64SCORE_COMMAND_DECL_T(Scenario::Command::SetEventScriptable)
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition SetCondition.hpp:24
Definition SetCondition.hpp:42
Definition SetCondition.hpp:53
Definition EventModel.hpp:36
Allows for grouping of multiple commands in a single one.
Definition AggregateCommand.hpp:15
The Command class.
Definition Command.hpp:34
The PropertyCommand class.
Definition PropertyCommand.hpp:21
Main plug-in of score.
Definition ConnectionsList.hpp:22
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18