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

A value the language can write out in full: what a literal is, and what folding a literal expression gives. More...

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

Public Types

enum class  Kind {
  kNull , kBool , kInteger , kDouble ,
  kString , kDuration , kList , kObject
}
 

Public Member Functions

double AsDouble () const
 The number this holds, whichever way it was written.
 

Static Public Member Functions

static Constant Null ()
 
static Constant Bool (bool value)
 
static Constant Integer (long long value)
 
static Constant Double (double value)
 
static Constant String (std::string value)
 
static Constant Duration (absl::Duration value)
 

Public Attributes

Kind kind = Kind::kNull
 
bool boolean = false
 
long long integer = 0
 
double number = 0.0
 
std::string text
 
absl::Duration duration
 
std::vector< Constant > items
 
std::vector< std::pair< std::string, Constant > > pairs
 

Detailed Description

A value the language can write out in full: what a literal is, and what folding a literal expression gives.

Recursive, because a list of objects of lists is a constant like any other. kInteger is kept apart from kDouble for the reason the grammar cares about: a count of values has to be a whole number of them.

Member Enumeration Documentation

◆ Kind

Enumerator
kNull 
kBool 
kInteger 
kDouble 
kString 
kDuration 
kList 
kObject 

Member Function Documentation

◆ AsDouble()

double a11::flow::syntax::Constant::AsDouble ( ) const

The number this holds, whichever way it was written.

◆ Bool()

Constant a11::flow::syntax::Constant::Bool ( bool  value)
static

◆ Double()

Constant a11::flow::syntax::Constant::Double ( double  value)
static

◆ Duration()

Constant a11::flow::syntax::Constant::Duration ( absl::Duration  value)
static

◆ Integer()

Constant a11::flow::syntax::Constant::Integer ( long long  value)
static

◆ Null()

static Constant a11::flow::syntax::Constant::Null ( )
inlinestatic

◆ String()

Constant a11::flow::syntax::Constant::String ( std::string  value)
static

Member Data Documentation

◆ boolean

bool a11::flow::syntax::Constant::boolean = false

◆ duration

absl::Duration a11::flow::syntax::Constant::duration

◆ integer

long long a11::flow::syntax::Constant::integer = 0

◆ items

std::vector<Constant> a11::flow::syntax::Constant::items

◆ kind

Kind a11::flow::syntax::Constant::kind = Kind::kNull

◆ number

double a11::flow::syntax::Constant::number = 0.0

◆ pairs

std::vector<std::pair<std::string, Constant> > a11::flow::syntax::Constant::pairs

◆ text

std::string a11::flow::syntax::Constant::text

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