Halide
cmdline::parser Class Reference

#include <cmdline.h>

Public Member Functions

 parser ()
 
 ~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 372 of file cmdline.h.

Constructor & Destructor Documentation

◆ parser()

cmdline::parser::parser ( )
inline

Definition at line 374 of file cmdline.h.

◆ ~parser()

cmdline::parser::~parser ( )
inline

Definition at line 376 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 382 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 391 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 400 of file cmdline.h.

References cmdline::throw_cmdline_error().

◆ footer()

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

Definition at line 411 of file cmdline.h.

◆ set_program_name()

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

Definition at line 415 of file cmdline.h.

◆ exist()

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

Definition at line 419 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 425 of file cmdline.h.

References NULL, and cmdline::throw_cmdline_error().

◆ rest()

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

Definition at line 437 of file cmdline.h.

◆ parse() [1/3]

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

Definition at line 441 of file cmdline.h.

References buf.

Referenced by parse(), and parse_check().

◆ parse() [2/3]

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

Definition at line 483 of file cmdline.h.

References parse().

◆ parse() [3/3]

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

Definition at line 493 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 588 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 594 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 600 of file cmdline.h.

References add(), and parse().

◆ error()

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

Definition at line 606 of file cmdline.h.

◆ error_full()

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

Definition at line 610 of file cmdline.h.

◆ usage()

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

Definition at line 617 of file cmdline.h.

References Halide::max().


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