CppWAMP
C++11 client library for the WAMP protocol
|
Go to the documentation of this file.
7 #ifndef CPPWAMP_CODEC_HPP
8 #define CPPWAMP_CODEC_HPP
35 static constexpr
int json() {
return 1;}
36 static constexpr
int msgpack() {
return 2;}
37 static constexpr
int cbor() {
return 3;}
57 template <
typename O,
typename Enabled =
void>
71 struct OutputCategory<O,
EnableIf<!std::is_base_of<std::ostream, O>::value,
74 using type = ByteContainerOutputCategory;
90 template <
typename F,
typename O,
typename C = OutputCategoryTypeOf<O>>
102 template <
typename TFormat,
typename TOutput>
106 encoder.encode(variant, std::forward<TOutput>(output));
126 template <
typename I,
typename Enabled =
void>
132 template <
typename I>
139 template <
typename I>
140 struct InputCategory<I,
EnableIf<!std::is_base_of<std::istream, I>::value,
143 using type = ByteArrayInputCategory;
147 template <
typename I>
159 template <
typename F,
typename I,
typename C = InputCategoryTypeOf<I>>
171 template <
typename TFormat,
typename TInput>
175 return decoder.decode(std::forward<TInput>(input), variant);
180 #endif // CPPWAMP_CODEC_HPP
Output category for output streams of bytes.
Definition: codec.hpp:50
Discriminated union container that represents a JSON value.
Definition: variant.hpp:134
Contains the MessageBuffer definition.
Defines macros related to exporting/importing APIs.
Type used to indicate output category detection failed.
Definition: codec.hpp:53
void encode(const Variant &variant, TOutput &&output)
Encodes the given variant to the given byte container or stream.
Definition: codec.hpp:103
Definition: anyhandler.hpp:36
Traits class that determines the category type that best matches the given output type.
Definition: codec.hpp:58
typename OutputCategory< ValueTypeOf< O > >::type OutputCategoryTypeOf
Yields the category type that best matches the given output type.
Definition: codec.hpp:79
typename InputCategory< ValueTypeOf< I > >::type InputCategoryTypeOf
Yields the category type that best matches the given input type.
Definition: codec.hpp:148
Output category for containers of bytes which provide push_back and insert member functions.
Definition: codec.hpp:47
typename std::enable_if< B, T >::type EnableIf
Metafunction used to enable overloads based on a boolean condition.
Definition: traits.hpp:37
Contains the declaration of Variant and other closely related types/functions.
typename F::template Encoder< ValueTypeOf< O >, C > Encoder
Yields the encoder type needed to encode a Variant to the given output type and output category.
Definition: codec.hpp:91
std::error_code decode(TInput &&input, Variant &variant)
Decodes from the given byte sequence or stream to the given variant.
Definition: codec.hpp:172
IDs used by rawsocket transports to negotiate the serializer.
Definition: codec.hpp:33
Contains general-purpose type traits.
typename F::template Decoder< ValueTypeOf< I >, C > Decoder
Yields the decoder type needed to decode a Variant from the given input type and input category.
Definition: codec.hpp:160