/*
 * Jakelib2 - General purpose C++ library
 * Copyright (C) 2001 Florian Wolff  (florian@donuz.de)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: Exception.h,v 1.35 2003/02/17 23:27:20 alfa Exp $
 */

#ifndef INCLUDE_JAKELIB2_LANG_EXCEPTION_H
# define INCLUDE_JAKELIB2_LANG_EXCEPTION_H
#include "Throwable.h"

namespace jakelib {
  namespace lang {

    /**
     * \c Exception is the base class of all exceptions thrown from
     * within Jakelib.
     *
     * \c Exceptions should always be thrown and caught 'by value' like this:
     * \code
     * try {
     *   ...
     *   throw Exception();
     *   ...
     * }
     * catch (Exception &e) {
     *   ...
     * }
     * \endcode
     *
     * @class Exception
     * @version $Id: Exception.h,v 1.35 2003/02/17 23:27:20 alfa Exp $
     * @author Florian 'Overflo' Wolff (florian@donuz.de)
     */
    class Exception : public Throwable
      {
      public:
	Exception(String* msg = null);
  
        /**
         * @brief Called by \c Object::initJakelib2().
         * Do not use otherwise.
         */
        static void initExceptionClass();

	JAKELIB_DECLARE_CLASS(Exception);
      };


    /*****************************************************************************\
     * IndexOutOfBoundsException                                                  |
     *****************************************************************************/
    class IndexOutOfBoundsException : public Exception
      {
      public:
	IndexOutOfBoundsException(String* msg = null);

	JAKELIB_DECLARE_CLASS(IndexOutOfBoundsException);
      };


    /*****************************************************************************\
     * ArrayIndexOutOfBoundsException                                             |
     *****************************************************************************/
    class ArrayIndexOutOfBoundsException : public IndexOutOfBoundsException
      {
      public:
	ArrayIndexOutOfBoundsException(String* msg);

	JAKELIB_DECLARE_CLASS(ArrayIndexOutOfBoundsException);
      };

     /*****************************************************************************\
     * StringIndexOutOfBoundsException                                             |
     *****************************************************************************/
    class StringIndexOutOfBoundsException : public IndexOutOfBoundsException
      {
      public:
	StringIndexOutOfBoundsException(String* msg);

	JAKELIB_DECLARE_CLASS(StringIndexOutOfBoundsException);
      };

    /*****************************************************************************\
     * IllegalArgumentException                                                   |
     *****************************************************************************/
    class IllegalArgumentException : public Exception
      {
      public:
	IllegalArgumentException(String* msg = null);

	JAKELIB_DECLARE_CLASS(IllegalArgumentException);
      };


    /*****************************************************************************\
     * MemoryException                                                            |
     *****************************************************************************/
    class MemoryException : public Exception
      {
      public:
	MemoryException(String* msg = null);

	JAKELIB_DECLARE_CLASS(MemoryException);
      };

     /*****************************************************************************\
     * MemoryException                                                            |
     *****************************************************************************/
    class MissingResourceException : public Exception
      {
      public:
	MissingResourceException(String* msg = null);

	JAKELIB_DECLARE_CLASS(MissingResourceException);
      };

    /*****************************************************************************\
     * MemoryException                                                            |
     *****************************************************************************/
    class ConcurrentModificationException : public Exception
      {
      public:
	ConcurrentModificationException(String* msg = null);

	JAKELIB_DECLARE_CLASS(ConcurrentModificationException);
      };

    /*****************************************************************************\
     * NullPointerException                                                       |
     *****************************************************************************/
    class NullPointerException : public Exception
      {
      public:
	NullPointerException(String* msg = null);

	JAKELIB_DECLARE_CLASS(NullPointerException);
      };


    /*****************************************************************************\
     * IllegalThreadStateException                                                |
     *****************************************************************************/
    class IllegalThreadStateException : public IllegalArgumentException
      {
      public:
	IllegalThreadStateException(String* msg = null);

	JAKELIB_DECLARE_CLASS(IllegalThreadStateException);
      };


    /*****************************************************************************\
     * IllegalMonitorStateException                                               |
     *****************************************************************************/
    class IllegalMonitorStateException : public Exception
      {
      public:
	IllegalMonitorStateException(String* msg = null);

	JAKELIB_DECLARE_CLASS(IllegalMonitorStateException);
      };


    /*****************************************************************************\
     * UnsupportedOperationException                                              |
     *****************************************************************************/
    class UnsupportedOperationException : public Exception
      {
      public:
	UnsupportedOperationException(String* msg = null);

	JAKELIB_DECLARE_CLASS(UnsupportedOperationException);
      };


    /*****************************************************************************\
     * NoSuchElementException                                                     |
     *****************************************************************************/
    class NoSuchElementException : public Exception
      {
      public:
	NoSuchElementException(String* msg = null);

	JAKELIB_DECLARE_CLASS(NoSuchElementException);
      };


    /*****************************************************************************\
     * NumberFormatException                                                      |
     *****************************************************************************/
    class NumberFormatException : public IllegalArgumentException
      {
      public:
	NumberFormatException(String* msg = null);

	JAKELIB_DECLARE_CLASS(NumberFormatException);
      };


    /*****************************************************************************\
     * IllegalStateException                                                      |
     *****************************************************************************/
    class IllegalStateException : public Exception
      {
      public:
	IllegalStateException(String* msg = null);

	JAKELIB_DECLARE_CLASS(IllegalStateException);
      };


    /*****************************************************************************\
     * CloneNotSupportedException                                                 |
     *****************************************************************************/
    class CloneNotSupportedException : public Exception
      {
      public:
	CloneNotSupportedException(String* msg = null);

	JAKELIB_DECLARE_CLASS(CloneNotSupportedException);
      };
  }
}

// "\n     at "
//static jchar *chars_jakelib2_exception_0001;
extern jakelib::lang::String* jakelib2_exception_0001;
// "("
//static jchar *chars_jakelib2_exception_0002;
extern jakelib::lang::String* jakelib2_exception_0002;
// ":"
//static jchar *chars_jakelib2_exception_0003;
extern jakelib::lang::String* jakelib2_exception_0003;
// ")"
//static jchar *chars_jakelib2_exception_0004;
extern jakelib::lang::String* jakelib2_exception_0004;

#endif

