Molybden API
Loading...
Searching...
No Matches
field_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_FIELD_CONTAINER_HPP
6#define MOLYBDEN_FIELD_CONTAINER_HPP
7
8#include <map>
9#include <mutex>
10
11#include "molybden/js/internal/js_accessible_field.hpp"
12
13namespace molybden::internal {
14
19class FieldContainer {
20 protected:
30 template <class C, class T>
31 int addField(Field<C, T> field, const char* name);
32
37 JsValue getFieldValue(const std::string& property_name);
38
42 [[nodiscard]] bool hasField(const std::string& property_name) const;
43
52 bool setFieldValue(const std::string& property_name, const JsValue& value);
53
57 std::vector<std::string> propertyNames();
58
59 virtual ~FieldContainer() = default;
60
61 private:
62 std::map<std::string, std::unique_ptr<JsAccessibleField>> fields_;
63 std::mutex mutex_;
64};
65
66} // namespace molybden::internal
67
68#endif // MOLYBDEN_FIELD_CONTAINER_HPP