Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

GEOSException.h

00001 /**********************************************************************
00002  * $Id: GEOSException.h 2958 2010-03-29 11:29:40Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  * Copyright (C) 2006 Refractions Research Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  **********************************************************************/
00016 
00017 #ifndef GEOS_UTIL_GEOSEXCEPTION_H
00018 #define GEOS_UTIL_GEOSEXCEPTION_H
00019 
00020 #include <geos/export.h>
00021 #include <stdexcept>
00022 #include <string>
00023 
00024 #ifdef _MSC_VER
00025 #pragma warning(push)
00026 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00027 #endif
00028 
00029 namespace geos {
00030 namespace util { // geos.util
00031 
00039 class GEOS_DLL GEOSException: public std::exception {
00040 
00041         std::string _msg;
00042 
00043 public:
00044 
00045         GEOSException()
00046                 :
00047                 _msg("Unknown error")
00048         {}
00049 
00050         GEOSException(std::string const& msg)
00051                 :
00052                 _msg(msg)
00053         {}
00054 
00055         GEOSException(std::string const& name, std::string const& msg)
00056                 :
00057                 _msg(name+": "+msg)
00058         {}
00059 
00060         virtual ~GEOSException() throw()
00061         {}
00062 
00063         const char* what() const throw()
00064         {
00065                 return _msg.c_str();
00066         }
00067 
00068 };
00069 
00070 } // namespace geos.util
00071 } // namespace geos
00072 
00073 #ifdef _MSC_VER
00074 #pragma warning(pop)
00075 #endif
00076 
00077 #endif // GEOS_UTIL_GEOSEXCEPTION_H
00078 
00079 /**********************************************************************
00080  * $Log$
00081  * Revision 1.4  2006/05/22 15:08:01  strk
00082  * Print colon after exception name (as it has always been)
00083  *
00084  * Revision 1.3  2006/04/05 09:34:20  strk
00085  * GEOSException derived from std::exception again, hopefully the correct way now
00086  *
00087  * Revision 1.2  2006/04/04 08:16:46  strk
00088  * Changed GEOSException hierarchy to be derived from std::runtime_exception.
00089  * Removed the GEOSException::toString redundant method (use ::what() instead)
00090  *
00091  * Revision 1.1  2006/03/09 16:46:49  strk
00092  * geos::geom namespace definition, first pass at headers split
00093  *
00094  **********************************************************************/

Generated on Tue Jun 5 14:58:08 2012 for GEOS by  doxygen 1.3.9.1