Halide
cmdline::parser Class Reference

#include <cmdline.h>

Public Member Functions

 parser ()=default
 
 ~parser ()
 
void add (const std::string &name, char short_name=0, const std::string &desc="")
 
template<class T >
void add (const std::string &name, char short_name=0, const std::string &desc="", bool need=true, const T def=T())
 
template<class T , class F >
void add (const std::string &name, char short_name=0, const std::string &desc="", bool need=true, const T def=T(), F reader=F())
 
void footer (const std::string &f)
 
void set_program_name (const std::string &name)
 
bool exist (const std::string &name) const
 
template<class T >
const T & get (const std::string &name) const
 
const std::vector< std::string > & rest () const
 
bool parse (const std::string &arg)
 
bool parse (const std::vector< std::string > &args)
 
bool parse (int argc, const char *const argv[])
 
void parse_check (const std::string &arg)
 
void parse_check (const std::vector< std::string > &args)
 
void parse_check (int argc, char *argv[])
 
std::string error () const
 
std::string error_full () const
 
std::string usage () const
 

Detailed Description

Definition at line 376 of file cmdline.h.

Constructor & Destructor Documentation

◆ parser()

cmdline::parser::parser ( )
default

◆ ~parser()

cmdline::parser::~parser ( )
inline

Definition at line 379 of file cmdline.h.

Member Function Documentation

◆ add() [1/3]

void cmdline::parser::add ( const std::string &  name,
char  short_name = 0,
const std::string &  desc = "" 
)
inline

Definition at line 385 of file cmdline.h.

References cmdline::throw_cmdline_error().

Referenced by add(), and parse_check().

◆ add() [2/3]

template<class T >
void cmdline::parser::add ( const std::string &  name,
char  short_name = 0,
const std::string &  desc = "",
bool  need = true,
const T  def = T() 
)
inline

Definition at line 396 of file cmdline.h.

References add().

◆ add() [3/3]

template<class T , class F >
void cmdline::parser::add ( const std::string &  name,
char  short_name = 0,
const std::string &  desc = "",
bool  need = true,
const T  def = T(),
reader = F() 
)
inline

Definition at line 405 of file cmdline.h.

References cmdline::throw_cmdline_error().

◆ footer()

void cmdline::parser::footer ( const std::string &  f)
inline

Definition at line 418 of file cmdline.h.

◆ set_program_name()

void cmdline::parser::set_program_name ( const std::string &  name)
inline

Definition at line 422 of file cmdline.h.

◆ exist()

bool cmdline::parser::exist ( const std::string &  name) const
inline

Definition at line 426 of file cmdline.h.

References cmdline::throw_cmdline_error().

◆ get()

template<class T >
const T& cmdline::parser::get ( const std::string &  name) const
inline

Definition at line 434 of file cmdline.h.

References cmdline::throw_cmdline_error().

◆ rest()

const std::vector<std::string>& cmdline::parser::rest ( ) const
inline

Definition at line 450 of file cmdline.h.

◆ parse() [1/3]

bool cmdline::parser::parse ( const std::string &  arg)
inline

Definition at line 454 of file cmdline.h.

Referenced by parse(), and parse_check().

◆ parse() [2/3]

bool cmdline::parser::parse ( const std::vector< std::string > &  args)
inline

Definition at line 498 of file cmdline.h.

References parse().

◆ parse() [3/3]

bool cmdline::parser::parse ( int  argc,
const char *const  argv[] 
)
inline

Definition at line 509 of file cmdline.h.

References strchr(), and strncmp().

◆ parse_check() [1/3]

void cmdline::parser::parse_check ( const std::string &  arg)
inline

Definition at line 610 of file cmdline.h.

References add(), and parse().

◆ parse_check() [2/3]

void cmdline::parser::parse_check ( const std::vector< std::string > &  args)
inline

Definition at line 617 of file cmdline.h.

References add(), and parse().

◆ parse_check() [3/3]

void cmdline::parser::parse_check ( int  argc,
char *  argv[] 
)
inline

Definition at line 624 of file cmdline.h.

References add(), and parse().

◆ error()

std::string cmdline::parser::error ( ) const
inline

Definition at line 631 of file cmdline.h.

Referenced by error_full().

◆ error_full()

std::string cmdline::parser::error_full ( ) const
inline

Definition at line 635 of file cmdline.h.

References error().

◆ usage()

std::string cmdline::parser::usage ( ) const
inline

Definition at line 643 of file cmdline.h.

References Halide::max().


The documentation for this class was generated from the following file: