AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::codec::Text Struct Reference

#include <text.hpp>

Collaboration diagram for anch::codec::Text:

Static Public Member Functions

static std::string_view mediaType () noexcept
template<typename T>
requires requires(std::ostream& out, const T& value) { out << value; }
static void serialize (const T &value, std::ostream &out)
static void deserialize (std::string &value, std::istream &input)

Detailed Description

text/plain codec: serializes values with stream injection operator, deserializes strings.
It is part of anch-codec (no format library needed) and always available.

Author
Vincent Lachenal
Since
0.3 (anch::rest::Text in 0.2)

Member Function Documentation

◆ deserialize()

void anch::codec::Text::deserialize ( std::string & value,
std::istream & input )
static

Read the whole input

Parameters
valuethe value to fill
inputthe input stream

◆ mediaType()

std::string_view anch::codec::Text::mediaType ( )
staticnoexcept

Media type

Returns
text/plain

◆ serialize()

template<typename T>
requires requires(std::ostream& out, const T& value) { out << value; }
void anch::codec::Text::serialize ( const T & value,
std::ostream & out )
static

Write value

Parameters
valuethe value
outthe output stream

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