xref: /minix3/external/bsd/libc++/dist/libcxxrt/src/stdexcept.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
14684ddb6SLionel Sambuc /*
24684ddb6SLionel Sambuc  * Copyright 2010-2011 PathScale, Inc. All rights reserved.
34684ddb6SLionel Sambuc  *
44684ddb6SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
54684ddb6SLionel Sambuc  * modification, are permitted provided that the following conditions are met:
64684ddb6SLionel Sambuc  *
74684ddb6SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright notice,
84684ddb6SLionel Sambuc  *    this list of conditions and the following disclaimer.
94684ddb6SLionel Sambuc  *
104684ddb6SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright notice,
114684ddb6SLionel Sambuc  *    this list of conditions and the following disclaimer in the documentation
124684ddb6SLionel Sambuc  *    and/or other materials provided with the distribution.
134684ddb6SLionel Sambuc  *
144684ddb6SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
154684ddb6SLionel Sambuc  * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
164684ddb6SLionel Sambuc  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
174684ddb6SLionel Sambuc  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
184684ddb6SLionel Sambuc  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
194684ddb6SLionel Sambuc  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
204684ddb6SLionel Sambuc  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
214684ddb6SLionel Sambuc  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
224684ddb6SLionel Sambuc  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
234684ddb6SLionel Sambuc  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
244684ddb6SLionel Sambuc  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
254684ddb6SLionel Sambuc  */
264684ddb6SLionel Sambuc 
274684ddb6SLionel Sambuc /**
284684ddb6SLionel Sambuc  * stdexcept.h - provides a stub version of <stdexcept>, which defines enough
294684ddb6SLionel Sambuc  * of the exceptions for the runtime to use.
304684ddb6SLionel Sambuc  */
314684ddb6SLionel Sambuc 
324684ddb6SLionel Sambuc namespace std
334684ddb6SLionel Sambuc {
344684ddb6SLionel Sambuc 
354684ddb6SLionel Sambuc 	class exception
364684ddb6SLionel Sambuc 	{
374684ddb6SLionel Sambuc 	public:
384684ddb6SLionel Sambuc 		exception() throw();
394684ddb6SLionel Sambuc 		exception(const exception&) throw();
404684ddb6SLionel Sambuc 		exception& operator=(const exception&) throw();
414684ddb6SLionel Sambuc 		virtual ~exception();
424684ddb6SLionel Sambuc 		virtual const char* what() const throw();
434684ddb6SLionel Sambuc 	};
444684ddb6SLionel Sambuc 
454684ddb6SLionel Sambuc 
464684ddb6SLionel Sambuc 	/**
474684ddb6SLionel Sambuc 	 * Bad allocation exception.  Thrown by ::operator new() if it fails.
484684ddb6SLionel Sambuc 	 */
494684ddb6SLionel Sambuc 	class bad_alloc: public exception
504684ddb6SLionel Sambuc 	{
514684ddb6SLionel Sambuc 	public:
524684ddb6SLionel Sambuc 		bad_alloc() throw();
534684ddb6SLionel Sambuc 		bad_alloc(const bad_alloc&) throw();
544684ddb6SLionel Sambuc 		bad_alloc& operator=(const bad_alloc&) throw();
554684ddb6SLionel Sambuc 		~bad_alloc();
564684ddb6SLionel Sambuc 		virtual const char* what() const throw();
574684ddb6SLionel Sambuc 	};
584684ddb6SLionel Sambuc 
594684ddb6SLionel Sambuc 	/**
604684ddb6SLionel Sambuc 	 * Bad cast exception.  Thrown by the __cxa_bad_cast() helper function.
614684ddb6SLionel Sambuc 	 */
624684ddb6SLionel Sambuc 	class bad_cast: public exception {
634684ddb6SLionel Sambuc 	public:
644684ddb6SLionel Sambuc 		bad_cast() throw();
654684ddb6SLionel Sambuc 		bad_cast(const bad_cast&) throw();
664684ddb6SLionel Sambuc 		bad_cast& operator=(const bad_cast&) throw();
674684ddb6SLionel Sambuc 		virtual ~bad_cast();
684684ddb6SLionel Sambuc 		virtual const char* what() const throw();
694684ddb6SLionel Sambuc 	};
704684ddb6SLionel Sambuc 
714684ddb6SLionel Sambuc 	/**
724684ddb6SLionel Sambuc 	 * Bad typeidexception.  Thrown by the __cxa_bad_typeid() helper function.
734684ddb6SLionel Sambuc 	 */
744684ddb6SLionel Sambuc 	class bad_typeid: public exception
754684ddb6SLionel Sambuc 	{
764684ddb6SLionel Sambuc 	public:
774684ddb6SLionel Sambuc 		bad_typeid() throw();
784684ddb6SLionel Sambuc 		bad_typeid(const bad_typeid &__rhs) throw();
794684ddb6SLionel Sambuc 		virtual ~bad_typeid();
804684ddb6SLionel Sambuc 		bad_typeid& operator=(const bad_typeid &__rhs) throw();
814684ddb6SLionel Sambuc 		virtual const char* what() const throw();
824684ddb6SLionel Sambuc 	};
834684ddb6SLionel Sambuc 
84*0a6a1f1dSLionel Sambuc 	class bad_array_new_length: public bad_alloc
85*0a6a1f1dSLionel Sambuc 	{
86*0a6a1f1dSLionel Sambuc 	public:
87*0a6a1f1dSLionel Sambuc 		bad_array_new_length() throw();
88*0a6a1f1dSLionel Sambuc 		bad_array_new_length(const bad_array_new_length&) throw();
89*0a6a1f1dSLionel Sambuc 		bad_array_new_length& operator=(const bad_array_new_length&) throw();
90*0a6a1f1dSLionel Sambuc 		virtual ~bad_array_new_length();
91*0a6a1f1dSLionel Sambuc 		virtual const char *what() const throw();
92*0a6a1f1dSLionel Sambuc 	};
934684ddb6SLionel Sambuc 
944684ddb6SLionel Sambuc 
954684ddb6SLionel Sambuc } // namespace std
964684ddb6SLionel Sambuc 
97