home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IBEXCTXT.H
< prev
next >
Wrap
Text File
|
1993-09-22
|
4KB
|
88 lines
/*******************************************************************************
* *
* COPYRIGHT: *
* IBM C/C++ Tools Version 2.01 - Collection Class Library *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IBEXCTXT_H
#define _IBEXCTXT_H
#include <ibexcdef.h>
#include <imsgtext.hpp>
/* The following is the ExceptionText class used to load a text
* string from the resource file.
*/
class IBExceptionText {
/*******************************************************************************
* This class loads exception text from a resource file. *
* *
* Typically an instance of this class is created when an error condition has *
* been detected, and an exception is going to be thrown. The exception text *
* can be used to construct an IException subclass instance. *
* *
* EXAMPLE: *
* *
* int bSuccess = someFunction(); *
* if (!bSuccess) *
* { *
* IBExceptionText myTxt(IC_PARTICULAR_ERROR); *
* IInvalidRequest exc(myTxt, IC_SOMEFUNCTIONFAIL, 0); *
* ITHROW(exc); *
* } *
* *
*******************************************************************************/
public:
IBExceptionText ( unsigned long resourceId );
~IBExceptionText ( );
/*-------------------------------- ACCESSORS -----------------------------------
| The following conversion operator and function provide means of getting the |
| exception text from instances of this class: |
| const char* - Returns the exception text. |
| text - Returns the exception text. |
------------------------------------------------------------------------------*/
operator const char* () const;
const char*
text ( ) const;
private:
/*--------------------------------- PRIVATE ----------------------------------*/
IMessageText * ivMsgTxt;
};
inline IBExceptionText::~IBExceptionText ( )
/****************************************************************/
/* */
/****************************************************************/
{
delete ivMsgTxt;
}
inline IBExceptionText::operator const char* () const
/****************************************************************/
/* */
/****************************************************************/
{
return ivMsgTxt->text();
}
inline const char* IBExceptionText::text ( ) const
/****************************************************************/
/* */
/****************************************************************/
{
return ivMsgTxt->text();
}
#endif