Fancy argparser
Single file argument parser for c++
Loading...
Searching...
No Matches
argparse.h File Reference
#include <string>
#include <sstream>
#include <vector>
#include <tuple>
#include <map>
#include <algorithm>
#include <stdexcept>
#include <limits>
#include <initializer_list>

Go to the source code of this file.

Classes

class  ARGPARSE_NAMESPACE_NAME::Argument
 This class represents argument configuration which should be passed to ArgumentParser objects instance. More...
struct  ARGPARSE_NAMESPACE_NAME::NamedArgSpec
 Aggregate description of a named argument, for keyword-style construction. More...
struct  ARGPARSE_NAMESPACE_NAME::PositionalArgSpec
 Aggregate description of a positional argument, for keyword-style construction with C++20 designated initializers. More...
class  ARGPARSE_NAMESPACE_NAME::ArgumentParsed
 Class which represent actual parsed argument in case of successfully parsing. More...
class  ARGPARSE_NAMESPACE_NAME::ArgumentsObject
 Class that carries result of real parsing Indicates if parsing is successful and allows to get ArgumentParsed object in that case. More...
class  ARGPARSE_NAMESPACE_NAME::ArgumentParser
 Main class of argument parser hold all user arguments from code and orchestrate other classes in order to parse command line input. More...

Namespaces

namespace  ARGPARSE_NAMESPACE_NAME
 namespace of argument parser constants and Classes can be changed if ARGPARSE_NAMESPACE_NAME macro specified during compilation.

Macros

#define ARGPARSE_NAMESPACE_NAME   argparse
 MIT License.

Enumerations

enum class  ARGPARSE_NAMESPACE_NAME::ArgTypeCast : int {
  ARGPARSE_NAMESPACE_NAME::e_String , ARGPARSE_NAMESPACE_NAME::e_int , ARGPARSE_NAMESPACE_NAME::e_longlong , ARGPARSE_NAMESPACE_NAME::e_double ,
  ARGPARSE_NAMESPACE_NAME::e_bool
}
 Supported types for argument If needed type is not in this list, then just use e_String. More...

Functions

Argument ARGPARSE_NAMESPACE_NAME::CreateNamedArgument (const std::string &shortName="", const std::string &longName="", const int argsCount=1, ArgTypeCast argType=ArgTypeCast::e_String, const bool required=true, const std::string &help="")
 Helper function to create named argument.
Argument ARGPARSE_NAMESPACE_NAME::CreatePositionalArgument (const std::string &positionalName="", const int argsCount=1, ArgTypeCast argType=ArgTypeCast::e_String, const bool required=true, const std::string &help="")
 Helper function to create positional argument.
Argument ARGPARSE_NAMESPACE_NAME::CreateNamedArgument (const NamedArgSpec &spec)
 Keyword-style factory for a named argument.
Argument ARGPARSE_NAMESPACE_NAME::CreatePositionalArgument (const PositionalArgSpec &spec)
 Keyword-style factory for a positional argument.

Variables

const int ARGPARSE_NAMESPACE_NAME::kAnyArgCount = -1
 constant to indicate arguments with various count from 0 to infinite
const int ARGPARSE_NAMESPACE_NAME::kFromOneToInfiniteArgCount = -2
 constant to indicate arguments with various count from 1 to infinite

Macro Definition Documentation

◆ ARGPARSE_NAMESPACE_NAME

#define ARGPARSE_NAMESPACE_NAME   argparse

MIT License.

Copyright(c) 2021 simfeo

Permission is hereby granted, free of charge, to any person obtaining a copy of this softwareand associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and /or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :

The above copyright noticeand this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition at line 30 of file argparse.h.