Jpp  17.2.1-pre0
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< JCounter > Class Template Reference

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

#include <JParser.hh>

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

Public Member Functions

 JParserTemplateElement (JCounter &object, const std::string &name, 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::stringgetName () const
 Get name of parameter. More...
 
const std::stringgetHelp () 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

JCounterobject
 

Detailed Description

template<>
class JPARSER::JParserTemplateElement< JCounter >

Template specialisation of JPARSER::JParserTemplateElement for type JCounter.

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

Definition at line 1187 of file JParser.hh.

Constructor & Destructor Documentation

JPARSER::JParserTemplateElement< JCounter >::JParserTemplateElement ( JCounter object,
const std::string name,
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 1200 of file JParser.hh.

1200  :
1202  object(object)
1203  {
1204  this->object = JCounter();
1205  }
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:376
Auxiliary class to handle multiple boolean-like I/O.
Definition: JParser.hh:238

Member Function Documentation

virtual std::istream& JPARSER::JParserTemplateElement< JCounter >::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 1215 of file JParser.hh.

1216  {
1217  return in >> object;
1218  }
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
virtual std::ostream& JPARSER::JParserTemplateElement< JCounter >::write ( std::ostream &  out) const
inlineoverridevirtual

Stream output.

Parameters
outoutput stream
Returns
output stream

Implements JLANG::JStreamOutput.

Definition at line 1227 of file JParser.hh.

1228  {
1229  return out << object;
1230  }
virtual bool JPARSER::JParserTemplateElement< JCounter >::getStatus ( ) const
inlineoverridevirtual

Status of object.

Returns
true

Implements JPARSER::JParserElementInterface.

Definition at line 1238 of file JParser.hh.

1239  {
1240  return true;
1241  }
virtual bool JPARSER::JParserTemplateElement< JCounter >::getInitialisationStatus ( ) const
inlineoverridevirtual

Get initialisation status of parameter.

Returns
true

Implements JPARSER::JParserElementInterface.

Definition at line 1249 of file JParser.hh.

1250  {
1251  return true;
1252  }
virtual void JPARSER::JParserTemplateElement< JCounter >::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 1261 of file JParser.hh.

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

Read counter.

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

Reimplemented from JPARSER::JParserElementInterface.

Definition at line 1270 of file JParser.hh.

1271  {
1272  return false;
1273  }
const std::string& JPARSER::JParserElementInterface::getName ( ) const
inlineinherited

Get name of parameter.

Returns
name

Definition at line 389 of file JParser.hh.

390  {
391  return __name;
392  }
const std::string& JPARSER::JParserElementInterface::getHelp ( ) const
inlineinherited

Get help of parameter.

Returns
help

Definition at line 400 of file JParser.hh.

401  {
402  return __help;
403  }
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 436 of file JParser.hh.

437  {
438  using namespace std;
439 
440  out << "<" << getName() << ">";
441 
442  if (getStatus() && !getShortprint(out)) {
443 
444  int width = WIDTH - getName().length();
445 
446  if (width > 0) {
447  out << setw(width) << " ";
448  }
449 
450  out << " = ";
451 
452  write(out);
453  }
454 
455  if (getLongprint(out) && getHelp() != "") {
456  out << " \"" << getHelp() << "\"";
457  }
458  }
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:389
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:400

Member Data Documentation

Definition at line 1277 of file JParser.hh.

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

Definition at line 473 of file JParser.hh.

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

Definition at line 474 of file JParser.hh.


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