Talos::ConfigStreams Class Reference

Streams associated with several configuration files. More...

#include <Files.hxx>

List of all members.

Public Member Functions

 ConfigStreams ()
 Default constructor.
 ConfigStreams (const vector< string > &files)
 Main constructor.
 ConfigStreams (string file0)
 Constructor.
 ConfigStreams (string file0, string file1)
 Constructor.
 ConfigStreams (string file0, string file1, string file2)
 Constructor.
 ~ConfigStreams ()
 Destructor.
vector< ConfigStream * > & GetStreams ()
 Returns the vector of streams.
vector< ConfigStream
* >::iterator 
GetCurrent ()
 Returns the current position in the vector of streams.
void AddFile (string file)
 Adds a file to the streams.
void NoSection ()
 Deselects the section.
void SetSection (string section)
 Sets the current section.
string GetSection () const
 Returns the current section.
bool Discard (string line) const
 Checks whether a line should be discarded.
ConfigStreamsSkipDiscarded ()
 Skips discarded lines.
ConfigStreamsSkipDelimiters ()
 Skips delimiters.
string RemoveDelimiters (const string &str) const
 Removes delimiters at both ends of a string.
ConfigStreamsSkip ()
 Skips discarded lines and delimiters.
bool IsEmpty ()
 Checks whether the streams are empty.
ConfigStreamsRewind ()
 Rewinds all streams and goes back to the first 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.
string GetRawLine ()
 Returns the next valid line, without markups substitution.
string GetLine ()
 Returns the next valid line.
bool GetLine (string &line)
 Returns the next valid line.
string PeekLine ()
 Returns the next valid line without extracting it from the stream.
string PeekLine (streampos &position)
 Returns the next valid line without extracting it from the stream.
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.
string GetRawElement ()
 Returns the next valid element, without markups substitution.
string GetElement ()
 Returns the next valid element.
