RESTinio
|
Helper class for accumulating integer value during parsing it from string (with check for overflow). More...
#include <overflow_controlled_integer_accumulator.hpp>
Public Member Functions | |
void | next_digit (T digit) noexcept |
Try to add another digit to the accumulator. More... | |
bool | overflow_detected () const noexcept |
Is overflow detected during previous call to next_digit? More... | |
T | value () const noexcept |
Get the current accumulator value. More... | |
Private Types | |
using | extremum_value = overflow_controlled_integer_accumulator_details::extremum_value< T, Extremum_Type > |
using | storage_type = typename extremum_value::storage_type |
Type to be used for holding intermediate value. More... | |
Private Attributes | |
storage_type | m_current {} |
The current value of the accumulator. More... | |
bool | m_overflow_detected { false } |
Overflow detection flag. More... | |
Helper class for accumulating integer value during parsing it from string (with check for overflow).
Usage example:
Definition at line 135 of file overflow_controlled_integer_accumulator.hpp.
|
private |
Definition at line 137 of file overflow_controlled_integer_accumulator.hpp.
|
private |
Type to be used for holding intermediate value.
Definition at line 143 of file overflow_controlled_integer_accumulator.hpp.
|
inlinenoexcept |
Try to add another digit to the accumulator.
Value of the accumulator will be changed only if there is no overflow.
Definition at line 156 of file overflow_controlled_integer_accumulator.hpp.
|
inlinenoexcept |
Is overflow detected during previous call to next_digit?
Definition at line 176 of file overflow_controlled_integer_accumulator.hpp.
|
inlinenoexcept |
Get the current accumulator value.
Definition at line 183 of file overflow_controlled_integer_accumulator.hpp.
|
private |
The current value of the accumulator.
Definition at line 146 of file overflow_controlled_integer_accumulator.hpp.
|
private |
Overflow detection flag.
Definition at line 148 of file overflow_controlled_integer_accumulator.hpp.