Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)
« « « Anklang Documentation |
Value type used to interface with various property types. More...
#include "value.hh"
Public Types | |
enum | Type { NONE , BOOL , INT64 , DOUBLE , STRING , ARRAY , RECORD , INSTANCE } |
Public Member Functions | |
constexpr Type | index () const |
size_t | count () const |
Number of elements in a RECORD or ARRAY Value. | |
int64 | as_int () const |
Convert Value to int64 or return 0. | |
double | as_double () const |
Convert Value to double or return 0. | |
String | as_string () const |
Convert Value to a string, not very useful for RECORD or ARRAY. | |
const ValueS & | as_array () const |
Retrive a non-empty array if Value contains a non-empty array. | |
const ValueR & | as_record () const |
String | repr () const |
Convert Value to a string representation, useful for debugging. | |
StringS | keys () const |
List the field names of a RECORD Value. | |
bool | has (const String &key) const |
Check for a named field in a RECORD. | |
void | filter (const std::function< bool(const ValueField &)> &pred) |
Recursively purge/remove RECORD elements iff to pred (recordfield) == true . | |
bool | is_numeric (bool boolisnumeric=true) const |
Checks if Value is a DOUBLE, INT64, or BOOL. | |
bool | is_string () const |
void | operator= (bool v) |
void | operator= (int64 v) |
void | operator= (int32 v) |
void | operator= (uint32 v) |
void | operator= (double v) |
void | operator= (const char *v) |
void | operator= (const String &v) |
void | operator= (const ValueS &v) |
void | operator= (ValueS &&v) |
void | operator= (const ValueR &v) |
void | operator= (ValueR &&v) |
void | operator= (const InstanceP &v) |
Value & | operator[] (size_t i) |
const Value & | operator[] (size_t i) const |
Value & | operator[] (const String &name) |
const Value & | operator[] (const String &name) const |
Value (bool v) | |
Value (int64 v) | |
Value (int32 v) | |
Value (uint32 v) | |
Value (double v) | |
Value (const char *v) | |
Value (const String &v) | |
bool | operator== (const Value &other) const |
bool | operator!= (const Value &other) const |
![]() | |
T | emplace (T... args) |
T | index (T... args) |
T | operator= (T... args) |
T | swap (T... args) |
T | valueless_by_exception (T... args) |
T | variant (T... args) |
T | ~variant (T... args) |
Static Public Attributes | |
static const Value | empty_value |
const ValueS & Ase::Value::as_array | ( | ) | const |
Retrive a non-empty array if Value contains a non-empty array.
Definition at line 135 of file value.cc.
Referenced by Ase::WritNode::to_nodes().
double Ase::Value::as_double | ( | ) | const |
Convert Value to double or return 0.
Definition at line 77 of file value.cc.
References count(), and Ase::string_to_double().
Referenced by Ase::ClapPropertyImpl::get_normalized(), Ase::ParameterProperty::set_value(), Ase::ClapPropertyImpl::set_value(), and Ase::AudioPropertyImpl::set_value().
int64 Ase::Value::as_int | ( | ) | const |
Convert Value to int64 or return 0.
Definition at line 59 of file value.cc.
References count(), and Ase::string_to_int().
Referenced by Ase::WritNode::operator&().
String Ase::Value::as_string | ( | ) | const |
Convert Value to a string, not very useful for RECORD or ARRAY.
Definition at line 95 of file value.cc.
References count(), Ase::string_from_double(), and Ase::string_from_int().
Referenced by repr(), Ase::ServerImpl::set_data(), and Ase::AudioPropertyImpl::set_value().
size_t Ase::Value::count | ( | ) | const |
Number of elements in a RECORD or ARRAY Value.
Definition at line 15 of file value.cc.
Referenced by as_double(), as_int(), and as_string().
void Ase::Value::filter | ( | const std::function< bool(const ValueField &)> & | pred | ) |
Recursively purge/remove RECORD elements iff to pred (recordfield) == true
.
Definition at line 262 of file value.cc.
References std::vector::begin(), std::vector::erase(), and std::vector::size().
Referenced by Ase::WritNode::purge_value(), and Ase::ClipImpl::serialize().
StringS Ase::Value::keys | ( | ) | const |
List the field names of a RECORD Value.
Definition at line 39 of file value.cc.
References std::vector::push_back().
String Ase::Value::repr | ( | ) | const |
Convert Value to a string representation, useful for debugging.
Definition at line 243 of file value.cc.
References as_string(), Ase::string_format(), and Ase::string_to_cquote().