Main Page   Compound List   File List   Compound Members   File Members   Related Pages  

AutoNSExceptionHandler Class Reference

#include <NSXException.h>

List of all members.


Detailed Description

Scope-aware C++ wrapper for NSException's _NSHandler2.

_NSHandlers are installed via _NSAddHandler2() and removed via _NSRemoveHandler2 -- they maintain the setjmp context buffer and allow access to it later on down the call chain. The last NSHandler installed is removed from the thread and longjmp()'d to when a NSException is raised. If an exception is not raised, then the _NSHandler2 must be manually removed.

This class wraps _NSHandler2 into a scope-aware C++ class, allowing automated installation and removal (and avoiding the need for the NS_[VOID|VALUE]RETURN hack).

Definition at line 162 of file NSXException.h.

Public Methods

 AutoNSExceptionHandler ()
 Constructor installs a local _NSHandler2.

 ~AutoNSExceptionHandler ()
 Destructor removes the local _NSHandle2 if it wasn't already removed by an exception being raised.

NSException * localException ()
 Returns the ObjC NSException object that was raised.


Constructor & Destructor Documentation

AutoNSExceptionHandler::AutoNSExceptionHandler   [inline]
 

Constructor installs a local _NSHandler2.

Definition at line 165 of file NSXException.h.

AutoNSExceptionHandler::~AutoNSExceptionHandler   [inline]
 

Destructor removes the local _NSHandle2 if it wasn't already removed by an exception being raised.

Definition at line 172 of file NSXException.h.


Member Function Documentation

NSException* AutoNSExceptionHandler::localException   [inline]
 

Returns the ObjC NSException object that was raised.

Always use this to retrieve the exception object, as it notes an exception was raised and remembers not to try to remove the local handler it previously installed.

Definition at line 182 of file NSXException.h.


The documentation for this class was generated from the following file:
Generated on Wed Mar 5 09:57:47 2003 for TempFile by doxygen1.2.17