Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JPARSER Namespace Reference

Local namespace for command line parser. More...

Classes

struct  initialised
 Empty structure for specification of parser element that is initialised (i.e. does not require input). More...
 
class  JCounter
 Auxiliary class to handle multiple boolean-like I/O. More...
 
class  JCSV
 Auxiliary class to assign the remainder of a sequence of Comma Separated Values. More...
 
class  JParser
 Utility class to parse command line options. More...
 
class  JParserElement
 Auxiliary class to handle pointer to JPARSER::JParserElementInterface. More...
 
class  JParserElementInterface
 Interface for I/O of parser element. More...
 
class  JParserTemplateElement
 Template class holder for I/O of parser element. More...
 
class  JParserTemplateElement< bool >
 Template specialisation of JPARSER::JParserTemplateElement for type bool. More...
 
class  JParserTemplateElement< JCounter >
 Template specialisation of JPARSER::JParserTemplateElement for type JCounter. More...
 
class  JParserTemplateElement< JType_t, false >
 Template specialisation of JPARSER::JParserTemplateElement for data type without equal operator ==. More...
 
class  JParserTemplateElement< JType_t, true >
 Template specialisation of JPARSER::JParserTemplateElement for data type with equal operator ==. More...
 
class  JProxy
 Auxiliary class to assign a custom value following the reading of a specific textual value. More...
 
class  JProxy< T, false >
 Template specialisation of JProxy for non-fundamental data type. More...
 
class  JProxy< T, true >
 Template specialisation of JProxy for fundamental data type. More...
 
struct  not_initialised
 Empty structure for specification of parser element that is not initialised (i.e. does require input). More...
 
struct  TStringHelper
 Auxiliary class for handling I/O of TString depending on its existence. More...
 
struct  TStringHelper< false >
 Specialisation of TStringHelper if TString does not exist. More...
 
struct  TStringHelper< true >
 Specialisation of TStringHelper if TString exists. More...
 

Functions

bool fail (std::istream &in)
 Check for stream state.
 
template<class JType_t >
JParserTemplateElement< JType_t > getOption (JType_t &object, const std::string &name, const std::string &help="")
 Auxiliary method for creation of template parser element object.
 
template<class JType_t , class T >
JParserTemplateElement< JType_t > getOption (JType_t &object, const std::string &name, const std::string &help, T __begin, T __end)
 Auxiliary method for creation of template parser element object.
 
template<class JType_t , class T >
JParserTemplateElement< JType_t > getOption (JType_t &object, const std::string &name, T __begin, T __end)
 Auxiliary method for creation of template parser element object.
 

Variables

static char START_OF_OPTION = '-'
 Parser options.
 
static char END_OF_OPTIONS = '-'
 end of all options
 
static char HELP_OPTION = 'h'
 help option
 
static char REVISION_OPTION = 'v'
 revision option
 
static char PRINT_OPTION = '!'
 print option
 
static char PID_OPTION = 'P'
 print PID to file
 
static int NORMAL_EXIT_CODE = 0
 exit code of normal end
 
static int WIDTH = 12
 format specifier
 

Detailed Description

Local namespace for command line parser.

Function Documentation

◆ fail()

bool JPARSER::fail ( std::istream & in)
inline

Check for stream state.

Note that end-of-file is not defined as an error so to normally process e.g. std::string and std::vector.

Parameters
ininput stream
Returns
true if failure; else false

Definition at line 98 of file JParser.hh.

99 {
100 return in.bad() || (in.fail() && !in.eof());
101 }

◆ getOption() [1/3]

template<class JType_t >
JParserTemplateElement< JType_t > JPARSER::getOption ( JType_t & object,
const std::string & name,
const std::string & help = "" )
inline

Auxiliary method for creation of template parser element object.

Parameters
objectobject
namename of object
helphelp of object
Returns
parser element

Definition at line 2077 of file JParser.hh.

2078 {
2079 return JParserTemplateElement<JType_t>(object, name, help);
2080 }
Template class holder for I/O of parser element.
Definition JParser.hh:663

◆ getOption() [2/3]

template<class JType_t , class T >
JParserTemplateElement< JType_t > JPARSER::getOption ( JType_t & object,
const std::string & name,
const std::string & help,
T __begin,
T __end )
inline

Auxiliary method for creation of template parser element object.

Parameters
objectobject
namename of object
helphelp of object
__beginbegin of possible values
__endend of possible values
Returns
parser element

Definition at line 2094 of file JParser.hh.

2099 {
2100 return JParserTemplateElement<JType_t>(object, name, help, __begin, __end);
2101 }

◆ getOption() [3/3]

template<class JType_t , class T >
JParserTemplateElement< JType_t > JPARSER::getOption ( JType_t & object,
const std::string & name,
T __begin,
T __end )
inline

Auxiliary method for creation of template parser element object.

Parameters
objectobject
namename of object
__beginbegin of possible values
__endend of possible values
Returns
parser element

Definition at line 2114 of file JParser.hh.

2118 {
2119 return getOption(object, name, "", __begin, __end);
2120 }

Variable Documentation

◆ START_OF_OPTION

char JPARSER::START_OF_OPTION = '-'
static

Parser options.

start of an option

Definition at line 80 of file JParser.hh.

◆ END_OF_OPTIONS

char JPARSER::END_OF_OPTIONS = '-'
static

end of all options

Definition at line 81 of file JParser.hh.

◆ HELP_OPTION

char JPARSER::HELP_OPTION = 'h'
static

help option

Definition at line 82 of file JParser.hh.

◆ REVISION_OPTION

char JPARSER::REVISION_OPTION = 'v'
static

revision option

Definition at line 83 of file JParser.hh.

◆ PRINT_OPTION

char JPARSER::PRINT_OPTION = '!'
static

print option

Definition at line 84 of file JParser.hh.

◆ PID_OPTION

char JPARSER::PID_OPTION = 'P'
static

print PID to file

Definition at line 85 of file JParser.hh.

◆ NORMAL_EXIT_CODE

int JPARSER::NORMAL_EXIT_CODE = 0
static

exit code of normal end

Definition at line 86 of file JParser.hh.

◆ WIDTH

int JPARSER::WIDTH = 12
static

format specifier

Definition at line 87 of file JParser.hh.