Cgu Namespace Reference

## Namespaces

| Callback
| This namespace provides classes for type erasure.
| DoIf
| This namespace provides utility functions for conditional compilation.
| MemFun
| This namespace contains an adaptor to create a functor from a class member function to pass to C++ standard algorithms.
| SharedHandleAllocFail
| SharedPtrAllocFail
| Thread
| Utf8
| This namespace contains utilities relevant to the use of UTF-8 in programs.

## Classes

class | ApplicationNameError
| This class is thrown when the program id name passed to the constructor of Cgu::Application is invalid. More...
class | Application
| This is a class for constructing and managing GtkApplication objects. More...
class | AsyncQueuePopError
| An exception thrown if calling pop() on a AsyncQueue or AsyncQueueDispatch object fails because the queue is empty. More...
class | AsyncQueue
| A thread-safe asynchronous queue. More...
class | AsyncQueueDispatch
| A thread-safe asynchronous queue with a blocking pop() method. More...
class | AsyncResult
| A thread-safe asynchronous result class. More...
class | EmitterArg
| A class to execute callbacks connected to it, with provision for automatic disconnection. More...
class | SafeEmitterArg
| A thread-safe class to execute callbacks connected to it, with provision for automatic disconnection. More...
class | Releaser
| A class used for tracking EmitterArg and SafeEmitterArg connections. More...
class | basic_fdoutbuf
| Output stream buffer for unix file descriptors. More...
class | basic_fdostream
| Output stream for unix file descriptors. More...
class | basic_fdinbuf
| Input stream buffer for unix file descriptors. More...
class | basic_fdistream
| Input stream for unix file descriptors. More...
class | FilePrintDialog
| A print dialog class for FilePrintManager. More...
class | FilePrintManager
| A class to print a file using the GTK+ print system. More...
class | GerrorFree
| A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_error_free(). More...
class | GobjHandle
| This is a handle for managing the reference count of GObjects. More...
struct | GobjWeakHandleError
class | GobjWeakHandle
| This is a handle for managing weak references to GObjects. More...
class | basic_gstreambuf
| C++ stream buffer for GIO streams. More...
class | basic_gostream
| C++ output stream for GIO streams. More...
class | basic_gistream
| C++ input stream for GIO streams. More...
class | basic_giostream
| C++ input-output stream for GIO streams. More...
class | GvarHandle
| This is a handle for managing the reference count of GVariant objects. More...
class | IntrusivePtr
| This is a smart pointer for managing objects allocated on freestore which maintain their own reference count. More...
class | IntrusiveCounter
| This is a counter class providing the ref() and unref() functions required by IntrusivePtr. More...
class | IntrusiveLockCounter
| This is a counter class providing the ref() and unref() functions required by IntrusivePtr, with a thread safe reference count.. More...
class | Notifier
| Provides thread-safe signalling between a worker thread and the main program thread. More...
class | Param
| Struct for automatic typing of function parameter arguments. More...
struct | Param< T & >
struct | Param< T * >
class | RemoveRefCond
| Struct which will conditionally convert a reference type to a value type. More...
struct | RemoveRefCond< T, true >
struct | RemoveRefCond< T &, true >
struct | RemoveRefCond< T, false >
struct | RemoveRefCond< T &, false >
struct | PipeError
class | PipeFifo
| A wrapper for unix anonymous pipes. More...
class | SyncPipe
| A class which uses an anonymous pipe to synchronise between processes. More...
class | StandardArrayDelete
| A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls the C++ delete[] expression. More...
class | CFree
| A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls std::free. More...
class | GFree
| A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_free(). More...
class | GSliceFree
| A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_slice_free1(). More...
class | GSliceDestroy
| A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_slice_free1(), but before doing so also explicitly calls the destructor of a C++ object constructed in the memory. More...
class | GSliceFreeSize
| A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_slice_free1(). More...
class | SharedHandle
| This is a generic class for managing the lifetime of objects allocated on freestore. More...
class | ScopedHandle
| This is a generic scoped class for managing the lifetime of objects allocated on freestore. More...
class | SharedHandleError
| This is an exception struct thrown as an alternative to deleting a managed object when internal memory allocation for SharedHandle or SharedLockHandle fails in their reset() method or in their constructor which takes a pointer. More...
class | SharedLockHandle
| This is a generic class for managing the lifetime of objects allocated on freestore, with a thread safe reference count.. More...
class | SharedPtrError
| This is an exception struct thrown as an alternative to deleting a managed object when internal memory allocation for SharedPtr or SharedLockPtr fails in their reset() method or in their constructor which takes a pointer. More...
class | SharedPtr
| This is a smart pointer for managing the lifetime of objects allocated on freestore. More...
class | SharedLockPtr
| This is a smart pointer for managing the lifetime of objects allocated on freestore, with a thread safe reference count. More...
class | TextPrintManager
| A class to print plain text using the GTK+ print system. More...
class | MainWidgetBase
| This is a class to manage the lifetime of widgets which are not top-level widgets (ie which are not derived from GtkWindow). More...
class | WinBase
| This is a class for managing the lifetime of top level widgets. More...

## Typedefs

typedef EmitterArg | Emitter
typedef SafeEmitterArg | SafeEmitter
typedef basic_fdinbuf< char > | fdinbuf
| Input stream buffer for file descriptors for char type. More...
typedef basic_fdoutbuf< char > | fdoutbuf
| Output stream buffer for file descriptors for char type. More...
typedef basic_fdistream< char > | fdistream
| Input stream for file descriptors for char type. More...
typedef basic_fdostream< char > | fdostream
| Output stream for file descriptors for char type. More...
typedef basic_fdinbuf< wchar_t > | wfdinbuf
| Input stream buffer for file descriptors for wchar_t type. More...
typedef basic_fdoutbuf< wchar_t > | wfdoutbuf
| Output stream buffer for file descriptors for wchar_t type. More...
typedef basic_fdistream< wchar_t > | wfdistream
| Input stream for file descriptors for wchar_t type. More...
typedef basic_fdostream< wchar_t > | wfdostream
| Output stream for file descriptors for wchar_t type. More...
typedef basic_fdinbuf< char16_t > | u16fdinbuf
| Input stream buffer for file descriptors for char16_t type. More...
typedef basic_fdoutbuf< char16_t > | u16fdoutbuf
| Output stream buffer for file descriptors for char16_t type. More...
typedef basic_fdistream< char16_t > | u16fdistream
| Input stream for file descriptors for char16_t type. More...
typedef basic_fdostream< char16_t > | u16fdostream
| Output stream for file descriptors for char16_t type. More...
typedef basic_fdinbuf< char32_t > | u32fdinbuf
| Input stream buffer for file descriptors for char32_t type. More...
typedef basic_fdoutbuf< char32_t > | u32fdoutbuf
| Output stream buffer for file descriptors for char32_t type. More...
typedef basic_fdistream< char32_t > | u32fdistream
| Input stream for file descriptors for char32_t type. More...
typedef basic_fdostream< char32_t > | u32fdostream
| Output stream for file descriptors for char32_t type. More...
typedef ScopedHandle< GError *, GerrorFree > | GerrorScopedHandle
| A handle comprising a typed instance of the ScopedHandle class for managing GError objects. More...
typedef SharedHandle< GError *, GerrorFree > | GerrorSharedHandle
| A handle comprising a typed instance of the SharedHandle class for managing GError objects. More...
typedef basic_gstreambuf< char > | gstreambuf
| C++ stream buffer for GIO streams for char type. More...
typedef basic_gistream< char > | gistream
| C++ input stream for GIO streams for char type. More...
typedef basic_gostream< char > | gostream
| C++ output stream for GIO streams for char type. More...
typedef basic_giostream< char > | giostream
| C++ input/output stream for GIO streams for char type. More...
typedef basic_gstreambuf< wchar_t > | wgstreambuf
| C++ stream buffer for GIO streams for wchar_t type. More...
typedef basic_gistream< wchar_t > | wgistream
| C++ input stream for GIO streams for wchar_t type. More...
typedef basic_gostream< wchar_t > | wgostream
| C++ output stream for GIO streams for wchar_t type. More...
typedef basic_giostream< wchar_t > | wgiostream
| C++ input/output stream for GIO streams for wchar_t type. More...
typedef basic_gstreambuf < char16_t > | u16gstreambuf
| C++ stream buffer for GIO streams for char16_t type. More...
typedef basic_gistream< char16_t > | u16gistream
| C++ input stream for GIO streams for char16_t type. More...
typedef basic_gostream< char16_t > | u16gostream
| C++ output stream for GIO streams for char16_t type. More...
typedef basic_giostream< char16_t > | u16giostream
| C++ input/output stream for GIO streams for char16_t type. More...
typedef basic_gstreambuf < char32_t > | u32gstreambuf
| C++ stream buffer for GIO streams for char32_t type. More...
typedef basic_gistream< char32_t > | u32gistream
| C++ input stream for GIO streams for char32_t type. More...
typedef basic_gostream< char32_t > | u32gostream
| C++ output stream for GIO streams for char32_t type. More...
typedef basic_giostream< char32_t > | u32giostream
| C++ input/output stream for GIO streams for char32_t type. More...
typedef gboolean(* | PresentFunc )(void *object_data, const char **instance_args)
typedef SharedHandle< gchar *, GFree > | GcharSharedHandle
| A handle comprising a typed instance of the SharedHandle class for gchar* arrays and strings. More...
typedef ScopedHandle< gchar *, GFree > | GcharScopedHandle
| A handle comprising a typed instance of the ScopedHandle class for gchar* arrays and strings. More...

## Functions

template<class T , class Container >
void | swap (Cgu::AsyncQueue< T, Container > &q1, Cgu::AsyncQueue< T, Container > &q2)
template<class T , class Container >
void | swap (Cgu::AsyncQueueDispatch< T, Container > &q1, Cgu::AsyncQueueDispatch< T, Container > &q2)
template<class T >
bool | operator== (const GobjHandle< T > &h1, const GobjHandle< T > &h2)
template<class T >
bool | operator!= (const GobjHandle< T > &h1, const GobjHandle< T > &h2)
template<class T >
bool | operator< (const GobjHandle< T > &h1, const GobjHandle< T > &h2)
bool | operator== (const GvarHandle &h1, const GvarHandle &h2)
bool | operator!= (const GvarHandle &h1, const GvarHandle &h2)
bool | operator< (const GvarHandle &h1, const GvarHandle &h2)
template<class T >
bool | operator== (const IntrusivePtr< T > &s1, const IntrusivePtr< T > &s2)
template<class T >
bool | operator!= (const IntrusivePtr< T > &s1, const IntrusivePtr< T > &s2)
template<class T >
bool | operator< (const IntrusivePtr< T > &s1, const IntrusivePtr< T > &s2)
guint | start_iowatch (int fd, const Callback::CallbackArg< bool & > *cb, GIOCondition io_condition, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
guint | start_iowatch (int fd, const Callback::CallbackArg< bool & > *cb, Releaser &r, GIOCondition io_condition, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
guint | start_iowatch (int fd, const Callback::CallbackArg< GIOCondition, bool & > *cb, GIOCondition io_condition, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
guint | start_iowatch (int fd, const Callback::CallbackArg< GIOCondition, bool & > *cb, Releaser &r, GIOCondition io_condition, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
template<class F , class = typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<GIOCondition, bool&>*>::value && !std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<bool&>*>::value>::type>
guint | start_iowatch (int fd, F &&func, GIOCondition io_condition, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
template<class F , class = typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<GIOCondition, bool&>*>::value && !std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<bool&>*>::value>::type>
guint | start_iowatch (int fd, F &&func, Releaser &r, GIOCondition io_condition, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
bool | register_prog (const char *prog_name, PresentFunc func, void *object_data=0)
int | present_instance (const char **instance_args=0)
template<class T , class Dealloc >
bool | operator== (const SharedHandle< T, Dealloc > &s1, const SharedHandle< T, Dealloc > &s2)
template<class T , class Dealloc >
bool | operator!= (const SharedHandle< T, Dealloc > &s1, const SharedHandle< T, Dealloc > &s2)
template<class T , class Dealloc >
bool | operator< (const SharedHandle< T, Dealloc > &s1, const SharedHandle< T, Dealloc > &s2)
template<class T , class Dealloc >
bool | operator== (const SharedLockHandle< T, Dealloc > &s1, const SharedLockHandle< T, Dealloc > &s2)
template<class T , class Dealloc >
bool | operator!= (const SharedLockHandle< T, Dealloc > &s1, const SharedLockHandle< T, Dealloc > &s2)
template<class T , class Dealloc >
bool | operator< (const SharedLockHandle< T, Dealloc > &s1, const SharedLockHandle< T, Dealloc > &s2)
template<class T >
bool | operator== (const SharedPtr< T > &s1, const SharedPtr< T > &s2)
template<class T >
bool | operator!= (const SharedPtr< T > &s1, const SharedPtr< T > &s2)
template<class T >
bool | operator< (const SharedPtr< T > &s1, const SharedPtr< T > &s2)
template<class T >
bool | operator== (const SharedLockPtr< T > &s1, const SharedLockPtr< T > &s2)
template<class T >
bool | operator!= (const SharedLockPtr< T > &s1, const SharedLockPtr< T > &s2)
template<class T >
bool | operator< (const SharedLockPtr< T > &s1, const SharedLockPtr< T > &s2)
guint | start_timeout (guint millisec, const Callback::CallbackArg< bool & > *cb, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
guint | start_timeout (guint millisec, const Callback::CallbackArg< bool & > *cb, Releaser &r, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
template<class F , class = typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<bool&>*>::value>::type>
guint | start_timeout (guint millisec, F &&func, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
template<class F , class = typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<bool&>*>::value>::type>
guint | start_timeout (guint millisec, F &&func, Releaser &r, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
guint | start_timeout_seconds (guint sec, const Callback::CallbackArg< bool & > *cb, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
guint | start_timeout_seconds (guint sec, const Callback::CallbackArg< bool & > *cb, Releaser &r, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
template<class F , class = typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<bool&>*>::value>::type>
guint | start_timeout_seconds (guint sec, F &&func, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)
template<class F , class = typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type, const Callback::CallbackArg<bool&>*>::value>::type>
guint | start_timeout_seconds (guint sec, F &&func, Releaser &r, gint priority=G_PRIORITY_DEFAULT, GMainContext *context=0)

## Typedef Documentation

typedef EmitterArg Cgu::Emitter

typedef SafeEmitterArg Cgu::SafeEmitter

## Function Documentation

template<class T , class Container >

void Cgu::swap | ( | Cgu::AsyncQueue< T, Container > & | q1,
|  | Cgu::AsyncQueue< T, Container > & | q2
| ) |  |

Swaps the contents of two AsyncQueue objects. It will not throw assuming that the swap method of the container type does not throw (which the C++11 standard requires not to happen with the standard sequence containers). It is thread safe and the swap is thread-wise atomic.

Parameters

  q1 | An object to be swapped with the other.
  q2 | An object to be swapped with the other.

Note
  Calling std::swap on AsyncQueue objects is thread safe but does not provide a thread-wise atomic swap (the swapped objects may not be mirror images if during the execution of std::swap's default algorithm one of them has been modified), although in many cases that doesn't matter. If swap() is called without a namespace qualifier, argument dependent look-up will pick this one correctly.

Since 2.0.8

template<class T , class Container >

void Cgu::swap | ( | Cgu::AsyncQueueDispatch< T, Container > & | q1,
|  | Cgu::AsyncQueueDispatch< T, Container > & | q2
| ) |  |

Swaps the contents of two AsyncQueueDispatch objects. It will not throw assuming that the swap method of the container type does not throw (which the C++11 standard requires not to happen with the standard sequence containers). It is thread safe and the swap is thread-wise atomic.

Parameters

  q1 | An object to be swapped with the other.
  q2 | An object to be swapped with the other.

Note
  1. An object swapped does not, by virtue of the swap, inherit any threads waiting on the other one. However if threads were waiting on a swapped object prior to the swap, and it acquires items by virtue of the swap, the waiting threads will unblock and extract those items.
  2. Calling std::swap on AsyncQueueDispatch objects is thread safe but does not provide a thread-wise atomic swap (the swapped objects may not be mirror images if during the execution of std::swap's default algorithm one of them has been modified), although in many cases that doesn't matter. If swap() is called without a namespace qualifier, argument dependent look-up will pick this one correctly.

Since 2.0.8