#include <Files.hxx>
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. | |
ConfigStreams & | SkipDiscarded () |
Skips discarded lines. | |
ConfigStreams & | SkipDelimiters () |
Skips delimiters. | |
string | RemoveDelimiters (const string &str) const |
Removes delimiters at both ends of a string. | |
ConfigStreams & | Skip () |
Skips discarded lines and delimiters. | |
bool | IsEmpty () |
Checks whether the streams are empty. | |
ConfigStreams & | Rewind () |
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. |
Talos::ConfigStreams::ConfigStreams | ( | ) |
Default constructor.
Nothing is performed.
Talos::ConfigStreams::ConfigStreams | ( | const vector< string > & | files | ) |
Main constructor.
Opens a set of file.
files | files to be opened. |
Talos::ConfigStreams::ConfigStreams | ( | string | file | ) |
Constructor.
Opens a file.
file | file to be opened. |
Talos::ConfigStreams::ConfigStreams | ( | string | file0, | |
string | file1 | |||
) |
Constructor.
Opens two files.
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.
file0 | first file to be opened. | |
file1 | second file to be opened. | |
file2 | third file to be opened. |
vector< ConfigStream * > & Talos::ConfigStreams::GetStreams | ( | ) |
vector< ConfigStream * >::iterator Talos::ConfigStreams::GetCurrent | ( | ) |
Returns the current position in the vector of streams.
void Talos::ConfigStreams::AddFile | ( | string | file | ) |
Adds a file to the streams.
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.
section | current section. |
string Talos::ConfigStreams::GetSection | ( | ) | const |
Returns the current section.
bool Talos::ConfigStreams::Discard | ( | string | line | ) | const |
Checks whether a line should be discarded.
line | line to be checked. |
ConfigStreams & Talos::ConfigStreams::SkipDiscarded | ( | ) |
Skips discarded lines.
Extracts discarded lines.
ConfigStreams & Talos::ConfigStreams::SkipDelimiters | ( | ) |
Skips delimiters.
Extracts following delimiters from the string, until another character is found.
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.
str | string to processed. |
ConfigStreams & Talos::ConfigStreams::Skip | ( | ) |
Skips discarded lines and delimiters.
Extracts discarded lines and delimiters.
bool Talos::ConfigStreams::IsEmpty | ( | ) |
Checks whether the streams are empty.
Checcks whether the streams have still valid elements to be read.
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.
string Talos::ConfigStreams::GetFullLine | ( | ) |
Returns the next line.
bool Talos::ConfigStreams::GetFullLine | ( | string & | line | ) |
Returns the next line.
line | (output) the next line. |
string Talos::ConfigStreams::PeekFullLine | ( | ) |
Returns the next line without extracting it from the stream.
string Talos::ConfigStreams::PeekFullLine | ( | streampos & | position | ) |
Returns the next line without extracting it from the stream.
position | (output) the position of the line following the next line. |
bool Talos::ConfigStreams::PeekFullLine | ( | string & | line | ) |
Returns the next line without extracting it from the stream.
line | (output) the next line. |
void Talos::ConfigStreams::SkipFullLines | ( | int | nb | ) |
Skips full lines.
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.
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.
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.
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.
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.
position | (output) the position of the line following the next 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.
line | (output) the next valid line. |
void Talos::ConfigStreams::SkipLines | ( | int | nb | ) |
Skips valid lines.
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.
element | the element to be found. |
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.
element | the element to be found from the beginning of the stream. |
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.
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.
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.
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.
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.
element | (output) the next valid element. |
void Talos::ConfigStreams::SkipElements | ( | int | nb | ) |
Skips valid elements.
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.
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.
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.
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.
number | (output) the next valid number. |
void Talos::ConfigStreams::SkipNumbers | ( | int | nb | ) |
Skips numbers.
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.
name | the name 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.
name | the name of the variable. |
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.
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.
name | the name of the variable. | |
value | value associated with the variable. |
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.
name | the name of the variable. | |
value | value associated with the variable. |
void Talos::ConfigStreams::GetValue | ( | string | name, | |
T | min, | |||
T | 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.
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. |
void Talos::ConfigStreams::PeekValue | ( | string | name, | |
T | min, | |||
T | 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.
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. |
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.
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::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.
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.
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.
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.
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.
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.
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.
name | the name of the variable. | |
value | boolean associated with the variable. |