Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::G Namespace Reference

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

## Compounds

- class AsyncQueue
    A GAsyncQueue C++ wrapper interface. More...
- class Boxed
    A generic base class for GTK+ boxed objects. More...
- class Condition
    A GCond C++ wrapper interface. More...
- class Date
    A GDate C++ wrapper interface. More...
- class Dir
    A GDir C++ wrapper interface. More...
- class Error
    A C++ GLib error reporting class. More...
- class IOChannel
    A GIOChannel C++ wrapper class. More...
- class MarkupParseContext
    A GMarkupParseContext C++ wrapper interface. More...
- class MarkupParser
    A GMarkupParser C++ wrapper interface. More...
- class Mutex
    A GMutex C++ wrapper interface. More...
- class Object
    Base class for wrapped GTK+ objects and widgets. More...
- class PatternSpec
    A GPatternSpec C++ wrapper interface. More...
- class Private
    A run-time GStaticPrivate C++ wrapper interface. More...
- class Quark
    A GQuark C++ wrapper interface. More...
- class Rand
    A GRand C++ wrapper interface. More...
- class RecMutex
    A run-time GStaticRecMutex C++ wrapper interface. More...
- class RWLock
    A run-time GStaticRWlock C++ wrapper interface. More...
- class Scanner
    A general purpose lexical scanner. More...
- class Signal
    Base class for the GTK+ C++ signal interface. More...
- class Signal0
    A template for a signal passing no arguments and returning a value of type R. More...
- class Signal1
    A template for a signal passing one argument of type P1 and returning a value of type R. More...
- class Signal2
    A template for a signal passing two arguments of type P1 and P2, and returning a value of type R. More...
- class Signal3
    A template for a signal passing three arguments of type P1, P2 and P3, and returning a value of type R. More...
- class Signal4
    A template for a signal passing four arguments of type P1, P2, P3 and P4, and returning a value of type R. More...
- class Signal5
    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 Signal6
    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 SignalProxy
    A proxy for manipulating a protected signal (connection, mostly). More...
- class SlotNode
    A node class for managing slots connected to Inti::G::Signal's. More...
- class Spawn
    A C++ interface for the GLib spawn functions. More...
- class SpawnAsync
    A C++ interface for the GLib asynchronous spawn functions. More...
- class SpawnSync
    A C++ interface for the GLib synchronous spawn functions. More...
- struct StaticMutex
    A GStaticMutex C++ wrapper interface. More...
- struct StaticPrivate
    A compile-time GStaticPrivate C++ wrapper interface. More...
- struct StaticRecMutex
    A compile-time GStaticRecMutex C++ wrapper interface. More...
- struct StaticRWLock
    A compile-time GStaticRWlock C++ wrapper interface. More...
- class TempFile
    A C++ wrapper interface for the g_file_open_tmp() and g_mkstemp() functions. More...
- class Thread
    A GThread C++ wrapper interface. More...
- class ThreadPool
    A GThreadPool C++ wrapper interface. More...
- class Timer
    A GTimer C++ wrapper interface. More...
- class TimeVal
    A GTimeVal C++ wrapper interface. More...
- class TypeInstance
    Abstract base class for GTK+ interfaces and objects. More...
- class TypeInterface
    Abstract base class for GTK+ interfaces. More...
- class Unichar
    A C++ gunichar wrapper class. More...
- class Value
    A GValue wrapper class. More...

## File Methods

- GFileError file_error_from_errno (int err_no)
    Gets a GFileError 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.

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

## Typedefs

- typedef GTime Time
    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
    FileTestField holds one or more bit values from the G::FileTest enumeration.
- typedef unsigned int IOConditionField
    IOConditionField holds one or more conditions from the IOCondition enumeration OR'd together.
- typedef unsigned int IOFlagsField
    IOFlags holds one or more flags form the IOFlags enumeration OR'd together.
- typedef unsigned int SpawnFlagsField
    SpawnFlagsField holds one or more bitflags from the 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 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 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...

## Detailed Description

C++ framework for the GObject and GLib libraries.

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

## Typedef Documentation

typedef GDateDay Inti::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 Inti::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

enum Inti::G::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 Inti::G::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 Inti::G::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 Inti::G::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 Inti::G::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 Inti::G::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 Inti::G::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 Inti::G::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 Inti::G::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 Inti::G::ThreadError

Specifies the possible errors for thread related methods.

Enumeration values:

  THREAD_ERROR_AGAIN | The resource temporarily unavailable.

enum Inti::G::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

GFileError file_error_from_errno | ( | int | err_no | ) |

Gets a GFileError 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 GFileError corresponding to the given errno.

Unlike errno values, you can portably assume that all GFileError values will exist. Normally a GFileError 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 GFileError 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.

TimeVal get_current_time | ( |  | ) |

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

Returns:
  A TimeVal object that stores the current time.

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.

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

Main Page - Footer