Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::G Namespace Reference

The C++ framework for the GObject and GLib libraries. More...

## Classes

- class Xfc::G::AsyncQueue
    A GAsyncQueue C++ wrapper interface. More...
- class Xfc::G::Boxed
    A generic base class for GTK+ boxed objects. More...
- class Xfc::G::Completion
    A GCompletion C++ wrapper interface. More...
- class Xfc::G::Date
    A GDate C++ wrapper interface. More...
- class Xfc::G::Error
    A C++ GLib error reporting class. More...
- class Xfc::G::TempFile
    A C++ wrapper interface for the g_file_open_tmp() and g_mkstemp() functions. More...
- class Xfc::G::Dir
    A GDir C++ wrapper interface. More...
- class Xfc::G::IOChannel
    A GIOChannel C++ wrapper class. More...
- class Xfc::G::KeyFile
    A C++ wrapper interface for the GKeyFile configuration file parser. More...
- class Xfc::G::PollFD
    A C++ wrapper for the GPollFD. More...
- class Xfc::G::MainContext
    A C++ interface for the GMainContext. More...
- class Xfc::G::MainLoop
    A C++ interface for the GMainLoop. More...
- class Xfc::G::Source
    A GSource C++ interface. More...
- class Xfc::G::ChildWatchSource
    A child watch GSource C++ interface. More...
- class Xfc::G::TimeoutSource
    A timeout GSource C++ interface. More...
- class Xfc::G::IdleSource
    A idle GSource C++ interface. More...
- class Xfc::G::IOSource
    A input/output GSource C++ interface. More...
- class Xfc::G::ChildWatchSignal
    A child watch signal class. More...
- class Xfc::G::TimeoutSignal
    A Timeout signal class. More...
- class Xfc::G::IdleSignal
    Idle signal class. More...
- class Xfc::G::IOSignal
    IO signal class. More...
- class Xfc::G::MarkupParser
    A GMarkupParser C++ wrapper interface. More...
- class Xfc::G::MarkupParseContext
    A GMarkupParseContext C++ wrapper interface. More...
- class Xfc::G::Module
    A GModule C++ wrapper interface. More...
- class Xfc::G::Mutex
    A GMutex C++ wrapper interface. More...
- struct Xfc::G::StaticMutex
    A GStaticMutex C++ wrapper interface. More...
- struct Xfc::G::StaticRecMutex
    A compile-time GStaticRecMutex C++ wrapper interface. More...
- class Xfc::G::RecMutex
    A run-time GStaticRecMutex C++ wrapper interface. More...
- struct Xfc::G::StaticRWLock
    A compile-time GStaticRWlock C++ wrapper interface. More...
- class Xfc::G::RWLock
    A run-time GStaticRWlock C++ wrapper interface. More...
- class Xfc::G::Object
    Base class for wrapped GTK+ objects and widgets. More...
- class Xfc::G::ObjectSignals
    Abstract base class that implements the virtual signal handlers for G::Object. More...
- class Xfc::G::OptionContext
    A C++ wrapper interface for GOptionContext. More...
- class Xfc::G::OptionGroup
    A C++ wrapper interface for the GOptionGroup. More...
- class Xfc::G::PatternSpec
    A GPatternSpec C++ wrapper interface. More...
- class Xfc::G::Quark
    A GQuark C++ wrapper interface. More...
- class Xfc::G::Rand
    A GRand C++ wrapper interface. More...
- class Xfc::G::Scanner
    A general purpose lexical scanner. More...
- class Xfc::G::SignalBase
    Base class for the GTK+ C++ signal interface. More...
- class Xfc::G::SignalProxy< ObjectType, SignalType >
    A proxy object for manipulating a protected signal (connection, mostly). More...
- class Xfc::G::Signal0< R >
    A template for a signal passing no arguments and returning a value of type R. More...
- class Xfc::G::Signal1< R, P1 >
    A template for a signal passing one argument of type P1 and returning a value of type R. More...
- class Xfc::G::Signal2< R, P1, P2 >
    A template for a signal passing two arguments of type P1 and P2, and returning a value of type R. More...
- class Xfc::G::Signal3< R, P1, P2, P3 >
    A template for a signal passing three arguments of type P1, P2 and P3, and returning a value of type R. More...
- class Xfc::G::Signal4< R, P1, P2, P3, P4 >
    A template for a signal passing four arguments of type P1, P2, P3 and P4, and returning a value of type R. More...
- class Xfc::G::Signal5< R, P1, P2, P3, P4, P5 >
    A template for a signal passing five arguments of type P1, P2, P3, P4 and P5, and returning a value of type R. More...
- class Xfc::G::Signal6< R, P1, P2, P3, P4, P5, P6 >
    A template for a signal passing six arguments of type P1, P2, P3, P4, P5 and P6, and returning a value of type R. More...
- class Xfc::G::Signal7< R, P1, P2, P3, P4, P5, P6, P7 >
    A template for a signal passing seven arguments of type P1, P2, P3, P4, P5, P6 and P7, and returning a value of type R. More...
- class Xfc::G::Signal< R, P1, P2, P3, P4, P5, P6, P7 >
    A convenience template wrapper for the numbered Signal#<> templates. More...
- struct Xfc::G::SpawnAsyncData
    Internal data structure used by G::SpawnAsync and Gdk::Spawn. More...
- class Xfc::G::Spawn
    A C++ interface for the GLib spawn functions. More...
- class Xfc::G::SpawnAsync
    A C++ interface for the GLib asynchronous spawn functions. More...
- class Xfc::G::SpawnSync
    A C++ interface for the GLib synchronous spawn functions. More...
- class Xfc::G::Thread
    A GThread C++ wrapper interface. More...
- class Xfc::G::Condition
    A GCond C++ wrapper interface. More...
- struct Xfc::G::StaticPrivate< T >
    A compile-time GStaticPrivate C++ wrapper interface. More...
- class Xfc::G::Private< T >
    A run-time GStaticPrivate C++ wrapper interface. More...
- class Xfc::G::ThreadPool
    A GThreadPool C++ wrapper interface. More...
- class Xfc::G::Timer
    A GTimer C++ wrapper interface. More...
- class Xfc::G::TimeVal
    A GTimeVal C++ wrapper interface. More...
- class Xfc::G::TypeInstance
    Abstract base class for GTK+ interfaces and objects. More...
- class Xfc::G::TypeInterface
    Abstract base class for GTK+ interfaces. More...
- class Xfc::G::Unichar
    A C++ gunichar wrapper class. More...
- class Xfc::G::Value
    A GValue wrapper class. More...

## File Methods

- FileError file_error_from_errno (int err_no)
    Gets a FileError constant based on the passed-in errno, for example, if you pass in EEXIST this function returns G_FILE_ERROR_EXIST.
