Files
qt5-legatus-legacy/Lts/Viewer/SituationMap/Common/exception.h
T
2026-08-13 18:33:10 +02:00

94 lines
2.2 KiB
C++
Executable File

/**
**
** @RDE_HEADER@
** Implementation of Splines
** $Id$
** $HeadURL$
** $Author$
** -----------------------------------------------------------------------------------------------
**
** Hardware-Environment: Intel-PC
** Software-Environment: Windows 7, Qt 5.4. ArcGIS 10.2.5
**
** Language ........: C++ 11
**
** -----------------------------------------------------------------------------------------------
**
** Author ...........: Joerg Turla, SPD G, Tel. 3132
**
** -----------------------------------------------------------------------------------------------
**
** Notes .........:
**
** 19.06.2012, JT : Urversion for use in VIntel project
** 12.08.2015, JT : adapted to SituationMap
**
** -----------------------------------------------------------------------------------------------
*/
#pragma once
#include <QtCore/QString>
namespace SituationMap
{
/**
\class Exception exception.h
\brief Basisklasse for Exception-Handling
The class Exception defines a very simple exception handler, that will be able to return
a string message when an exception is thrown
*/
class Exception
{
public:
Exception()
: _message(QLatin1String("Error"))
{}
Exception(const Exception &) = default;
explicit Exception(const QString &msg)
: _message(msg)
{}
// explicit is not used here because
// throw SituationMap::Exception(__FILE__, __LINE__, "Message" );
// will become more complicated
Exception(const char *Source
, unsigned int lineNo
, const char *msg)
: Exception(QLatin1String(Source), lineNo, QLatin1String(msg))
{}
Exception(const char *Source
, unsigned int lineNo
, const QString &msg)
: Exception(QLatin1String(Source), lineNo, msg)
{}
Exception(const QString &Source
, unsigned int lineNo
, const QString &msg)
: _message(QStringLiteral("\"%1\" in %2 at %3").arg(msg, Source).arg(lineNo))
{}
~Exception() = default;
Exception &operator = (const Exception &e) = default;
QString getMessage() const { return _message; } //!< returns a specific error message as QString
protected:
QString _message;
};
} // namespace SituationMap