userver: formats::yaml Namespace Reference
Loading...
Searching...
No Matches
formats::yaml Namespace Reference

Detailed Description

YAML support.

YAML document model (formats::yaml::Value) and helpers.

Namespaces

namespace  blocking
 Blocking operations that should not be used on main task processor after startup.

Classes

class  BadStreamException
class  Exception
class  ExceptionWithPath
class  Iterator
 Iterator for formats::yaml::Value. More...
class  MemberMissingException
class  OutOfBoundsException
class  ParseException
class  Path
class  PathPrefixException
class  TypeMismatchException
class  Value
 Non-mutable YAML value representation. More...
class  ValueBuilder
 Builder for YAML. More...

Enumerations

enum class  Type
 Common enum of types. More...

Functions

formats::yaml::Value FromString (const std::string &doc)
 Parse YAML from string.
formats::yaml::Value FromStream (std::istream &is)
 Parse YAML from stream.
void Serialize (const formats::yaml::Value &doc, std::ostream &os)
 Serialize YAML to stream.
std::string ToString (const formats::yaml::Value &doc)
 Serialize YAML to string.
bool Parse (const Value &value, parse::To< bool >)
int64_t Parse (const Value &value, parse::To< int64_t >)
uint64_t Parse (const Value &value, parse::To< uint64_t >)
double Parse (const Value &value, parse::To< double >)
std::string Parse (const Value &value, parse::To< std::string >)
template<typename T>
requires (std::is_integral<T>::value && sizeof(T) <= sizeof(long long))
Value Serialize (T value, formats::serialize::To< Value >)
formats::yaml::Value FromFile (const std::string &path)
 Read YAML from file.
template<typename Value>
ItemsWrapper< ValueItems (Value &&value)
 Wrapper for handy python-like iteration over a map.

Enumeration Type Documentation

◆ Type

enum class formats::common::Type
strong

Common enum of types.

Definition at line 13 of file type.hpp.

Function Documentation

◆ FromStream()

formats::yaml::Value formats::yaml::FromStream ( std::istream & is)

Parse YAML from stream.

Parse JSON from stream.

◆ FromString()

formats::yaml::Value formats::yaml::FromString ( const std::string & doc)

Parse YAML from string.

Definition at line 289 of file from_string.hpp.

◆ Items()

template<typename Value>
ItemsWrapper< Value > formats::common::Items ( Value && value)

Wrapper for handy python-like iteration over a map.

for (const auto& [name, value] : Items(map)) {
EXPECT_EQ(name, "key");
EXPECT_EQ(value.As<std::string>(), "value");
break;
}

Definition at line 113 of file items.hpp.

◆ Serialize()

template<typename T>
requires (std::is_integral<T>::value && sizeof(T) <= sizeof(long long))
Value formats::yaml::Serialize ( T value,
formats::serialize::To< Value >  )

Definition at line 206 of file value_builder.hpp.