- bool file_test (const std::string &filename, FileTestField test)
    Determines whether any of the tests in the bitfield test are true.
- bool file_get_contents (const std::string &filename, std::string &contents, G::Error *error)
    Reads an entire file into allocated memory, with good error checking.

## Time Methods

- void get_current_time (TimeVal &timeval)
    Equivalent to the UNIX gettimeofday() function, but portable.

## Random Number Methods

- void random_set_seed (unsigned int seed)
    Sets the seed for the global random number generator, which is used by the G::random_* methods, to seed.
- bool random_boolean ()
    Gets a random boolean value (this corresponds to a unbiased coin toss).
- unsigned int random_int ()
    Gets a random unsigned integer equally distributed over the range [0..2^32-1].
- int random_int_range (int begin, int end)
    Gets a random integer equally distributed over the range [begin..end-1].
- double random_double ()
    Gets a random double equally distributed over the range [0..1).
- double random_double_range (double begin, double end)
    Gets a random double equally distributed over the range [begin..end).

## Shell Methods

- String shell_quote (const String &unquoted_string)
    Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string.
- String shell_unquote (const String &quoted_string, G::Error *error=0)
    Unquotes a string as the shell (/bin/sh) would.
- bool shell_parse_argv (const String &command_line, std::vector< String > &args, G::Error *error=0)
    Parses a command line into an argument vector, in much the same way the shell would, but without many of the expansions the shell would perform (variable expansion, globs, operators, filename expansion, and the like are not supported).

## Time Methods

- TimeVal get_current_time ()
    Equivalent to the UNIX gettimeofday() function, but portable.
- void usleep (unsigned long microseconds)
    Pauses execution of the current thread for the given number of microseconds.

## TimeVal addition operators

- const TimeVal operator+ (const TimeVal &lhs, long microseconds)
    Add a specified number of microseconds to the TimeVal object lhs.
- const TimeVal operator+ (const TimeVal &lhs, const TimeVal &rhs)
    Add two TimeVal objects together.

## TimeVal subtraction operators

- const TimeVal operator- (const TimeVal &lhs, long microseconds)
    Subtract a specified number of microseconds from the TimeVal object lhs.
- const TimeVal operator- (const TimeVal &lhs, const TimeVal &rhs)
    Subtract the TimeVal object rhs from lhs.

## Miscellaneous Utility Methods

- std::string get_user_name ()
    Gets the user name of the current user.
- std::string get_real_name ()
    Gets the real name of the user.
- std::string get_home_dir ()
    Gets the current user's home directory.
- std::string get_tmp_dir ()
    Gets the directory to use for temporary files.
- std::string get_prgname ()
    Gets the name of the program.
- void set_prgname (const std::string &prgname)
    Sets the name of the program.
- String get_application_name ()
    Gets a human-readable name for the application, as set by set_application_name().
- void set_application_name (const String &application_name)
    Sets a human-readable name for the application.
- std::string get_user_data_dir ()
    Gets the base directory in which to access application data such as icons that is customized for a particular user.
- std::string get_user_config_dir ()
    Gets the base directory in which to store user-specific application configuration information such as user preferences and settings.
- std::string get_user_cache_dir ()
    Gets the base directory in which to store non-essential, cached data specific to particular user.
- std::vector< std::string > get_system_data_dirs ()
    Gets an ordered list of base directories in which to access system-wide application data.
- std::vector< std::string > get_system_config_dirs ()
    Gets an ordered list of base directories in which to access system-wide configuration information.
- bool path_is_absolute (const std::string &file_name)
    Determines whether the given file_name is an absolute file name.
- std::string path_skip_root (const std::string &file_name)
    Gets a pointer into file_name after the root component, that is, after the "/" in UNIX or "C:\' under Windows.
- std::string get_current_dir ()
    Gets the current directory.
- std::string path_get_basename (const std::string &file_name)
    Gets the last component of the filename.
- std::string path_get_dirname (const std::string &file_name)
    Gets the directory components of a file name.
- std::string getenv (const std::string &variable)
    Gets the value of an environment variable.
- bool setenv (const std::string &variable, const std::string &value, bool overwrite)
    Sets the value of an environment variable.
- void unsetenv (const std::string &variable)
    Removes an environment variable from the environment.
- 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() locates it.
- std::string build_filename (const std::string &s1, const std::string &s2)
    Creates a filename from 2 elements using the correct separator for filenames.
