|
bpp-core
2.2.0
|
An improved tokenizer for strings. More...
#include <Bpp/Text/NestedStringTokenizer.h>
Inheritance diagram for bpp::NestedStringTokenizer:
Collaboration diagram for bpp::NestedStringTokenizer:Public Member Functions | |
| NestedStringTokenizer (const std::string &s, const std::string &open, const std::string &end, const std::string &delimiters=" \\", bool solid=false) throw (Exception) | |
| Build a new StringTokenizer from a string. More... | |
| virtual | ~NestedStringTokenizer () |
| const std::string & | nextToken () throw (Exception) |
| Get the next available token. If no token is availbale, throw an Exception. More... | |
| std::string | unparseRemainingTokens () const |
| This function is not supported for nested tokenizers. More... | |
| bool | hasMoreToken () const |
| Tell if some tokens are still available. More... | |
| size_t | numberOfRemainingTokens () const |
| Tell how many tokens are available. More... | |
| const std::string & | getToken (size_t pos) const |
| Get a particular token. More... | |
| const std::deque< std::string > & | getTokens () const |
| Retrieve all tokens. More... | |
| void | removeEmptyTokens () |
| remove all empty token from the current position. More... | |
Protected Attributes | |
| std::deque< std::string > | tokens_ |
| Where the tokens are stored. More... | |
| std::deque< std::string > | splits_ |
| size_t | currentPosition_ |
| the current position in the token list. More... | |
An improved tokenizer for strings.
Splits a string according to a given (set of) delimiter(s). Delimiters in certains blocks ({}, [], etc) are ignored.
Definition at line 59 of file NestedStringTokenizer.h.
| NestedStringTokenizer::NestedStringTokenizer | ( | const std::string & | s, |
| const std::string & | open, | ||
| const std::string & | end, | ||
| const std::string & | delimiters = " \t\n\f\r", |
||
| bool | solid = false |
||
| ) | |||
| throw | ( | Exception | |
| ) | |||
Build a new StringTokenizer from a string.
| s | The string to parse. |
| open | Opening block. |
| end | Ending block. |
| delimiters | Chars that must be considered as delimiters. |
| solid | If true, delimiters is considered as a single bloc delimiter. |
Definition at line 50 of file NestedStringTokenizer.cpp.
References bpp::TextTools::count().
|
inlinevirtual |
Definition at line 75 of file NestedStringTokenizer.h.
|
inlineinherited |
Get a particular token.
Do not move the iterator.
| pos | The index of the token. |
Definition at line 119 of file StringTokenizer.h.
References bpp::StringTokenizer::tokens_.
Referenced by bpp::NumCalcApplicationTools::seqFromString().
|
inlineinherited |
Retrieve all tokens.
Definition at line 126 of file StringTokenizer.h.
References bpp::StringTokenizer::tokens_.
Referenced by bpp::DataTable::read().
|
inlineinherited |
Tell if some tokens are still available.
Definition at line 100 of file StringTokenizer.h.
References bpp::StringTokenizer::currentPosition_, and bpp::StringTokenizer::tokens_.
Referenced by bpp::ParameterList::getMatchingParameterNames(), bpp::ApplicationTools::getMatrixParameter(), bpp::NumCalcApplicationTools::getVector(), bpp::ApplicationTools::matchingParameters(), bpp::KeyvalTools::multipleKeyvals(), bpp::StringTokenizer::nextToken(), bpp::BppODiscreteDistributionFormat::read(), and bpp::NumCalcApplicationTools::seqFromString().
| const std::string & NestedStringTokenizer::nextToken | ( | ) | ||
| throw | ( | Exception | ||
| ) | ||||
Get the next available token. If no token is availbale, throw an Exception.
Definition at line 148 of file NestedStringTokenizer.cpp.
Referenced by bpp::ApplicationTools::getVectorParameter().
|
inlineinherited |
Tell how many tokens are available.
Definition at line 109 of file StringTokenizer.h.
References bpp::StringTokenizer::currentPosition_, and bpp::StringTokenizer::tokens_.
Referenced by bpp::ApplicationTools::getMatrixParameter(), bpp::ApplicationTools::getVectorParameter(), bpp::NumCalcApplicationTools::seqFromString(), and bpp::StringTokenizer::unparseRemainingTokens().
|
inherited |
remove all empty token from the current position.
Definition at line 104 of file StringTokenizer.cpp.
References bpp::StringTokenizer::currentPosition_, and bpp::StringTokenizer::tokens_.
|
inline |
This function is not supported for nested tokenizers.
Definition at line 93 of file NestedStringTokenizer.h.
|
protectedinherited |
the current position in the token list.
Definition at line 67 of file StringTokenizer.h.
Referenced by bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), bpp::StringTokenizer::numberOfRemainingTokens(), bpp::StringTokenizer::removeEmptyTokens(), and bpp::StringTokenizer::unparseRemainingTokens().
|
protectedinherited |
Definition at line 64 of file StringTokenizer.h.
Referenced by bpp::StringTokenizer::StringTokenizer(), and bpp::StringTokenizer::unparseRemainingTokens().
|
protectedinherited |
Where the tokens are stored.
Definition at line 63 of file StringTokenizer.h.
Referenced by bpp::StringTokenizer::getToken(), bpp::StringTokenizer::getTokens(), bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), bpp::StringTokenizer::numberOfRemainingTokens(), bpp::StringTokenizer::removeEmptyTokens(), bpp::StringTokenizer::StringTokenizer(), and bpp::StringTokenizer::unparseRemainingTokens().