|
iash
v0.5
Library to provide a bash-like shell in an application
|
Splits up a source string into Tokens based on the given delimiter(s). More...
#include <Tokenizer.h>
Public Member Functions | |
| Tokenizer () | |
| Creates a Tokenizer with no initial settings. | |
| Tokenizer (const std::string &raw) | |
| Creates a Tokenizer and tokenizes the given raw string over spaces. More... | |
| Tokenizer (const std::string &raw, const char delim) | |
| Creates a Tokenizer and tokenizes the given raw string over the given delimiter. More... | |
| Tokenizer (const std::string &raw, const std::string &delims) | |
| Creates a Tokenizer and tokenizes the given raw string over the given delimiters. More... | |
| Tokenizer (const Token &raw) | |
| Creates a Tokenizer and tokenizes the contents of the given token over spaces. More... | |
| Tokenizer (const Token &raw, const char delim) | |
| Creates a Tokenizer and tokenizes the contents of the given token over the given delimiter. More... | |
| Tokenizer (const Token &raw, const std::string &delims) | |
| Creates a Tokenizer and tokenizes the contents of the given token over the given delimiters. More... | |
| void | setSource (const std::string &raw) |
| Sets the source string to tokenize and tokenizes it. More... | |
| void | setDelims (const std::string &delims) |
| Sets the delimiters to tokenize over. More... | |
| const std::vector< Token > & | getTokens () const |
| Gets a reference to a vector of all of the tokens that were found in the source string. More... | |
| const Token & | getToken (const size_t pos) const |
| Gets the Token at the given position in the token vector. More... | |
| size_t | indexOf (const Token &token, const size_t start=0) const |
| Finds the index of the given Token in the token vector. More... | |
Splits up a source string into Tokens based on the given delimiter(s).
This is used under the hood by iash to parse the user's command input into UserCommands to be used by iash and Commands.
| Tokenizer::Tokenizer | ( | const std::string & | raw | ) |
Creates a Tokenizer and tokenizes the given raw string over spaces.
This does not tokenize over tabs, newlines, and carriage returns, use Tokenizer::Tokenizer(const std::string&, const std::string&) instead.
| raw | the string to tokenize |
| Tokenizer::Tokenizer | ( | const std::string & | raw, |
| const char | delim | ||
| ) |
Creates a Tokenizer and tokenizes the given raw string over the given delimiter.
| raw | the string to tokenize |
| delim | the delimiter to tokenize over |
| Tokenizer::Tokenizer | ( | const std::string & | raw, |
| const std::string & | delims | ||
| ) |
Creates a Tokenizer and tokenizes the given raw string over the given delimiters.
| raw | the string to tokenize |
| delims | the delimiters to tokenize over as a string. Each character in the string is interpreted as a delimiter |
| Tokenizer::Tokenizer | ( | const Token & | raw | ) |
Creates a Tokenizer and tokenizes the contents of the given token over spaces.
This does not tokenize over tabs, newlines, and carriage returns, use Tokenizer::Tokenizer(const Token&, const std::string&) instead.
| raw | the Token to tokenize further |
| Tokenizer::Tokenizer | ( | const Token & | raw, |
| const char | delim | ||
| ) |
| Tokenizer::Tokenizer | ( | const Token & | raw, |
| const std::string & | delims | ||
| ) |
| const Token & Tokenizer::getToken | ( | const size_t | pos | ) | const |
| const std::vector< Token > & Tokenizer::getTokens | ( | ) | const |
Gets a reference to a vector of all of the tokens that were found in the source string.
| size_t Tokenizer::indexOf | ( | const Token & | token, |
| const size_t | start = 0 |
||
| ) | const |
| void Tokenizer::setDelims | ( | const std::string & | delims | ) |
Sets the delimiters to tokenize over.
Does not retokenize the source.
| void Tokenizer::setSource | ( | const std::string & | raw | ) |
Sets the source string to tokenize and tokenizes it.
| raw | the string to tokenize |