dconv 2.0
C++14 library for printing and parsing floating point numbers
Loading...
Searching...
No Matches
dconv::StringProbe Class Reference

string probe. More...

#include <probe.hpp>

Public Types

using ProbePos = const char*
 

Public Member Functions

constexpr StringProbe (const char *in, size_t count)
 default constructor.
 
constexpr StringProbe (const char *first, const char *last)
 default constructor.
 
 StringProbe (const char *in)
 default constructor.
 
 StringProbe (const StringProbe &other)=default
 copy constructor.
 
StringProbe & operator= (const StringProbe &other)=default
 copy assignment.
 
 StringProbe (StringProbe &&other)=default
 move constructor.
 
StringProbe & operator= (StringProbe &&other)=default
 move assignment.
 
 ~StringProbe ()=default
 destroy instance.
 
int peek () const noexcept
 get character without extracting it.
 
int get () noexcept
 extracts character.
 
bool getIf (char expected) noexcept
 extracts expected character.
 
bool getIfNoCase (char expected) noexcept
 extracts expected character (case insensitive, ASCII-only).
 
size_t readDigits (uint64_t &value, size_t max=std::numeric_limits< size_t >::max()) noexcept
 read consecutive digits.
 
size_t read (char *buf, size_t count) noexcept
 read characters.
 
ProbePos tell () const noexcept
 get input position indicator.
 
ProbePos end () const noexcept
 get end position indicator.
 
void seek (ProbePos pos) noexcept
 seek to the specified position.
 

Detailed Description

string probe.

Member Typedef Documentation

◆ ProbePos

using dconv::StringProbe::ProbePos = const char*

Constructor & Destructor Documentation

◆ StringProbe() [1/5]

dconv::StringProbe::StringProbe ( const char * in,
size_t count )
inlineconstexpr

default constructor.

Parameters
ininput string.
countnumber of characters.

◆ StringProbe() [2/5]

dconv::StringProbe::StringProbe ( const char * first,
const char * last )
inlineconstexpr

default constructor.

Parameters
firstpointer to the first character of the string.
lastpointer to the last character of the string.

◆ StringProbe() [3/5]

dconv::StringProbe::StringProbe ( const char * in)
inlineexplicit

default constructor.

Parameters
ininput string.

◆ StringProbe() [4/5]

dconv::StringProbe::StringProbe ( const StringProbe & other)
default

copy constructor.

Parameters
otherobject to copy.

◆ StringProbe() [5/5]

dconv::StringProbe::StringProbe ( StringProbe && other)
default

move constructor.

Parameters
otherobject to move.

◆ ~StringProbe()

dconv::StringProbe::~StringProbe ( )
default

destroy instance.

Member Function Documentation

◆ end()

ProbePos dconv::StringProbe::end ( ) const
inlinenoexcept

get end position indicator.

Returns
end position.

◆ get()

int dconv::StringProbe::get ( )
inlinenoexcept

extracts character.

Returns
extracted character.

◆ getIf()

bool dconv::StringProbe::getIf ( char expected)
inlinenoexcept

extracts expected character.

Parameters
expectedexpected character.
Returns
true if extracted, false otherwise.

◆ getIfNoCase()

bool dconv::StringProbe::getIfNoCase ( char expected)
inlinenoexcept

extracts expected character (case insensitive, ASCII-only).

Parameters
expectedexpected character.
Returns
true if extracted, false otherwise.

◆ operator=() [1/2]

StringProbe & dconv::StringProbe::operator= ( const StringProbe & other)
default

copy assignment.

Parameters
otherobject to copy.
Returns
a reference of the current object.

◆ operator=() [2/2]

StringProbe & dconv::StringProbe::operator= ( StringProbe && other)
default

move assignment.

Parameters
otherobject to move.
Returns
a reference of the current object.

◆ peek()

int dconv::StringProbe::peek ( ) const
inlinenoexcept

get character without extracting it.

Returns
extracted character.

◆ read()

size_t dconv::StringProbe::read ( char * buf,
size_t count )
inlinenoexcept

read characters.

Parameters
bufoutput buffer.
countnumber of characters to read.
Returns
number of characters read.

◆ readDigits()

size_t dconv::StringProbe::readDigits ( uint64_t & value,
size_t max = std::numeric_limits<size_t>::max () )
inlinenoexcept

read consecutive digits.

Parameters
valuevalue the digits are appended to.
maxmaximum number of digits to read.
Returns
number of digits read.

◆ seek()

void dconv::StringProbe::seek ( ProbePos pos)
inlinenoexcept

seek to the specified position.

Parameters
posposition to seek to.

◆ tell()

ProbePos dconv::StringProbe::tell ( ) const
inlinenoexcept

get input position indicator.

Returns
current position.

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