OSDN Git Service

Add facility for control of child window placement.
[mingw/wtklite.git] / wtkexcept.h
1 #ifndef WTKEXCEPT_H
2 /*
3  * wtkexcept.h
4  *
5  * ---------------------------------------------------------------------------
6  *
7  * Implementation of a minimal C++ class framework for use with the
8  * Microsoft Windows Application Programming Interface.
9  *
10  * $Id$
11  *
12  * This header file declares the exception class WTK::runtime_error.
13  * It is implicitly included when including wtklite.h, but may also be
14  * explicitly included by any application which wishes to use the WTK
15  * exception class, without the rest of the WTK C++ class framework.
16  *
17  * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
18  * Copyright (C) 2012, MinGW.org Project.
19  *
20  * Based on the implementation of mingw-get's dmh_exception class
21  * Originally written by Charles Wilson <cwilso11@users.sourceforge.net>
22  *
23  * ---------------------------------------------------------------------------
24  *
25  * Permission is hereby granted, free of charge, to any person obtaining a
26  * copy of this software and associated documentation files (the "Software"),
27  * to deal in the Software without restriction, including without limitation
28  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
29  * and/or sell copies of the Software, and to permit persons to whom the
30  * Software is furnished to do so, subject to the following conditions:
31  *
32  * The above copyright notice, this permission notice, and the following
33  * disclaimer shall be included in all copies or substantial portions of
34  * the Software.
35  *
36  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
37  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
39  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
42  * DEALINGS IN THE SOFTWARE.
43  *
44  * ---------------------------------------------------------------------------
45  *
46  */
47 #define WTKEXCEPT_H  1
48
49 /* This header file is primarily intended to be used only for C++.  However,
50  * configure scripts may try to compile it as C, when checking availability;
51  * thus, we ignore C++ specific content when compiling as C, to ensure that
52  * configure doesn't choke in such cases.
53  */
54 #ifdef __cplusplus
55
56 #include <exception>
57
58 namespace WTK
59 {
60   class runtime_error: public std::exception
61   {
62     /* An exception class, similar to std::runtime_error, but using
63      * a "const char *" rather than a "std::string" to categorise and
64      * describe the exception.
65      */
66     public:
67       runtime_error() throw();
68       runtime_error( const char * ) throw();
69       virtual const char *what() const throw();
70       virtual ~runtime_error() throw(){}
71
72     protected:
73       const char *message;
74   };
75
76   class error_text
77   {
78     /* A helper class to dynamically place message text, up to a
79      * maximum of 256 characters, into a static buffer whence it
80      * may be retrieved on catching a runtime_error exception.
81      */
82     public:
83       error_text( const char *, ... ) throw();
84       operator const char *() const throw(){ return message; }
85
86     private:
87       static char message[256];
88   };
89 }
90
91 #endif /* __cplusplus */
92 #endif /* ! WTKEXCEPT_H: $RCSfile$: end of file */