Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
Ase::Value Struct Reference

Value type used to interface with various property types. More...

#include "value.hh"

Inheritance diagram for Ase::Value:
[legend]

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 ValueSas_array () const
 Retrive a non-empty array if Value contains a non-empty array.
 
const ValueRas_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)
 
Valueoperator[] (size_t i)
 
const Valueoperator[] (size_t i) const
 
Valueoperator[] (const String &name)
 
const Valueoperator[] (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
 
- Public Member Functions inherited from std::variant
emplace (T... args)
 
index (T... args)
 
operator= (T... args)
 
swap (T... args)
 
valueless_by_exception (T... args)
 
variant (T... args)
 
~variant (T... args)
 

Static Public Attributes

static const Value empty_value
 

Detailed Description

Value type used to interface with various property types.

Definition at line 54 of file value.hh.

Member Enumeration Documentation

◆ Type

enum Ase::Value::Type

Definition at line 56 of file value.hh.

Constructor & Destructor Documentation

◆ Value() [1/8]

Ase::Value::Value ( )

Definition at line 86 of file value.hh.

◆ Value() [2/8]

Ase::Value::Value ( bool  v)

Definition at line 87 of file value.hh.

◆ Value() [3/8]

Ase::Value::Value ( int64  v)

Definition at line 88 of file value.hh.

◆ Value() [4/8]

Ase::Value::Value ( int32  v)

Definition at line 89 of file value.hh.

◆ Value() [5/8]

Ase::Value::Value ( uint32  v)

Definition at line 90 of file value.hh.

◆ Value() [6/8]

Ase::Value::Value ( double  v)

Definition at line 91 of file value.hh.

◆ Value() [7/8]

Ase::Value::Value ( const char v)

Definition at line 92 of file value.hh.

◆ Value() [8/8]

Ase::Value::Value ( const String v)

Definition at line 93 of file value.hh.

Member Function Documentation

◆ as_array()

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().

◆ as_double()

double Ase::Value::as_double ( ) const

◆ as_int()

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&().

◆ as_record()

const ValueR & Ase::Value::as_record ( ) const

Definition at line 143 of file value.cc.

◆ as_string()

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().

◆ count()

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().

◆ filter()

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().

◆ has()

bool Ase::Value::has ( const String key) const

Check for a named field in a RECORD.

Definition at line 28 of file value.cc.

◆ index()

constexpr Type Ase::Value::index ( ) const
constexpr

Definition at line 57 of file value.hh.

◆ is_numeric()

bool Ase::Value::is_numeric ( bool  boolisnumeric = true) const

Checks if Value is a DOUBLE, INT64, or BOOL.

Definition at line 51 of file value.cc.

◆ is_string()

bool Ase::Value::is_string ( ) const

Definition at line 69 of file value.hh.

◆ keys()

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().

◆ operator!=()

bool Ase::Value::operator!= ( const Value other) const

Definition at line 95 of file value.hh.

◆ operator=() [1/12]

void Ase::Value::operator= ( bool  v)

Definition at line 70 of file value.hh.

◆ operator=() [2/12]

void Ase::Value::operator= ( const char v)

Definition at line 75 of file value.hh.

◆ operator=() [3/12]

void Ase::Value::operator= ( const InstanceP v)

Definition at line 81 of file value.hh.

◆ operator=() [4/12]

void Ase::Value::operator= ( const String v)

Definition at line 76 of file value.hh.

◆ operator=() [5/12]

void Ase::Value::operator= ( const ValueR v)

Definition at line 79 of file value.hh.

◆ operator=() [6/12]

void Ase::Value::operator= ( const ValueS v)

Definition at line 77 of file value.hh.

◆ operator=() [7/12]

void Ase::Value::operator= ( double  v)

Definition at line 74 of file value.hh.

◆ operator=() [8/12]

void Ase::Value::operator= ( int32  v)

Definition at line 72 of file value.hh.

◆ operator=() [9/12]

void Ase::Value::operator= ( int64  v)

Definition at line 71 of file value.hh.

◆ operator=() [10/12]

void Ase::Value::operator= ( uint32  v)

Definition at line 73 of file value.hh.

◆ operator=() [11/12]

void Ase::Value::operator= ( ValueR &&  v)

Definition at line 80 of file value.hh.

◆ operator=() [12/12]

void Ase::Value::operator= ( ValueS &&  v)

Definition at line 78 of file value.hh.

◆ operator==()

bool Ase::Value::operator== ( const Value other) const

Definition at line 146 of file value.hh.

◆ operator[]() [1/4]

Value & Ase::Value::operator[] ( const String name)

Definition at line 195 of file value.cc.

◆ operator[]() [2/4]

const Value & Ase::Value::operator[] ( const String name) const

Definition at line 203 of file value.cc.

◆ operator[]() [3/4]

Value & Ase::Value::operator[] ( size_t  i)

Definition at line 151 of file value.cc.

◆ operator[]() [4/4]

const Value & Ase::Value::operator[] ( size_t  i) const

Definition at line 177 of file value.cc.

◆ repr()

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().

Member Data Documentation

◆ empty_value

const Value Ase::Value::empty_value
static

Definition at line 96 of file value.hh.


The documentation for this struct was generated from the following files: