OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
except.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1993, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// ObjectWindows exception class & function definitions
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_EXCEPT_H)
10#define OWL_EXCEPT_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/private/except.h>
18#include <owl/exbase.h>
19#include <owl/private/gmodule.h>
20#include <owl/except.rh>
21
22namespace owl {
23
24#include <owl/preclass.h>
25
26
27//
28// Global function to handle exceptions in OWL as a last resort
29//
31
32/// \addtogroup except
33/// @{
34/// \class TXOwl
35// ~~~~~ ~~~~~
36/// TXOwl is root class of the ObjectWindows exception hierarchy.
37//
38class _OWLCLASS TXOwl : public TXBase {
39 public:
40 TXOwl(const tstring& msg, uint resId = 0);
41 TXOwl(uint resId, TModule* module = &GetGlobalModule());
42 virtual ~TXOwl();
43
44 // Override TXBase's virtuals
45 //
46 TXOwl* Clone();
47 void Throw();
48
49 /// Per-exception class unhandled-handler, will default to the per-module
50 /// unhandled-handler
51 //
52 virtual int Unhandled(TModule* appModule, uint promptResId);
53
54 uint GetErrorCode() const;
55
56 static tstring ResourceIdToString(bool* found, uint resId,
57 TModule* module = &GetGlobalModule());
58 static tstring MakeMessage(uint resId, const tstring& infoStr, TModule* module = &GetGlobalModule());
59 static tstring MakeMessage(uint resId, LPCTSTR infoStr, TModule* module = &GetGlobalModule());
60#if defined(UNICODE)
61 static tstring MakeMessage(uint resId, LPCSTR infoStr, TModule* module = &GetGlobalModule());
62#endif
63 static tstring MakeMessage(uint resId, uint infoNum, TModule* module = &GetGlobalModule());
64
65 static void Raise(const tstring& msg, uint resId = 0);
66 static void Raise(uint resId, TModule* module = &GetGlobalModule());
67
68 public:
69/// Resource ID for a TXOwl object.
71};
72
73//
74/// \class TXOutOfMemory
75// ~~~~~ ~~~~~~~~~~~~~
76/// Describes an exception that results from running out of memory.
77//
79 public:
81
82 TXOutOfMemory* Clone();
83 void Throw();
84
85 static void Raise();
86};
87
88//
89/// \class TXNotSupportedCall
90// ~~~~~ ~~~~~~~~~~~~~~~~~~
92 public:
94
95 TXNotSupportedCall* Clone();
96 void Throw();
97
98 static void Raise();
99};
100
101
102//
103/// \class TXEndSession
104// ~~~~~ ~~~~~~~~~~~~
105/// TXEndSession is thrown from TWindow's handler for WM_ENDSESSION.
106/// Since it is not derived from TXOwl, it does not fall into the same
107/// catch handler.
108/// It is used exclusively for shutting down the application.
109//
110
112 public:
114};
115
116
117
118#include <owl/posclass.h>
119
120//
121/// Returns the resource ID.
122//
123inline uint TXOwl::GetErrorCode() const {
124 return ResId;
125}
126
127} // OWL namespace
128
129
130#endif // OWL_EXCEPT_H
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
Derived from xmsg, TXBase is the base class for ObjectWindows and ObjectComponents exception-handling...
Definition exbase.h:41
TXEndSession is thrown from TWindow's handler for WM_ENDSESSION.
Definition except.h:111
Describes an exception that results from running out of memory.
Definition except.h:78
TXOwl is root class of the ObjectWindows exception hierarchy.
Definition except.h:38
Base exception support for framework exceptions.
uint GetErrorCode() const
Returns the resource ID.
Definition except.h:123
uint ResId
Resource ID for a TXOwl object.
Definition except.h:70
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
int HandleGlobalException(owl::TXBase &x, LPCTSTR caption, LPCTSTR canResume=nullptr)
Definition except.cpp:29
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
TModule & GetGlobalModule()
Definition global.cpp:48
#define _OWLFUNC(p)
Definition defs.h:341
#define _OWLCLASS
Definition defs.h:338
#define _OWLCLASS_RTL
Definition defs.h:339