sisi4s
Loading...
Searching...
No Matches
sisi4s::RangeParser Class Reference

Class to parse a string of comma separated range delimiters. Note: It only works for unsigned integers. More...

#include <RangeParser.hpp>

Collaboration diagram for sisi4s::RangeParser:

Public Member Functions

 RangeParser (const std::string &rawRange_)
 Constructor from a string, it will parse the string automatically.
 
std::vector< int > getRange () const
 Get the range in the form of a vector of integers.
 
std::vector< int > atomicRangeToRange (const std::string &atomicRange)
 Parse individual range atoms. For example this method will map "2" into std::vector<int>{2} and "2-3" into std::vector<int>{2,3}.
 
void parse ()
 Main parser method, it will parse a comma separated string of range delimiters.
 

Protected Attributes

const std::string rawRange
 
std::vector< int > parsedRange
 

Detailed Description

Class to parse a string of comma separated range delimiters. Note: It only works for unsigned integers.

Constructor & Destructor Documentation

◆ RangeParser()

sisi4s::RangeParser::RangeParser ( const std::string &  rawRange_)
inline

Constructor from a string, it will parse the string automatically.

Here is the call graph for this function:

Member Function Documentation

◆ atomicRangeToRange()

std::vector< int > sisi4s::RangeParser::atomicRangeToRange ( const std::string &  atomicRange)
inline

Parse individual range atoms. For example this method will map "2" into std::vector<int>{2} and "2-3" into std::vector<int>{2,3}.

Here is the caller graph for this function:

◆ getRange()

std::vector< int > sisi4s::RangeParser::getRange ( ) const
inline

Get the range in the form of a vector of integers.

Here is the caller graph for this function:

◆ parse()

void sisi4s::RangeParser::parse ( )
inline

Main parser method, it will parse a comma separated string of range delimiters.

E.g. it will turn "2 ,3 , 4, 8-10" into {2,3,4,8,9,10}. Note that it is supposed to be whitespace safe.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ parsedRange

std::vector<int> sisi4s::RangeParser::parsedRange
protected

◆ rawRange

const std::string sisi4s::RangeParser::rawRange
protected

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