Molybden API
Loading...
Searching...
No Matches
method_container.hpp
1// Copyright (c) 2000-2024 TeamDev. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_METHOD_CONTAINER_HPP
6#define MOLYBDEN_METHOD_CONTAINER_HPP
7
8#include <map>
9#include <mutex>
10
11#include "molybden/js/internal/js_accessible_method.hpp"
12
13namespace molybden {
14namespace internal {
15
22class MethodContainer {
23 protected:
34 template <class C, class R, class... T>
35 int addMethod(MethodSignature<C, R, T...> signature, const char* name);
36
40 bool hasMethod(const std::string& method_name);
41
49 JsReturnValue callMethod(const std::string& method_name,
50 const std::vector<JsValue>& args);
51
55 std::vector<std::string> methodNames();
56 virtual ~MethodContainer() = default;
57
58 private:
59 std::map<std::string, std::unique_ptr<JsAccessibleMethod>> methods_;
60 std::mutex mutex_;
61};
62
63} // namespace internal
64} // namespace molybden
65
66#endif // MOLYBDEN_METHOD_CONTAINER_HPP