X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fstlplus%2Fcontainers%2Fexceptions.hpp;h=19110137c5aeb8cf06e9828b2f21129db07bc270;hp=3549ff4c9022e98b570a975bd52bf18fb544cca0;hb=5846afb00833cc72fe72422ca896d2387c712cb4;hpb=a97500609dc3c1b11f9786d32bc458eb00de4c36 diff --git a/src/stlplus/containers/exceptions.hpp b/src/stlplus/containers/exceptions.hpp index 3549ff4..1911013 100644 --- a/src/stlplus/containers/exceptions.hpp +++ b/src/stlplus/containers/exceptions.hpp @@ -1,71 +1,71 @@ -#ifndef STLPLUS_EXCEPTIONS -#define STLPLUS_EXCEPTIONS -//////////////////////////////////////////////////////////////////////////////// - -// Author: Andy Rushton -// Copyright: (c) Southampton University 1999-2004 -// (c) Andy Rushton 2004-2009 -// License: BSD License, see ../docs/license.html - -// The set of general exceptions thrown by STLplus components - -//////////////////////////////////////////////////////////////////////////////// -#include "containers_fixes.hpp" -#include -#include - -namespace stlplus -{ - - //////////////////////////////////////////////////////////////////////////////// - // Thrown if a pointer or an iterator is dereferenced when it is null - - class null_dereference : public std::logic_error - { - public: - null_dereference(const std::string& description) throw() : - std::logic_error(std::string("stlplus::null_dereference: ") + description) {} - ~null_dereference(void) throw() {} - }; - - //////////////////////////////////////////////////////////////////////////////// - // Thrown if an iterator is dereferenced when it is pointing to the end element - - class end_dereference : public std::logic_error - { - public: - end_dereference(const std::string& description) throw() : - std::logic_error("stlplus::end_dereference: " + description) {} - ~end_dereference(void) throw() {} - }; - - //////////////////////////////////////////////////////////////////////////////// - // Thrown if an iterator is used with the wrong container. In other words, an - // iterator is created as a pointer to a sub-object within a container. If - // that iterator is then used with a different container, this exception is - // thrown. - - class wrong_object : public std::logic_error - { - public: - wrong_object(const std::string& description) throw() : - std::logic_error("stlplus::wrong_object: " + description) {} - ~wrong_object(void) throw() {} - }; - - //////////////////////////////////////////////////////////////////////////////// - // Thrown if an attempt is made to copy an object that is uncopyable - - class illegal_copy : public std::logic_error - { - public: - illegal_copy(const std::string& description) throw() : - std::logic_error("stlplus::illegal_copy: " + description) {} - ~illegal_copy(void) throw() {} - }; - - //////////////////////////////////////////////////////////////////////////////// - -} // end namespace stlplus - -#endif +#ifndef STLPLUS_EXCEPTIONS +#define STLPLUS_EXCEPTIONS +//////////////////////////////////////////////////////////////////////////////// + +// Author: Andy Rushton +// Copyright: (c) Southampton University 1999-2004 +// (c) Andy Rushton 2004-2009 +// License: BSD License, see ../docs/license.html + +// The set of general exceptions thrown by STLplus components + +//////////////////////////////////////////////////////////////////////////////// +#include "containers_fixes.hpp" +#include +#include + +namespace stlplus +{ + + //////////////////////////////////////////////////////////////////////////////// + // Thrown if a pointer or an iterator is dereferenced when it is null + + class null_dereference : public std::logic_error + { + public: + null_dereference(const std::string& description) throw() : + std::logic_error(std::string("stlplus::null_dereference: ") + description) {} + ~null_dereference(void) throw() {} + }; + + //////////////////////////////////////////////////////////////////////////////// + // Thrown if an iterator is dereferenced when it is pointing to the end element + + class end_dereference : public std::logic_error + { + public: + end_dereference(const std::string& description) throw() : + std::logic_error("stlplus::end_dereference: " + description) {} + ~end_dereference(void) throw() {} + }; + + //////////////////////////////////////////////////////////////////////////////// + // Thrown if an iterator is used with the wrong container. In other words, an + // iterator is created as a pointer to a sub-object within a container. If + // that iterator is then used with a different container, this exception is + // thrown. + + class wrong_object : public std::logic_error + { + public: + wrong_object(const std::string& description) throw() : + std::logic_error("stlplus::wrong_object: " + description) {} + ~wrong_object(void) throw() {} + }; + + //////////////////////////////////////////////////////////////////////////////// + // Thrown if an attempt is made to copy an object that is uncopyable + + class illegal_copy : public std::logic_error + { + public: + illegal_copy(const std::string& description) throw() : + std::logic_error("stlplus::illegal_copy: " + description) {} + ~illegal_copy(void) throw() {} + }; + + //////////////////////////////////////////////////////////////////////////////// + +} // end namespace stlplus + +#endif