Main Page | User's Guide | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

Talos::ExtStream Class Reference

Extended streams. More...

#include <Files.hxx>

Inheritance diagram for Talos::ExtStream:

Talos::ConfigStream List of all members.

Public Member Functions

 ExtStream ()
 Default constructor.
 ExtStream (string file_name, string comments="#%", string delimiters=" \t:=|\n,;")
 Main constructor.
virtual ~ExtStream ()
 Destructor.
bool Discard (string line) const
 Checks whether a line should be discarded.
ExtStreamSkipDiscarded ()
 Skips discarded lines.
void SetDelimiters (string delimiters)
 Sets the characters considered as delimiters..
void SetComments (string comments)
 Sets the characters that denote a comment line.
string GetDelimiters () const
 Returns the characters considered as delimiters..
string GetComments () const
 Returns the characters that denote a comment line.
string GetFileName () const
 Returns the name of the file that was opened.
ExtStreamSkipDelimiters ()
 Skips delimiters.
string RemoveDelimiters (const string &str) const
 Removes delimiters at both ends of a string.
ExtStreamSkip ()
 Skips discarded lines and delimiters.
void Open (string file_name, openmode mode=in)
 Opens a file.
void Close ()
 Closes the current file.
bool IsEmpty ()
 Checks whether the stream is empty.
ExtStreamRewind ()
 Rewinds the stream.
string GetFullLine ()
 Returns the next line.
bool GetFullLine (string &line)
 Returns the next line.
string PeekFullLine ()
 Returns the next line without extracting it from the stream.
string PeekFullLine (streampos &position)
 Returns the next line without extracting it from the stream.
bool PeekFullLine (string &line)
 Returns the next line without extracting it from the stream.
void SkipFullLines (int nb)
 Skips full lines.
virtual string GetLine ()
 Returns the next valid line.
virtual bool GetLine (string &line)
 Returns the next valid line.
virtual string PeekLine ()
 Returns the next valid line without extracting it from the stream.
virtual string PeekLine (streampos &position)
 Returns the next valid line without extracting it from the stream.
virtual bool PeekLine (string &line)
 Returns the next valid line without extracting it from the stream.
void SkipLines (int nb)
 Skips valid lines.
bool Find (string element)
 Sets the position of the get pointer after a given element.
bool FindFromBeginning (string element)
 Sets the position of the get pointer after a given element.
virtual string GetElement ()
 Returns the next valid element.
template<class T>
bool GetElement (T &element)
 Gets the next valid element.
template<class T>
bool GetRawElement (T &element)
 Gets the next valid element.
string PeekElement ()
 Returns the next valid element without extracting it from the stream.
template<class T>
bool PeekElement (T &element)
 Gets the next valid element without extracting it from the stream.
void SkipElements (int nb)
 Skips valid elements.
double GetNumber ()
 Returns the next valid number.
template<class T>
bool GetNumber (T &number)
 Gets the next valid number.
double PeekNumber ()
 Returns the next valid number without extracting it from the stream.
template<class T>
bool PeekNumber (T &number)
 Gets the next valid number without extracting it from the stream.
void SkipNumbers (int nb)
 Skips numbers.
string GetValue (string name)
 Gets the value of a given variable.
string PeekValue (string name)
 Gets the value of a given variable without extracting from the stream.
template<class T>
bool GetValue (string name, T &value)
 Gets the value of a given variable.
template<class T>
bool PeekValue (string name, T &value)
 Gets the value of a given variable without extracting them from the stream.
bool GetValue (string name, string &value)
 Gets the value of a given variable.
bool PeekValue (string name, string &value)
 Gets the value of a given variable without extracting them from the stream.
bool GetValue (string name, bool &value)
 Gets the value of a given variable.
bool PeekValue (string name, bool &value)
 Gets the value of a given variable without extracting from the stream.

Protected Attributes

string file_name_
 File name associated with the stream.
string comments_
 Characters that denote a comment line.
string delimiters_
 Characters considered as delimiters.
string searching_
 Field currently searched.

Detailed Description

Extended streams.


Constructor & Destructor Documentation

Talos::ExtStream::ExtStream  ) 
 

Default constructor.

Nothing is performed.

Talos::ExtStream::ExtStream string  file_name,
string  comments = "#%",
string  delimiters = " \t:=|\n,;"
 

Main constructor.

Opens a file.

Parameters:
file_name file to be opened.

Talos::ExtStream::~ExtStream  )  [virtual]
 

Destructor.

Closes the stream.


Member Function Documentation

void Talos::ExtStream::Close  ) 
 

Closes the current file.

Note:
The stream is cleared.

bool Talos::ExtStream::Discard string  line  )  const
 

Checks whether a line should be discarded.

Parameters:
line line to be checked.

bool Talos::ExtStream::Find string  element  ) 
 

Sets the position of the get pointer after a given element.

Sets the position of the get pointer exactly after a given element.

