5#define init_const_type(is_const, type) ((is_const ? (1 << 7) : 0) | static_cast<uint8_t>(type))
19 m_value = std::vector<Value>();
23#ifdef ARK_PROFILER_COUNT
28#ifdef ARK_PROFILER_COUNT
29 extern unsigned value_creations = 0;
30 extern unsigned value_copies = 0;
31 extern unsigned value_moves = 0;
35 m_const_type(val.m_const_type)
43 m_value = std::move(other.m_value);
44 m_const_type = std::move(other.m_const_type);
50 Value& Value::operator=(
const Value& other)
noexcept
52 m_value = other.m_value;
53 m_const_type = other.m_const_type;
114 return std::get<std::vector<Value>>(
m_value);
119 return std::get<internal::Closure>(
m_value);
124 return std::get<String>(
m_value);
129 return std::get<UserType>(
m_value);
134 return std::get<Value*>(
m_value);
141 list().push_back(value);
146 list().push_back(std::move(value));
153 switch (V.valueType())
157 double d = V.number();
164 os << V.string().c_str();
168 os <<
"Function @ " << V.pageAddr();
178 for (
auto it = V.constList().begin(), it_end = V.constList().end(); it != it_end; ++it)
181 os <<
"\"" << (*it) <<
"\"";
184 if (it + 1 != it_end)
216 os << (*V.reference());
220 os <<
"Instruction @ " << V.pageAddr();
Lots of utilities about string, filesystem and more.
#define init_const_type(is_const, type)
A class to be use C++ objects in ArkScript.
std::vector< Value > & list()
Return the stored list as a reference.
internal::Closure & refClosure()
Return a reference to the closure held by the value.
Value * reference() const
Return the stored internal object reference.
Value(*)(std::vector< Value > &, VM *) ProcType
Value() noexcept
Construct a new Value object.
void push_back(const Value &value)
Add an element to the list held by the value (if the value type is set to list)
String & stringRef()
Return the stored string as a reference.
UserType & usertypeRef()
Return the stored user type as a reference.
int decPlaces(double d)
Count the number of decimals for a double.
int digPlaces(double d)
Count the number of digits for a double.
std::ostream & operator<<(std::ostream &os, const Value &V) noexcept