Molybden API
Loading...
Searching...
No Matches
js_accessible_field_impl_detail.hpp
1// Copyright (c) 2000-2023 TeamDev Ltd. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_JS_ACCESSIBLE_FIELD_IMPL_DETAIL_HPP
6#define MOLYBDEN_JS_ACCESSIBLE_FIELD_IMPL_DETAIL_HPP
7
8namespace molybden {
9namespace internal {
10
11template <class C, class T>
12JsValue JsAccessibleFieldImpl<C, T>::value() {
13 return JsValue::from(object_->*field_);
14}
15
16template <class C, class T>
17bool JsAccessibleFieldImpl<C, T>::setValue(const JsValue& value) {
18 if (JsValueConverter<T>::isConvertible(value)) {
19 object_->*field_ = JsValueConverter<T>::convert(value);
20 return true;
21 }
22 return false;
23}
24
25template <class C, class T>
26JsAccessibleFieldImpl<C, T>::JsAccessibleFieldImpl(C* object, Field<C, T> field)
27 : object_(object), field_(field) {
28 AreAllConvertibleFromJsDirectly<T>::check();
29}
30
31} // namespace internal
32} // namespace molybden
33
34#endif // MOLYBDEN_JS_ACCESSIBLE_FIELD_IMPL_DETAIL_HPP
static JsValue from(T &&value)
Constructs a JavaScript value from the convertible C++ one.
Definition js_value_detail.hpp:51