C++ Utilities 5.26.1
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Loading...
Searching...
No Matches
argumentparser.h File Reference
#include "../conversion/stringconversion.h"
#include "../misc/traits.h"
#include <functional>
#include <initializer_list>
#include <limits>
#include <tuple>
#include <vector>
Include dependency graph for argumentparser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CppUtilities::ApplicationInfo
 Stores information about an application. More...
 
struct  CppUtilities::ArgumentOccurrence
 The ArgumentOccurrence struct holds argument values for an occurrence of an argument. More...
 
class  CppUtilities::Argument
 The Argument class is a wrapper for command line argument information. More...
 
class  CppUtilities::HelpArgument
 The HelpArgument class prints help information for an argument parser when present (–help, -h). More...
 
class  CppUtilities::OperationArgument
 The OperationArgument class is an Argument where denotesOperation() is true by default. More...
 
class  CppUtilities::ConfigValueArgument
 The ConfigValueArgument class is an Argument where setCombinable() is true by default. More...
 
class  CppUtilities::NoColorArgument
 The NoColorArgument class allows to specify whether use of escape codes or similar technique to provide formatted output on the terminal should be enabled/disabled. More...
 
class  CppUtilities::ArgumentParser
 The ArgumentParser class provides a means for handling command line arguments. More...
 

Namespaces

namespace  CppUtilities
 Contains all utilities provides by the c++utilities library.
 
namespace  CppUtilities::ValueConversion
 Contains functions to convert raw argument values to certain types.
 

Macros

#define SET_DEPENDENCY_INFO   ::CppUtilities::applicationInfo.dependencyVersions = DEPENCENCY_VERSIONS
 Sets meta data about the dependencies the application was linked against which is used by ArgumentParser::printHelp().
 
#define SET_APPLICATION_INFO
 Sets application meta data (including SET_DEPENDENCY_INFO) used by ArgumentParser::printHelp().
 

Typedefs

using CppUtilities::ArgumentInitializerList = std::initializer_list<Argument *>
 
using CppUtilities::ArgumentVector = std::vector<Argument *>
 
using CppUtilities::ArgumentPredicate = std::function<bool(Argument *)>
 

Enumerations

enum class  CppUtilities::UnknownArgumentBehavior { CppUtilities::Ignore , CppUtilities::Warn , CppUtilities::Fail }
 The UnknownArgumentBehavior enum specifies the behavior of the argument parser when an unknown argument is detected. More...
 
enum class  CppUtilities::ParseArgumentBehavior { CppUtilities::ReadArguments = 0x0 , CppUtilities::CheckConstraints = 0x1 , CppUtilities::InvokeCallbacks = 0x2 , CppUtilities::ExitOnFailure = 0x4 }
 The ParseArgumentBehavior enum specifies the behavior when parsing arguments. More...
 
enum class  CppUtilities::ValueCompletionBehavior : unsigned char {
  CppUtilities::None = 0 , CppUtilities::PreDefinedValues = 2 , CppUtilities::Files = 4 , CppUtilities::Directories = 8 ,
  CppUtilities::FileSystemIfNoPreDefinedValues = 16 , CppUtilities::AppendEquationSign = 32 , CppUtilities::InvokeCallback = 64
}
 The ValueCompletionBehavior enum specifies the items to be considered when generating completion for an argument value. More...
 

Functions

template<typename TargetType , Traits::EnableIf< std::is_same< TargetType, std::string > > * = nullptr>
TargetType CppUtilities::ValueConversion::convert (const char *value)
 

Variables

CPP_UTILITIES_EXPORT ApplicationInfo CppUtilities::applicationInfo
 Stores global application info used by ArgumentParser::printHelp() and AboutDialog.
 

Macro Definition Documentation

◆ SET_APPLICATION_INFO

#define SET_APPLICATION_INFO
Value:
#define SET_DEPENDENCY_INFO
Sets meta data about the dependencies the application was linked against which is used by ArgumentPar...
CPP_UTILITIES_EXPORT ApplicationInfo applicationInfo
Stores global application info used by ArgumentParser::printHelp() and AboutDialog.

Sets application meta data (including SET_DEPENDENCY_INFO) used by ArgumentParser::printHelp().

Remarks
Reads those data from the config header so "config.h" must be included.

Definition at line 53 of file argumentparser.h.

◆ SET_DEPENDENCY_INFO

#define SET_DEPENDENCY_INFO   ::CppUtilities::applicationInfo.dependencyVersions = DEPENCENCY_VERSIONS

Sets meta data about the dependencies the application was linked against which is used by ArgumentParser::printHelp().

Remarks
Reads those data from the config header so "config.h" must be included.

Definition at line 46 of file argumentparser.h.