GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
ExpressionsParameterMover.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-present Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 #ifndef ExpressionsParameterMover_H
7 #define ExpressionsParameterMover_H
8 #include <map>
9 #include <memory>
10 #include <vector>
11 #include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
12 #include "GDCore/String.h"
13 namespace gd {
14 class BaseEvent;
15 class Platform;
16 class EventsList;
17 } // namespace gd
18 
19 namespace gd {
20 
28 class GD_CORE_API ExpressionsParameterMover
30  public:
31  ExpressionsParameterMover(const gd::Platform &platform_)
32  : platform(platform_){};
33  virtual ~ExpressionsParameterMover();
34 
35  ExpressionsParameterMover &SetFreeExpressionMovedParameter(
36  const gd::String &functionName_,
37  std::size_t oldIndex_,
38  std::size_t newIndex_) {
39  objectType = "";
40  behaviorType = "";
41  functionName = functionName_;
42  oldIndex = oldIndex_;
43  newIndex = newIndex_;
44  return *this;
45  }
46  ExpressionsParameterMover &SetObjectExpressionMovedParameter(
47  const gd::String &objectType_,
48  const gd::String &functionName_,
49  std::size_t oldIndex_,
50  std::size_t newIndex_) {
51  objectType = objectType_;
52  behaviorType = "";
53  functionName = functionName_;
54  oldIndex = oldIndex_;
55  newIndex = newIndex_;
56  return *this;
57  };
58  ExpressionsParameterMover &SetBehaviorExpressionMovedParameter(
59  const gd::String &behaviorType_,
60  const gd::String &functionName_,
61  std::size_t oldIndex_,
62  std::size_t newIndex_) {
63  objectType = "";
64  behaviorType = behaviorType_;
65  functionName = functionName_;
66  oldIndex = oldIndex_;
67  newIndex = newIndex_;
68  return *this;
69  };
70 
71  private:
72  bool DoVisitInstruction(gd::Instruction &instruction,
73  bool isCondition) override;
74 
75  const gd::Platform &platform;
76  gd::String functionName;
77  std::size_t oldIndex = 0;
78  std::size_t newIndex = 0;
79  gd::String behaviorType;
80  gd::String objectType;
81 };
82 
83 } // namespace gd
84 
85 #endif // ExpressionsParameterMover_H
An events worker that will know about the context (the objects container). Useful for workers working...
Definition: ArbitraryEventsWorker.h:136
Move in expressions, in parameters of actions or conditions, a parameter from one position to another...
Definition: ExpressionsParameterMover.h:29
An instruction is a member of an event: It can be a condition or an action.
Definition: Instruction.h:30
Base class for implementing a platform.
Definition: Platform.h:42
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24