summaryrefslogtreecommitdiff
path: root/src/lua/include/bridge.hpp
blob: 26401d148c8d05dc3fd5e5069adbf6b6bce99197 (plain)
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
37
38
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#pragma once

#include <memory>
#include <string>

#include "lua.hpp"
#include "lvgl.h"
#include "property.hpp"
#include "service_locator.hpp"

namespace lua {

class Bridge {
 public:
  static auto Get(lua_State* state) -> Bridge*;

  Bridge(system_fsm::ServiceLocator&, lua_State& s);

  auto AddPropertyModule(
      const std::string&,
      std::vector<std::pair<std::string, std::shared_ptr<Property>>>) -> void;

  system_fsm::ServiceLocator& services() { return services_; }
  PropertyBindings& bindings() { return bindings_; }

 private:
  system_fsm::ServiceLocator& services_;
  lua_State& state_;
  PropertyBindings bindings_;
};

}  // namespace lua