GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
EventsRemover.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 #ifndef EventsRemover_H
7 #define EventsRemover_H
8 #include <set>
9 #include <vector>
10 #include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
11 #include "GDCore/String.h"
12 namespace gd {
13 class BaseEvent;
14 }
15 namespace gd {
16 class Project;
17 }
18 namespace gd {
19 class EventsList;
20 }
21 
22 namespace gd {
23 
29 class GD_CORE_API EventsRemover : public ArbitraryEventsWorker {
30  public:
31  EventsRemover(){};
32  virtual ~EventsRemover();
33 
34  void AddEventToRemove(gd::BaseEvent &event) { eventsToRemove.insert(&event); }
35  void AddInstructionToRemove(gd::Instruction &instruction) {
36  instructionsToRemove.insert(&instruction);
37  }
38 
39  private:
40  virtual bool DoVisitEvent(gd::BaseEvent &event) {
41  return eventsToRemove.count(&event) != 0;
42  }
43 
44  virtual bool DoVisitInstruction(gd::Instruction &instruction,
45  bool isCondition) {
46  return instructionsToRemove.count(&instruction) != 0;
47  }
48 
49  std::set<gd::BaseEvent *> eventsToRemove;
50  std::set<gd::Instruction *> instructionsToRemove;
51 };
52 
53 } // namespace gd
54 
55 #endif // EventsRemover_H
ArbitraryEventsWorker is an abstract class used to browse events (and instructions) and do some work ...
Definition: ArbitraryEventsWorker.h:111
Base class defining an event.
Definition: Event.h:43
Allow to safely remove a bunch of events.
Definition: EventsRemover.h:29
An instruction is a member of an event: It can be a condition or an action.
Definition: Instruction.h:30
Definition: CommonTools.h:24