GEOS: GEOSException.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# GEOSException.h

    00001 /**********************************************************************
    00002  * $Id: GEOSException.h 2556 2009-06-06 22:22:28Z strk $
    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 namespace geos {
    00025 namespace util { // geos.util
    00026
    00034 class GEOS_DLL GEOSException: public std::exception {
    00035
    00036         std::string _msg;
    00037
    00038 public:
    00039
    00040         GEOSException()
    00041                 :
    00042                 _msg("Unknown error")
    00043         {}
    00044
    00045         GEOSException(std::string const& msg)
    00046                 :
    00047                 _msg(msg)
    00048         {}
    00049
    00050         GEOSException(std::string const& name, std::string const& msg)
    00051                 :
    00052                 _msg(name+": "+msg)
    00053         {}
    00054
    00055         virtual ~GEOSException() throw()
    00056         {}
    00057
    00058         const char* what() const throw()
    00059         {
    00060                 return _msg.c_str();
    00061         }
    00062
    00063 };
    00064
    00065 } // namespace geos.util
    00066 } // namespace geos
    00067
    00068 #endif // GEOS_UTIL_GEOSEXCEPTION_H
    00069
    00070 /**********************************************************************
    00071  * $Log$
    00072  * Revision 1.4  2006/05/22 15:08:01  strk
    00073  * Print colon after exception name (as it has always been)
    00074  *
    00075  * Revision 1.3  2006/04/05 09:34:20  strk
    00076  * GEOSException derived from std::exception again, hopefully the correct way now
    00077  *
    00078  * Revision 1.2  2006/04/04 08:16:46  strk
    00079  * Changed GEOSException hierarchy to be derived from std::runtime_exception.
    00080  * Removed the GEOSException::toString redundant method (use ::what() instead)
    00081  *
    00082  * Revision 1.1  2006/03/09 16:46:49  strk
    00083  * geos::geom namespace definition, first pass at headers split
    00084  *
    00085  **********************************************************************/