Support Classes

There are several support classes which are used by YAAF to encapsulate different basic data structures. These routines provide a portable way to manage different simple types, such as strings, string arrays, variable length arrays of classes and handles.

Handles

There are two classes which are used for managing "handles." For those who don't know, a handle is a Macintosh and Windows memory object, like a pointer, which can be resized. Unlike a pointer, however, a handle is maintained by reference, and can be resized without having to reinitialize the pointer. Handle objects are emulated by YAAF, and a full range of methods are used to encapsulate 'locking' and dereferencing them. Handles are used by YAAF to provide a simplified alternative to memory-based variable-sized files.

> XGHandle

> > The encapsulation of a handle object.

> XGHandleLock

> > A simple stack-based class which provides locking/unlocking semantics for an XGHandle.

Strings and String Lists

Strings and string lists are maintained by YAAF using two special classes.

> XGString

> > Maintains a single C style string.

> XGStringList

> > Maintains an array of C format strings. This also provides a mechanism for associating a small fixed-sized record with each C string, and is used extensively by the X Windows menu management code to store menus.

Dynamic Arrays

There are three templates used to maintain dynamically resizable arrays. These three templates provide different levels of dynamic resizable arrays, depending on what is being stored.

> XGDynArray

> > Maintains a dynamic resizable array for generic C++ objects. Each object must have a default constructor and a copy operator to work.

> XGSDynArray

> > For structures, basic types (such as long) and objects which can be copied using memory copy, use XGSDynArray. This template takes less space to expand than XGDynArray.

> XGPDynArray

> > This maintains an array of pointers to objects.

Exception Safe Pointers

This template provides exception-safe pointers to objects; this pointer will automatically delete it's contents if it was initialized with a pointer, and can be used for storing a pointer to a constructed object without fear of leaking memory when an exception is received.

> autoptr

> > A template class which defines a pointer to a particular class.