Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JPARSER::JCounter Struct Reference

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

#include <JParser.hh>

Public Member Functions

 JCounter ()
 Default constructor.
 
int getCounter () const
 Get counter.
 
 operator int () const
 Type conversion operator.
 
const JCounteroperator= (const bool value)
 Set value.
 

Protected Attributes

int counter
 

Friends

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

Detailed Description

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

Definition at line 417 of file JParser.hh.

Constructor & Destructor Documentation

◆ JCounter()

JPARSER::JCounter::JCounter ( )
inline

Default constructor.

Definition at line 421 of file JParser.hh.

421 :
422 counter(0)
423 {}

Member Function Documentation

◆ getCounter()

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

Get counter.

Returns
counter

Definition at line 431 of file JParser.hh.

432 {
433 return counter;
434 }

◆ operator int()

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

Type conversion operator.

Returns
counter

Definition at line 442 of file JParser.hh.

443 {
444 return counter;
445 }

◆ operator=()

const JCounter & JPARSER::JCounter::operator= ( const bool value)
inline

Set value.

Parameters
valuevalue
Returns
this object

Definition at line 454 of file JParser.hh.

455 {
456 counter = (value ? 1 : 0);
457
458 return *this;
459 }

Friends And Related Symbol 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 471 of file JParser.hh.

472 {
473 ++object.counter;
474
475 return in;
476 }

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

487 {
488 out << object.counter;
489
490 return out;
491 }

Member Data Documentation

◆ counter

int JPARSER::JCounter::counter
protected

Definition at line 494 of file JParser.hh.


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