mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
qgis exception classes
git-svn-id: http://svn.osgeo.org/qgis/trunk@1999 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
7e82d9e82e
commit
0112da58ff
75
src/qgsexception.h
Normal file
75
src/qgsexception.h
Normal file
@ -0,0 +1,75 @@
|
||||
/***************************************************************************
|
||||
qgsproject.cpp - description
|
||||
-------------------
|
||||
begin : August 31, 2004
|
||||
copyright : (C) 2004 by Mark Coletti
|
||||
email : mcoletti at gmail.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef QGSEXCEPTION_H
|
||||
#define QGSEXCEPTION_H
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
/**
|
||||
Defines a qgis exception class
|
||||
*/
|
||||
class QgsException : public std::exception
|
||||
{
|
||||
public:
|
||||
|
||||
QgsException( std::string const & what )
|
||||
: what_( what )
|
||||
{}
|
||||
|
||||
QgsException( QString const & what )
|
||||
: what_( what.ascii() )
|
||||
{}
|
||||
|
||||
virtual ~QgsException() throw()
|
||||
{}
|
||||
|
||||
const char* what() const throw()
|
||||
{
|
||||
return what_.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// description of exception
|
||||
std::string what_;
|
||||
|
||||
}; // class QgsException
|
||||
|
||||
|
||||
/** for Qgis I/O related exceptions
|
||||
|
||||
@note usually thrown for opening file's that don't exist, and the like.
|
||||
|
||||
*/
|
||||
class QgsIOException : public QgsException
|
||||
{
|
||||
public:
|
||||
|
||||
QgsIOException( std::string const & what )
|
||||
: QgsException( what )
|
||||
{}
|
||||
|
||||
QgsIOException( QString const & what )
|
||||
: QgsException( what )
|
||||
{}
|
||||
|
||||
}; // class QgsIOException
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user