GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
EventsPositionFinder.h
1 #ifndef EventsPositionFinder_H
2 #define EventsPositionFinder_H
3 #include "GDCore/Events/EventsList.h"
4 #include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
5 #include "GDCore/String.h"
6 
7 namespace gd {
8 class BaseEvent;
9 class EventsList;
10 } // namespace gd
11 
12 namespace gd {
13 
20 class GD_CORE_API EventsPositionFinder : public ArbitraryEventsWorker {
21  public:
22  EventsPositionFinder() : index(0){};
23  virtual ~EventsPositionFinder();
24 
28  const std::vector<std::size_t>& GetPositions() const { return positions; }
29 
34  searchedEvents.push_back(event);
35  positions.push_back(gd::String::npos);
36  }
37 
38  private:
39  bool DoVisitEvent(gd::BaseEvent& event) override;
40 
41  std::vector<gd::BaseEvent*> searchedEvents;
42  std::vector<std::size_t> positions;
43  std::size_t index;
44 };
45 
46 } // namespace gd
47 
48 #endif // EventsPositionFinder_H
ArbitraryEventsWorker is an abstract class used to browse events (and instructions) and do some work ...
Definition: ArbitraryEventsWorker.h:36
Base class defining an event.
Definition: Event.h:44
Scans an event list to retrieve the position of a list of searched events when the events list is fla...
Definition: EventsPositionFinder.h:20
const std::vector< std::size_t > & GetPositions() const
Definition: EventsPositionFinder.h:28
void AddEventToSearch(gd::BaseEvent *event)
Definition: EventsPositionFinder.h:33
Definition: CommonTools.h:24