XPPlanes
X-Plane plugin to display additional planes based on network data
Public Member Functions | Protected Attributes | List of all members
StrTokens Class Reference

Class to extract tokens from a string. More...

#include <Utilities.h>

Public Member Functions

 StrTokens (const std::string &_s, const std::string &_sep)
 Constructor: Pass in the string to separate and the separators. More...
 
std::string next ()
 returns the next token, can be the empty string if two tokens follow immediately, or if finished() More...
 
std::string next (const std::string &_sep)
 (re)sets the separators, then returns the next token More...
 
int count () const
 returns how many finds have been returned so far More...
 
bool finished () const
 have all tokens been returned? More...
 

Protected Attributes

const std::string & s
 reference to the string to search More...
 
std::string sep
 separators More...
 
size_t p = std::string::npos
 points to last separator found More...
 
int num = 0
 counts the findings More...
 

Detailed Description

Class to extract tokens from a string.

Constructor & Destructor Documentation

◆ StrTokens()

StrTokens::StrTokens ( const std::string &  _s,
const std::string &  _sep 
)
inline

Constructor: Pass in the string to separate and the separators.

Member Function Documentation

◆ count()

int StrTokens::count ( ) const
inline

returns how many finds have been returned so far

◆ finished()

bool StrTokens::finished ( ) const
inline

have all tokens been returned?

◆ next() [1/2]

std::string StrTokens::next ( )

returns the next token, can be the empty string if two tokens follow immediately, or if finished()

◆ next() [2/2]

std::string StrTokens::next ( const std::string &  _sep)
inline

(re)sets the separators, then returns the next token

Member Data Documentation

◆ num

int StrTokens::num = 0
protected

counts the findings

◆ p

size_t StrTokens::p = std::string::npos
protected

points to last separator found

◆ s

const std::string& StrTokens::s
protected

reference to the string to search

◆ sep

std::string StrTokens::sep
protected

separators


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