Programming Guide: Appendix E. Sample Utilities

# Programming Guide

# Appendix E. Sample Utilities

Complete C++ source is provided for the sample utilities. This allows the part programmer to use them with any C++ compiler, extend or modify them, and port them to other languages. The source code is hoped to be self-documenting.

The source for the sample utilities can be found in the UTILS subdirectory. A makefile is provided to build the sample utilities into a library and the sample parts link with this library.

The following sample utilities are provided:

- ALTPOINT provides C++ class versions of the standard OpenDoc types of ODPoint, ODRect, and ODToolSpaceRect.

- ALTPOLY provides C++ class versions of the standard OpenDoc types of ODPolygon, ODContour, ODPolygonData, and ODTempPolygon. It also contains a helper class PolyEdgeIterator.

- ODEXCEPT provides macros, functions and a C++ class that help with the implementation of exceptions. This utility is documented in the recipe "Exception Handling".

- FOCUSLIB provides C++ class that reduces the amount of code that needs to be written in the ODPart::Draw method. Focuslib provides methods that setup and cleanup a GPI HPS using the shape and clipping information from OpenDoc. See "FocusLib Utility" for more information.

- LINEOPS provides geometric operations on lines in 2-D space.

- ODDEBUG provides sample debugging utilities, for assertions, safe type-casting and logging.

- ODUTILS provides macros and functions for use particularly with reference-counted objects.

- TEMPOBJ provides C++ template classes for exception-safe temporary object references. TempObj and TempRef are simple template classes that act as a transparent wrapper around an OpenDoc object pointer. The temp object can be used wherever a pointer to the object would be used. When the temp object goes out of scope, the object it wraps will be deleted (in the case of TempObj) or released (in the case of TempRef). This includes the case where an exception is thrown; the wrapper is exception-safe. This utility is documented in the recipe "Temporary References and Objects".

[ Top | Previous | Next | Contents | Index | Documentation Homepage ]