A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::flow::Value Class Reference

An immutable Flow value with shared containers and long text. More...

#include <cpp/a11/flow/values.h>

Classes

struct  PackedList
 
class  Pairs
 
struct  StatusPayload
 
struct  WindowList
 

Public Types

enum class  Kind {
  kNull , kBool , kInteger , kDouble ,
  kTypedInteger , kTypedFloat , kString , kBytes ,
  kList , kObject , kDuration , kTime ,
  kChunk , kHost
}
 

Public Member Functions

 Value ()=default
 
bool is_option () const
 
Kind kind () const
 
bool IsNull () const
 
bool IsNumber () const
 
bool IsTimelike () const
 
bool IsTextlike () const
 Whether the value is one the language itself can take apart: a string or a byte string, which index and slice but are not containers of values.
 
bool boolean () const
 
std::int64_t integer () const
 
double number () const
 
absl::uint128 magnitude () const
 
bool negative () const
 
bool numeric_signed () const
 
int numeric_bits () const
 
bool is_legacy_number () const
 
const std::string & text () const
 
const std::vector< Value > & items () const
 
size_t list_size () const
 
Value list_at (size_t index) const
 
bool has_packed_element_type (std::string_view name) const
 
const Pairs & pairs () const
 
const absl::Status *absl_nullable native_status () const
 
absl::Duration duration () const
 
absl::Time time () const
 
const data::Chunk & chunk () const
 
const HostObject & host () const
 
const std::shared_ptr< const HostObject > & host_object () const
 
const Value *absl_nullable Get (std::string_view key) const
 The value at key of an object, or nullptr.
 

Static Public Member Functions

static Value Null ()
 
static Value Bool (bool value)
 
static Value Integer (std::int64_t value)
 
static Value Double (double value)
 
static Value TypedInteger (absl::uint128 magnitude, bool negative, int bits, bool is_signed)
 
static Value TypedFloat (double value, int bits)
 
static Value LegacyNumber (Value value)
 
static Value String (std::string value)
 
static Value Bytes (data::Bytes value)
 
static Value List (std::vector< Value > items)
 
static Value List (std::vector< Value > items, std::string_view element_type)
 
static Value Object (Pairs pairs)
 
static Value Status (absl::Status status, Pairs fields)
 
static Value Option (std::optional< Value > value)
 
static Value Duration (absl::Duration value)
 
static Value Time (absl::Time value)
 
static Value Chunk (data::Chunk chunk)
 
static Value Host (std::shared_ptr< const HostObject > object)
 
static Value Of (const syntax::Constant &constant)
 The value a Constant – a literal, or a folded literal expression – is.
 

Friends

class WindowBuffer
 
bool operator== (const Value &left, const Value &right)
 Whether the two values are equal, as == in a flow decides it.
 

Detailed Description

An immutable Flow value with shared containers and long text.

Integer and floating-point values retain distinct renderings.

Member Enumeration Documentation

◆ Kind

enum class a11::flow::Value::Kind
strong
Enumerator
kNull 

A value that is not there: an absent key, an empty stream, a missing header.

One kind for all of them, because a flow asking if not x should not have to know which sort of nothing it got.

kBool 
kInteger 
kDouble 
kTypedInteger 
kTypedFloat 
kString 
kBytes 
kList 
kObject 
kDuration 
kTime 
kChunk 

An undecoded chunk, kept whole so a pipe that only moves values re-writes the producer's own bytes and mimetype.

kHost 

Constructor & Destructor Documentation

◆ Value()

a11::flow::Value::Value ( )
default

Member Function Documentation

◆ Bool()

Value a11::flow::Value::Bool ( bool  value)
static

◆ boolean()

bool a11::flow::Value::boolean ( ) const

◆ Bytes()

Value a11::flow::Value::Bytes ( data::Bytes  value)
static

◆ chunk()

const data::Chunk & a11::flow::Value::chunk ( ) const

◆ Chunk()

Value a11::flow::Value::Chunk ( data::Chunk  chunk)
static

◆ Double()

