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

Talos namespace. More...


Classes

class  Talos::Date
 Class Date. More...
class  Talos::ExtStream
 Extended streams. More...
class  Talos::ConfigStream
 Streams associated with configuration files. More...
class  Talos::ConfigStreams
 Streams associated with several configuration files. More...

Functions

bool exists (string file_name)
 Tests whether a file exists.
unsigned long file_size (string file_name)
 Returns a file size.
unsigned long stream_size (istream &stream)
 Returns a stream size.
bool is_empty (istream &stream)
 Checks whether a stream is empty.
bool has_element (istream &stream)
 Checks whether a stream contains an element.
template<typename T> string to_str (const T &input)
 Converts most types to string.
template<typename T> string to_str_fill (const T &input, char f, int l, ostringstream::fmtflags flags=ostringstream::right)
 Converts most types to a filled string.
template<class T> void to_num (const string &s, T &num)
 Converts string to most types, specially numbers.
template<class T> T to_num (const string &s)
 Converts string to most types, specially numbers.
template<class T> void convert (const string &s, T &out)
 Converts strings to most types.
void convert (const string &s, string &out)
 Sets a string.
void convert (const string &s, bool &out)
 Converts a string to a boolean.
template<class T> T convert (const string &s)
 Converts strings to most types.
string lower_case (string str)
 Converts a string to lower-case string.
string upper_case (string str)
 Converts a string to upper-case string.
bool is_num (const string &str)
 Checks whether a string is a number.
bool is_integer (const string &str)
 Checks whether a string is an integer.
bool is_unsigned_integer (const string &str)
 Checks whether a string is an unsigned integer.
string find_replace (string str, string old_str, string new_str)
 Finds and replace a substring.
string trim (string str, string delimiters)
 Trims off a string.
string trim_beg (string str, string delimiters)
 Trims off a string.
string trim_end (string str, string delimiters)
 Trims off a string.
template<class T> void split (string str, vector< T > &vect, string delimiters)
 Splits a string.
vector< string > split (string str, string delimiters)
 Splits a string.
template<class T> void split_markup (string str, vector< T > &elements, vector< bool > &is_markup, string delimiters)
 Extracts markups from a string.
template<class T> void print (const vector< T > &v)
 Displays a vector.
template<typename T> std::string to_str_fill (const T &input, int l=2)
string fill (const string &input, int l=2, char c= ' ', ios_base &pos(ios_base &)=left)


Detailed Description

Talos namespace.

Function Documentation

template<class T>
T Talos::convert const string &  s  ) 
 

Converts strings to most types.

Parameters:
input string to be converted.
Returns:
'input' converted to 'T'.

void convert const string &  s,
bool &  out
 

Converts a string to a boolean.

Parameters:
s input string.
out output boolean.

void Talos::convert const string &  s,
string &  num
 

Sets a string.

Parameters:
s input string.
out output string, equal to 's' on exit.

template<class T>
void Talos::convert const string &  s,
T &  num
 

Converts strings to most types.

Parameters:
input string to be converted.
num 'input' converted to 'T'.

bool Talos::exists string  file_name  ) 
 

Tests whether a file exists.

Parameters:
file_name file name.
Returns:
true if the file exists, false otherwise.
Note:
This function returns false if the user has not the rights to read the file, even if the file exists.

unsigned long Talos::file_size string  file_name  ) 
 

Returns a file size.

Parameters:
file_name file name.
Returns:
the file size in bytes.

string Talos::find_replace string  str,
string  old_str,
string  new_str = ""
 

Finds and replace a substring.

Parameters:
str base string.
old_str substring to be replaced.
new_str substring to be put in place of 'old_str'.
Returns:
'str' where 'old_str' was replaced by 'new'str'.

bool Talos::has_element istream &  stream  ) 
 

Checks whether a stream contains an element.

Checks whether a stream contains an element that may be extracted through 'operator <<'.

Parameters:
stream the stream.
Returns:
true if the stream has an element, false otherwise.

bool Talos::is_empty istream &  stream  ) 
 

Checks whether a stream is empty.

