AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
codecs.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 standard
3 Copyright (C) 2026 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <https://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <cstddef>
23#include <istream>
24#include <optional>
25#include <ostream>
26#include <vector>
27
28#include "codec/codec.hpp"
29#include "codec/mediaType.hpp"
30
31namespace anch::codec {
32
45 template<typename... Cs>
46 struct Codecs {
47
49 template<typename T>
50 static constexpr bool SERIALIZES = (anch::codec::Serializer<Cs, T> || ...);
51
53 template<typename T>
54 static constexpr bool DESERIALIZES = (anch::codec::Deserializer<Cs, T> || ...);
55
63 static std::vector<anch::codec::MediaType> mediaTypes();
64
78 template<typename T>
79 static bool deserialize(T& value, std::istream& input, const anch::codec::MediaType& contentType,
81
95 template<typename T>
96 static std::optional<anch::codec::MediaType> serialize(const T& value, std::ostream& out,
97 const std::vector<anch::codec::MediaType>& accept,
99
100 };
101
102}
103
104#include "codec/impl/codecs.hpp"
Definition mediaType.hpp:41
Definition codec.hpp:157
Definition codec.hpp:140
AnCH codec library namespace.
Definition csv.hpp:31
Side
Definition codec.hpp:48
Definition codecs.hpp:46
static std::vector< anch::codec::MediaType > mediaTypes()
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 constexpr bool SERIALIZES
Definition codecs.hpp:50
static constexpr bool DESERIALIZES
Definition codecs.hpp:54
static bool deserialize(T &value, std::istream &input, const anch::codec::MediaType &contentType, anch::codec::Side side)