Fleet  0.0.9
Inference in the LOT
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
CL11.hpp File Reference
#include <sys/stat.h>
#include <deque>
#include <set>
#include <iostream>
#include <string>
#include <iterator>
#include <tuple>
#include <locale>
#include <functional>
#include <numeric>
#include <iomanip>
#include <sys/types.h>
#include <utility>
#include <exception>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <vector>
#include <type_traits>
#include <memory>
Include dependency graph for CL11.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CLI::Error
 All errors derive from this one. More...
 
class  CLI::ConstructionError
 Construction errors (not in parsing) More...
 
class  CLI::IncorrectConstruction
 Thrown when an option is set to conflicting values (non-vector and multi args, for example) More...
 
class  CLI::BadNameString
 Thrown on construction of a bad name. More...
 
class  CLI::OptionAlreadyAdded
 Thrown when an option already exists. More...
 
class  CLI::ParseError
 Anything that can error in Parse. More...
 
class  CLI::Success
 This is a successful completion on parsing, supposed to exit. More...
 
class  CLI::CallForHelp
 -h or –help on command line More...
 
class  CLI::RuntimeError
 Does not output a diagnostic in CLI11_PARSE, but allows to return from main() with a specific error code. More...
 
class  CLI::FileError
 Thrown when parsing an INI file and it is missing. More...
 
class  CLI::ConversionError
 Thrown when conversion call back fails, such as when an int fails to coerce to a string. More...
 
class  CLI::ValidationError
 Thrown when validation of results fails. More...
 
class  CLI::RequiredError
 Thrown when a required option is missing. More...
 
class  CLI::ArgumentMismatch
 Thrown when the wrong number of arguments has been received. More...
 
class  CLI::RequiresError
 Thrown when a requires option is missing. More...
 
class  CLI::ExcludesError
 Thrown when an excludes option is present. More...
 
class  CLI::ExtrasError
 Thrown when too many positionals or options are found. More...
 
class  CLI::INIError
 Thrown when extra values are found in an INI file. More...
 
class  CLI::InvalidError
 Thrown when validation fails before parsing. More...
 
class  CLI::HorribleError
 
class  CLI::OptionNotFound
 Thrown when counting a non-existent option. More...
 
struct  CLI::is_vector< T >
 
struct  CLI::is_vector< std::vector< T, A > >
 
struct  CLI::is_bool< T >
 
struct  CLI::is_bool< bool >
 

Namespaces

 CLI
 
 CLI::detail
 

Macros

#define CLI11_VERSION_MAJOR   1
 
#define CLI11_VERSION_MINOR   4
 
#define CLI11_VERSION_PATCH   0
 
#define CLI11_VERSION   "1.4.0"
 
#define CLI11_ERROR_DEF(parent, name)
 
#define CLI11_ERROR_SIMPLE(name)   name(std::string msg) : name(#name, msg, ExitCodes::name) {}
 

Typedefs

template<bool B, class T = void>
using CLI::enable_if_t = typename std::enable_if< B, T >::type
 

Enumerations

enum  CLI::ExitCodes {
  CLI::ExitCodes::Success = 0, CLI::ExitCodes::IncorrectConstruction = 100, CLI::ExitCodes::BadNameString, CLI::ExitCodes::OptionAlreadyAdded,
  CLI::ExitCodes::FileError, CLI::ExitCodes::ConversionError, CLI::ExitCodes::ValidationError, CLI::ExitCodes::RequiredError,
  CLI::ExitCodes::RequiresError, CLI::ExitCodes::ExcludesError, CLI::ExitCodes::ExtrasError, CLI::ExitCodes::INIError,
  CLI::ExitCodes::InvalidError, CLI::ExitCodes::HorribleError, CLI::ExitCodes::OptionNotFound, CLI::ExitCodes::ArgumentMismatch,
  CLI::ExitCodes::BaseClass = 127
}
 
enum  CLI::detail::enabler
 Simple empty scoped class. More...
 

Functions

std::vector< std::string > CLI::detail::split (const std::string &s, char delim)
 Split a string by a delim. More...
 
template<typename T >
std::string CLI::detail::join (const T &v, std::string delim=",")
 Simple function to join a string. More...
 
