1 #ifndef INCLUDEJS_ENGINE_VALUE_H_
2 #define INCLUDEJS_ENGINE_VALUE_H_
4 #include "engine_export.h"
15 enum class ValueType {
30 class INCLUDEJS_ENGINE_EXPORT
Value {
34 Value(
const void *context,
const void *value);
41 using Function = std::function<
Value(std::vector<Value> arguments)>;
42 using FunctionStorage = std::map<void *, Function>;
44 auto is_number()
const -> bool;
45 auto is_string()
const -> bool;
46 auto is_error()
const -> bool;
47 auto is_object()
const -> bool;
48 auto is_boolean()
const -> bool;
49 auto is_undefined()
const -> bool;
50 auto is_null()
const -> bool;
51 auto is_array()
const -> bool;
52 auto is_function()
const -> bool;
53 auto to_number()
const -> double;
54 auto to_string()
const -> std::string;
55 auto to_boolean()
const -> bool;
56 auto to_function()
const -> Function;
57 auto type()
const -> ValueType;
58 auto at(
const std::string &property)
const -> std::optional<Value>;
59 auto at(
const unsigned int &position)
const -> std::optional<Value>;
60 auto set(
const std::string &property,
Value value) -> void;
61 auto set(
const std::string &property, Function
function) -> void;
62 auto private_data() ->
void *;
63 auto private_data(
void *data, std::function<
void(
void *)> deleter) -> void;
64 auto push(
Value value) -> void;
65 auto to_map()
const -> std::map<std::string, Value>;
66 auto to_vector()
const -> std::vector<Value>;
67 auto to_json_string()
const -> std::string;
71 auto native()
const ->
const void *;
76 std::unique_ptr<Internal>
internal;
Definition: engine_value.h:30