#include <codecs.hpp>
Static Public Member Functions | |
| static std::vector< anch::codec::MediaType > | mediaTypes () |
| template<typename T> | |
| static bool | deserialize (T &value, std::istream &input, const anch::codec::MediaType &contentType, anch::codec::Side side) |
| template<typename T> | |
| static std::optional< anch::codec::MediaType > | serialize (const T &value, std::ostream &out, const std::vector< anch::codec::MediaType > &accept, anch::codec::Side side) |
Static Public Attributes | |
| template<typename T> | |
| static constexpr bool | SERIALIZES = (anch::codec::Serializer<Cs, T> || ...) |
| template<typename T> | |
| static constexpr bool | DESERIALIZES = (anch::codec::Deserializer<Cs, T> || ...) |
List of codecs, resolved at compilation: selects the codec of a content type (reading) or of an Accept negotiation (writing).
anch::codec::Available (codec/all.hpp , target anch::codec-all ) lists the codecs of the formats built with the framework.
| Cs | the codecs, by preference order |
|
static |
Deserialize value with the first codec which deserializes T values and whose media type has the type/subtype of the content type (parameters are given to the codec)
| T | the value type |
| value | the value to fill |
| input | the input stream |
| contentType | the content type |
| side | the side which deserializes value |
false when no codec handles the content type (value and input are untouched)
|
static |
Get codecs media types
| std::invalid_argument | when a codec media type is invalid |
|
static |
Serialize value with the codec selected by Accept negotiation (negotiate) among the codecs which serialize T values
| T | the value type |
| value | the value |
| out | the output stream |
| accept | the accepted media ranges ; empty means that every media type is accepted (first codec) |
| side | the side which serializes value |
|
staticconstexpr |
true when one of the codecs deserializes T values
|
staticconstexpr |
true when one of the codecs serializes T values