Jpp  15.0.5
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | Private Attributes | List of all members
JPARSER::JParserTemplateElement< bool > Class Template Reference

Template specialisation of JPARSER::JParserTemplateElement for type bool. More...

#include <JParser.hh>

Inheritance diagram for JPARSER::JParserTemplateElement< bool >:
JPARSER::JParserElementInterface JLANG::JStreamInput JLANG::JStreamOutput

Public Member Functions

 JParserTemplateElement (bool &object, const std::string &name="arg", const std::string &help="")
 Constructor. More...
 
virtual std::istream & read (std::istream &in) override
 Stream input. More...
 
virtual std::ostream & write (std::ostream &out) const override
 Stream output. More...
 
virtual bool getStatus () const override
 Status of object. More...
 
virtual bool getInitialisationStatus () const override
 Get initialisation status of parameter. More...
 
virtual void setInitialiationStatus (const bool value) override
 Set initialisation status of parameter. More...
 
virtual bool gcount () const override
 Read counter. More...
 
const std::string & getName () const
 Get name of parameter. More...
 
const std::string & getHelp () const
 Get help of parameter. More...
 
virtual void print (std::ostream &out) const
 Print. More...
 

Protected Attributes

std::string __name
 
std::string __help
 

Private Attributes

bool & object
 

Detailed Description

template<>
class JPARSER::JParserTemplateElement< bool >

Template specialisation of JPARSER::JParserTemplateElement for type bool.

The value is by default set to false and set to true in method read() without reading any data. This makes it possible to parse mutiple options in one go (e.g. -abc). This class implements the JPARSER::JParserElementInterface interface.

Definition at line 1067 of file JParser.hh.

Constructor & Destructor Documentation

JPARSER::JParserTemplateElement< bool >::JParserTemplateElement ( bool &  object,
const std::string &  name = "arg",
const std::string &  help = "" 
)
inline

Constructor.

The constructor assigns the default value false to the referenced parameter.

Parameters
objectreference to object
namename of object
helphelp of object

Definition at line 1080 of file JParser.hh.

1080  :
1082  object(object)
1083  {
1084  this->object = false;
1085  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
JParserElementInterface(const std::string &name="arg", const std::string &help="")
Constructor.
Definition: JParser.hh:359

Member Function Documentation

virtual std::istream& JPARSER::JParserTemplateElement< bool >::read ( std::istream &  in)
inlineoverridevirtual

Stream input.

This method sets the value to true, without reading any data.

Parameters
ininput stream
Returns
input stream

Implements JLANG::JStreamInput.

Definition at line 1095 of file JParser.hh.

1096  {
1097  this->object = true;
1098 
1099  return in;
1100  }
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
virtual std::ostream& JPARSER::JParserTemplateElement< bool >::write ( std::ostream &  out) const
inlineoverridevirtual

Stream output.

Parameters
outoutput stream
Returns
output stream

Implements JLANG::JStreamOutput.

Definition at line 1109 of file JParser.hh.

1110  {
1111  return out << object;
1112  }
virtual bool JPARSER::JParserTemplateElement< bool >::getStatus ( ) const
inlineoverridevirtual

Status of object.

Returns
true

Implements JPARSER::JParserElementInterface.

Definition at line 1120 of file JParser.hh.

1121  {
1122  return true;
1123  }
virtual bool JPARSER::JParserTemplateElement< bool >::getInitialisationStatus ( ) const
inlineoverridevirtual

Get initialisation status of parameter.

Returns
true

Implements JPARSER::JParserElementInterface.

Definition at line 1131 of file JParser.hh.

1132  {
1133  return true;
1134  }
virtual void JPARSER::JParserTemplateElement< bool >::setInitialiationStatus ( const bool  value)
inlineoverridevirtual

Set initialisation status of parameter.

This implementation doesn't do anything.

Parameters
valueinitialisation status

Implements JPARSER::JParserElementInterface.

Definition at line 1143 of file JParser.hh.

1144  {}
virtual bool JPARSER::JParserTemplateElement< bool >::gcount ( ) const
inlineoverridevirtual

Read counter.

Returns
true if at least one character to be read; else false

Reimplemented from JPARSER::JParserElementInterface.

Definition at line 1152 of file JParser.hh.

1153  {
1154  return false;
1155  }
const std::string& JPARSER::JParserElementInterface::getName ( ) const
inlineinherited

Get name of parameter.

Returns
name

Definition at line 372 of file JParser.hh.

373  {
374  return __name;
375  }
const std::string& JPARSER::JParserElementInterface::getHelp ( ) const
inlineinherited

Get help of parameter.

Returns
help

Definition at line 383 of file JParser.hh.

384  {
385  return __help;
386  }
virtual void JPARSER::JParserElementInterface::print ( std::ostream &  out) const
inlinevirtualinherited

Print.

Parameters
outoutput stream
Returns
output stream

Reimplemented in JPARSER::JParserTemplateElement< JType_t, true >.

Definition at line 419 of file JParser.hh.

420  {
421  using namespace std;
422 
423  out << "<" << getName() << ">";
424 
425  if (getStatus() && !getShortprint(out)) {
426 
427  int width = WIDTH - getName().length();
428 
429  if (width > 0) {
430  out << setw(width) << " ";
431  }
432 
433  out << " = ";
434 
435  write(out);
436  }
437 
438  if (getLongprint(out) && getHelp() != "") {
439  out << " \"" << getHelp() << "\"";
440  }
441  }
Auxiliary data structure for alignment of data.
Definition: JManip.hh:231
virtual bool getStatus() const =0
Get status of parameter.
const std::string & getName() const
Get name of parameter.
Definition: JParser.hh:372
bool getLongprint(std::ostream &out)
Get long print option.
Definition: JManip.hh:121
virtual std::ostream & write(std::ostream &out) const =0
Stream output.
bool getShortprint(std::ostream &out)
Get short print option.
Definition: JManip.hh:75
const std::string & getHelp() const
Get help of parameter.
Definition: JParser.hh:383

Member Data Documentation

bool& JPARSER::JParserTemplateElement< bool >::object
private

Definition at line 1159 of file JParser.hh.

std::string JPARSER::JParserElementInterface::__name
protectedinherited

Definition at line 456 of file JParser.hh.

std::string JPARSER::JParserElementInterface::__help
protectedinherited

Definition at line 457 of file JParser.hh.


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