Jpp
 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)
 Stream input. More...
 
virtual std::ostream & write (std::ostream &out) const
 Stream output. More...
 
virtual bool getStatus () const
 Status of object. More...
 
virtual bool getInitialisationStatus () const
 Get initialisation status of parameter. More...
 
virtual void setInitialiationStatus (const bool value)
 Set initialisation status of parameter. More...
 
virtual bool gcount () const
 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

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 1084 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 1097 of file JParser.hh.

1097  :
1098  JParserElementInterface(name, help),
1099  object(object)
1100  {
1101  this->object = JCounter();
1102  }
JParserElementInterface(const std::string &name="arg", const std::string &help="")
Constructor.
Definition: JParser.hh:355
Auxiliary class to handle multiple boolean-like I/O.
Definition: JParser.hh:218

Member Function Documentation

virtual std::istream& JPARSER::JParserTemplateElement< JCounter >::read ( std::istream &  in)
inlinevirtual

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 1112 of file JParser.hh.

1113  {
1114  return in >> object;
1115  }
virtual std::ostream& JPARSER::JParserTemplateElement< JCounter >::write ( std::ostream &  out) const
inlinevirtual

Stream output.

Parameters
outoutput stream
Returns
output stream

Implements JLANG::JStreamOutput.

Definition at line 1124 of file JParser.hh.

1125  {
1126  return out << object;
1127  }
virtual bool JPARSER::JParserTemplateElement< JCounter >::getStatus ( ) const
inlinevirtual

Status of object.

Returns
true

Implements JPARSER::JParserElementInterface.

Definition at line 1135 of file JParser.hh.

1136  {
1137  return true;
1138  }
virtual bool JPARSER::JParserTemplateElement< JCounter >::getInitialisationStatus ( ) const
inlinevirtual

Get initialisation status of parameter.

Returns
true

Implements JPARSER::JParserElementInterface.

Definition at line 1146 of file JParser.hh.

1147  {
1148  return true;
1149  }
virtual void JPARSER::JParserTemplateElement< JCounter >::setInitialiationStatus ( const bool  value)
inlinevirtual

Set initialisation status of parameter.

This implementation doesn't do anything.

Parameters
valueinitialisation status

Implements JPARSER::JParserElementInterface.

Definition at line 1158 of file JParser.hh.

1159  {}
virtual bool JPARSER::JParserTemplateElement< JCounter >::gcount ( ) const
inlinevirtual

Read counter.

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

Reimplemented from JPARSER::JParserElementInterface.

Definition at line 1167 of file JParser.hh.

1168  {
1169  return false;
1170  }
const std::string& JPARSER::JParserElementInterface::getName ( ) const
inlineinherited

Get name of parameter.

Returns
name

Definition at line 368 of file JParser.hh.

369  {
370  return __name;
371  }
const std::string& JPARSER::JParserElementInterface::getHelp ( ) const
inlineinherited

Get help of parameter.

Returns
help

Definition at line 379 of file JParser.hh.

380  {
381  return __help;
382  }
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 415 of file JParser.hh.

416  {
417  out << "<" << getName() << ">";
418 
419  if (getStatus() && !getShortprint(out)) {
420 
421  out << " = ";
422 
423  write(out);
424  }
425 
426  if (getLongprint(out) && getHelp() != "") {
427  out << " \"" << getHelp() << "\"";
428  }
429  }
virtual bool getStatus() const =0
Get status of parameter.
const std::string & getName() const
Get name of parameter.
Definition: JParser.hh:368
bool getLongprint(std::ostream &out)
Get long print option.
Definition: JPrint.hh:138
virtual std::ostream & write(std::ostream &out) const =0
Stream output.
bool getShortprint(std::ostream &out)
Get short print option.
Definition: JPrint.hh:92
const std::string & getHelp() const
Get help of parameter.
Definition: JParser.hh:379

Member Data Documentation

Definition at line 1174 of file JParser.hh.

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

Definition at line 444 of file JParser.hh.

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

Definition at line 445 of file JParser.hh.


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