summary refs log tree commit diff stats
path: root/script.h
blob: fabf531bbb94134686a9b3cfd1a337f07dc47d4f (plain) (blame)
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
36
#ifndef SCRIPT_H
#define SCRIPT_H

#include <filesystem>
#include <map>
#include <string>
#include <string_view>
#include <tuple>
#include <vector>

class Script {
 public:
  Script() = default;

  Script(const std::filesystem::path& path, std::string_view file_prefix);

  const std::vector<std::string>& loaded_scripts() const {
    return loaded_scripts_;
  }

  const std::vector<std::tuple<std::string, int>>& exports() const {
    return exports_;
  }

  void ReplaceScriptReferences(const std::map<std::string, int>& script_ids);

  std::string ToString() const;

 private:
  std::string text_;
  std::string file_prefix_;
  std::vector<std::string> loaded_scripts_;
  std::vector<std::tuple<std::string, int>> exports_;
};

#endif /* SCRIPT_H */