Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions | Variables
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...
 
struct  not_initialised
 Empty structure for specification of parser element that is not initialised (i.e. does require input). More...
 
class  JOption
 Auxiliary class to handle optional I/O. More...
 
class  JCounter
 Auxiliary class to handle multiple boolean-like I/O. More...
 
class  JParserElementInterface
 Interface for I/O of parser element. More...
 
class  JParserTemplateElement
 Template class holder for I/O of parser element. More...
 
class  JCSV
 Auxiliary class to assign the remainder of a sequence of Comma Separated Values. More...
 
class  JParserTemplateElement< JType_t, false >
 Template specialisation of JPARSER::JParserTemplateElement for data type without equal operator ==. 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...
 
class  JParserTemplateElement< JType_t, true >
 Template specialisation of JPARSER::JParserTemplateElement for data type with equal operator ==. 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  JParserElement
 Auxiliary class to handle pointer to JPARSER::JParserElementInterface. More...
 
class  JParser
 Utility class to parse command line options. More...
 

Functions

std::ostream & getOstream ()
 Get output stream for conversion to std::string. More...
 
bool fail (std::istream &in)
 Check for stream state. More...
 
JParserTemplateElement< bool > getOption (bool &object, const std::string &name, const std::string &help="")
 Auxiliary method for creation of template parser element object. More...
 
JParserTemplateElement< JCountergetOption (JCounter &object, const std::string &name, const std::string &help="")
 Auxiliary method for creation of template parser element object. More...
 
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. More...
 
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. More...
 
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. More...
 

Variables

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

Detailed Description

Local namespace for command line parser.

Function Documentation

std::ostream& JPARSER::getOstream ( )
inline

Get output stream for conversion to std::string.

Note that the stream is emptied before use.

Returns
output stream

Definition at line 70 of file JParser.hh.

71  {
72  static std::ostringstream buffer;
73 
74  buffer.str("");
75 
76  return buffer;
77  }
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 113 of file JParser.hh.

114  {
115  return in.bad() || (in.fail() && !in.eof());
116  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
JParserTemplateElement<bool> JPARSER::getOption ( bool &  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 1899 of file JParser.hh.

1900  {
1901  return JParserTemplateElement<bool>(object, name, help);
1902  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
JParserTemplateElement<JCounter> JPARSER::getOption ( JCounter 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 1913 of file JParser.hh.

1914  {
1915  return JParserTemplateElement<JCounter>(object, name, help);
1916  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
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 1928 of file JParser.hh.

1929  {
1930  return JParserTemplateElement<JType_t>(object, name, help);
1931  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
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 1945 of file JParser.hh.

1950  {
1951  return JParserTemplateElement<JType_t>(object, name, help, __begin, __end);
1952  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
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 1965 of file JParser.hh.

1969  {
1970  return getOption(object, name, "", __begin, __end);
1971  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
JOption_t getOption()
Get fit option.

Variable Documentation

char JPARSER::START_OF_OPTION = '-'
static

Parser options.

start of an option

Definition at line 95 of file JParser.hh.

char JPARSER::END_OF_OPTIONS = '-'
static

end of all options

Definition at line 96 of file JParser.hh.

char JPARSER::HELP_OPTION = 'h'
static

help option

Definition at line 97 of file JParser.hh.

char JPARSER::REVISION_OPTION = 'v'
static

revision option

Definition at line 98 of file JParser.hh.

char JPARSER::PRINT_OPTION = '!'
static

print option

Definition at line 99 of file JParser.hh.

char JPARSER::PID_OPTION = 'P'
static

print PID to file

Definition at line 100 of file JParser.hh.

int JPARSER::NORMAL_EXIT_CODE = 0
static

exit code of normal end

Definition at line 101 of file JParser.hh.

int JPARSER::WIDTH = 12
static

format specifier

Definition at line 102 of file JParser.hh.