12#ifndef ARK_VM_VALUE_HPP
13#define ARK_VM_VALUE_HPP
23#include <Ark/String.hpp>
59 "List",
"Number",
"String",
"Function",
60 "CProc",
"Closure",
"UserType",
"Nil",
61 "Bool",
"Bool",
"Undefined",
"Reference",
66#ifdef ARK_PROFILER_COUNT
67 extern unsigned value_creations, value_copies, value_moves;
111 template <typename T>
113 m_const_type(static_cast<uint8_t>(type)),
114 m_value(std::move(value))
117#ifdef ARK_PROFILER_COUNT
120 Value& operator=(
const Value& other)
noexcept;
128 explicit Value(
int value)
noexcept;
135 explicit Value(
float value)
noexcept;
142 explicit Value(
double value)
noexcept;
149 explicit Value(
const std::string& value)
noexcept;
156 explicit Value(
const String& value)
noexcept;
163 explicit Value(
const char* value)
noexcept;
184 explicit Value(std::vector<Value>&& value)
noexcept;
220 inline
bool isFunction() const noexcept;
227 inline
double number() const;
234 inline const String&
string() const;
241 inline const std::vector<
Value>& constList() const;
255 std::vector<
Value>& list();
276 Value* reference() const;
283 void push_back(const
Value& value);
290 void push_back(
Value&& value);
292 void toString(std::ostream& os,
VM& vm) const 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 Value False
ArkScript False value.
const Value True
ArkScript True value.
const Value Nil
ArkScript Nil value.
const std::array< std::string, 13 > types_to_str