home *** CD-ROM | disk | FTP | other *** search
- // Methods for Exception Support for -*- C++ -*-
- // Copyright (C) 1994 Free Software Foundation
-
- // This file is part of the GNU ANSI C++ Library. This library is free
- // software; you can redistribute it and/or modify it under the
- // terms of the GNU General Public License as published by the
- // Free Software Foundation; either version 2, or (at your option)
- // any later version.
-
- // This library is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
-
- // You should have received a copy of the GNU General Public License
- // along with GNU CC; see the file COPYING. If not, write to
- // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
- // As a special exception, if you link this library with files
- // compiled with a GNU compiler to produce an executable, this does not cause
- // the resulting executable to be covered by the GNU General Public License.
- // This exception does not however invalidate any other reasons why
- // the executable file might be covered by the GNU General Public License.
-
- // Written by Mike Stump based upon the specification in the 20 September 1994
- // C++ working paper, ANSI document X3J16/94-0158.
-
- #ifndef __exception__
- #define __exception__
- /* #include <string> */
-
- typedef char *string;
-
- class exception {
- public:
- typedef void (*raise_handler)(exception&);
- static raise_handler set_raise_handler(raise_handler handler_arg);
- exception(const string& what_arg);
- virtual ~exception() { }
- void raise();
- virtual string what() const { return "exception"; }
- protected:
- exception() { }
- virtual void do_raise() { }
- };
-
- class logic : public exception {
- public:
- logic(const string& what_arg) { }
- virtual ~logic() { }
- /* XXX Remove this sometime. */
- logic() { }
- };
-
- class runtime : public exception {
- public:
- runtime(const string& what_arg) { }
- virtual ~runtime() { }
- protected:
- runtime();
- };
-
- class bad_cast : public logic {
- public:
- bad_cast(const string& what_arg);
- virtual ~bad_cast() { }
- virtual string what() const { return "bad_cast"; }
-
- /* XXX Remove this sometime. */
- bad_cast() { }
- };
-
- extern bad_cast __bad_cast_object;
- #endif
-