Contains classes and methods for defining and using encoders/decoders for various types.
More...
#include "layer.h"
#include "containers.h"
Go to the source code of this file.
|
template<typename Type , GARLIC_VIEW Layer> |
static std::enable_if_t< internal::use_explicit_decoder< Type, Layer >, Type > | garlic::decode (Layer &&layer) |
| Decodes a layer. More...
|
|
template<typename Type , GARLIC_VIEW Layer, typename Callable > |
static std::enable_if_t< internal::use_safe_decode_layer_method< Type, Layer > > | garlic::safe_decode (Layer &&layer, Callable &&cb) |
| Safely attempt to decode a value and if successful, call the callback method. More...
|
|
template<GARLIC_REF Layer, typename Type > |
static std::enable_if_t< internal::use_encode_layer_method< Type, Layer > > | garlic::encode (Layer &&layer, const Type &value) |
| Encode a value in a garlic::RefLayer. More...
|
|
Contains classes and methods for defining and using encoders/decoders for various types.
◆ decode()
template<typename Type , GARLIC_VIEW Layer>
static std::enable_if_t<internal::use_explicit_decoder<Type, Layer>, Type> garlic::decode |
( |
Layer && |
layer | ) |
|
|
inlinestatic |
Decodes a layer.
- Template Parameters
-
Layer | any readable layer that conforms to the garlic::ViewLayer concept. |
Type | the output type. |
- Parameters
-
layer | the layer to read from. |
◆ encode()
template<GARLIC_REF Layer, typename Type >
static std::enable_if_t<internal::use_encode_layer_method<Type, Layer> > garlic::encode |
( |
Layer && |
layer, |
|
|
const Type & |
value |
|
) |
| |
|
inlinestatic |
Encode a value in a garlic::RefLayer.
If an encoder is defined for the Type, it will be used to encode that value into the layer.
- Template Parameters
-
- Parameters
-
layer | the layer to write to. |
value | the value to encode to the layer. |
◆ safe_decode()
template<typename Type , GARLIC_VIEW Layer, typename Callable >
static std::enable_if_t<internal::use_safe_decode_layer_method<Type, Layer> > garlic::safe_decode |
( |
Layer && |
layer, |
|
|
Callable && |
cb |
|
) |
| |
|
inlinestatic |
Safely attempt to decode a value and if successful, call the callback method.
- Template Parameters
-
Layer | any readable layer that conforms to the garlic::ViewLayer concept. |
Callable | any lambda or callable type. |
- Parameters
-
layer | the layer to read from. |
cb | the callback function to call with a successfully decoded value. |