Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

RazorBack::Symvar_ Class Reference

Objects of this class represent symbolic variables. More...

#include <Symvar.hh>

List of all members.

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.


Detailed Description

Objects of this class represent symbolic variables.

Such variables may store a string value from a set of prescribed tokens.

Definition at line 48 of file Symvar.hh.


Constructor & Destructor Documentation

RazorBack::Symvar_::Symvar_ ( const string & Tokenstr = "",
const string & Seps = "|, \t" ) [inline, explicit]
 

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.

Definition at line 67 of file Symvar.hh.

RazorBack::Symvar_::Symvar_ ( const Symvar_ & Sv ) [inline]
 

Copy constructor.

Definition at line 71 of file Symvar.hh.

RazorBack::Symvar_::~Symvar_ ( ) [inline, virtual]
 

Destructor.

Definition at line 76 of file Symvar.hh.


Member Function Documentation

Symvar_ & RazorBack::Symvar_::operator= ( const Symvar_ & Rhs ) [inline]
 

Assignment.

Definition at line 79 of file Symvar.hh.

unsigned int RazorBack::Symvar_::set_tokens ( const string & Tokenstr )
 

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_().

void RazorBack::Symvar_::add_token ( const string & Newtok ) [inline]
 

Adds a new token Newtok to the list of allowed tokens.

Definition at line 100 of file Symvar.hh.

void RazorBack::Symvar_::remove_token ( const string & Tok )
 

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.

const string & RazorBack::Symvar_::separators ( ) [inline]
 

Returns a string containing all accepted separator characters.

Definition at line 112 of file Symvar.hh.

bool RazorBack::Symvar_::valid_token ( const string & Tok ) const [inline]
 

Returns true if Tok is one of the valid tokens. Comparison is case-sensitive.

Definition at line 115 of file Symvar.hh.

bool RazorBack::Symvar_::empty ( ) const [inline]
 

Returns true if the calling object contains no valid tokens.

Definition at line 121 of file Symvar.hh.

Referenced by token().

const string & RazorBack::Symvar_::token ( ) const [inline]
 

Returns a reference to the current token.

Throws Emptyexc_ if the calling object has no tokens defined.

Definition at line 127 of file Symvar.hh.

const string & RazorBack::Symvar_::token ( const string & Tok )
 

Sets the current token to Tok if it is valid.

Returns the old current token. Throws Emptyexc_ if the calling object was empty.

string RazorBack::Symvar_::all_tokens ( ) const
 

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.

unsigned int RazorBack::Symvar_::curtokptr_offset ( ) const [protected]
 

Referenced by Symvar_(), and operator=().

void RazorBack::Symvar_::curtokptr_offset ( unsigned int Offs ) [protected]
 


Friends And Related Function Documentation

istream & operator>> ( istream & In,
Symvar_ & Sv ) [friend]
 

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.

ostream & operator<< ( ostream & Out,
const Symvar_ & Sv ) [friend]
 

Output: writes the token string in Sv to Out. No newline at the end.


Member Data Documentation

const string RazorBack::Symvar_::Separators [private]
 

Definition at line 53 of file Symvar.hh.

list<string> RazorBack::Symvar_::Toklist [private]
 

Definition at line 54 of file Symvar.hh.

list<string>::iterator RazorBack::Symvar_::Curtokptr [private]
 

Definition at line 55 of file Symvar.hh.


The documentation for this class was generated from the following file:
Generated at Wed Aug 21 09:33:42 2002 for The Razorback C++ Library: Miscellaneous by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001