Value a11::flow::Value::Double ( double  value)
static

◆ duration()

absl::Duration a11::flow::Value::duration ( ) const

◆ Duration()

Value a11::flow::Value::Duration ( absl::Duration  value)
static

◆ Get()

const Value *absl_nullable a11::flow::Value::Get ( std::string_view  key) const

The value at key of an object, or nullptr.

◆ has_packed_element_type()

bool a11::flow::Value::has_packed_element_type ( std::string_view  name) const

◆ host()

const HostObject & a11::flow::Value::host ( ) const

◆ Host()

Value a11::flow::Value::Host ( std::shared_ptr< const HostObject >  object)
static

◆ host_object()

const std::shared_ptr< const HostObject > & a11::flow::Value::host_object ( ) const

◆ integer()

std::int64_t a11::flow::Value::integer ( ) const

◆ Integer()

Value a11::flow::Value::Integer ( std::int64_t  value)
static

◆ is_legacy_number()

bool a11::flow::Value::is_legacy_number ( ) const
inline

◆ is_option()

bool a11::flow::Value::is_option ( ) const
inline

◆ IsNull()

bool a11::flow::Value::IsNull ( ) const
inline

◆ IsNumber()

bool a11::flow::Value::IsNumber ( ) const
inline

◆ IsTextlike()

bool a11::flow::Value::IsTextlike ( ) const
inline

Whether the value is one the language itself can take apart: a string or a byte string, which index and slice but are not containers of values.

◆ IsTimelike()

bool a11::flow::Value::IsTimelike ( ) const
inline

◆ items()

const std::vector< Value > & a11::flow::Value::items ( ) const

◆ kind()

Kind a11::flow::Value::kind ( ) const
inline

◆ LegacyNumber()

Value a11::flow::Value::LegacyNumber ( Value  value)
static

◆ List() [1/2]

Value a11::flow::Value::List ( std::vector< Value >  items)
static

◆ List() [2/2]

Value a11::flow::Value::List ( std::vector< Value >  items,
std::string_view  element_type 
)
static

◆ list_at()

Value a11::flow::Value::list_at ( size_t  index) const

◆ list_size()

size_t a11::flow::Value::list_size ( ) const

◆ magnitude()

absl::uint128 a11::flow::Value::magnitude ( ) const

◆ native_status()

const absl::Status * a11::flow::Value::native_status ( ) const

◆ negative()

bool a11::flow::Value::negative ( ) const
inline

◆ Null()

static Value a11::flow::Value::Null ( )
inlinestatic

◆ number()

double a11::flow::Value::number ( ) const

◆ numeric_bits()

int a11::flow::Value::numeric_bits ( ) const
inline

◆ numeric_signed()

bool a11::flow::Value::numeric_signed ( ) const
inline

◆ Object()

Value a11::flow::Value::Object ( Pairs  pairs)
static

◆ Of()

Value a11::flow::Value::Of ( const syntax::Constant &  constant)
static

The value a Constant – a literal, or a folded literal expression – is.

◆ Option()

Value a11::flow::Value::Option ( std::optional< Value >  value)
static

◆ pairs()

const Value::Pairs & a11::flow::Value::pairs ( ) const

◆ Status()

Value a11::flow::Value::Status ( absl::Status  status,
Pairs  fields 
)
static

◆ String()

Value a11::flow::Value::String ( std::string  value)
static

◆ text()

const std::string & a11::flow::Value::text ( ) const

◆ time()

absl::Time a11::flow::Value::time ( ) const

◆ Time()

Value a11::flow::Value::Time ( absl::Time  value)
static

◆ TypedFloat()

Value a11::flow::Value::TypedFloat ( double  value,
int  bits 
)
static

◆ TypedInteger()

Value a11::flow::Value::TypedInteger ( absl::uint128  magnitude,
bool  negative,
int  bits,
bool  is_signed 
)
static

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const Value &  left,
const Value &  right 
)
friend

Whether the two values are equal, as == in a flow decides it.

◆ WindowBuffer

friend class WindowBuffer
friend

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