Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
rpc::validation::OneOf< Type > Class Template Referencefinal

Validates that the value is one of the values passed in. More...

#include <Validators.hpp>

Public Member Functions

 OneOf (std::initializer_list< Type > options)
 Construct the validator with stored options of initializer list.
 
template<typename InputIt >
 OneOf (InputIt begin, InputIt end)
 Construct the validator with stored options of other container.
 
MaybeError verify (boost::json::value const &value, std::string_view key) const
 Verify that the JSON value is one of the stored options.
 

Detailed Description

template<typename Type>
class rpc::validation::OneOf< Type >

Validates that the value is one of the values passed in.

Constructor & Destructor Documentation

◆ OneOf() [1/2]

template<typename Type >
rpc::validation::OneOf< Type >::OneOf ( std::initializer_list< Type > options)
inlineexplicit

Construct the validator with stored options of initializer list.

Parameters
optionsThe list of allowed options

◆ OneOf() [2/2]

template<typename Type >
template<typename InputIt >
rpc::validation::OneOf< Type >::OneOf ( InputIt begin,
InputIt end )
inlineexplicit

Construct the validator with stored options of other container.

Parameters
begin,endthe range to copy the elements from

Member Function Documentation

◆ verify()

template<typename Type >
MaybeError rpc::validation::OneOf< Type >::verify ( boost::json::value const & value,
std::string_view key ) const
inlinenodiscard

Verify that the JSON value is one of the stored options.

Parameters
valueThe JSON value representing the outer object
keyThe key used to retrieve the tested value from the outer object
Returns
RippledError::rpcINVALID_PARAMS if validation failed; otherwise no error is returned

The documentation for this class was generated from the following file: