/** -*- C++ -*-
 **
 **  KAI C++ Compiler
 **
 **  Copyright (C) 1996-1999, Kuck & Associates, Inc. All rights reserved.
 **/
/**
 ** Lib++     : The Modena C++ Standard Library,
 **             Version 1.9, May 1996
 **
 ** Copyright (c) 1994-1996 Modena Software Inc.
 **/
#ifndef __KAI_STDEXCEPT
#define __KAI_STDEXCEPT

#include <mcompile.h>
#include <exception>

namespace std {

// 
// Forward declaration for string types.
//
template <class T> class allocator; 
template <class charT> class char_traits;
template <class charT, class traits, class Allocator> class basic_string;
typedef  basic_string<char, char_traits<char>, allocator<char> > string;


class logic_error : public exception {
    char *str;
public :
    logic_error() : str("") { }
    logic_error(const string& what_arg);
    logic_error(const char *what_arg);
    virtual const char* what() const MSIPL_THROW;
};

class domain_error : public logic_error {
public :
    domain_error(const string& what_arg) : logic_error(what_arg) { }
    domain_error(const char * what_arg) : logic_error(what_arg) { }
    static void __throw( const char* what_arg );
};

class invalid_argument : public logic_error {
public :
    invalid_argument(const string& what_arg) : logic_error(what_arg) { }
    invalid_argument(const char * what_arg) : logic_error(what_arg) { }
    static void __throw( const char* what_arg );
};

class length_error : public logic_error {
public :
    length_error(const string& what_arg) : logic_error(what_arg) { }
    length_error(const char * what_arg) : logic_error(what_arg) { }
    static void __throw( const char* what_arg );
};

class out_of_range : public logic_error {
public :
    out_of_range(const string& what_arg) : logic_error(what_arg) { }
    out_of_range(const char * what_arg) : logic_error(what_arg) { }
    static void __throw( const char* what_arg );
};

class runtime_error : public exception {
    char *str;
public :
    runtime_error(const char * what_arg);
    runtime_error(const string& what_arg);
    virtual const char* what() const MSIPL_THROW;
    static void __throw(const char* what_arg);
protected :
    runtime_error() : exception(), str("") { }
};

class range_error : public runtime_error {
public :
    range_error (const string& what_arg) : runtime_error(what_arg) { }
};

class overflow_error : public runtime_error {
public :
    overflow_error(const char * what_arg) : runtime_error(what_arg) { }
    overflow_error (const string& what_arg) : runtime_error(what_arg) { }
    static void __throw( const char* what_arg );
};

class underflow_error : public runtime_error {
public :
    underflow_error (const string& what_arg) : runtime_error (what_arg) { }
};

} /* namespace std */

#endif /* __KAI_STDEXCEPT */
