Blame view

epsilon-master/apps/code/script_node.h 898 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  #ifndef CODE_SCRIPT_NODE_H
  #define CODE_SCRIPT_NODE_H
  
  #include <stdint.h>
  
  namespace Code {
  
  class ScriptNode {
  public:
    enum class Type {
      Function = 0,
      Variable = 1
    };
    ScriptNode() :
      m_type(Type::Function), m_name(nullptr), m_scriptIndex(0) {}
    static ScriptNode FunctionNode(const char * name, uint16_t scriptIndex) {
      return ScriptNode(Type::Function, name, scriptIndex);
    }
    static ScriptNode VariableNode(const char * name, uint16_t scriptIndex) {
      return ScriptNode(Type::Variable, name, scriptIndex);
    }
    Type type() const { return m_type; }
    const char * name() const { return m_name; }
    uint16_t scriptIndex() const { return m_scriptIndex; }
  private:
    ScriptNode(Type type, const char * name, uint16_t scriptIndex) :
      m_type(type), m_name(name), m_scriptIndex(scriptIndex) {}
    Type m_type;
    const char * m_name;
    uint16_t m_scriptIndex;
  };
  
  }
  
  #endif