template<typename T >
std::string CLI::detail::rjoin (const T &v, std::string delim=",")
 Join a string in reverse order. More...
 
std::string & CLI::detail::ltrim (std::string &str)
 Trim whitespace from left of string. More...
 
std::string & CLI::detail::ltrim (std::string &str, const std::string &filter)
 Trim anything from left of string. More...
 
std::string & CLI::detail::rtrim (std::string &str)
 Trim whitespace from right of string. More...
 
std::string & CLI::detail::rtrim (std::string &str, const std::string &filter)
 Trim anything from right of string. More...
 
std::string & CLI::detail::trim (std::string &str)
 Trim whitespace from string. More...
 
std::string & CLI::detail::trim (std::string &str, const std::string filter)
 Trim anything from string. More...
 
std::string CLI::detail::trim_copy (const std::string &str)
 Make a copy of the string and then trim it. More...
 
std::string CLI::detail::trim_copy (const std::string &str, const std::string &filter)
 Make a copy of the string and then trim it, any filter string can be used (any char in string is filtered) More...
 
void CLI::detail::format_help (std::stringstream &out, std::string name, std::string description, size_t wid)
 Print a two part "help" string. More...
 
template<typename T >
bool CLI::detail::valid_first_char (T c)
 Verify the first character of an option. More...
 
template<typename T >
bool CLI::detail::valid_later_char (T c)
 Verify following characters of an option. More...
 
bool CLI::detail::valid_name_string (const std::string &str)
 Verify an option name. More...
 
std::string CLI::detail::to_lower (std::string str)
 Return a lower case version of a string. More...
 
std::vector< std::string > CLI::detail::split_up (std::string str)
 Split a string '"one two" "three"' into 'one two', 'three'. More...
 
std::string CLI::detail::fix_newlines (std::string leader, std::string input)
 
template<typename T , enable_if_t< std::is_integral< T >::value &&std::is_signed< T >::value, detail::enabler > = detail::dummy>
constexpr const char * CLI::detail::type_name ()
 This one should not be used, since vector types print the internal type. More...
 
template<typename T , enable_if_t<(std::is_integral< T >::value &&std::is_signed< T >::value)||std::is_enum< T >::value, detail::enabler > = detail::dummy>
bool CLI::detail::lexical_cast (std::string input, T &output)
 Signed integers / enums. More...
 
bool CLI::detail::split_short (const std::string &current, std::string &name, std::string &rest)
 
bool CLI::detail::split_long (const std::string &current, std::string &name, std::string &value)
 
std::vector< std::string > CLI::detail::split_names (std::string current)
 
std::tuple< std::vector< std::string >, std::vector< std::string >, std::string > CLI::detail::get_names (const std::vector< std::string > &input)
 Get a vector of short names, one of long names, and a single name. More...
 

Variables

constexpr enabler CLI::detail::dummy = {}
 An instance to use in EnableIf. More...
 

Macro Definition Documentation

◆ CLI11_ERROR_DEF

#define CLI11_ERROR_DEF (   parent,
  name 
)
Value:
protected: \
name(std::string name, std::string msg, int exit_code) : parent(std::move(name), std::move(msg), exit_code) {} \
name(std::string name, std::string msg, ExitCodes exit_code) \
: parent(std::move(name), std::move(msg), exit_code) {} \
\
public: \
name(std::string msg, ExitCodes exit_code) : parent(#name, std::move(msg), exit_code) {} \
name(std::string msg, int exit_code) : parent(#name, std::move(msg), exit_code) {}
ExitCodes
Definition: CL11.hpp:264

◆ CLI11_ERROR_SIMPLE

#define CLI11_ERROR_SIMPLE (   name)    name(std::string msg) : name(#name, msg, ExitCodes::name) {}

◆ CLI11_VERSION

#define CLI11_VERSION   "1.4.0"

◆ CLI11_VERSION_MAJOR

#define CLI11_VERSION_MAJOR   1

◆ CLI11_VERSION_MINOR

#define CLI11_VERSION_MINOR   4

◆ CLI11_VERSION_PATCH

#define CLI11_VERSION_PATCH   0