A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
values.cc File Reference
#include "a11/flow/values.h"
#include <algorithm>
#include <cerrno>
#include <charconv>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <limits>
#include <set>
#include <utility>
#include <variant>
#include <absl/base/thread_annotations.h>
#include <absl/functional/function_ref.h>
#include <absl/log/check.h>
#include <absl/status/status.h>
#include <absl/status/status_macros.h>
#include <absl/strings/ascii.h>
#include <absl/strings/escaping.h>
#include <absl/strings/match.h>
#include <absl/strings/str_cat.h>
#include <absl/strings/str_format.h>
#include <absl/strings/str_join.h>
#include <absl/strings/str_split.h>
#include <absl/time/clock.h>
#include <cmath>
#include <nlohmann/json.hpp>
#include "a11/data/serial_tags.h"
#include "a11/data/serialization.h"
#include "a11/flow/vocabulary.h"
#include "a11/internal/regex.h"
#include "a11/json_codec.h"
#include "a11/status.h"
#include "a11/time.h"
#include "a11/utf8.h"
#include "thread/boost_primitives.h"

Classes

struct  a11::flow::Value::StatusPayload
 
struct  a11::flow::Value::PackedList
 
struct  a11::flow::WindowBuffer::Block
 
struct  a11::flow::Value::WindowList
 

Namespaces

namespace  a11
 
namespace  a11::flow
 

Functions

bool a11::flow::operator== (const Value &left, const Value &right)
 
std::unique_ptr< HostBridge > a11::flow::NativeHostBridge ()
 A host bridge backed by the C++ serialization registry.
 
std::optional< Value > a11::flow::LookupOptional (const Value &value, const Value &key)
 
absl::StatusOr< Value > a11::flow::LookupChecked (const Value &value, const Value &key)
 
Value a11::flow::Lookup (const Value &value, const Value &key)
 Take key out of value: a mapping key, an index, or a field.
 
bool a11::flow::Truthy (const Value &value)
 Whether value counts as true, as an if and a where decide it.
 
std::string a11::flow::AsText (const Value &value)
 value as text, the way the text stage and builtin render it.
 
Value a11::flow::AsNumber (const Value &value)
 value as a number, or zero when there is nothing to read.
 
std::optional< std::int64_t > a11::flow::ExactInt64 (const Value &value)
 
double a11::flow::AsDouble (const Value &value)
 AsNumber as a double, for the places that only want the magnitude.
 
Value a11::flow::AsHole (pattern::HoleType type, std::string_view text)
 One hole's text, read as the hole said to read it.
 
absl::StatusOr< Value > a11::flow::MatchPattern (std::string_view pattern, std::string_view subject)
 The fields a pattern pulls out of subject, or null where it does not fit.
 
Value a11::flow::MatchCompiled (const pattern::Pattern &pattern, std::string_view subject)
 The same, against a pattern already compiled.
 
Value a11::flow::AsJson (const Value &value)
 Text parsed as JSON; anything already decoded is left alone.
 
Value a11::flow::Truncate (const Value &value, std::int64_t size)
 The first size of a value: characters, bytes, elements or pairs.
 
std::string a11::flow::JsonText (const Value &value)
 Renders JSON with sorted keys, spaced separators, and escaped non-ASCII.
 
double a11::flow::DurationSeconds (absl::Duration value)
 A duration as a number of seconds, for every duration there is.
 
absl::Duration a11::flow::AsDuration (const Value &value)
 A duration from a duration, from written text, or from seconds.
 
absl::Time a11::flow::AsTime (const Value &value)
 An instant from an instant, from RFC 3339 text, or from epoch seconds.
 
std::string a11::flow::DurationText (absl::Duration value, std::string_view spec={})
 A duration as text: 1m30s by default, or one unit when spec names one.
 
std::string a11::flow::TimeText (absl::Time value, std::string_view spec={})
 An instant as text: RFC 3339 in UTC, a strftime pattern, or epoch.
 
FormatTemplate a11::flow::CompileStrformat (std::string_view text)
 
std::string a11::flow::StrformatCompiled (const FormatTemplate &parts, absl::Span< const Value > arguments)
 
std::string a11::flow::Strformat (const Value &format, absl::Span< const Value > arguments)
 format with each % conversion replaced by one of arguments.
 
absl::StatusOr< Value > a11::flow::CallBuiltin (std::string_view name, absl::Span< const Value > arguments, HostBridge *absl_nullable bridge, const PreparedExpressions *prepared)
 
absl::StatusOr< Value > a11::flow::CoerceShape (const DtoPlan &shape, const Value &value, const CoerceContext &context)
 Make value a value of shape: fill its defaults, check its bounds, and coerce every field to the type the shape gives it.
 
absl::StatusOr< Value > a11::flow::Coerce (const Value &value, const syntax::TypeExpression &type, const CoerceContext &context)
 Make value a value of the type type names.
 
int a11::flow::Order (const Value &left, const Value &right)
 Where two values sit relative to one another: -1, 0 or 1.
 
absl::StatusOr< Value > a11::flow::Add (const Value &left, const Value &right)
 left + right, as an expression means it.
 
absl::StatusOr< Value > a11::flow::Evaluate (const syntax::Node &node, const EvalContext &context)
 Evaluate one expression.
 
Value a11::flow::StatusRecord (const absl::Status &status)
 A status as the record a flow sees when it looks at an outcome.
 
Value a11::flow::FailureRecord (const absl::Status &status, Value item, std::int64_t seq)
 A tolerated stage failure, with the original item and zero-based position.
 
std::optional< absl::StatusCode > a11::flow::StatusCodeOf (const Value &value)
 The canonical code value names, by name or by number, or nullopt.
 
absl::Status a11::flow::StatusOfRecord (const Value &record)
 The status a record like the one above describes.
 

Variable Documentation

◆ bits

int bits

◆ is_signed

bool is_signed

◆ items

std::vector<Value> items

◆ key

std::string key

◆ object

bool object = false

◆ pairs

Value::Pairs pairs