OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TXOwl Class Reference

TXOwl is root class of the ObjectWindows exception hierarchy. More...

#include <owl/except.h>

Inheritance diagram for owl::TXOwl:
owl::TXBase owl::TTransferBufferWindowBase::TXFieldConflict owl::TTransferBufferWindowBase::TXMeddlingValidator owl::TTransferBufferWindowBase::TXPolygamousControl owl::TTransferBufferWindowBase::TXUnboundControl owl::TXBadFormat owl::TXClipboard owl::TXCommCtrl owl::TXGdi owl::TXInvalidMainWindow owl::TXInvalidModule owl::TXMenu owl::TXModuleVersionInfo owl::TXNotSupportedCall owl::TXOutOfMemory owl::TXPrinter owl::TXPrinting owl::TXRegistry owl::TXShell owl::TXTheme owl::TXValidator owl::TXWindow

Public Member Functions

 TXOwl (const tstring &msg, uint resId=0)
 An OWL exception with a given message for displaying and an unsigned Id that can be used for identification or loading a string.
 
 TXOwl (uint resId, TModule *module=&GetGlobalModule())
 An OWL exception with a given unsigned Id that can is used for loading a message string & identification.
 
virtual ~TXOwl ()
 Destroys a TXOwl object.
 
TXOwlClone ()
 
void Throw ()
 Throws the exception object.
 
virtual int Unhandled (TModule *appModule, uint promptResId)
 Per-exception class unhandled-handler, will default to the per-module unhandled-handler.
 
uint GetErrorCode () const
 Returns the resource ID.
 
- Public Member Functions inherited from owl::TXBase
 TXBase (const tstring &msg)
 Calls the xmsg class's constructor that takes a string parameter and initializes xmsg with the value of the string parameter.
 
 TXBase (const TXBase &src)
 Creates a copy of the TXBase object passed in the TXBase parameter.
 
virtual ~TXBase ()
 
const charwhat () const noexcept
 
TXBase &_RTLENTRY operator= (const TXBase &src)
 
tstring why () const
 

Static Public Member Functions

static tstring ResourceIdToString (bool *found, uint resId, TModule *module=&GetGlobalModule())
 Static member function used to convert a resource id to a 'string'.
 
static tstring MakeMessage (uint resId, const tstring &infoStr, TModule *module=&GetGlobalModule())
 
static tstring MakeMessage (uint resId, LPCTSTR infoStr, TModule *module=&GetGlobalModule())
 Extension to string loader adds the feature of sprintf'ing an additional information string into the resource message string.
 
static tstring MakeMessage (uint resId, uint infoNum, TModule *module=&GetGlobalModule())
 This extension to the string loader adds the feature of sprintf'ing an additional information string into the resource message string.
 
static void Raise (const tstring &msg, uint resId=0)
 
static void Raise (uint resId, TModule *module=&GetGlobalModule())
 
- Static Public Member Functions inherited from owl::TXBase
static void Raise (const tstring &msg)
 Constructs a TXBase exception from scratch, and throws it.
 

Public Attributes

uint ResId
 Resource ID for a TXOwl object.
 

Additional Inherited Members

- Protected Attributes inherited from owl::TXBase
std::string str
 

Detailed Description

TXOwl is root class of the ObjectWindows exception hierarchy.

TXOwl is a parent class for several classes designed to describe exceptions.

In most cases, you derive a new class from TXOwl instead of using this one directly. The ObjectWindows classes derived from TXOwl include

  • TXCompatibility Describes an exception that occurs if TModule::Status is not zero
  • TXValidator Describes an exception that occurs if there is an invalid validator expression
  • TXWindow Describes an exception that results from trying to create an invalid window
  • TXGdi Describes an exception that results from creating an invalid GDI object
  • TXInvalidMainWindow Describes an exception that results from creating an invalid main window
  • TXMenu Describes an exception that occurs when a menu object is invalid
  • TXInvalidModule Describes an exception that occurs if a TModule object is invalid
  • TXPrinter Describes an exception that occurs if a printer device context is invalid
  • TXOutOfMemory Describes an exception that occurs if an out of memory error occurs

Each of the exception classes describes a particular type of exception. When your program encounters a given situation that's likely to produce this exception, it passes control to the specified exception-handling object. If you use exceptions in your code, you can avoid having to scatter error-handling procedures throughout your program.

To create an exception handler, place the keyword try before the block of code that might produce the abnormal condition (the code that might generate an exception object) and the keyword catch before the block of code that follows the try block. If an exception is thrown within the try block, the classes within each of the subsequent catch clauses are checked in sequence. The first one that matches the class of the exception object is executed.

The following example from MDIFILE.CPP, a sample program on BC5.0x distribution disk, shows how to set up a try/catch block around the code that might throw an exception.

void TMDIFileApp::CmRestoreState()
{
char* errorMsg = 0;
if (is.bad())
errorMsg = "Unable to open desktop file.";
// try block of code //
else {
if (Client->CloseChildrenParen) {
try {
is >>* this;
if (is.bad())
errorMsg = "Error reading desktop file.";
else
Client->CreateChildren();
}
// catch block of code //
catch (xalloc) {
Client->CloseChildren();
errorMsg = "Not enough memory to open file.";
}
}
}
if (errorMsg)
MainWindow->MessageBox(errorMsg, "Error",
}
ifpstream is a simple "mix" of its bases, fpbase and ipstream.
Definition objstrm.h:574

Definition at line 38 of file except.h.


The documentation for this class was generated from the following files: