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
10#include "molybden/js/internal/js_accessible_field.hpp"
11
12namespace molybden::internal {
13
18class FieldContainer {
19 protected:
29 template <class C, class T>
30 int addField(Field<C, T> field, const char* name);
31
36 JsValue getFieldValue(const std::string& property_name);
37
41 [[nodiscard]] bool hasField(const std::string& property_name) const;
42
51 bool setFieldValue(const std::string& property_name, const JsValue& value);
52
56 std::vector<std::string> propertyNames();
57
58 virtual ~FieldContainer() = default;
59
60 private:
61 std::map<std::string, std::unique_ptr<JsAccessibleField>> fields_;
62};
63
64} // namespace molybden::internal
65
66#endif // MOLYBDEN_FIELD_CONTAINER_HPP