12#ifndef ARK_VM_VALUE_HPP
13#define ARK_VM_VALUE_HPP
23#include <Ark/String.hpp>
60 "List",
"Number",
"String",
"Function",
61 "CProc",
"Closure",
"UserType",
"Nil",
62 "Bool",
"Bool",
"Undefined",
"Reference",
67#ifdef ARK_PROFILER_COUNT
68 extern unsigned value_creations, value_copies, value_moves;
112 template <typename T>
114 m_const_type(static_cast<uint8_t>(type)),
115 m_value(std::move(value))
118#ifdef ARK_PROFILER_COUNT
121 Value& operator=(
const Value& other)
noexcept;
129 explicit Value(
int value)
noexcept;
136 explicit Value(
float value)
noexcept;
143 explicit Value(
double value)
noexcept;
150 explicit Value(
const std::string& value)
noexcept;
157 explicit Value(
const String& value)
noexcept;
164 explicit Value(
const char* value)
noexcept;
185 explicit Value(std::vector<Value>&& value)
noexcept;
221 inline
bool isFunction() const noexcept;
228 inline
double number() const;
235 inline const String&
string() const;
242 inline const std::vector<
Value>& constList() const;
256 std::vector<
Value>& list();
277 Value* reference() const;
284 void push_back(const
Value& value);
291 void push_back(
Value&& value);
293 friend
ARK_API std::ostream& operator<<(std::ostream& os, const
Value& V) noexcept;
301 uint8_t m_const_type;
325 inline const internal::
Closure& closure() const;
332 internal::
Closure& refClosure();
340 inline
bool isConst() const noexcept;
347 inline
void setConst(
bool value) noexcept;
350#include "inline/Value.inl"
Subtype of the value type, handling closures.
Subtype of the value, capable of handling any C++ type.
A class to be use C++ objects in ArkScript.
The ArkScript virtual machine, executing ArkScript bytecode.
Value(*)(std::vector< Value > &, VM *) ProcType
std::variant< double, String, internal::PageAddr_t, ProcType, internal::Closure, UserType, std::vector< Value >, Value * > Value_t
std::vector< Value >::iterator Iterator
ValueType valueType() const noexcept
Return the value type.
std::vector< Value >::const_iterator ConstIterator
const std::array< std::string, 13 > types_to_str