Talos::ConfigStream Class Reference

Streams associated with configuration files. More...

#include <Files.hxx>

Inheritance diagram for Talos::ConfigStream:

Talos::ExtStream List of all members.

Public Member Functions

 ConfigStream ()
 Default constructor.
 ConfigStream (string file_name, string comments="#%", string delimiters=" \t:=|\n,;\r\x0D\x0A", string markup_tags="<>$")
 Main constructor.
void NoSection ()
 Deselects the section.
void SetSection (string section)
 Sets the current section.
string GetSection () const
 Returns the current section.
void SetMarkupTags (string markup_tags)
 Sets the markup tags.
string GetMarkupTags () const
 Returns the markup tags.
bool IsEmpty ()
 Checks whether the stream or the current section is empty.
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.
virtual string GetLine ()
 Returns the next valid line.
virtual bool GetLine (string &line)
 Returns the next valid line.

Protected Attributes

string markup_tags_
string section_

Friends

class ConfigStreams

Detailed Description

Streams associated with configuration files.


Constructor & Destructor Documentation

Talos::ConfigStream::ConfigStream (  ) 

Default constructor.

Nothing is performed.

Talos::ConfigStream::ConfigStream ( string  file_name,
string  comments = "#%",
string  delimiters = " \t:=|\n,;\r\x0D\x0A",
string  markup_tags = "<>$" 
)

Main constructor.

Opens a file.

Parameters:
file_name file to be opened.


Member Function Documentation

void Talos::ConfigStream::NoSection (  ) 

Deselects the section.

Deselects the section (this is equivalent to SetSection("")).

void Talos::ConfigStream::SetSection ( string  section  ) 

Sets the current section.

Parameters:
section current section.

string Talos::ConfigStream::GetSection (  )  const

Returns the current section.

Returns:
The current section.

void Talos::ConfigStream::SetMarkupTags ( string  markup_tags  ) 

Sets the markup tags.

Parameters:
markup_tags the new markup tags.

string Talos::ConfigStream::GetMarkupTags (  )  const

Returns the markup tags.

Returns:
The markup tags.

bool Talos::ConfigStream::IsEmpty (  ) 

Checks whether the stream or the current section is empty.

If no section has been selected, this method checks whether the stream has still valid elements to be read. If the stream is bound to a given section, this method checks whether there remains at least one element in the section.

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

Reimplemented from Talos::ExtStream.

bool Talos::ConfigStream::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.
Note:
The scope of the search is only the current section if any.

Reimplemented from Talos::ExtStream.

bool Talos::ConfigStream::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.
Note:
The current section (if any) is unset.

Reimplemented from Talos::ExtStream.

string Talos::ConfigStream::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.
Note:
Markups are replaced with their values.

Reimplemented from Talos::ExtStream.

string Talos::ConfigStream::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 from Talos::ExtStream.

bool Talos::ConfigStream::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 from Talos::ExtStream.


The documentation for this class was generated from the following files:
Generated on Mon Nov 17 18:20:41 2008 for Talos by  doxygen 1.5.1