- std::string build_filename (const std::string &s1, const std::string &s2, const std::string &s3)
    Creates a filename from 3 elements using the correct separator for filenames (see build_filename(const std::string&, const std::string&).
- std::string build_filename (const std::string &s1, const std::string &s2, const std::string &s3, const std::string &s4)
    Creates a filename from 4 elements using the correct separator for filenames (see build_filename(const std::string&, const std::string&).
- std::string build_path (const std::string &separator, const std::string &s1, const std::string &s2)
    Creates a path from 2 elements using separator as the separator between elements.
- std::string build_path (const std::string &separator, const std::string &s1, const std::string &s2, const std::string &s3)
    Creates a path from 3 elements using separator as the separator between elements (see build_path(const std::string&, const std::string&, const std::string&).
- std::string build_path (const std::string &separator, const std::string &s1, const std::string &s2, const std::string &s3, const std::string &s4)
    Creates a path from 4 elements using separator as the separator between elements (see build_path(const std::string&, const std::string&, const std::string&).

## Typedefs

- typedef GTime Time
    G::Time is a equivalent to time_t.
- typedef GDateDay DateDay
    DateDay is an integer that represents a day of the month; between 1 and 31.
- typedef GDateYear DateYear
    DateYear is an integer representing a year; DATE::BAD_YEAR is the invalid value.
- typedef unsigned int FileTestField
    G::FileTestField holds one or more bit values from the G::FileTest enumeration.
- typedef unsigned int IOConditionField
    IOConditionField holds one or more conditions from the G::IOCondition enumeration OR'd together.
- typedef unsigned int IOFlagsField
    IOFlags holds one or more flags form the G::IOFlags enumeration OR'd together.
- typedef unsigned int KeyFileFlagsField
    G::KeyFileFlagsField holds one or more bit values from the G::KeyFileFlags enumeration.
- typedef unsigned int ModuleFlagsField
    ModuleFlagsField holds one or more flags the G::ModuleFlags enumeration OR'd together.
- typedef unsigned int OptionFlagsField
    G::OptionFlagsField holds one or more bit values from the G::OptionFlags enumeration.
- typedef unsigned int SpawnFlagsField
    SpawnFlagsField holds one or more bitflags from the G::SpawnFlags enumeration OR'd together.

## Enumerations

- enum DateWeekday {
  DATE_BAD_WEEKDAY = G_DATE_BAD_WEEKDAY,
  DATE_MONDAY = G_DATE_MONDAY,
  DATE_TUESDAY = G_DATE_TUESDAY,
  DATE_WEDNESDAY = G_DATE_WEDNESDAY,
  DATE_THURSDAY = G_DATE_THURSDAY,
  DATE_FRIDAY = G_DATE_FRIDAY,
  DATE_SATURDAY = G_DATE_SATURDAY,
  DATE_SUNDAY = G_DATE_SUNDAY
  }
    Represents a day of the week. More...
- enum DateMonth {
  DATE_BAD_MONTH = G_DATE_BAD_MONTH,
  DATE_JANUARY = G_DATE_JANUARY,
  DATE_FEBRUARY = G_DATE_FEBRUARY,
  DATE_MARCH = G_DATE_MARCH,
  DATE_APRIL = G_DATE_APRIL,
  DATE_MAY = G_DATE_MAY,
  DATE_JUNE = G_DATE_JUNE,
  DATE_JULY = G_DATE_JULY,
  DATE_AUGUST = G_DATE_AUGUST,
  DATE_SEPTEMBER = G_DATE_SEPTEMBER,
  DATE_OCTOBER = G_DATE_OCTOBER,
  DATE_NOVEMBER = G_DATE_NOVEMBER,
  DATE_DECEMBER = G_DATE_DECEMBER
  }
    Represents a month of the year. More...
- enum FileError {
  FILE_ERROR_EXIST = G_FILE_ERROR_EXIST,
  FILE_ERROR_ISDIR = G_FILE_ERROR_ISDIR,
  FILE_ERROR_ACCES = G_FILE_ERROR_ACCES,
  FILE_ERROR_NAMETOOLONG = G_FILE_ERROR_NAMETOOLONG,
  FILE_ERROR_NOENT = G_FILE_ERROR_NOENT,
  FILE_ERROR_NOTDIR = G_FILE_ERROR_NOTDIR,
  FILE_ERROR_NXIO = G_FILE_ERROR_NXIO,
  FILE_ERROR_NODEV = G_FILE_ERROR_NODEV,
  FILE_ERROR_ROFS = G_FILE_ERROR_ROFS,
  FILE_ERROR_TXTBSY = G_FILE_ERROR_TXTBSY,
  FILE_ERROR_FAULT = G_FILE_ERROR_FAULT,
  FILE_ERROR_LOOP = G_FILE_ERROR_LOOP,
  FILE_ERROR_NOSPC = G_FILE_ERROR_NOSPC,
  FILE_ERROR_NOMEM = G_FILE_ERROR_NOMEM,
  FILE_ERROR_MFILE = G_FILE_ERROR_MFILE,
  FILE_ERROR_NFILE = G_FILE_ERROR_NFILE,
  FILE_ERROR_BADF = G_FILE_ERROR_BADF,
  FILE_ERROR_INVAL = G_FILE_ERROR_INVAL,
  FILE_ERROR_PIPE = G_FILE_ERROR_PIPE,
  FILE_ERROR_AGAIN = G_FILE_ERROR_AGAIN,
  FILE_ERROR_INTR = G_FILE_ERROR_INTR,
  FILE_ERROR_IO = G_FILE_ERROR_IO,
  FILE_ERROR_PERM = G_FILE_ERROR_PERM,
  FILE_ERROR_NOSYS = G_FILE_ERROR_NOSYS,
  FILE_ERROR_FAILED = G_FILE_ERROR_FAILED
  }
    Values corresponding to errno codes returned from file operations on UNIX. More...
- enum FileTest {
  FILE_TEST_IS_REGULAR = G_FILE_TEST_IS_REGULAR,
  FILE_TEST_IS_SYMLINK = G_FILE_TEST_IS_SYMLINK,
  FILE_TEST_IS_DIR = G_FILE_TEST_IS_DIR,
  FILE_TEST_IS_EXECUTABLE = G_FILE_TEST_IS_EXECUTABLE,
  FILE_TEST_EXISTS = G_FILE_TEST_EXISTS
  }
    Specifies a test to perform on a file using G::file_test(). More...
- enum IOChannelError {
  IO_CHANNEL_ERROR_FBIG = G_IO_CHANNEL_ERROR_FBIG,
  IO_CHANNEL_ERROR_INVAL = G_IO_CHANNEL_ERROR_INVAL,
  IO_CHANNEL_ERROR_IO = G_IO_CHANNEL_ERROR_IO,
  IO_CHANNEL_ERROR_ISDIR = G_IO_CHANNEL_ERROR_ISDIR,
  IO_CHANNEL_ERROR_NOSPC = G_IO_CHANNEL_ERROR_NOSPC,
  IO_CHANNEL_ERROR_NXIO = G_IO_CHANNEL_ERROR_NXIO,
  IO_CHANNEL_ERROR_OVERFLOW = G_IO_CHANNEL_ERROR_OVERFLOW,
  IO_CHANNEL_ERROR_PIPE = G_IO_CHANNEL_ERROR_PIPE,
  IO_CHANNEL_ERROR_FAILED = G_IO_CHANNEL_ERROR_FAILED
  }
    enum IOChannelError The error codes returned by IOChannel operations. More...
- enum IOStatus {
  IO_STATUS_ERROR = G_IO_STATUS_ERROR,
  IO_STATUS_NORMAL = G_IO_STATUS_NORMAL,
  IO_STATUS_EOF = G_IO_STATUS_EOF,
  IO_STATUS_AGAIN = G_IO_STATUS_AGAIN
  }
    enum IOStatus Describes the status of an IO operation. More...
- enum SeekType {
  IO_SEEK_CUR = G_SEEK_CUR,
  IO_SEEK_SET = G_SEEK_SET,
  IO_SEEK_END = G_SEEK_END
  }
    Specifies the base position for a IOChannel::seek() operation. More...
- enum IOCondition {
  IO_IN = G_IO_IN,
  IO_OUT = G_IO_OUT,
  IO_PRI = G_IO_PRI,
  IO_ERR = G_IO_ERR,
  IO_HUP = G_IO_HUP,
  IO_NVAL = G_IO_NVAL
  }
    enum IOCondition A bitwise combination representing a condition to watch for on an event source. More...
- enum IOFlags {
  IO_FLAG_APPEND = G_IO_FLAG_APPEND,
  IO_FLAG_NONBLOCK = G_IO_FLAG_NONBLOCK ,
  IO_FLAG_IS_WRITEABLE = G_IO_FLAG_IS_WRITEABLE,
  IO_FLAG_IS_SEEKABLE = G_IO_FLAG_IS_SEEKABLE,
  IO_FLAG_MASK = G_IO_FLAG_MASK,
  IO_FLAG_GET_MASK = G_IO_FLAG_GET_MASK,
  IO_FLAG_SET_MASK = G_IO_FLAG_SET_MASK
  }
    enum IOFlags Specifies the properties of an IOChannel. More...
- enum KeyFileError {
  KEY_FILE_ERROR_UNKNOWN_ENCODING = G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
  KEY_FILE_ERROR_PARSE = G_KEY_FILE_ERROR_PARSE,
  KEY_FILE_ERROR_NOT_FOUND = G_KEY_FILE_ERROR_NOT_FOUND,
  KEY_FILE_ERROR_KEY_NOT_FOUND = G_KEY_FILE_ERROR_KEY_NOT_FOUND,
  KEY_FILE_ERROR_GROUP_NOT_FOUND = G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
  KEY_FILE_ERROR_INVALID_VALUE = G_KEY_FILE_ERROR_INVALID_VALUE
  }
    Specifies the error codes returned by key file parsing. More...
- enum KeyFileFlags {
  KEY_FILE_NONE = G_KEY_FILE_NONE,
  KEY_FILE_KEEP_COMMENTS = G_KEY_FILE_KEEP_COMMENTS,
  KEY_FILE_KEEP_TRANSLATIONS = G_KEY_FILE_KEEP_TRANSLATIONS
  }
    Specifies the flags which influence the parsing. More...
- enum {
  PRIORITY_HIGH = G_PRIORITY_HIGH,
  PRIORITY_DEFAULT = G_PRIORITY_DEFAULT,
  PRIORITY_HIGH_IDLE = G_PRIORITY_HIGH_IDLE,
  PRIORITY_DEFAULT_IDLE = G_PRIORITY_DEFAULT_IDLE,
  PRIORITY_LOW = G_PRIORITY_LOW
  }
- enum ModuleFlags {
  MODULE_BIND_LAZY = G_MODULE_BIND_LAZY,
  MODULE_BIND_LOCAL = G_MODULE_BIND_LOCAL,
  MODULE_BIND_MASK = G_MODULE_BIND_MASK
  }
    enum G::ModuleFlags Flags passed to G::Module::open(). More...
- enum OptionError {
  OPTION_ERROR_UNKNOWN_OPTION = G_OPTION_ERROR_UNKNOWN_OPTION,
  OPTION_ERROR_BAD_VALUE = G_OPTION_ERROR_BAD_VALUE
  }
    Specifies the error codes returned by option parsing. More...
- enum OptionFlags {
  OPTION_FLAG_HIDDEN = G_OPTION_FLAG_HIDDEN,
  OPTION_FLAG_IN_MAIN = G_OPTION_FLAG_IN_MAIN,
  OPTION_FLAG_REVERSE = G_OPTION_FLAG_REVERSE
  }
    Specifies the flags which modify individual options. More...
- enum SpawnFlags {
  SPAWN_LEAVE_DESCRIPTORS_OPEN = G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
  SPAWN_DO_NOT_REAP_CHILD = G_SPAWN_DO_NOT_REAP_CHILD,
  SPAWN_SEARCH_PATH = G_SPAWN_SEARCH_PATH,
  SPAWN_STDOUT_TO_DEV_NULL = G_SPAWN_STDOUT_TO_DEV_NULL,
  SPAWN_STDERR_TO_DEV_NULL = G_SPAWN_STDERR_TO_DEV_NULL,
  SPAWN_CHILD_INHERITS_STDIN = G_SPAWN_CHILD_INHERITS_STDIN,
  SPAWN_FILE_AND_ARGV_ZERO = G_SPAWN_FILE_AND_ARGV_ZERO
  }
    Specifies the flags that effect how a child process is spawned. More...
- enum ThreadError { THREAD_ERROR_AGAIN = G_THREAD_ERROR_AGAIN }
    Specifies the possible errors for thread related methods. More...
- enum ThreadPriority {
  THREAD_PRIORITY_LOW = G_THREAD_PRIORITY_LOW,
  THREAD_PRIORITY_NORMAL = G_THREAD_PRIORITY_NORMAL,
  THREAD_PRIORITY_HIGH = G_THREAD_PRIORITY_HIGH,
  THREAD_PRIORITY_URGENT = G_THREAD_PRIORITY_URGENT
  }
    Specifies the priority of a thread. More...

## Variables

- ChildWatchSignal child_watch_signal
    A namespace instance of the ChildWatchSignal for connecting slots to be invoked periodically.
- TimeoutSignal timeout_signal
    A namespace instance of the TimeoutSignal for connecting slots to be invoked periodically.
- IdleSignal idle_signal
    A namespace instance of IdleSignal for connecting slots to be invoked when the event loop is idle.
- IOSignal io_signal
    A namespace instance of IOSignal for connecting slots to be invoked when a condition is met.

## Detailed Description

The C++ framework for the GObject and GLib libraries.

Implements the object API that provides the base classes for the entire XFC library. Also wraps several of GLIB utility classes.

## Typedef Documentation

typedef GDateDay Xfc::G::DateDay

| DateDay is an integer that represents a day of the month; between 1 and 31. G::Date::BAD_DAY represents an invalid day of the month.

typedef GDateYear Xfc::G::DateYear

| DateYear is an integer representing a year; DATE::BAD_YEAR is the invalid value. The year must be 1 or higher; negative (BC) years are not allowed. The year is represented with four digits.

## Enumeration Type Documentation

anonymous enum

Enumeration values:

  PRIORITY_HIGH | Use this for high priority event sources; It is not used within GLib or GTK+ (value -100).
  PRIORITY_DEFAULT | Use this for default priority event sources; In GLib this priority is used when adding timeout functions with g_timeout_add(); In GDK this priority is used for events from the X server (value 0).

  PRIORITY_HIGH_IDLE

  Use this for high priority idle functions (value 100); GTK+ uses G_PRIORITY_HIGH_IDLE + 10 for window resizes and G_PRIORITY_HIGH_IDLE + 20 for window redraws, to ensure that any pending resizes are processed before any pending redraws, so that widgets are not redrawn twice unnecessarily; Note that you will interfere with GTK+ if you use a priority above G_PRIORITY_HIGH_IDLE + 10 (that is, GTK_PRIORITY_RESIZE).

  PRIORITY_DEFAULT_IDLE | Use this for default priority idle functions; In GLib this priority is used when adding idle functions with g_idle_add() (value 200).
  PRIORITY_LOW | Use this for very low priority background tasks; It is not used within GLib or GTK+ (value 300).

enum DateMonth

Represents a month of the year.

Enumeration values:

  DATE_BAD_MONTH | Invalid value.
  DATE_JANUARY | January.
  DATE_FEBRUARY | February.
  DATE_MARCH | March.
  DATE_APRIL | April.
  DATE_MAY | May.
  DATE_JUNE | June.
  DATE_JULY | July.
  DATE_AUGUST | August.
  DATE_SEPTEMBER | September.
  DATE_OCTOBER | October.
  DATE_NOVEMBER | November.
  DATE_DECEMBER | December.

enum DateWeekday

Represents a day of the week.

Enumeration values:

  DATE_BAD_WEEKDAY | Invalid value.
  DATE_MONDAY | Monday.
  DATE_TUESDAY | Tuesday.
  DATE_WEDNESDAY | Wednesday.
  DATE_THURSDAY | Thursday.
  DATE_FRIDAY | Friday.
  DATE_SATURDAY | Saturday.
  DATE_SUNDAY | Sunday.

enum FileError

Values corresponding to errno codes returned from file operations on UNIX.

Unlike errno codes, FileError values are available on all systems. The exact meaning of each code depends on what sort of file operation you were performing; the UNIX documentation gives more details. The following error code descriptions come from the GNU C Library manual, and are under the copyright of that manual.

It's not very portable to make detailed assumptions about exactly which errors will be returned from a given operation. Some errors don't occur on some systems, etc., sometimes there are subtle differences in when a system will report a given error, etc.

Enumeration values:

  FILE_ERROR_EXIST | Operation not permitted; only the owner of the file (or other resource) or processes with special privileges can perform the operation.
  FILE_ERROR_ISDIR | File is a directory; you cannot open a directory for writing, or create or remove hard links to it.
  FILE_ERROR_ACCES | Permission denied; the file permissions do not allow the attempted operation.
  FILE_ERROR_NAMETOOLONG | Filename is too long.
  FILE_ERROR_NOENT | No such file or directory; This is a "file doesn't exist" error for ordinary files that are referenced in contexts where they are expected to already exist.
  FILE_ERROR_NOTDIR | A file that isn't a directory was specified when a directory is required.
  FILE_ERROR_NXIO | No such device or address; The system tried to use the device represented by a file you specified, and it couldn't find the device; This can mean that the device file was installed incorrectly, or that the physical device is missing or not correctly attached to the computer.
  FILE_ERROR_NODEV | This file is of a type that doesn't support mapping.
  FILE_ERROR_ROFS | The directory containing the new link can't be modified because it's on a read-only file system.
  FILE_ERROR_TXTBSY | Text file busy.
  FILE_ERROR_FAULT | You passed in a pointer to bad memory (GLib won't reliably return this, don't pass in pointers to bad memory).
  FILE_ERROR_LOOP | Too many levels of symbolic links were encountered in looking up a file name; This often indicates a cycle of symbolic links.
  FILE_ERROR_NOSPC | No space left on device; write operation on a file failed because the disk is full.
  FILE_ERROR_NOMEM | No memory available; The system cannot allocate more virtual memory because its capacity is full.
  FILE_ERROR_MFILE | The current process has too many files open and can't open any more; Duplicate descriptors do count toward this limit.
  FILE_ERROR_NFILE | There are too many distinct file openings in the entire system.
  FILE_ERROR_BADF | Bad file descriptor; for example, I/O on a descriptor that has been closed or reading from a descriptor open only for writing (or vice versa).
  FILE_ERROR_INVAL | Invalid argument; This is used to indicate various kinds of problems with passing the wrong argument to a library function.
  FILE_ERROR_PIPE | Broken pipe; there is no process reading from the other end of a pipe (Every library function that returns this error code also generates a `SIGPIPE' signal; this signal terminates the program if not handled or blocked; Thus, your program will never actually see this code unless it has handled or blocked `SIGPIPE').
  FILE_ERROR_AGAIN | Resource temporarily unavailable; the call might work if you try again later.
  FILE_ERROR_INTR | Interrupted function call; an asynchronous signal occurred and prevented completion of the call (When this happens, you should try the call again).
  FILE_ERROR_IO | Input/output error; usually used for physical read or write errors, that is, the disk or other physical device hardware is returning errors.
  FILE_ERROR_PERM | Operation not permitted; only the owner of the file (or other resource) or processes with special privileges can perform the operation.
  FILE_ERROR_NOSYS | Function not implemented; this indicates that the system is missing some functionality.
  FILE_ERROR_FAILED | Does not correspond to a UNIX error code; this is the standard "failed for unspecified reason" error code present in all GError error code enumerations (Returned if no specific code applies).

enum FileTest

Specifies a test to perform on a file using G::file_test().

Enumeration values:

  FILE_TEST_IS_REGULAR | Tests true if the file is a regular file (not a symlink or directory).
  FILE_TEST_IS_SYMLINK | Tests true if the file is a symlink.
  FILE_TEST_IS_DIR | Tests true if the file is a directory.
  FILE_TEST_IS_EXECUTABLE | Tests true if the file is executable.
  FILE_TEST_EXISTS | Tests true if the file exists. It may or may not be a regular file.

enum IOChannelError

enum IOChannelError The error codes returned by IOChannel operations.

Enumeration values:

  IO_CHANNEL_ERROR_FBIG | File too large.
  IO_CHANNEL_ERROR_INVAL | Invalid argument.
  IO_CHANNEL_ERROR_IO | IO error.
  IO_CHANNEL_ERROR_ISDIR | File is a directory.
  IO_CHANNEL_ERROR_NOSPC | No space left on device.
  IO_CHANNEL_ERROR_NXIO | No such device or address.
  IO_CHANNEL_ERROR_OVERFLOW | Value too large for defined datatype.
  IO_CHANNEL_ERROR_PIPE | Broken pipe.
  IO_CHANNEL_ERROR_FAILED | Some other error.

enum IOCondition

enum IOCondition A bitwise combination representing a condition to watch for on an event source.

Enumeration values:

  IO_IN | There is data to read.
  IO_OUT | Data can be written (without blocking).
  IO_PRI | There is urgent data to read.
  IO_ERR | Error condition.
  IO_HUP | Hung up (the connection has been broken, usually for pipes and sockets).
  IO_NVAL | Invalid request. The file descriptor is not open.

enum IOFlags

enum IOFlags Specifies the properties of an IOChannel.

Some of the flags can only be read with G::IOChannel::get_flags(), but not changed with G::IOChannel::set_flags().

Enumeration values:

  IO_FLAG_APPEND | Turns on append mode, corresponds to O_APPEND (see the documentation of the UNIX open() syscall).
  IO_FLAG_NONBLOCK | Turns on nonblocking mode, corresponds to O_NONBLOCK/O_NDELAY (see the documentation of the UNIX open() syscall).
  IO_FLAG_IS_WRITEABLE | Read only flag; Indicates that the io channel is readable.
  IO_FLAG_IS_SEEKABLE | Read only flag; Indicates that the io channel is writable..
  IO_FLAG_MASK | Mask flag (I dont know what this means).
  IO_FLAG_GET_MASK | Same as mask flag.
  IO_FLAG_SET_MASK | Turns on append mode and nonblocking mode.

enum IOStatus

enum IOStatus Describes the status of an IO operation.

Enumeration values:

  IO_STATUS_ERROR | An error occurred.
  IO_STATUS_NORMAL | Success.
  IO_STATUS_EOF | End of file.
  IO_STATUS_AGAIN | Resource temporarily unavailable.

enum KeyFileError

Specifies the error codes returned by key file parsing.

Enumeration values:

  KEY_FILE_ERROR_UNKNOWN_ENCODING | The text being parsed was in an unknown encoding.
  KEY_FILE_ERROR_PARSE | The document was ill-formed.
  KEY_FILE_ERROR_NOT_FOUND | The file was not found.
  KEY_FILE_ERROR_KEY_NOT_FOUND | A requested key was not found.
  KEY_FILE_ERROR_GROUP_NOT_FOUND | A requested group was not found.
  KEY_FILE_ERROR_INVALID_VALUE | A value could not be parsed.

enum KeyFileFlags

Specifies the flags which influence the parsing.

Enumeration values:

  KEY_FILE_NONE | No flags, default behaviour.
  KEY_FILE_KEEP_COMMENTS | Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise all comments will be lost when the key file is written back.
  KEY_FILE_KEEP_TRANSLATIONS | Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise only the translations for the current language will be written back.

enum ModuleFlags

enum G::ModuleFlags Flags passed to G::Module::open().

Note that these flags are not supported on all platforms.

Enumeration values:

  MODULE_BIND_LAZY | Specifies that symbols are only resolved when needed; The default action is to bind all symbols when the module is loaded.
  MODULE_BIND_LOCAL | Specifies that symbols in the module should not be added to the global name space. The default action on most platforms is to place symbols in the module in the global name space, which may cause conflicts with existing symbols.
  MODULE_BIND_MASK | Mask for all flags.

enum OptionError

Specifies the error codes returned by option parsing.

Enumeration values:

  OPTION_ERROR_UNKNOWN_OPTION | An option was not known to the parser; this error will only be reported, if the parser hasn't been instructed to ignore unknown options (see set_ignore_unknown_options()).
  OPTION_ERROR_BAD_VALUE | A value couldn't be parsed.

enum OptionFlags

Specifies the flags which modify individual options.

Enumeration values:

  OPTION_FLAG_HIDDEN | The option doesn't appear in --help output.
  OPTION_FLAG_IN_MAIN | The option appears in the main section of the --help output, even if it is defined in a group.
  OPTION_FLAG_REVERSE | For options of the G_OPTION_ARG_NONE kind, this flag indicates that the sense of the option is reversed.

enum SeekType

Specifies the base position for a IOChannel::seek() operation.

Enumeration values:

  IO_SEEK_CUR | The current position in the file.
  IO_SEEK_SET | The start of the file.
  IO_SEEK_END | The end of the file.

enum SpawnFlags

Specifies the flags that effect how a child process is spawned.

Enumeration values:

  SPAWN_LEAVE_DESCRIPTORS_OPEN | The parent's open file descriptors will be inherited by the child; otherwise all descriptors except stdin/stdout/stderr will be closed before calling exec() in the child.
  SPAWN_DO_NOT_REAP_CHILD | The child will not be automatically reaped; you must call waitpid() or handle SIGCHLD yourself, or the child will become a zombie.
  SPAWN_SEARCH_PATH | argv[0] need not be an absolute path, it will be looked for in the user's PATH.
  SPAWN_STDOUT_TO_DEV_NULL | The child's standard output will be discarded, instead of going to the same location as the parent's standard output.
  SPAWN_STDERR_TO_DEV_NULL | The child's standard error will be discarded.
  SPAWN_CHILD_INHERITS_STDIN | The child will inherit the parent's standard input (by default, the child's standard input is attached to /dev/null).
  SPAWN_FILE_AND_ARGV_ZERO | The first element of argv is the file to execute, while the remaining elements are the actual argument vector to pass to the file; Normally SpawnAsync uses argv[0] as the file to execute, and passes all of argv to the child.

enum ThreadError

Specifies the possible errors for thread related methods.

Enumeration values:

  THREAD_ERROR_AGAIN | The resource temporarily unavailable.

enum ThreadPriority

Specifies the priority of a thread.

It is not guaranteed, that threads with different priorities really behave accordingly. On some systems (e.g. Linux) only root can increase priorities. On other systems (e.g. Solaris) there doesn't seem to be different scheduling for different priorities. All in all try to avoid being dependent on priorities.

Enumeration values:

  THREAD_PRIORITY_LOW | A priority lower than normal.
  THREAD_PRIORITY_NORMAL | The default priority.
  THREAD_PRIORITY_HIGH | A priority higher than normal.
  THREAD_PRIORITY_URGENT | The highest priority.

## Function Documentation

std::string build_filename | ( | const std::string & | s1,
|  | const std::string & | s2,
|  | const std::string & | s3,
|  | const std::string & | s4
| ) |

Creates a filename from 4 elements using the correct separator for filenames (see build_filename(const std::string&, const std::string&).

Parameters:

  | s1 | The first element in the filename.
  | s2 | The second element in the filename.
  | s3 | The third element in the filename.
  | s4 | The fourth element in the filename.

Returns:
  The resulting filename.

std::string build_filename | ( | const std::string & | s1,
|  | const std::string & | s2,
|  | const std::string & | s3
| ) |

Creates a filename from 3 elements using the correct separator for filenames (see build_filename(const std::string&, const std::string&).

Parameters:

  | s1 | The first element in the filename.
  | s2 | The second element in the filename.
  | s3 | The third element in the filename.

Returns:
  The resulting filename.

std::string build_filename | ( | const std::string & | s1,
|  | const std::string & | s2
| ) |

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

Parameters:

  | s1 | The first element in the filename.
  | s2 | The second element in the filename.

Returns:
  The resulting filename.

On Unix, this function behaves identically to G::build_path() with G_DIR_SEPARATOR_S set as the separator. On Windows, it takes into account that either the backslash "\" or slash "/" can be used as separator in filenames, but otherwise behaves as on Unix. When file pathname separators need to be inserted, the one that last previously occurred in the parameters (reading from left to right) is used. 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.

std::string build_path | ( | const std::string & | separator,
|  | const std::string & | s1,
|  | const std::string & | s2,
|  | const std::string & | s3,
|  | const std::string & | s4
| ) |

Creates a path from 4 elements using separator as the separator between elements (see build_path(const std::string&, const std::string&, const std::string&).

Parameters:

  | separator | A string used to separator the elements of the path.
  | s1 | The first element in the path.
  | s2 | The second element in the path.
  | s3 | The third element in the path.
  | s4 | The fourth element in the path.

Returns:
  The resulting path.

std::string build_path | ( | const std::string & | separator,
|  | const std::string & | s1,
|  | const std::string & | s2,
|  | const std::string & | s3
| ) |

Creates a path from 3 elements using separator as the separator between elements (see build_path(const std::string&, const std::string&, const std::string&).

Parameters:

  | separator | A string used to separator the elements of the path.
  | s1 | The first element in the path.
  | s2 | The second element in the path.
  | s3 | The third element in the path.

Returns:
  The resulting path.

std::string build_path | ( | const std::string & | separator,
|  | const std::string & | s1,
|  | const std::string & | s2
| ) |

Creates a path from 2 elements using separator as the separator between elements.

Parameters:

  | separator | A string used to separator the elements of the path.
  | s1 | The first element in the path.
  | s2 | The second element in the path.

Returns:
  The resulting path.

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.)

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.

FileError file_error_from_errno | ( | int | err_no | ) |

Gets a FileError constant based on the passed-in errno, for example, if you pass in EEXIST this function returns G_FILE_ERROR_EXIST.

Parameters:

  | err_no | An "errno" value

Returns:
  A FileError corresponding to the given errno.

Unlike errno values, you can portably assume that all FileError values will exist. Normally a FileError value goes into a G::Error returned from a method that manipulates files. So you would use G::file_error_from_errno() when constructing a G::Error.

bool file_get_contents | ( | const std::string & | filename,
|  | std::string & | contents,
|  | G::Error * | error
| ) |

Reads an entire file into allocated memory, with good error checking.

Parameters:

  | filename | A file to read the contents from.
  | contents | The location to store the file contents.
  | error | The return location for a G::Error.

Returns:
  true on success, false if error is set.

If error is set, false is returned, and contents is set to an empty string. If true is returned, error will not be set, and contents will be set to the file contents. The error domain is G_FILE_ERROR. Possible error codes are those in the FileError enumeration.

bool file_test | ( | const std::string & | filename,
|  | FileTestField | test
| ) |

Determines whether any of the tests in the bitfield test are true.

Parameters:

  | filename | A filename to test.
  | test | A bitfield of G::FileTest flags.

Returns:
  true if a test was true.

For example, (G::FILE_TEST_EXISTS | G::FILE_TEST_IS_DIR) will return true if the file exists; the check whether it's a directory doesn't matter since the existence test is true. With the current set of available tests, there's no point passing in more than one test at a time.

Apart from G::FILE_TEST_IS_SYMLINK all tests follow symbolic links, so for a symbolic link to a regular file file_test() will return true for both G::FILE_TEST_IS_SYMLINK and G::FILE_TEST_IS_REGULAR. Note, that for a dangling symbolic link file_test() will return true for G::FILE_TEST_IS_SYMLINK and false for all other flags.

You should never use file_test() to test whether it is safe to perform an operaton, because there is always the possibility of the condition changing before you actually perform the operation. For example, you might think you could use G::FILE_TEST_IS_SYMLINK to know whether it is is safe to write to a file without being tricked into writing into a different location. It doesn't work!

Example: DON'T DO THIS.

         if (!file_test(filename, FILE_TEST_IS_SYMLINK))
         {
            TempFile file(filename);
            if (file.is_open())
            // write to file
         }

Another thing to note is that G::FILE_TEST_EXISTS and G::FILE_TEST_IS_EXECUTABLE are implemented using the access() system call. This usually doesn't matter, but if your program is setuid or setgid it means that these tests will give you the answer for the real user ID and group ID , rather than the effective user ID and group ID.

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() locates it.

Parameters:

  | program | A program name.

Returns:
  A string with the absolute path name, or an empty string 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 an empty string otherwise. On Windows, if program does not have a file type suffix, tries to append the suffixes in the PATHEXT environment variable (if that doesn't exists, the suffixes .com, .exe, and .bat) in turn, and then look for the resulting file name in the same way as CreateProcess() would. This means first in the directory where the program was loaded from, then in the current directory, then in the Windows 32-bit system directory, then in the Windows directory, and finally in the directories in the PATH environment variable. If the program is found, the return value contains the full name including the type suffix.

String get_application_name | ( |  | ) |

Gets a human-readable name for the application, as set by set_application_name().

Returns:
  A human-readable application name (may return a null string).

This name should be localized if possible, and is intended for display to the user. Contrast with get_prgname(), which gets a non-localized name. If set_application_name() has not been called, returns the result of get_prgname() (which may be null if set_prgname() has also not been called).

std::string get_current_dir | ( |  | ) |

Gets the current directory.

Returns:
  The current directory.

The encoding of the returned string is system defined. On Windows, it is always UTF-8.

TimeVal get_current_time | ( |  | ) |

Equivalent to the UNIX gettimeofday() function, but portable.

Returns:
  A TimeVal object that stores the current time.

void get_current_time | ( | TimeVal & | timeval | ) |

Equivalent to the UNIX gettimeofday() function, but portable.

Parameters:

  | timeval | A TimeVal object in which to store the current time.

std::string get_home_dir | ( |  | ) |

Gets the current user's home directory.

Returns:
  The current user's home directory.

Note that in contrast to traditional Unix tools, this function prefers passwd entries over the HOME environment variable.

std::string get_prgname | ( |  | ) |

Gets the name of the program.

Returns:
  The name of the program.

This name should NOT be localized, contrast with get_application_name(). If you are using libXFCui the program name is set in Main::init(). The program name is found by taking the last component of argv[0].

std::string get_real_name | ( |  | ) |

Gets the real name of the user.

Returns:
  The user's real name.

This usually comes from the user's entry in the passwd file. The encoding of the returned string is system defined. (On Windows, it is, however, always UTF-8.) If the real user name cannot be determined, the string "Unknown" is returned.

std::vector<std::string> get_system_config_dirs | ( |  | ) |

Gets an ordered list of base directories in which to access system-wide configuration information.

Returns:
  A vector of std::string holding the list of base directories.

On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification

std::vector<std::string> get_system_data_dirs | ( |  | ) |

Gets an ordered list of base directories in which to access system-wide application data.

Returns:
  A vector of std::string holding the ordered list of base directories.

On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification.

std::string get_tmp_dir | ( |  | ) |

Gets the directory to use for temporary files.

Returns:
  The directory to use for temporary files.

This is found from inspecting the environment variables TMPDIR, TMP, and TEMP in that order. If none of those are defined "/tmp" is returned on UNIX and "C:\" on Windows. The encoding of the returned string is system defined. On Windows, it is always UTF-8. The return value is never null.

std::string get_user_cache_dir | ( |  | ) |

Gets the base directory in which to store non-essential, cached data specific to particular user.

Returns:
  The base directory string.

On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification.

std::string get_user_config_dir | ( |  | ) |

Gets the base directory in which to store user-specific application configuration information such as user preferences and settings.

Returns:
  The base directory string.

On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification.

std::string get_user_data_dir | ( |  | ) |

Gets the base directory in which to access application data such as icons that is customized for a particular user.

Returns:
  The base directory string.

On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification.

std::string get_user_name | ( |  | ) |

Gets the user name of the current user.

Returns:
  The user name of the current user.

The encoding of the returned string is system defined. On Unix, it might be the preferred file name encoding, or something else, and there is no guarantee that it is even consistent on a machine. On Windows, it is always UTF-8.

std::string getenv | ( | const std::string & | variable | ) |

Gets the value of an environment variable.

Parameters:

  | variable | The environment variable to get.

Returns:
  The value of the environment variable, or an empty string if variable is not found.

The returned string may be overwritten by the next call to getenv(), setenv() or unsetenv().

std::string path_get_basename | ( | const std::string & | file_name | ) |

Gets the last component of the filename.

Parameters:

  | file_name | The name of the file.

Returns:
  A string containing the last component of the filename.

If file_name ends with a directory separator it gets the component before the last slash. If file_name consists only of directory separators (and on Windows, possibly a drive letter), a single separator is returned. If file_name is empty, "." is returned.

std::string path_get_dirname | ( | const std::string & | file_name | ) |

Gets the directory components of a file name.

Parameters:

  | file_name | The name of the file.

Returns:
  The directory components of the file.

If the file name has no directory components "." is returned.

bool path_is_absolute | ( | const std::string & | file_name | ) |

Determines whether the given file_name is an absolute file name.

Parameters:

  | file_name | A file name.

Returns:
  true if file_name is an absolute path.

A file name is absolute if it contains a full path from the root directory such as "/usr/local" on UNIX or "C:\windows" on Windows systems.

std::string path_skip_root | ( | const std::string & | file_name | ) |

Gets a pointer into file_name after the root component, that is, after the "/" in UNIX or "C:\' under Windows.

Parameters:

  | file_name | A file name.

Returns:
  A pointer into file_name after the root component.

If file_name is not an absolute path it returns an empty string.

bool random_boolean | ( |  | ) |

Gets a random boolean value (this corresponds to a unbiased coin toss).

Returns:
  A random bool value.

double random_double | ( |  | ) |

Gets a random double equally distributed over the range [0..1).

Returns:
  A random number.

double random_double_range | ( | double | begin,
|  | double | end
| ) |

Gets a random double equally distributed over the range [begin..end).

Parameters:

  | begin | The lower closed bound of the interval.
  | end | The upper open bound of the interval.

Returns:
  A random number.

unsigned int random_int | ( |  | ) |

Gets a random unsigned integer equally distributed over the range [0..2^32-1].

Returns:
  A random number.

int random_int_range | ( | int | begin,
|  | int | end
| ) |

Gets a random integer equally distributed over the range [begin..end-1].

Parameters:

  | begin | The lower closed bound of the interval.
  | end | The upper open bound of the interval.

Returns:
  A random number.

void random_set_seed | ( | unsigned int | seed | ) |

Sets the seed for the global random number generator, which is used by the G::random_* methods, to seed.

Parameters:

  | seed | A value to reinitialize the global random number generator.

void set_application_name | ( | const String & | application_name | ) |

Sets a human-readable name for the application.

Parameters:

  | application_name | The localized name of the application.

This name should be localized if possible, and is intended for display to the user. Contrast with set_prgname(), which sets a non-localized name. set_prgname() will be called automatically by Main::init(), but set_application_name() will not. Note that for thread safety reasons, this function can only be called once. The application name will be used in contexts such as error messages, or when displaying an application's name in the task list.

void set_prgname | ( | const std::string & | prgname | ) |

Sets the name of the program.

Parameters:

  | prgname | The name of the program.

This name should NOT be localized, contrast with set_application_name(). Note that for thread-safety reasons this function can only be called once.

bool setenv | ( | const std::string & | variable,
|  | const std::string & | value,
|  | bool | overwrite
| ) |

Sets the value of an environment variable.

Parameters:

  | variable | The environment variable to set, must not contain "=".
  | value | The value to set for the variable.
  | overwrite | Whether to change the variable if it already exists.

Returns:
  false if the environment variable couldn't be set.

Note that on some systems, the memory used for the variable and its value can't be reclaimed.

bool shell_parse_argv | ( | const String & | command_line,
|  | std::vector< String > & | args,
|  | G::Error * | error = `0`
| ) |

Parses a command line into an argument vector, in much the same way the shell would, but without many of the expansions the shell would perform (variable expansion, globs, operators, filename expansion, and the like are not supported).

Parameters:

  | command_line | A command line to parse.
  | args | A reference to a vector of String to hold the argument strings.
  | error | The return location for a G::Error, or null.

Returns:
  true on success, false if error was set.

The results are defined to be the same as those you would get from a UNIX98 /bin/sh, as long as the input contains none of the unsupported shell expansions. If the input does contain such expansions, they are passed through literally. Possible errors are those from the G_SHELL_ERROR domain.

String shell_quote | ( | const String & | unquoted_string | ) |

Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string.

Parameters:

  | unquoted_string | A literal string

Returns:
  The quoted string.

If you pass a filename to the shell, for example, you should first quote it with this function. The quoting style used is undefined (single or double quotes may be used).

String shell_unquote | ( | const String & | quoted_string,
|  | G::Error * | error = `0`
| ) |

Unquotes a string as the shell (/bin/sh) would.

Parameters:

  | quoted_string | A shell-quoted string.
  | error | The return location for a G::Error, or null.

Returns:
  An unquoted string.

Only handles quotes; if a string contains file globs, arithmetic operators, variables, backticks, redirections, or other special-to-the-shell features, the result will be different from the result a real shell would produce (the variables, backticks, etc. will be passed through literally instead of being expanded). This method is guaranteed to succeed if applied to the result of shell_quote(). If it fails, it returns a null String and sets the error. The quoted_string need not actually contain quoted or escaped text; shell_unquote() simply goes through the string and unquotes/unescapes anything that the shell would. Both single and double quotes are handled, as are escapes including escaped newlines. Possible errors are in the G_SHELL_ERROR domain.

Shell quoting rules are a bit strange. Single quotes preserve the literal string exactly. Escape sequences are not allowed; not even \' - if you want a ' in the quoted text, you have to do something like 'foo'\''bar'. Double quotes allow $, `, ", \, and newline to be escaped with backslash. Otherwise double quotes preserve things literally.

void unsetenv | ( | const std::string & | variable | ) |

Removes an environment variable from the environment.

Parameters:

  | variable | The environment variable to remove, must not contain "=".

Note that on some systems, the memory used for the variable and its value can't be reclaimed. Furthermore, this function can't be guaranteed to operate in a threadsafe way.

void usleep | ( | unsigned long | microseconds | ) |

Pauses execution of the current thread for the given number of microseconds.

Parameters:

  | microseconds | The number of microseconds to pause.

There are 1 million microseconds per second (represented by the G_USEC_PER_SEC macro). This method may have limited precision, depending on hardware and operating system; don't rely on the exact length of the sleep.

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3