GEOS: GEOSException.h Source File

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

# GEOSException.h

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