rtop
Public Member Functions | Private Attributes | List of all members
rtop::StringParser Class Reference

responsible for parsing strings in a line, specfied by some character separator More...

#include <rtop_utils.h>

Public Member Functions

 StringParser (char c)
 StringParser constructor. Instantiates a StringParser object with provided separator character. More...
 
void operator<< (std::string)
 reads in a line and stores parsed string into StringParser::words More...
 
std::vector< std::string > Words () const
 returns a vector of parsed strings stored in StringParser::words More...
 
int size () const
 returns size of StringParser::words vector More...
 
void clear ()
 clears StringParser::words vector More...
 
void setSeparator (char c)
 sets separator character More...
 

Private Attributes

char sep
 character separator More...
 
std::vector< std::string > words
 stores the parsed strings More...
 
int sz
 size of words More...
 

Detailed Description

responsible for parsing strings in a line, specfied by some character separator

provides API to read in a line string, specify separator and accessing the parsed strings

Definition at line 55 of file rtop_utils.h.

Constructor & Destructor Documentation

◆ StringParser()

rtop::StringParser::StringParser ( char  c)
inline

StringParser constructor. Instantiates a StringParser object with provided separator character.

Definition at line 66 of file rtop_utils.h.

Member Function Documentation

◆ clear()

void rtop::StringParser::clear ( )
inline

clears StringParser::words vector

Definition at line 74 of file rtop_utils.h.

◆ operator<<()

void rtop::StringParser::operator<< ( std::string  str1)

reads in a line and stores parsed string into StringParser::words

remove white space from parsed strings.

Todo:
: no rational. rationalize

Definition at line 83 of file rtop_utils.h.

◆ setSeparator()

void rtop::StringParser::setSeparator ( char  c)
inline

sets separator character

Definition at line 80 of file rtop_utils.h.

◆ size()

int rtop::StringParser::size ( ) const
inline

returns size of StringParser::words vector

Definition at line 72 of file rtop_utils.h.

◆ Words()

std::vector<std::string> rtop::StringParser::Words ( ) const
inline

returns a vector of parsed strings stored in StringParser::words

Definition at line 70 of file rtop_utils.h.

Member Data Documentation

◆ sep

char rtop::StringParser::sep
private

character separator

Definition at line 59 of file rtop_utils.h.

◆ sz

int rtop::StringParser::sz
private

size of words

Definition at line 63 of file rtop_utils.h.

◆ words

std::vector<std::string> rtop::StringParser::words
private

stores the parsed strings

Definition at line 61 of file rtop_utils.h.


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