Parameters:
stream the stream.
Returns:
true if the stream is empty, false otherwise.

bool Talos::is_integer const string &  s  ) 
 

Checks whether a string is an integer.

Parameters:
str string to be checked.
Returns:
true if 'str' is an integer, false otherwise.

bool Talos::is_num const string &  s  ) 
 

Checks whether a string is a number.

Parameters:
str string to be checked.
Returns:
true if 'str' is a number, false otherwise.

bool Talos::is_unsigned_integer const string &  s  ) 
 

Checks whether a string is an unsigned integer.

Parameters:
str string to be checked.
Returns:
true if 'str' is an unsigned integer, false otherwise.

string Talos::lower_case string  str  ) 
 

Converts a string to lower-case string.

Parameters:
str string to be converted.
Returns:
'str' in lower case.

template<class T>
void Talos::print const vector< T > &  v  ) 
 

Displays a vector.

Parameters:
v the vector to de displayed.

vector< string > Talos::split string  str,
string  delimiters = " \n\t"
 

Splits a string.

The string is split according to delimiters.

Parameters:
str string to be split.
delimiters (optional) delimiters. Default: " \n\t".
Returns:
A vector containing elements of the string.

template<class T>
void Talos::split string  str,
vector< T > &  vect,
string  delimiters = " \n\t"
 

Splits a string.

The string is split according to delimiters and elements are stored in the vector 'vect'.

Parameters:
str string to be split.
vect (output) vector containing elements of the string.
delimiters (optional) delimiters. Default: " \n\t".

template<class T>
void Talos::split_markup string  str,
vector< T > &  elements,
vector< bool > &  is_markup,
string  delimiters = "$"
 

Extracts markups from a string.

The string is split into markups and elements.

Parameters:
str string to be split.
elements (output) vector containing markups (without their tags) and elements of the string.
is_markup (output) booleans set to true for each markup found in 'elements'.
delimiters (optional) markup tags. Default: "$".
Note:
A markup is a field delimited by two tags.

unsigned long Talos::stream_size istream &  stream  ) 
 

Returns a stream size.

Parameters:
stream the stream.
Returns:
the stream size in bytes.

template<class T>
T Talos::to_num const string &  s  ) 
 

Converts string to most types, specially numbers.

Parameters:
input string to be converted.
Returns:
'input' converted to 'T'.

template<class T>
void Talos::to_num const string &  s,
T &  num
 

Converts string to most types, specially numbers.

Parameters:
input string to be converted.
num 'input' converted to 'T'.

template<typename T>
string Talos::to_str const T &  input  ) 
 

Converts most types to string.

Parameters:
input variable to be converted.
Returns:
A string containing 'input'.

template<typename T>
string to_str_fill const T &  input,
char  f,
int  l,
ostringstream::fmtflags  flags = ostringstream::right
 

Converts most types to a filled string.

Parameters:
input variable to be converted.
f char with which the string will be filled.
l width of the output string.
flags (optional) format flags. Default: ostringstream::right.
Returns:
A string containing 'input' (filled).

string Talos::trim string  str,
string  delimiters = " \n\t"
 

Trims off a string.

Removes delimiters at each edge of the string.

Parameters:
str string to be trimmed off.
delimiters characters to be removed.
Returns:
'str' trimmed off.

string Talos::trim_beg string  str,
string  delimiters = " \n\t"
 

Trims off a string.

Removes delimiters at the beginning of the string.

Parameters:
str string to be trimmed off.
delimiters characters to be removed.
Returns:
'str' trimmed off at the beginning.

string Talos::trim_end string  str,
string  delimiters = " \n\t"
 

Trims off a string.

Removes delimiters at the end of the string.

Parameters:
str string to be trimmed off.
delimiters characters to be removed.
Returns:
'str' trimmed off at the end.

string Talos::upper_case string  str  ) 
 

Converts a string to upper-case string.

Parameters:
str string to be converted.
Returns:
'str' in upper case.


Generated on Sun Oct 3 19:22:03 2004 for Talos by doxygen 1.3.8