Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
parser_options.hpp File Reference
#include <string>
#include <map>
#include <vector>
#include <getopt.h>
#include <arkanjo/cli/cli_error.hpp>
+ Include dependency graph for parser_options.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CliOption
 
struct  ParsedOptions
 

Macros

#define OPTION_END   {nullptr, 0, NoArgument, nullptr}
 This marks the end of a long array of options.
 

Enumerations

enum  ArgumentsType { NoArgument , RequiredArgument , OptionalArgument , PositionalArgument }
 

Functions

bool parse_options (int argc, char *argv[], const std::vector< CliOption > &options, ParsedOptions &ctx_options)
 Analyzes command-line arguments and populates ParsedOptions.
 

Macro Definition Documentation

◆ OPTION_END

#define OPTION_END   {nullptr, 0, NoArgument, nullptr}

This marks the end of a long array of options.

Definition at line 26 of file parser_options.hpp.

Enumeration Type Documentation

◆ ArgumentsType

Enumerator
NoArgument 
RequiredArgument 
OptionalArgument 
PositionalArgument 

Definition at line 9 of file parser_options.hpp.

Function Documentation

◆ parse_options()

bool parse_options ( int argc,
char * argv[],
const std::vector< CliOption > & options,
ParsedOptions & ctx_options )

Analyzes command-line arguments and populates ParsedOptions.

It supports short (-c) and long (–config) options. Flags without arguments receive the value "true". Arguments that are not options are added to extra_args.

Parameters
argcNumber of arguments passed to the application.
argvVector of strings containing the arguments.
optionsArray of CliOption containing the options.
ctx_optionsReference to ParsedOptions that will be filled in.

Definition at line 45 of file parser_options.cpp.