libkazv
validator.hpp File Reference
#include <libkazv-config.hpp>
#include <functional>
#include <types.hpp>
Include dependency graph for validator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Kazv
 

Enumerations

enum class  Kazv::CastArrayStrategy { Kazv::IgnoreInvalid , Kazv::FailAll }
 Strategy used for castArray(). More...
 
enum class  Kazv::CastObjectStrategy { Kazv::IgnoreInvalid , Kazv::FailAll }
 Strategy used for castObject(). More...
 

Functions

template<class Jsonish , class Key , class Validator >
bool Kazv::cast (Jsonish &ret, const Jsonish &input, Key &&k, Validator &&f)
 Run validator against input[k] and add it to ret. More...
 
template<class Func >
auto Kazv::identValidate (Func &&f)
 Make an identity validator. More...
 
template<class Jsonish , class Key , class Validator >
bool Kazv::castArray (Jsonish &ret, const Jsonish &input, Key &&k, Validator &&f, CastArrayStrategy strategy)
 Cast an array of items. More...
 
template<class Jsonish , class Key , class Validator >
bool Kazv::castObject (Jsonish &ret, const Jsonish &input, Key &&k, Validator &&f, CastObjectStrategy strategy)
 Cast an object of items. More...
 
template<class Jsonish , class Key , class Jsonish2 >
std::decay_t< Jsonish > Kazv::makeDefaultValue (Jsonish &&input, Key &&k, Jsonish2 &&defaultValue)
 Replace a non-existent value with a default one. More...