Molybden API
Loading...
Searching...
No Matches
js_return_value.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_RETURN_VALUE_HPP
6#define MOLYBDEN_JS_RETURN_VALUE_HPP
7
8#include <memory>
9
10#include "molybden/js/js_error.hpp"
11#include "molybden/js/js_value.hpp"
12
13namespace molybden {
14
15class JsReturnValueVariant;
16
36 public:
37 explicit JsReturnValue(JsValue&& value);
38 explicit JsReturnValue(JsError&& error);
39
42
43 void operator = (JsReturnValue&& other);
44
51 bool isCorrect() const;
52
58
64
68 explicit operator bool() const;
69
70 private:
71 std::unique_ptr<JsReturnValueVariant> impl_;
72};
73
74} // namespace molybden
75
76#endif // MOLYBDEN_JS_RETURN_VALUE_HPP
Represents the JS function return value.
Definition js_return_value.hpp:35
JsError asError() &&
Returns the error that the return value represents if it does, otherwise it should not be called.
bool isCorrect() const
Indicates if the execution finished successfully and returned a value.
JsValue asValue() &&
Returns the value that the return value represents if it does, otherwise it should not be called.
A JavaScript value.
Definition js_value.hpp:44
Represents a JavaScript exception.
Definition js_error.hpp:83