GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
ForEachChildVariableEvent.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 
7 #ifndef FOREACHCHILDVARIABLEEVENT_H
8 #define FOREACHCHILDVARIABLEEVENT_H
9 #include "GDCore/Events/Event.h"
10 #include "GDCore/Events/EventsList.h"
11 #include "GDCore/Events/Expression.h"
12 namespace gd {
13 class Instruction;
14 class Project;
15 class Layout;
16 } // namespace gd
17 
18 namespace gd {
19 
23 class GD_CORE_API ForEachChildVariableEvent : public gd::BaseEvent {
24  public:
26  virtual ~ForEachChildVariableEvent(){};
28  return new ForEachChildVariableEvent(*this);
29  }
30 
31  virtual bool IsExecutable() const { return true; }
32 
33  virtual bool CanHaveSubEvents() const { return true; }
34  virtual const gd::EventsList& GetSubEvents() const { return events; };
35  virtual gd::EventsList& GetSubEvents() { return events; };
36 
37  const gd::InstructionsList& GetConditions() const { return conditions; };
38  gd::InstructionsList& GetConditions() { return conditions; };
39 
40  const gd::InstructionsList& GetActions() const { return actions; };
41  gd::InstructionsList& GetActions() { return actions; };
42 
48  const gd::String& GetIterableVariableName() const { return iterableVariableName.GetPlainString(); };
49 
55  void SetIterableVariableName(gd::String newName) { iterableVariableName = newName; };
56 
63  const gd::String& GetValueIteratorVariableName() const { return valueIteratorVariableName.GetPlainString(); };
64 
71  void SetValueIteratorVariableName(gd::String newName) { valueIteratorVariableName = newName; };
72 
79  const gd::String& GetKeyIteratorVariableName() const { return keyIteratorVariableName.GetPlainString(); };
80 
87  void SetKeyIteratorVariableName(gd::String newName) { keyIteratorVariableName = newName; };
88 
89  virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
90  const;
91  virtual std::vector<const gd::InstructionsList*> GetAllActionsVectors() const;
92 
93  virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
94  virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
95 
96  virtual std::vector<std::pair<const gd::Expression*, const gd::ParameterMetadata> >
97  GetAllExpressionsWithMetadata() const;
98  virtual std::vector<std::pair<gd::Expression*, gd::ParameterMetadata> >
99  GetAllExpressionsWithMetadata();
100 
101  virtual void SerializeTo(SerializerElement& element) const;
102  virtual void UnserializeFrom(gd::Project& project,
103  const SerializerElement& element);
104 
105  private:
106  gd::Expression valueIteratorVariableName;
107  gd::Expression keyIteratorVariableName;
108  gd::Expression iterableVariableName;
109  gd::InstructionsList conditions;
110  gd::InstructionsList actions;
111  gd::EventsList events;
112 };
113 
114 } // namespace gd
115 
116 #endif // FOREACHEVENT_H
Base class defining an event.
Definition: Event.h:43
A list of events.
Definition: EventsList.h:33
Class representing an expression used as a parameter of a gd::Instruction. This class is nothing more...
Definition: Expression.h:30
Event repeated for each every child of a structure variable.
Definition: ForEachChildVariableEvent.h:23
virtual bool CanHaveSubEvents() const
Definition: ForEachChildVariableEvent.h:33
const gd::String & GetKeyIteratorVariableName() const
Get the key iterator variable attached to the event.
Definition: ForEachChildVariableEvent.h:79
const gd::String & GetIterableVariableName() const
Get the iterable variable name attached to the event.
Definition: ForEachChildVariableEvent.h:48
virtual gd::ForEachChildVariableEvent * Clone() const
Definition: ForEachChildVariableEvent.h:27
void SetKeyIteratorVariableName(gd::String newName)
Set the key iterator variable attached to the event.
Definition: ForEachChildVariableEvent.h:87
void SetValueIteratorVariableName(gd::String newName)
Set the value iterator variable attached to the event.
Definition: ForEachChildVariableEvent.h:71
virtual const gd::EventsList & GetSubEvents() const
Definition: ForEachChildVariableEvent.h:34
const gd::String & GetValueIteratorVariableName() const
Get the value iterator variable attached to the event.
Definition: ForEachChildVariableEvent.h:63
virtual bool IsExecutable() const
Definition: ForEachChildVariableEvent.h:31
virtual gd::EventsList & GetSubEvents()
Definition: ForEachChildVariableEvent.h:35
void SetIterableVariableName(gd::String newName)
Set the iterable variable name attached to the event.
Definition: ForEachChildVariableEvent.h:55
Definition: InstructionsList.h:25
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:51
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:31
Definition: CommonTools.h:24