#include <Symvar.hh>
Public Methods | |
Symvar_ (const string &Tokenstr="", const string &Seps="|,\t") | |
Inits to contain the allowed tokens to Tokenstr. More... | |
Symvar_ (const Symvar_ &Sv) | |
Copy constructor. | |
virtual | ~Symvar_ () |
Destructor. | |
Symvar_& | operator= (const Symvar_ &Rhs) |
Assignment. | |
unsigned int | set_tokens (const string &Tokenstr) |
Sets the allowed tokens to Tokenstr. More... | |
void | add_token (const string &Newtok) |
Adds a new token Newtok to the list of allowed tokens. | |
void | remove_token (const string &Tok) |
Removes the token Tok from the list of allowed tokens. More... | |
const string& | separators () |
Returns a string containing all accepted separator characters. | |
bool | valid_token (const string &Tok) const |
Returns true if Tok is one of the valid tokens. Comparison is case-sensitive. | |
bool | empty () const |
Returns true if the calling object contains no valid tokens. | |
const string& | token () const |
Returns a reference to the current token. More... | |
const string& | token (const string &Tok) |
Sets the current token to Tok if it is valid. More... | |
string | all_tokens () const |
Constructs and returns a string that contains all legal tokens, separated by the first char in the string returned by separator(). More... | |
Protected Methods | |
unsigned int | curtokptr_offset () const |
void | curtokptr_offset (unsigned int Offs) |
Private Attributes | |
const string | Separators |
list<string> | Toklist |
list<string>::iterator | Curtokptr |
Friends | |
istream& | operator>> (istream &In, Symvar_ &Sv) |
Input: reads the next string into Sv. More... | |
ostream& | operator<< (ostream &Out, const Symvar_ &Sv) |
Output: writes the token string in Sv to Out. No newline at the end. |
Such variables may store a string value from a set of prescribed tokens.
Definition at line 48 of file Symvar.hh.
|
Inits to contain the allowed tokens to Tokenstr. This string shall contain the tokens separated by one of the allowed separator characters (given by Seps, "|, \t" by default). For example, set_tokens("tok1|tok2,tok3") specifies the three acceptable tokens "tok1", "tok2", "tok3". The current token iterator will be set to the first one. |
|
Copy constructor.
|
|
Destructor.
|
|
Assignment.
|
|
Sets the allowed tokens to Tokenstr. This string shall contain the tokens separated by one of the allowed separator characters (returned by the static method legal_separators()). For example, set_tokens("tok1|tok2,tok3") specifies the three acceptable tokens "tok1", "tok2", "tok3". The current token iterator will be set to the first one. Returns the number of tokens seen. Referenced by Symvar_(). |
|
Adds a new token Newtok to the list of allowed tokens.
|
|
Removes the token Tok from the list of allowed tokens. If the token to be removed was the current one, then the new current token will be the first in the internal list. |
|
Returns a string containing all accepted separator characters.
|
|
Returns true if Tok is one of the valid tokens. Comparison is case-sensitive.
|
|
Returns true if the calling object contains no valid tokens.
Definition at line 121 of file Symvar.hh. Referenced by token(). |
|
Returns a reference to the current token. Throws Emptyexc_ if the calling object has no tokens defined. |
|
Sets the current token to Tok if it is valid. Returns the old current token. Throws Emptyexc_ if the calling object was empty. |
|
Constructs and returns a string that contains all legal tokens, separated by the first char in the string returned by separator(). If the calling object is empty, then "" is returned. |
|
|
|
|
|
Input: reads the next string into Sv. If it is a valid token, then it will be stored in Sv, otherwise Sv is not modified and In's failbit will be set. |
|
Output: writes the token string in Sv to Out. No newline at the end.
|
|
|
|
|
|
|