Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
debug_parser.h
Go to the documentation of this file.
1 #ifndef DEBUG_PARSER_H
2 #define DEBUG_PARSER_H
3 
4 #include <queue>
5 #include "events/subject.h"
6 #include "events/observer.h"
7 #include "events/event.h"
8 //= SCRIPTABLE
9 //= SCRIPTABLE BASES Subject Observer
10 
11 namespace Utility {
15  class DebugParser : public Events::Subject, public Events::Observer {
16  private:
17  std::queue<std::string> tokenSplit(std::string command);
18  public:
19  void onNotifyNow(std::shared_ptr<Events::Event> event);
20  void handleQueuedEvent(std::shared_ptr<Events::Event> event);
21 
22 
23  //= BEGIN SCRIPTABLE
24 
28  DebugParser() = default;
34  void parseCommand(const std::string& command);
35  //Must be called every engine loop to get events
36  //out of the event queue and use them.
37 
44  void handleEvents();
45  //= END SCRIPTABLE
46 
50  virtual ~DebugParser() = default;
51  };
52 }
53 
54 #endif
virtual ~DebugParser()=default
Destroys the object.
void handleQueuedEvent(std::shared_ptr< Events::Event > event)
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received...
Definition: debug_parser.cpp:21
Class for a subject that an observer would observe for changes.
Definition: subject.h:13
Interface to be notified of an item's changes.
Definition: observer.h:13
DebugParser()=default
DebugParser constructor.
void onNotifyNow(std::shared_ptr< Events::Event > event)
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure ...
Definition: debug_parser.cpp:17
Class for debug parser.
Definition: debug_parser.h:15
void handleEvents()
Handles queued debug parser events.
Definition: debug_parser.cpp:31
void parseCommand(const std::string &command)
Parses a debug command.
Definition: debug_parser.cpp:46