logo top
Main Page   Widgets   Namespaces   Book  

Miscellaneous Utility Functions

Miscellaneous Utility Functions -- a selection of portable utility functions. More...

Functions

Glib::ustring Glib::get_application_name ()
 Gets a human-readable name for the application, as set by Glib::set_application_name().
void Glib::set_application_name (const Glib::ustring& application_name)
 Sets a human-readable name for the application.
std::string Glib::get_prgname ()
 Gets the name of the program.
void Glib::set_prgname (const std::string& prgname)
 Sets the name of the program.
std::string Glib::getenv (const std::string& variable, bool& found)
 Returns the value of an environment variable.
std::string Glib::getenv (const std::string& variable)
 Returns the value of an environment variable.
bool Glib::setenv (const std::string& variable, const std::string& value, bool overwrite=true)
 Sets an environment variable.
void Glib::unsetenv (const std::string& variable)
 Removes an environment variable from the environment.
std::string Glib::get_user_name ()
 Gets the user name of the current user.
std::string Glib::get_real_name ()
 Gets the real name of the user.
std::string Glib::get_home_dir ()
 Gets the current user's home directory.
std::string Glib::get_tmp_dir ()
 Gets the directory to use for temporary files.
std::string Glib::get_current_dir ()
 Gets the current directory.
bool Glib::path_is_absolute (const std::string& filename)
 Returns true if the given filename is an absolute file name, i.e. it contains a full path from the root directory such as "/usr/local" on UNIX or "C:\\windows" on Windows systems.
std::string Glib::path_skip_root (const std::string& filename)
 Returns the remaining part of filename after the root component, i.e. after the "/" on UNIX or "C:\\" on Windows.
std::string Glib::path_get_basename (const std::string& filename)
 Gets the name of the file without any leading directory components.
std::string Glib::path_get_dirname (const std::string& filename)
 Gets the directory components of a file name.
std::string Glib::build_filename (const Glib::ArrayHandle<std::string>& elements)
 Creates a filename from a series of elements using the correct separator for filenames.
std::string Glib::build_filename (const std::string& elem1, const std::string& elem2)
 Creates a filename from two elements using the correct separator for filenames.
std::string Glib::build_path (const std::string& separator, const Glib::ArrayHandle<std::string>& elements)
 Creates a path from a series of elements using separator as the separator between elements.
std::string Glib::find_program_in_path (const std::string& program)
 Locates the first executable named program in the user's path, in the same way that execvp() would locate it.

Detailed Description

Miscellaneous Utility Functions -- a selection of portable utility functions.


Function Documentation

std::string build_filename ( const std::string&  elem1,
const std::string&  elem2
 

Creates a filename from two elements using the correct separator for filenames.

No attempt is made to force the resulting filename to be an absolute path. If the first element is a relative path, the result will be a relative path.

Parameters:
elem1 First path element.
elem2 Second path element.
Returns:
The resulting path.

std::string build_filename ( const Glib::ArrayHandle<std::string>&  elements  ) 
 

Creates a filename from a series of elements using the correct separator for filenames.

This function behaves identically to Glib::build_path(G_DIR_SEPARATOR_S, elements). No attempt is made to force the resulting filename to be an absolute path. If the first element is a relative path, the result will be a relative path.

Parameters:
elements A container holding the elements of the path to build. Any STL compatible container type is accepted.
Returns:
The resulting path.

std::string build_path ( const std::string&  separator,
const Glib::ArrayHandle<std::string>&  elements
 

Creates a path from a series of elements using separator as the separator between elements.

At the boundary between two elements, any trailing occurrences of separator in the first element, or leading occurrences of separator in the second element are removed and exactly one copy of the separator is inserted.

Empty elements are ignored.

The number of leading copies of the separator on the result is the same as the number of leading copies of the separator on the first non-empty element.

The number of trailing copies of the separator on the result is the same as the number of trailing copies of the separator on the last non-empty element. (Determination of the number of trailing copies is done without stripping leading copies, so if the separator is "ABA", "ABABA" has 1 trailing copy.)

However, if there is only a single non-empty element, and there are no characters in that element not part of the leading or trailing separators, then the result is exactly the original value of that element.

Other than for determination of the number of leading and trailing copies of the separator, elements consisting only of copies of the separator are ignored.

Parameters:
separator A string used to separate the elements of the path.
elements A container holding the elements of the path to build. Any STL compatible container type is accepted.
Returns:
The resulting path.

std::string find_program_in_path ( const std::string&  program  ) 
 

Locates the first executable named program in the user's path, in the same way that execvp() would locate it.

Returns a string with the absolute path name, or "" if the program is not found in the path. If program is already an absolute path, returns a copy of program if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherwise.

On Windows, if program does not tr> if program exists and is executable, and "" otherw