Parameters:
element the element to be found.
Returns:
true if the element was found, false otherwise.

Reimplemented in Talos::ConfigStream.

bool Talos::ExtStream::FindFromBeginning string  element  ) 
 

Sets the position of the get pointer after a given element.

Sets the position of the get pointer exactly after a given element.

Parameters:
element the element to be found from the beginning of the stream.
Returns:
true if the element was found, false otherwise.

Reimplemented in Talos::ConfigStream.

string Talos::ExtStream::GetComments  )  const
 

Returns the characters that denote a comment line.

Returns:
The characters that denote a comment line.

string Talos::ExtStream::GetDelimiters  )  const
 

Returns the characters considered as delimiters..

Returns:
Delimiters.

template<class T>
bool Talos::ExtStream::GetElement T &  element  ) 
 

Gets the next valid element.

Gets the next valid element, i.e. the next element that is not in a line to be discarded.

Parameters:
element (output) the next valid element.

string Talos::ExtStream::GetElement  )  [virtual]
 

Returns the next valid element.

Returns the next valid element, i.e. the next element that is not in a line to be discarded.

Returns:
The next valid element.

Reimplemented in Talos::ConfigStream.

string Talos::ExtStream::GetFileName  )  const
 

Returns the name of the file that was opened.

Returns:
The name of the file that was opened.

bool Talos::ExtStream::GetFullLine string &  line  ) 
 

Returns the next line.

Parameters:
line (output) the next line.

string Talos::ExtStream::GetFullLine  ) 
 

Returns the next line.

Returns:
The next line.

bool Talos::ExtStream::GetLine string &  line  )  [virtual]
 

Returns the next valid line.

Returns the next valid line, i.e. the next line that is not a line to be discarded and from which comments have been extracted.

Parameters:
line (output) the next valid line.

Reimplemented in Talos::ConfigStream.

string Talos::ExtStream::GetLine  )  [virtual]
 

Returns the next valid line.

Returns the next valid line, i.e. the next line that is not a line to be discarded and from which comments have been extracted.

Returns:
The next valid line.

Reimplemented in Talos::ConfigStream.

template<class T>
bool Talos::ExtStream::GetNumber T &  number  ) 
 

Gets the next valid number.

Gets the next valid number, i.e. the next number that is not in a line to be discarded.

Parameters:
element (output) the next valid number.

double Talos::ExtStream::GetNumber  ) 
 

Returns the next valid number.

Returns the next valid number, i.e. the next number that is not in a line to be discarded.

Returns:
The next valid number.

template<class T>
bool Talos::ExtStream::GetRawElement T &  element  ) 
 

Gets the next valid element.

Gets the next valid element, i.e. the next element that is not in a line to be discarded.

Parameters:
element (output) the next valid element.

bool Talos::ExtStream::GetValue string  name,
bool &  value
 

Gets the value of a given variable.

Gets the value of a given variable, i.e. the next valid (not in a discarded line) number or element following the variable name.

Parameters:
name the name of the variable.
value boolean associated with the variable.

bool Talos::ExtStream::GetValue string  name,
string &  value
 

Gets the value of a given variable.

Gets the value of a given variable, i.e. the next valid (not in a discarded line) number or element following the variable name.

Parameters:
name the name of the variable.
value value associated with the variable.

template<class T>
bool Talos::ExtStream::GetValue string  name,
T &  value
 

Gets the value of a given variable.

Gets the (numerical) value of a given variable, i.e. the next valid (not in a discarded line) number or element following the variable name.

Parameters:
name the name of the variable.
value value associated with the variable.

string Talos::ExtStream::GetValue string  name  ) 
 

Gets the value of a given variable.

Gets the value of a given variable, i.e. the next valid (not in a discarded line) element following the variable name.

Parameters:
name the name of the variable.
Returns:
the value of the variable.

bool Talos::ExtStream::IsEmpty  ) 
 

Checks whether the stream is empty.

Checcks whether the stream has still valid elements to be read.

Returns:
'true' is the stream is empty, 'false' otherwise.

Reimplemented in Talos::ConfigStream.

void Talos::ExtStream::Open string  file_name,
openmode  mode = in
 

Opens a file.

Parameters:
file_name file name.
mode (optional) flags describing the requested I/O mode for the file. Default: in.
Note:
If a file was previously opened, it is closed and the stream is cleared.

template<class T>
bool Talos::ExtStream::PeekElement T &  element  ) 
 

Gets the next valid element without extracting it from the stream.

Gets the next valid element, i.e. the next element that is not in a line to be discarded.

Parameters:
element (output) the next valid element.

string Talos::ExtStream::PeekElement  ) 
 

Returns the next valid element without extracting it from the stream.

Returns the next valid element, i.e. the next element that is not in a line to be discarded.

Returns:
The next valid element.

bool Talos::ExtStream::PeekFullLine string &  line  ) 
 

Returns the next line without extracting it from the stream.

Parameters:
line (output) the next line.

