Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

utils.h File Reference

#include <libgnomevfsmm/types.h>
#include <glibmm/ustring.h>

Go to the source code of this file.

Namespaces

namespace  Gnome
namespace  Gnome::Vfs

Functions

Glib::ustring format_file_size_for_display (FileSize size)
 Formats the file size passed in sizein a way that is easy for the user to read.
Glib::ustring escape_string (const Glib::ustring &unescaped_string)
 Escapes , replacing any and all special characters with equivalent escape sequences.
Glib::ustring escape_path_string (const Glib::ustring &path)
 Escapes , replacing only special characters that would not be found in paths (so '/', '&', '=', and '?' will not be escaped by this function).
Glib::ustring escape_host_and_path_string (const Glib::ustring &path)
 Escapes path, replacing only special characters that would not be found in paths or host name (so '/', '&', '=', ':', '@' and '?' will not be escaped by this function).
Glib::ustring escape_slashes (const Glib::ustring &unescaped_string)
 Escapes only '/' and '%' characters in , replacing them with their escape sequence equivalents.
Glib::ustring unescape_string (const Glib::ustring &escaped_string, const Glib::ustring &illegal_characters=Glib::ustring())
 Decodes escaped characters (i.e.
Glib::ustring unescape_string_for_display (const Glib::ustring &escaped_string)
 Similar to unescape_string(), but it returns something semi-intelligable to a user even upon receiving traumatic input such as 00 or URIs in bad form.
Glib::ustring make_uri_canonical (const Glib::ustring &uri)
 gnome_vfs_make_path_name_canonical: : a file path, relative or absolute
Glib::ustring make_path_name_canonical (const Glib::ustring &path)
Glib::ustring expand_initial_tilde (const Glib::ustring &path)
 If path starts with a ~, representing the user's home directory, expand it to the actual path location.
Glib::ustring get_local_path_from_uri (const Glib::ustring &uri)
 Create a local path for a file:/// URI.
Glib::ustring get_uri_from_local_path (const Glib::ustring &local_full_path)
 Returns a file:/// URI for the local path .
bool is_executable_command_string (const Glib::ustring &command_string)
 Checks if command_string starts with the full path of an executable file or an executable in $PATH.
Glib::ustring icon_path_from_filename (const Glib::ustring &filename)


Function Documentation

Glib::ustring escape_host_and_path_string const Glib::ustring &  path  ) 
 

Escapes path, replacing only special characters that would not be found in paths or host name (so '/', '&', '=', ':', '@' and '?' will not be escaped by this function).

Parameters:
path String to be escaped Return value A string equivalent to path but with non-path/host characters escaped

Glib::ustring escape_path_string const Glib::ustring &  path  ) 
 

Escapes , replacing only special characters that would not be found in paths (so '/', '&', '=', and '?' will not be escaped by this function).

Parameters:
path String to be escaped
Returns:
A string equivalent to path but with non-path characters escaped

Glib::ustring escape_slashes const Glib::ustring &  unescaped_string  ) 
 

Escapes only '/' and '%' characters in , replacing them with their escape sequence equivalents.

Parameters:
unescaped_string String to be escaped
Returns:
A string equivalent to unescaped_string, but with no unescaped '/' or '%' characters

Glib::ustring escape_string const Glib::ustring &  unescaped_string  ) 
 

Escapes , replacing any and all special characters with equivalent escape sequences.

Parameters:
unscaped_string String to be escaped
Returns:
A string equivalent to unescaped_string but with all special characters escaped

Glib::ustring expand_initial_tilde const Glib::ustring &  path  ) 
 

If path starts with a ~, representing the user's home directory, expand it to the actual path location.

Parameters:
path a local file path which may start with a '~'
Returns:
a newly allocated string with the initial tilde (if there was one) converted to an actual path

Glib::ustring format_file_size_for_display FileSize  size  ) 
 

Formats the file size passed in sizein a way that is easy for the user to read.

Gives the size in bytes, kilobytes, megabytes or gigabytes, choosing whatever is appropriate.

Parameters:
size 
Returns:
a newly allocated string with the size ready to be shown.

Glib::ustring get_local_path_from_uri const Glib::ustring &  uri  ) 
 

Create a local path for a file:/// URI.

Do not use with URIs of other methods.

Parameters:
uri URI to convert to a local path
Returns:
a string containing the local path, or an empty string if the uri isn't a file: URI without a fragment identifier (or chained URI).

Glib::ustring get_uri_from_local_path const Glib::ustring &  local_full_path  ) 
 

Returns a file:/// URI for the local path .

Parameters:
local_full_path A full local filesystem path (i.e. not relative)
Returns:
A string containing the URI corresponding to local_full_path.

Glib::ustring icon_path_from_filename const Glib::ustring &  filename  ) 
 

bool is_executable_command_string const Glib::ustring &  command_string  ) 
 

Checks if command_string starts with the full path of an executable file or an executable in $PATH.

Parameters:
command_string: 
Returns:
true if command_string started with an executable file, false otherwise.

Glib::ustring make_path_name_canonical const Glib::ustring &  path  ) 
 

Glib::ustring make_uri_canonical const Glib::ustring &  uri  ) 
 

gnome_vfs_make_path_name_canonical: : a file path, relative or absolute

Calls _gnome_vfs_canonicalize_pathname, allocating storage for the result and providing for a cleaner memory management.

Returns:
a canonical version of

Glib::ustring unescape_string const Glib::ustring &  escaped_string,
const Glib::ustring &  illegal_characters = Glib::ustring()
 

Decodes escaped characters (i.e.

PERCENTxx sequences) in escaped_string. Characters are encoded in PERCENTxy form, where xy is the ASCII hex code for character 16x+y.

Parameters:
escaped_string An escaped URI, path, or other string
illegal_characters A string containing a sequence of characters considered "illegal", '' is automatically in this list.
Returns:
A newly allocated string with the unescaped equivalents, or an empty string if escaped_string contained one of the characters in illegal_characters.

Glib::ustring unescape_string_for_display const Glib::ustring &  escaped_string  ) 
 

Similar to unescape_string(), but it returns something semi-intelligable to a user even upon receiving traumatic input such as 00 or URIs in bad form.

WARNING: You should never use this function on a whole URI! It unescapes reserved characters, and can result in a mangled URI that can not be re-entered. For example, it unescapes "#" "&" and "?", which have special meanings in URI strings.

See also:
unescape_string().
Parameters:
escaped_string The string encoded with escaped sequences.
Returns:
A string with all characters replacing their escaped hex values


Generated on Wed Aug 17 17:31:33 2005 for libgnomevfsmm by  doxygen 1.3.9.1