CLI11 2.2.0
Loading...
Searching...
No Matches
Validators.hpp File Reference
#include "Macros.hpp"
#include "StringTools.hpp"
#include "TypeTools.hpp"
#include <cmath>
#include <cstdint>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <sys/stat.h>
#include <sys/types.h>
Include dependency graph for Validators.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CLI::Validator
 Some validators that are provided. More...
 
class  CLI::CustomValidator
 Class wrapping some of the accessors of Validator. More...
 
class  CLI::detail::ExistingFileValidator
 Check for an existing file (returns error message if check fails) More...
 
class  CLI::detail::ExistingDirectoryValidator
 Check for an existing directory (returns error message if check fails) More...
 
class  CLI::detail::ExistingPathValidator
 Check for an existing path. More...
 
class  CLI::detail::NonexistentPathValidator
 Check for an non-existing path. More...
 
class  CLI::detail::IPV4Validator
 Validate the given string is a legal ipv4 address. More...
 
class  CLI::TypeValidator< DesiredType >
 Validate the input as a particular type. More...
 
class  CLI::FileOnDefaultPath
 
class  CLI::Range
 Produce a range (factory). Min and max are inclusive. More...
 
class  CLI::Bound
 Produce a bounded range (factory). Min and max are inclusive. More...
 
struct  CLI::detail::has_find< C, V >
 
class  CLI::IsMember
 Verify items are in a set. More...
 
class  CLI::Transformer
 Translate named items to other or a value set. More...
 
class  CLI::CheckedTransformer
 translate named items to other or a value set More...
 
class  CLI::AsNumberWithUnit
 
class  CLI::AsSizeValue
 

Namespaces

namespace  CLI
 
namespace  CLI::detail
 

Enumerations

enum class  CLI::detail::path_type { CLI::detail::nonexistent , CLI::detail::file , CLI::detail::directory }
 CLI enumeration of different file types. More...
 

Functions

path_type CLI::detail::check_path (const char *file) noexcept
 get the type of the path from a file name
 
template<typename T , enable_if_t< is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy>
auto CLI::detail::smart_deref (T value) -> decltype(*value)
 
template<typename T , enable_if_t<!is_copyable_ptr< typename std::remove_reference< T >::type >::value, detail::enabler > = detail::dummy>
std::remove_reference< T >::type & CLI::detail::smart_deref (T &value)
 
template<typename T >
std::string CLI::detail::generate_set (const T &set)
 Generate a string representation of a set.
 
template<typename T >
std::string CLI::detail::generate_map (const T &map, bool key_only=false)
 Generate a string representation of a map.
 
template<typename T , typename V , enable_if_t<!has_find< T, V >::value, detail::enabler > = detail::dummy>
auto CLI::detail::search (const T &set, const V &val) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
 A search function.
 
template<typename T , typename V >
auto CLI::detail::search (const T &set, const V &val, const std::function< V(V)> &filter_function) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
 A search function with a filter function.
 
template<typename T >
std::enable_if< std::is_signed< T >::value, T >::type CLI::detail::overflowCheck (const T &a, const T &b)
 Do a check for overflow on signed numbers.
 
template<typename T >
std::enable_if<!std::is_signed< T >::value, T >::type CLI::detail::overflowCheck (const T &a, const T &b)
 Do a check for overflow on unsigned numbers.
 
template<typename T >
std::enable_if< std::is_integral< T >::value, bool >::type CLI::detail::checked_multiply (T &a, T b)
 Performs a *= b; if it doesn't cause integer overflow. Returns false otherwise.
 
template<typename T >
std::enable_if< std::is_floating_point< T >::value, bool >::type CLI::detail::checked_multiply (T &a, T b)
 Performs a *= b; if it doesn't equal infinity. Returns false otherwise.
 
std::pair< std::string, std::string > CLI::detail::split_program_name (std::string commandline)
 
template<typename T >
using CLI::TransformPairs = std::vector<std::pair<std::string, T>>
 definition of the default transformation object
 
const detail::ExistingFileValidator CLI::ExistingFile
 Check for existing file (returns error message if check fails)
 
const detail::ExistingDirectoryValidator CLI::ExistingDirectory
 Check for an existing directory (returns error message if check fails)
 
const detail::ExistingPathValidator CLI::ExistingPath
 Check for an existing path.
 
const detail::NonexistentPathValidator CLI::NonexistentPath
 Check for an non-existing path.
 
const detail::IPV4Validator CLI::ValidIPV4
 Check for an IP4 address.
 
const TypeValidator< double > CLI::Number ("NUMBER")
 Check for a number.
 
const Range CLI::NonNegativeNumber ((std::numeric_limits< double >::max)(), "NONNEGATIVE")
 Check for a non negative number.
 
const Range CLI::PositiveNumber ((std::numeric_limits< double >::min)(),(std::numeric_limits< double >::max)(), "POSITIVE")
 Check for a positive valued number (val>0.0), min() her is the smallest positive number.
 
std::string CLI::ignore_case (std::string item)
 Helper function to allow ignore_case to be passed to IsMember or Transform.
 
std::string CLI::ignore_underscore (std::string item)
 Helper function to allow ignore_underscore to be passed to IsMember or Transform.
 
std::string CLI::ignore_space (std::string item)
 Helper function to allow checks to ignore spaces to be passed to IsMember or Transform.