Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | Friends | List of all members
JPARSER::JCounter Class Reference

Auxiliary class to handle multiple boolean-like I/O. More...

#include <JParser.hh>

Inheritance diagram for JPARSER::JCounter:
JLANG::JAbstractObjectStatus JLANG::JComparable< JFirst_t, JSecond_t >

Public Member Functions

 JCounter ()
 Default constructor. More...
 
virtual bool getStatus () const
 Get status of this counter. More...
 
bool less (const JCounter &value) const
 Compare value. More...
 
bool less (const int value) const
 Compare value. More...
 
bool more (const int value) const
 Compare value. More...
 
int getCounter () const
 Get counter. More...
 
const JCounteroperator= (const bool value)
 Set value. More...
 
 operator bool () const
 Type conversion operator. More...
 
bool operator! () const
 Negated status of this object. More...
 

Protected Attributes

int counter
 

Friends

std::istream & operator>> (std::istream &in, JCounter &object)
 Read option from input. More...
 
std::ostream & operator<< (std::ostream &out, const JCounter &object)
 Write options to output. More...
 

Detailed Description

Auxiliary class to handle multiple boolean-like I/O.

Definition at line 218 of file JParser.hh.

Constructor & Destructor Documentation

JPARSER::JCounter::JCounter ( )
inline

Default constructor.

Definition at line 226 of file JParser.hh.

226  :
227  counter(0)
228  {}

Member Function Documentation

virtual bool JPARSER::JCounter::getStatus ( ) const
inlinevirtual

Get status of this counter.

Returns
true if counter not zero; else false

Implements JLANG::JAbstractObjectStatus.

Definition at line 236 of file JParser.hh.

237  {
238  return (this->counter != 0);
239  }
bool JPARSER::JCounter::less ( const JCounter value) const
inline

Compare value.

Parameters
valuevalue
Returns
true if this counter is less than given value; else false

Definition at line 248 of file JParser.hh.

249  {
250  return this->counter < value.counter;
251  }
bool JPARSER::JCounter::less ( const int  value) const
inline

Compare value.

Parameters
valuevalue
Returns
true if this counter is less than given value; else false

Definition at line 260 of file JParser.hh.

261  {
262  return this->counter < value;
263  }
bool JPARSER::JCounter::more ( const int  value) const
inline

Compare value.

Parameters
valuevalue
Returns
true if this counter is more than given value; else false

Definition at line 272 of file JParser.hh.

273  {
274  return this->counter > value;
275  }
int JPARSER::JCounter::getCounter ( ) const
inline

Get counter.

Returns
counter

Definition at line 283 of file JParser.hh.

284  {
285  return counter;
286  }
const JCounter& JPARSER::JCounter::operator= ( const bool  value)
inline

Set value.

Note that no assignment actually takes place but the internal counter is set to one.

Parameters
valuevalue
Returns
this object

Definition at line 297 of file JParser.hh.

298  {
299  counter = 1;
300 
301  return *this;
302  }
JLANG::JAbstractObjectStatus::operator bool ( ) const
inlineinherited

Type conversion operator.

Returns
status of this object

Definition at line 33 of file JAbstractObjectStatus.hh.

34  {
35  return this->getStatus();
36  }
virtual bool getStatus() const =0
Get status of object.
bool JLANG::JAbstractObjectStatus::operator! ( ) const
inlineinherited

Negated status of this object.

Returns
negated status of this object

Definition at line 44 of file JAbstractObjectStatus.hh.

45  {
46  return !(this->getStatus());
47  }
virtual bool getStatus() const =0
Get status of object.

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JCounter object 
)
friend

Read option from input.

Note that no value actually is read, only the internal counter is incremented.

Parameters
ininput stream
objectoption
Returns
input stream

Definition at line 314 of file JParser.hh.

315  {
316  ++object.counter;
317 
318  return in;
319  }
std::ostream& operator<< ( std::ostream &  out,
const JCounter object 
)
friend

Write options to output.

Parameters
outoutput stream
objectoption
Returns
output stream

Definition at line 329 of file JParser.hh.

330  {
331  out << object.counter;
332 
333  return out;
334  }

Member Data Documentation

int JPARSER::JCounter::counter
protected

Definition at line 337 of file JParser.hh.


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