source: trunk/include/cppbase/bs_errors.h

Last change on this file was 250, checked in by umoeller, 23 years ago

Build updates, moved files from warpin.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1
2/*
3 * bs_errors.h:
4 * this declares a number of C++ exception classes which
5 * are used throughout WarpIN for a more flexible error
6 * handling. Some of the more complex constructors are
7 * implemented in warpin.cpp.
8 *
9 * All exception classes are derived from BSExcptBase, so
10 * you can always catch BSExcptBase too. main() in warpin.cpp
11 * catches those exceptions, so if you don't, main() will.
12 *
13 *@@include #include "base\bs_string.h"
14 */
15
16/*
17 * This file Copyright (C) 1999-2002 Ulrich M”ller.
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation, in version 2 as it comes in the COPYING
21 * file of this distribution.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 */
27
28#ifndef WARPIN_ERRORS_HEADER_INCLUDED
29 #define WARPIN_ERRORS_HEADER_INCLUDED
30
31 /*
32 *@@ BSExcptBase:
33 * exception base class, from which all other exception
34 * classes are derived.
35 *
36 *@@changed V0.9.18 (2002-03-08) [umoeller]: now using ustring
37 */
38
39 class BSExcptBase
40 {
41 public:
42 ustring _ustrDescription; // UTF-8!
43
44 protected:
45 BSExcptBase() { };
46
47 public:
48 BSExcptBase(const char *pcsz)
49 {
50 _ustrDescription.assignUtf8(pcsz);
51 };
52 };
53
54 /*
55 *@@ BSCancelExcpt:
56 * dummy exception class which can be thrown by anything,
57 * and WarpIN will terminate itself.
58 * This is caught only by main(), so this is a quick way
59 * to exit WarpIN from anywhere.
60 *
61 *@@changed V0.9.0 (99-11-06) [umoeller]: renamed from CancelExcpt
62 */
63
64 class BSCancelExcpt : public BSExcptBase
65 {
66 };
67
68 /*
69 *@@ BSUnsupportedCPExcpt:
70 *
71 *@@added V0.9.18 (2002-03-08) [umoeller]
72 */
73
74 class BSUnsupportedCPExcpt : public BSExcptBase
75 {
76 public:
77 unsigned short _usCodepage;
78
79 BSUnsupportedCPExcpt(unsigned short usCodepage)
80 : _usCodepage(usCodepage)
81 {
82 _ustrDescription._printf("Unsupported codepage %u", usCodepage);
83 }
84 };
85
86#endif
87
Note: See TracBrowser for help on using the repository browser.