Scarab  v2.4.2
Project 8 C++ Utility Library
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
CLI11.hpp File Reference
#include <algorithm>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <locale>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for CLI11.hpp:

Go to the source code of this file.

Classes

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

Namespaces

 CLI
 
 CLI::detail
 

Macros

#define CLI11_VERSION_MAJOR   1
 
#define CLI11_VERSION_MINOR   6
 
#define CLI11_VERSION_PATCH   0
 
#define CLI11_VERSION   "1.6.0"
 
#define CLI11_DEPRECATED(reason)   __attribute__((deprecated(reason)))
 
#define CLI11_ERROR_DEF(parent, name)
 
#define CLI11_ERROR_SIMPLE(name)   explicit name(std::string msg) : name(#name, msg, ExitCodes::name) {}
 

Typedefs

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

Enumerations

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

Functions

std::vector< std::string > split (const std::string &s, char delim)
 Split a string by a delim. More...
 
template<typename T >
std::string join (const T &v, std::string delim=",")
 Simple function to join a string. More...
 
template<typename T >
std::string rjoin (const T &v, std::string delim=",")
 Join a string in reverse order. More...
 
std::string & ltrim (std::string &str)
 Trim whitespace from left of string. More...
 
std::string & ltrim (std::string &str, const std::string &filter)
 Trim anything from left of string. More...
 
std::string & rtrim (std::string &str)
 Trim whitespace from right of string. More...
 
std::string & rtrim (std::string &str, const std::string &filter)
 Trim anything from right of string. More...
 
std::string & trim (std::string &str)
 Trim whitespace from string. More...
 
std::string & trim (std::string &str, const std::string filter)
 Trim anything from string. More...
 
std::string trim_copy (const std::string &str)
 Make a copy of the string and then trim it. More...
 
std::string 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...
 
std::ostream & format_help (std::ostream &out, std::string name, std::string description, size_t wid)
 Print a two part "help" string. More...
 
template<typename T >
bool valid_first_char (T c)
 Verify the first character of an option. More...
 
template<typename T >
bool valid_later_char (T c)
 Verify following characters of an option. More...
 
bool valid_name_string (const std::string &str)
 Verify an option name. More...
 
std::string to_lower (std::string str)
 Return a lower case version of a string. More...
 
std::vector< std::string > split_up (std::string str)
 Split a string '"one two" "three"' into 'one two', 'three'. More...
 
std::string 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 * 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), detail::enabler > = detail::dummy>
bool lexical_cast (std::string input, T &output)
 Signed integers / enums. More...
 
bool split_short (const std::string &current, std::string &name, std::string &rest)
 
bool split_long (const std::string &current, std::string &name, std::string &value)
 
std::vector< std::string > split_names (std::string current)
 
std::tuple< std::vector< std::string >, std::vector< std::string >, std::string > 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 dummy = {}
 An instance to use in EnableIf. More...
 

Macro Definition Documentation

◆ CLI11_DEPRECATED

#define CLI11_DEPRECATED (   reason)    __attribute__((deprecated(reason)))

Definition at line 110 of file CLI11.hpp.

◆ 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) {}
STL namespace.
ExitCodes
Definition: CLI11.hpp:425

Definition at line 409 of file CLI11.hpp.

◆ CLI11_ERROR_SIMPLE

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

Definition at line 420 of file CLI11.hpp.

◆ CLI11_VERSION

#define CLI11_VERSION   "1.6.0"

Definition at line 72 of file CLI11.hpp.

◆ CLI11_VERSION_MAJOR

#define CLI11_VERSION_MAJOR   1

Definition at line 69 of file CLI11.hpp.

◆ CLI11_VERSION_MINOR

#define CLI11_VERSION_MINOR   6

Definition at line 70 of file CLI11.hpp.

◆ CLI11_VERSION_PATCH

#define CLI11_VERSION_PATCH   0

Definition at line 71 of file CLI11.hpp.