Glib::Util Namespace Reference


Classes

class  BadConversion
 Conversion exception. More...
class  Exception
 Base exception class. More...
class  Initializer
 Initialization worker, necessary if you need thread-safety. More...
class  LogStream
 The log stream class. More...
class  OptionDesc
class  ScopeLogger

Functions

void append_options_to_group (OptionDesc *a_descs, int a_number_of_options, Glib::OptionGroup &a_group)
template<typename T >
convert_to (const Glib::ustring &str, bool fail_if_leftover_chars=true)
 Converts a string to an arbitrary type that supports iostream by returning by value.
template<typename T >
void convert_to (const Glib::ustring &str, T &x, bool fail_if_leftover_chars=true)
 Converts a string to an arbitrary type that supports iostream.
LogStreamendl (LogStream &)
 log a '\n' and flushes the stream Use it like: Glib::Util::LogStream out ; out << "hello"<< Glib::Util::endl ;
LogStreamflush (LogStream &)
 flushes the stream Use it like: Glib::Util::LogStream out ; out << "Hello" << Glib::Util::flush ;
void get_current_date (Glib::ustring &date)
 Returns current time formatted in representation for the current locale.
void get_current_datetime (Glib::ustring &datetime)
 Returns current date and time formatted in representation for the current locale.
void get_current_time (Glib::ustring &time)
 Returns current date formatted in representation for the current locale.
void get_modification_date (time_t timet, Glib::ustring &date_str)
 Returns a modification date in GTK+ style.
LogStreamlevel_normal (LogStream &)
 sets the log level to normal Use it like Glib::Util::LogStream out ; out << Glib::Util::level_normal << "blabla" ;
LogStreamlevel_verbose (LogStream &)
 sets the log level to verbose Use it lik: Glib::Util::LogStream out ; out << Glib::Util::level_verbose << "bla bla bla" ;
void option_desc_to_option (OptionDesc &a_desc, Glib::OptionEntry &a_option)
std::vector< Glib::ustring > split (const Glib::ustring &str)
 Splits a string by whitespace (after skipping any leading whitespace) - like Perl's split function without the pattern.
std::vector< Glib::ustring > split (const Glib::ustring &str, const Glib::ustring &delim)
 Splits a string into tokens.
template<typename T >
Glib::ustring stringify (const T &x)
 Converts an ostream-able type to a Glib::ustring.
LogStreamtimestamp (LogStream &)
 logs a timestamp.
void trim (Glib::ustring &str)
 Trims any whitespace from the string.
void trim_left (Glib::ustring &str)
 Trims left hand side whitespace.
void trim_right (Glib::ustring &str)
 Trims right hand side whitespace.
Glib::ustring uprintf (const Glib::ustring &format,...)
 a printf() that returns a Glib::ustring

Function Documentation

void Glib::Util::append_options_to_group ( OptionDesc *  a_descs,
int  a_number_of_options,
Glib::OptionGroup &  a_group 
)

template<typename T >
T Glib::Util::convert_to ( const Glib::ustring &  str,
bool  fail_if_leftover_chars = true 
) [inline]

Converts a string to an arbitrary type that supports iostream by returning by value.

This is a convenience function which is handy for conversions to primitive types.

Parameters:
str the string to convert
fail_if_leftover_chars if set to true, the function will throw a BadConversion exception if any characters are remaining after the conversion
Returns:
the object with converted value

References convert_to().

template<typename T >
void Glib::Util::convert_to ( const Glib::ustring &  str,
T &  x,
bool  fail_if_leftover_chars = true 
) [inline]

Converts a string to an arbitrary type that supports iostream.

Inspired by the C++ FAQ.

Parameters:
str the string to convert
x the object to hold converted value
fail_if_leftover_chars if set to true, the function will throw a BadConversion exception if any characters are remaining after the conversion

Referenced by convert_to().

LogStream& Glib::Util::endl ( LogStream &   ) 

log a '\n' and flushes the stream Use it like: Glib::Util::LogStream out ; out << "hello"<< Glib::Util::endl ;

LogStream& Glib::Util::flush ( LogStream &   ) 

flushes the stream Use it like: Glib::Util::LogStream out ; out << "Hello" << Glib::Util::flush ;

void Glib::Util::get_current_date ( Glib::ustring &  date  ) 

Returns current time formatted in representation for the current locale.

Parameters:
date a string to hold the return value.

void Glib::Util::get_current_datetime ( Glib::ustring &  datetime  ) 

Returns current date and time formatted in representation for the current locale.

Parameters:
datetime a string to hold the return value.

void Glib::Util::get_current_time ( Glib::ustring &  time  ) 

Returns current date formatted in representation for the current locale.

Parameters:
time a string to hold the return value.

void Glib::Util::get_modification_date ( time_t  timet,
Glib::ustring &  date_str 
)

Returns a modification date in GTK+ style.

That will be: Today, Yesterday, X ago (if within a week) and, if older, a date formatted according to the current locale.

Parameters:
timet time information
date_str Return value:

LogStream& Glib::Util::level_normal ( LogStream &   ) 

sets the log level to normal Use it like Glib::Util::LogStream out ; out << Glib::Util::level_normal << "blabla" ;

LogStream& Glib::Util::level_verbose ( LogStream &   ) 

sets the log level to verbose Use it lik: Glib::Util::LogStream out ; out << Glib::Util::level_verbose << "bla bla bla" ;

void Glib::Util::option_desc_to_option ( OptionDesc &  a_desc,
Glib::OptionEntry &  a_option 
)

std::vector<Glib::ustring> Glib::Util::split ( const Glib::ustring &  str  ) 

Splits a string by whitespace (after skipping any leading whitespace) - like Perl's split function without the pattern.

std::vector<Glib::ustring> Glib::Util::split ( const Glib::ustring &  str,
const Glib::ustring &  delim 
)

Splits a string into tokens.

template<typename T >
Glib::ustring Glib::Util::stringify ( const T &  x  )  [inline]

Converts an ostream-able type to a Glib::ustring.

LogStream& Glib::Util::timestamp ( LogStream &   ) 

logs a timestamp.

Basically the the current date. You use it like: Glib::Util::LogStream out ; out << Glib::Util::timestamp ;

void Glib::Util::trim ( Glib::ustring &  str  ) 

Trims any whitespace from the string.

void Glib::Util::trim_left ( Glib::ustring &  str  ) 

Trims left hand side whitespace.

void Glib::Util::trim_right ( Glib::ustring &  str  ) 

Trims right hand side whitespace.

Glib::ustring Glib::Util::uprintf ( const Glib::ustring &  format,
  ... 
)

a printf() that returns a Glib::ustring


Generated on Wed Aug 26 20:47:07 2009 for gtkmm-utils by  doxygen 1.5.7.1