template<class T>
bool GetElement (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>
void GetValue (string name, T &value)
 Gets the value of a given variable.
void GetValue (string name, int &value)
 Gets the value of a given variable.
template<class T>
void PeekValue (string name, T &value)
 Gets the value of a given variable without extracting them from the stream.
template<class T>
void GetValue (string name, T min, T max, T &value)
 Gets the value of a given variable.
template<class T>
void PeekValue (string name, T min, T max, T &value)
 Gets the value of a given variable without extracting them from the stream.
template<class T>
void GetValue (string name, string constraints, T &value)
 Gets the value of a given variable.
template<class T>
void PeekValue (string name, string constraints, T &value)
 Gets the value of a given variable without extracting them from the stream.
void GetValue (string name, string &value)
 Gets the value of a given variable.
void PeekValue (string name, string &value)
 Gets the value of a given variable without extracting them from the stream.
void GetValue (string name, string accepted, string &value, string delimiter)
 Gets the value of a given variable.
void PeekValue (string name, string accepted, string &value, string delimiter)
 Gets the value of a given variable without extracting them from the stream.
void GetValue (string name, bool &value)
 Gets the value of a given variable.
void PeekValue (string name, bool &value)
 Gets the value of a given variable without extracting from the stream.

Protected Attributes

vector< ConfigStream * > streams_
vector< ConfigStream
* >::iterator 
current_
string section_
string searching_
 Field currently searched.


Detailed Description

Streams associated with several configuration files.


Constructor & Destructor Documentation

Talos::ConfigStreams::ConfigStreams (  ) 

Default constructor.

Nothing is performed.

Talos::ConfigStreams::ConfigStreams ( const vector< string > &  files  ) 

Main constructor.

Opens a set of file.

Parameters:
files files to be opened.

Talos::ConfigStreams::ConfigStreams ( string  file  ) 

Constructor.

Opens a file.

Parameters:
file file to be opened.

Talos::ConfigStreams::ConfigStreams ( string  file0,
string  file1 
)

Constructor.

Opens two files.

Parameters:
file0 first file to be opened.
file1 second file to be opened.

Talos::ConfigStreams::ConfigStreams ( string  file0,
string  file1,
string  file2 
)

Constructor.

Opens three files.

Parameters:
file0 first file to be opened.
file1 second file to be opened.
file2 third file to be opened.


Member Function Documentation

vector< ConfigStream * > & Talos::ConfigStreams::GetStreams (  ) 

Returns the vector of streams.

Returns:
A reference to the vector of ConfigStream.

vector< ConfigStream * >::iterator Talos::ConfigStreams::GetCurrent (  ) 

Returns the current position in the vector of streams.

Returns:
An iterator that points to the current element of the vector of streams.

void Talos::ConfigStreams::AddFile ( string  file  ) 

Adds a file to the streams.

Parameters:
file file to be added.

void Talos::ConfigStreams::NoSection (  ) 

Deselects the section.

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

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

Sets the current section.

Parameters:
section current section.

string Talos::ConfigStreams::GetSection (  )  const

Returns the current section.

Returns:
The current section.

bool Talos::ConfigStreams::Discard ( string  line  )  const

Checks whether a line should be discarded.

Parameters:
line line to be checked.

ConfigStreams & Talos::ConfigStreams::SkipDiscarded (  ) 

Skips discarded lines.

Extracts discarded lines.

Returns:
A reference to 'this'.

ConfigStreams & Talos::ConfigStreams::SkipDelimiters (  ) 

Skips delimiters.

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

Returns:
A reference to this.

string Talos::ConfigStreams::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:
str string to processed.
Returns:
The string with delimiters removed.

ConfigStreams & Talos::ConfigStreams::Skip (  ) 

Skips discarded lines and delimiters.

Extracts discarded lines and delimiters.

Returns:
A reference to this.

bool Talos::ConfigStreams::IsEmpty (  ) 

Checks whether the streams are empty.

Checcks whether the streams have still valid elements to be read.

Returns:
'true' is the streams are empty, 'false' otherwise.

ConfigStreams & Talos::ConfigStreams::Rewind (  ) 

Rewinds all streams and goes back to the first stream.

Goes back to the beginning of each stream, clears the control state and goes back to the first stream.

Returns:
A reference to 'this'.

string Talos::ConfigStreams::GetFullLine (  ) 

Returns the next line.

Returns:
The next line.

bool Talos::ConfigStreams::GetFullLine ( string &  line  ) 

Returns the next line.

Parameters:
line (output) the next line.

string Talos::ConfigStreams::PeekFullLine (  ) 

Returns the next line without extracting it from the stream.

Returns:
The next line.

string Talos::ConfigStreams::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.

bool Talos::ConfigStreams::PeekFullLine ( string &  line  ) 

Returns the next line without extracting it from the stream.

Parameters:
line (output) the next line.

void Talos::ConfigStreams::SkipFullLines ( int  nb  ) 

Skips full lines.

Parameters:
nb number of lines to be skipped.

string Talos::ConfigStreams::GetRawLine (  ) 

Returns the next valid line, without markups substitution.

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. No markup substitution is performed.

Returns:
The next valid line.

string Talos::ConfigStreams::GetLine (  ) 

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.

bool Talos::ConfigStreams::GetLine ( string &  line  ) 

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.

string Talos::ConfigStreams::PeekLine (  ) 

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.

string Talos::ConfigStreams::PeekLine ( streampos &  position  ) 

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.

bool Talos::ConfigStreams::PeekLine ( string &  line  ) 

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.

void Talos::ConfigStreams::SkipLines ( int  nb  ) 

Skips valid lines.

Parameters:
nb number of lines to be skipped.

bool Talos::ConfigStreams::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.

bool Talos::ConfigStreams::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.

string Talos::ConfigStreams::GetRawElement (  ) 

Returns the next valid element, without markups substitution.

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

Returns:
The next valid element.

string Talos::ConfigStreams::GetElement (  ) 

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.

template<class T>
bool Talos::ConfigStreams::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::ConfigStreams::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.

template<class T>
bool Talos::ConfigStreams::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.

void Talos::ConfigStreams::SkipElements ( int  nb  ) 

Skips valid elements.

Parameters:
nb number of valid elements to be skipped.

double Talos::ConfigStreams::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::ConfigStreams::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::ConfigStreams::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.

template<class T>
bool Talos::ConfigStreams::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.

void Talos::ConfigStreams::SkipNumbers ( int  nb  ) 

Skips numbers.

Parameters:
nb number of numbers to be skipped.

string Talos::ConfigStreams::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.

string Talos::ConfigStreams::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.

template<class T>
void Talos::ConfigStreams::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.

void Talos::ConfigStreams::GetValue ( string  name,
int &  value 
)

Gets the value of a given variable.

Gets the integral 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>
void Talos::ConfigStreams::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.

template<class T>
void Talos::ConfigStreams::GetValue ( string  name,
min,
max,
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.
min the minimum value that the variable should take.
max the maximum value that the variable should take.
value value associated with the variable.

template<class T>
void Talos::ConfigStreams::PeekValue ( string  name,
min,
max,
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.
min the minimum value that the variable should take.
max the maximum value that the variable should take.
value value associated with the variable.

template<class T>
void Talos::ConfigStreams::GetValue ( string  name,
string  constraint,
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. This methods also checks that the value meets given constraints.

Parameters:
name the name of the variable.
constraint the list of constraints. The constraints are delimited by |. The supported constraints are: positive, strictly positive, negative, strictly negative, non zero, integer, > x, >= x, < x, <= x, != x y z, = x y z.
value value associated with the variable.

template<class T>
void Talos::ConfigStreams::PeekValue ( string  name,
string  constraint,
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. This methods also checks that the value meets given constraints. Nothing is extracted from the stream.

Parameters:
name the name of the variable.
constraint the list of constraints. The constraints are delimited by |. The supported constraints are: positive, strictly positive, negative, strictly negative, non zero, integer, > x, >= x, < x, <= x, != x y z, = x y z.
value value associated with the variable.

void Talos::ConfigStreams::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.

void Talos::ConfigStreams::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.

void Talos::ConfigStreams::GetValue ( string  name,
string  accepted,
string &  value,
string  delimiter = "|" 
)

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. In addition, this method checks that the value is in an acceptable list of values.

Parameters:
name the name of the variable.
accepted list of accepted values.
value value associated with the variable.
delimiter delimiter in accepted. Default: |.

void Talos::ConfigStreams::PeekValue ( string  name,
string  accepted,
string &  value,
string  delimiter = "|" 
)

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. In addition, this method checks that the value is in an acceptable list of values. Nothing is extracted from the stream.

Parameters:
name the name of the variable.
accepted list of accepted values.
value value associated with the variable.
delimiter delimiter in accepted. Default: |.

void Talos::ConfigStreams::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.

void Talos::ConfigStreams::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.


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