string Talos::ExtStream::PeekFullLine streampos &  position  ) 
 

Returns the next line without extracting it from the stream.

Parameters:
position (output) the position of the line following the next line.
Returns:
The next line.

string Talos::ExtStream::PeekFullLine  ) 
 

Returns the next line without extracting it from the stream.

Returns:
The next line.

bool Talos::ExtStream::PeekLine string &  line  )  [virtual]
 

Returns the next valid line without extracting it from the stream.

Returns the next valid line, i.e. the next line that is not a line to be discarded and from which comments have been extracted. Nothing is extracted from the stream.

Parameters:
line (output) the next valid line.

string Talos::ExtStream::PeekLine streampos &  position  )  [virtual]
 

Returns the next valid line without extracting it from the stream.

Returns the next valid line, i.e. the next line that is not a line to be discarded and from which comments have been extracted. Nothing is extracted from the stream.

Parameters:
position (output) the position of the line following the next valid line.
Returns:
The valid line.

string Talos::ExtStream::PeekLine  )  [virtual]
 

Returns the next valid line without extracting it from the stream.

Returns the next valid line, i.e. the next line that is not a line to be discarded and from which comments have been extracted. Nothing is extracted from the stream.

Returns:
The next valid line.

template<class T>
bool Talos::ExtStream::PeekNumber T &  number  ) 
 

Gets the next valid number without extracting it from the stream.

Gets the next valid number, i.e. the next number that is not in a line to be discarded.

Parameters:
number (output) the next valid number.

double Talos::ExtStream::PeekNumber  ) 
 

Returns the next valid number without extracting it from the stream.

Returns the next valid number, i.e. the next number that is not in a line to be discarded.

Returns:
The next valid number.

bool Talos::ExtStream::PeekValue string  name,
bool &  value
 

Gets the value of a given variable without extracting from the stream.

Gets the value of a given variable, i.e. the next valid (not in a discarded line) number or element following the variable name. Nothing is extracted from the stream.

Parameters:
name the name of the variable.
value boolean associated with the variable.

bool Talos::ExtStream::PeekValue string  name,
string &  value
 

Gets the value of a given variable without extracting them from the stream.

Gets the value of a given variable, i.e. the next valid (not in a discarded line) number or element following the variable name. Nothing is extracted from the stream.

Parameters:
name the name of the variable.
value value associated with the variable.

template<class T>
bool Talos::ExtStream::PeekValue string  name,
T &  value
 

Gets the value of a given variable without extracting them from the stream.

Gets the (numerical) value of a given variable, i.e. the next valid (not in a discarded line) number or element following the variable name. Nothing is extracted from the stream.

Parameters:
name the name of the variable.
value value associated with the variable.

string Talos::ExtStream::PeekValue string  name  ) 
 

Gets the value of a given variable without extracting from the stream.

Gets the value of a given variable, i.e. the next valid (not in a discarded line) element following the variable name. Nothing is extracted from the stream.

Parameters:
name the name of the variable.
Returns:
the value associated with the variable.

string Talos::ExtStream::RemoveDelimiters const string &  str  )  const
 

Removes delimiters at both ends of a string.

Removes delimiters at the beginning and at the end of a string.

Parameters:
 

ExtStream & Talos::ExtStream::Rewind  ) 
 

Rewinds the stream.

Goes back to the beginning of the stream and clears the control state.

Returns:
A reference to the current stream.

void Talos::ExtStream::SetComments string  comments  ) 
 

Sets the characters that denote a comment line.

Parameters:
comments the characters that denote a comment line.

void Talos::ExtStream::SetDelimiters string  delimiters  ) 
 

Sets the characters considered as delimiters..

Parameters:
delimiters delimiters.

ExtStream & Talos::ExtStream::Skip  ) 
 

Skips discarded lines and delimiters.

Extracts discarded lines and delimiters.

Returns:
A reference to the current stream.

ExtStream & Talos::ExtStream::SkipDelimiters  ) 
 

Skips delimiters.

Extracts following delimiters from the string, until another character is found.

Returns:
A reference to the current stream.

ExtStream & Talos::ExtStream::SkipDiscarded  ) 
 

Skips discarded lines.

Extracts discarded lines.

Returns:
A reference to the current stream.

void Talos::ExtStream::SkipElements int  nb  ) 
 

Skips valid elements.

Parameters:
nb number of valid elements to be skipped.

void Talos::ExtStream::SkipFullLines int  nb  ) 
 

Skips full lines.

Parameters:
nb number of lines to be skipped.

void Talos::ExtStream::SkipLines int  nb  ) 
 

Skips valid lines.

Parameters:
nb number of lines to be skipped.

void Talos::ExtStream::SkipNumbers int  nb  ) 
 

Skips numbers.

Parameters:
nb number of numbers to be skipped.


The documentation for this class was generated from the following files:
Generated on Tue Nov 7 14:47:09 2006 for Talos by  doxygen 1.4.2