This file contains various functions and classes to work with layers like getting or resolving using a path. More...
Go to the source code of this file.
Data Structures | |
class | garlic::lazy_string_splitter |
Lazy string splitter for getting tokens one by one. More... | |
Functions | |
template<GARLIC_VIEW L1, GARLIC_VIEW L2> | |
static std::enable_if_t<!is_comparable< L1, L2 >::value, bool > | garlic::cmp_layers (const L1 &layer1, const L2 &layer2) |
Checks the equality of two layers. More... | |
template<GARLIC_VIEW LayerType, typename Callable > | |
static void | garlic::resolve_layer_cb (const LayerType &value, std::string_view path, Callable &&cb) |
template<typename OutputType , GARLIC_VIEW Layer> | |
static OutputType | garlic::safe_resolve (const Layer &value, std::string_view key, OutputType default_value) |
template<typename OutputType , GARLIC_VIEW Layer, typename Callable > | |
static void | garlic::safe_resolve_cb (const Layer &value, std::string_view key, Callable &&cb) |
template<typename OutputType , GARLIC_VIEW Layer> | |
static OutputType | garlic::resolve (const Layer &value, std::string_view key, OutputType default_value) |
template<typename OutputType , GARLIC_VIEW Layer, typename Callable > | |
static void | garlic::resolve_cb (const Layer &value, std::string_view key, Callable &&cb) |
template<GARLIC_VIEW Layer, typename Callable > | |
static void | garlic::get_member (const Layer &value, const char *key, Callable &&cb) noexcept |
template<GARLIC_VIEW Layer, typename Callable > | |
static void | garlic::get_member (const Layer &value, std::string_view key, Callable &&cb) noexcept |
template<GARLIC_VIEW Layer, std::integral IndexType, typename Callable > | |
static std::enable_if_t< std::__is_random_access_iter< ConstValueIteratorOf< Layer > >::value > | garlic::get_item (Layer &&layer, IndexType index, Callable &&cb) noexcept |
template<typename OutputType , GARLIC_VIEW Layer> | |
static OutputType | garlic::get (Layer &&layer, const char *key) |
template<typename OutputType , GARLIC_VIEW Layer, std::integral IndexType> | |
static std::enable_if_t< std::__is_random_access_iter< ConstValueIteratorOf< Layer > >::value, OutputType > | garlic::get (Layer &&layer, IndexType index) |
template<typename OutputType , GARLIC_VIEW Layer> | |
static OutputType | garlic::get (Layer &&layer, const char *key, OutputType default_value) |
template<typename OutputType , GARLIC_VIEW Layer, std::integral IndexType> | |
static OutputType | garlic::get (Layer &&layer, IndexType index, OutputType default_value) |
template<typename OutputType , typename Callable , GARLIC_VIEW Layer> | |
static void | garlic::get_cb (Layer &&layer, const char *key, Callable &&cb) |
template<typename OutputType , GARLIC_VIEW Layer, std::integral IndexType, typename Callable > | |
static void | garlic::get_cb (Layer &&layer, IndexType index, Callable &&cb) |
template<typename OutputType , GARLIC_VIEW Layer> | |
static OutputType | garlic::safe_get (Layer &&layer, const char *key, OutputType default_value) |
template<typename OutputType , GARLIC_VIEW Layer, std::integral IndexType> | |
static OutputType | garlic::safe_get (Layer &&layer, IndexType index, OutputType default_value) |
template<typename OutputType , GARLIC_VIEW Layer, typename Callable > | |
static void | garlic::safe_get_cb (Layer &&layer, const char *key, Callable &&cb) |
template<typename OutputType , GARLIC_VIEW Layer, std::integral IndexType, typename Callable > | |
static void | garlic::safe_get_cb (Layer &&layer, IndexType index, Callable &&cb) |
template<GARLIC_VIEW Layer, GARLIC_REF Output> | |
static void | garlic::copy_layer (Layer &&layer, Output output) |
template<GARLIC_VIEW Layer> | |
static size_t | garlic::list_size (Layer &&layer) |
Get the size of a list from a layer. More... | |
template<GARLIC_VIEW Layer> | |
static size_t | garlic::string_length (Layer &&layer) |
Get the length of a string from a layer. More... | |
This file contains various functions and classes to work with layers like getting or resolving using a path.
|
inlinestatic |
Checks the equality of two layers.
If the equality operator is defined or simply if layer1 == layer2 is valid, this function just returns the result of that comparison. This is done for performance reasons.
layer1 | The first layer, any type that conforms to the garlic::ViewLayer concept. |
layer2 | The second layer, any type that conforms to the garlic::ViewLayer concept. |
|
inlinestatic |
Deep copies the content of one layer to another.
Layer | any type that conforms to garlic::ViewLayer concept. |
Output | any type that conforms to garlic::RefLayer concept. |
layer | The source view layer to copy values from. |
output | The destination ref layer to copy values to. |
|
inlinestatic |
Get the decoded value associated with the given key in the layer.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
|
inlinestatic |
Get the decoded value associated with the given key in the layer, if found.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
|
inlinestatic |
Get the decoded i th element in the layer.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
|
inlinestatic |
Get the decoded i th element in the layer, if found.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
|
inlinestatic |
Calls the callback function with the decoded value associated with the given key in the layer, if found.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
cb | Any callable object/lambda with signature void(OutputType) |
|
inlinestatic |
Calls the callback function with the decoded i th element in the layer, if found.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
cb | Any callable object/lambda with signature void(OutputType) |
|
inlinestaticnoexcept |
Calls the callback function with the i th element in the layer.
cb | Any callable object/lambda with signature void(LayerType) |
|
inlinestaticnoexcept |
Calls the callback function with the value associated with the given key in the layer, if found.
cb | Any callable object/lambda with signature void(LayerType) |
|
inlinestaticnoexcept |
Calls the callback function with the value associated with the given key in the layer, if found.
cb | Any callable object/lambda with signature void(LayerType) |
|
inlinestatic |
Get the size of a list from a layer.
|
inlinestatic |
Navigates the layer using the given path and if found returns the decoded value.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
path | An object path (e.g. users.2.first_name). |
default_value | A default value in case the path does not exist. |
|
inlinestatic |
Navigates the layer using the given path and if found, calls the callback function with the decoded value.
This method DOES NOT check if the found layer is possible to decode to the OutputType.
path | An object path (e.g. users.2.first_name). |
cb | Any callable object/lambda with signature void(OutputType) |
|
inlinestatic |
Navigates the layer using the given path and if found, calls the callback function with the found layer.
path | An object path (e.g. users.2.first_name). |
cb | Any callable object/lambda with signature void(LayerType) |
|
inlinestatic |
Get the decoded value associated with the given key in the layer, if found.
This method safely checks if the found layer is possible to decode to the OutputType.
|
inlinestatic |
Get the decoded i th element in the layer, if found.
This method safely checks if the found layer is possible to decode to the OutputType.
|
inlinestatic |
Calls the callback function with the decoded value associated with the given key in the layer, if found.
This method safely checks if the found layer is possible to decode to the OutputType.
cb | Any callable object/lambda with signature void(OutputType) |
|
inlinestatic |
Calls the callback function with the decoded i th element in the layer, if found.
This method safely checks if the found layer is possible to decode to the OutputType.
cb | Any callable object/lambda with signature void(OutputType) |
|
inlinestatic |
Navigates the layer using the given path and if found returns the decoded value.
This method safely checks if the found layer is possible to decode to the OutputType.
path | An object path (e.g. users.2.first_name). |
default_value | A default value in case the path does not exist or it cannot be decoded to the OutputType. |
|
inlinestatic |
Navigates the layer using the given path and if found calls the callback function with the decoded value.
This method safely checks if the found layer is possible to decode to the OutputType.
path | An object path (e.g. users.2.first_name). |
cb | Any callable object/lambda with signature void(OutputType) |
|
inlinestatic |
Get the length of a string from a layer.