Jpp  master_rocky-43-ge265d140c
the software that should make you happy
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 > JLANG::JComparable< JFirst_t, JSecond_t >

Public Member Functions

 JCounter ()
 Default constructor. More...
 
virtual bool getStatus () const override
 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 419 of file JParser.hh.

Constructor & Destructor Documentation

◆ JCounter()

JPARSER::JCounter::JCounter ( )
inline

Default constructor.

Definition at line 428 of file JParser.hh.

428  :
429  counter(0)
430  {}

Member Function Documentation

◆ getStatus()

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

Get status of this counter.

Returns
true if counter not zero; else false

Implements JLANG::JAbstractObjectStatus.

Definition at line 438 of file JParser.hh.

439  {
440  return (this->counter != 0);
441  }

◆ less() [1/2]

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

451  {
452  return this->counter < value.counter;
453  }

◆ less() [2/2]

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

463  {
464  return this->counter < value;
465  }

◆ more()

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

475  {
476  return this->counter > value;
477  }

◆ getCounter()

int JPARSER::JCounter::getCounter ( ) const
inline

Get counter.

Returns
counter

Definition at line 485 of file JParser.hh.

486  {
487  return counter;
488  }

◆ operator=()

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

500  {
501  counter = 1;
502 
503  return *this;
504  }

◆ operator bool()

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.

◆ operator!()

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  }

Friends And Related Function Documentation

◆ operator>>

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

517  {
518  ++object.counter;
519 
520  return in;
521  }

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const JCounter object 
)
friend

Write options to output.

Parameters
outoutput stream
objectoption
Returns
output stream

Definition at line 531 of file JParser.hh.

532  {
533  out << object.counter;
534 
535  return out;
536  }

Member Data Documentation

◆ counter

int JPARSER::JCounter::counter
protected

Definition at line 539 of file JParser.hh.


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