Molybden API
Loading...
Searching...
No Matches
js_return_value.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_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
41 JsReturnValue(const JsReturnValue& other) = delete;
42
44
45 JsReturnValue& operator= (JsReturnValue&& other);
46 JsReturnValue& operator= (const JsReturnValue& other) = delete;
47
54 bool isCorrect() const;
55
61
67
71 explicit operator bool() const;
72
73 private:
74 std::unique_ptr<JsReturnValueVariant> impl_;
75};
76
77} // namespace molybden
78
79#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