MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | List of all members
util::Tokenizer Class Reference

Simple tokenizer. More...

#include <tokenizer.h>

Collaboration diagram for util::Tokenizer:
Collaboration graph
[legend]

Public Member Functions

std::string concat (std::size_t pos, std::size_t num=0) const
 Concatenates 'num' tokens with a space character starting from token at position 'pos'.
 
template<typename T >
get_as (std::size_t pos) const
 Returns the requested token as the specified type.
 
void parse_cmd (std::string const &str)
 A tokenizer that parses shell commands into tokens.
 
void split (std::string const &str, char delim=' ', bool keep_empty=false)
 Very simple tokenziation at a given delimiter characater.
 

Detailed Description

Simple tokenizer.

Reads an input string and splits the string according to some rules. The individual tokens are then stored in the vector baseclass.

Definition at line 28 of file tokenizer.h.

Member Function Documentation

◆ concat()

std::string util::Tokenizer::concat ( std::size_t  pos,
std::size_t  num = 0 
) const
inline

Concatenates 'num' tokens with a space character starting from token at position 'pos'.

Passing '0' as 'num' argument means to concat all remaining tokens.

Definition at line 108 of file tokenizer.h.

◆ get_as()

template<typename T >
T util::Tokenizer::get_as ( std::size_t  pos) const
inline

Returns the requested token as the specified type.

Definition at line 128 of file tokenizer.h.

◆ parse_cmd()

void util::Tokenizer::parse_cmd ( std::string const &  str)
inline

A tokenizer that parses shell commands into tokens.

It handles quotes gracefully, placing quoted strings into a single token and removes the quotes.

Definition at line 83 of file tokenizer.h.

◆ split()

void util::Tokenizer::split ( std::string const &  str,
char  delim = ' ',
bool  keep_empty = false 
)
inline

Very simple tokenziation at a given delimiter characater.

If requested, subsequent delimiter characters lead to empty tokens.

Definition at line 62 of file tokenizer.h.


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