home *** CD-ROM | disk | FTP | other *** search
- #if !defined( _IEXCEPT_ )
- #define _IEXCEPT_
- /****************************************************************/
- /* CLASS NAMES: IExceptionText */
- /* IErrorInfo */
- /* IGUIErrorInfo */
- /* ISystemErrorInfo */
- /* */
- /* DESCRIPTION: These classes are used to obtain exception */
- /* text from a resource file, and error */
- /* information from the last PM or OS/2 error. */
- /* */
- /* Hungarian notation is .... */
- /* */
- /* CHANGE ACTIVITY: */
- /* --------------- */
- /* DATE: INITIAL: DESCRIPTION: */
- /* */
- /* 04/09/92 Kevin Leong Initial Design and Code */
- /* 07/11/92 Bruce Olson Redesign, add assertion support */
- /* and termination model setup. */
- /* 07/26/92 Bruce Olson Move macros to iexcbase.hpp and */
- /* add classes for retrieving info. */
- /* 08/18/92 Bruce Olson Updated comments.. */
- /* */
- /****************************************************************/
- /* Copyright (c) IBM Corporation 1992 */
- /****************************************************************/
-
- #if !defined( _IBASETYP_ )
- #include <ibasetyp.hpp>
- #endif
-
- #include <iexcbase.hpp>
-
- class IResourceId;
-
- /****************************************************************/
- /* Class: IExceptionText */
- /****************************************************************/
- class IExceptionText {
- public:
- /****************************************************************/
- /* Constructor to load the exception text from a resource file. */
- /****************************************************************/
- IExceptionText(const IResourceId& resid);
-
- ~IExceptionText();
-
- /****************************************************************/
- /* Casting operator to return the exception text. */
- /****************************************************************/
- operator const char* () const;
-
- /****************************************************************/
- /* Function to return the exception text. */
- /****************************************************************/
- const char* text() const;
-
- private:
- char* excTextCl;
- IExceptionText(const IExceptionText& exctxt);
- IExceptionText& operator=(const IExceptionText& exctxt);
- };
-
- /****************************************************************/
- /* Class: IErrorInfo - This is a virtual base class. */
- /****************************************************************/
- class IErrorInfo {
- public:
-
- virtual operator const char* () const = 0;
- virtual const char* text() const = 0;
- virtual unsigned long errorId() const = 0;
- virtual Boolean isError() const = 0;
- };
-
-
- /****************************************************************/
- /* Class: IGUIErrorInfo */
- /****************************************************************/
- class IGUIErrorInfo : public IErrorInfo
- {
- public:
- /****************************************************************/
- /* Constructor to obtain the error information from the last */
- /* PM error. If the name of the failing API is passed in, it */
- /* will be prefixed to the error text. */
- /****************************************************************/
- IGUIErrorInfo(const char* GUIFunctionName = 0);
-
- ~IGUIErrorInfo();
-
- /****************************************************************/
- /* Casting operator to return the error text. */
- /****************************************************************/
- operator const char* () const;
-
- /****************************************************************/
- /* Function to return the error text. */
- /****************************************************************/
- const char* text() const;
-
- /****************************************************************/
- /* Function to return the error ID. */
- /****************************************************************/
- unsigned long errorId() const;
-
- /****************************************************************/
- /* Function to indicate if the constructor found error */
- /* information available. */
- /****************************************************************/
- Boolean isError() const;
-
- private:
- void* perrinfoCl;
- char* pszFuncNameTextCl;
- IGUIErrorInfo(const IGUIErrorInfo& errinf);
- IGUIErrorInfo& operator=(const IGUIErrorInfo& errinf);
- };
-
- /****************************************************************/
- /* Class: ISystemErrorInfo */
- /****************************************************************/
- class ISystemErrorInfo : public IErrorInfo {
- public:
- /****************************************************************/
- /* Constructor to obtain the error information from the last */
- /* OS/2 error. If the name of the failing API is passed in, */
- /* it will be prefixed to the error text. */
- /****************************************************************/
- ISystemErrorInfo(unsigned long systemErrorId,
- const char* systemFunctionName = 0);
-
- ~ISystemErrorInfo();
-
- /****************************************************************/
- /* Casting operator to return the error text. */
- /****************************************************************/
- operator const char* () const;
-
- /****************************************************************/
- /* Function to return the error text. */
- /****************************************************************/
- const char* text() const;
-
- /****************************************************************/
- /* Function to return the error ID. */
- /****************************************************************/
- unsigned long errorId() const;
-
- /****************************************************************/
- /* Function to indicate if the constructor found error */
- /* information available. */
- /****************************************************************/
- Boolean isError() const;
-
- private:
- unsigned long ulClSystemErrorId;
- char* pszClErrorText;
- ISystemErrorInfo(const ISystemErrorInfo& errinf);
- ISystemErrorInfo& operator=(const ISystemErrorInfo& errinf);
- };
-
-
- #endif /* _IEXCEPT_ */