libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
util
Exception.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_UTIL_EXCEPTION_H
2
#define OSMSCOUT_UTIL_EXCEPTION_H
3
4
/*
5
This source is part of the libosmscout library
6
Copyright (C) 2015 Tim Teulings
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <exception>
24
#include <string>
25
26
#include <
osmscout/lib/CoreImportExport.h
>
27
#include <system_error>
28
29
#if defined(_MSC_VER)
30
#if (_MSC_VER <= 1910)
31
#include <yvals.h>
32
#define OSMSCOUT_NOEXCEPT _NOEXCEPT
33
#else
34
#define OSMSCOUT_NOEXCEPT noexcept
35
#endif
36
#else
37
#define OSMSCOUT_NOEXCEPT noexcept
38
#endif
39
40
namespace
osmscout
{
41
42
#if defined(_MSC_VER)
43
#pragma warning (push)
44
#pragma warning (disable:4275)
45
#endif
46
47
class
OSMSCOUT_API
OSMScoutException
:
public
std::exception
48
{
49
public
:
50
virtual
std::string
GetDescription
()
const
;
51
};
52
53
#if defined(_MSC_VER)
54
#pragma warning (pop)
55
#endif
56
57
class
OSMSCOUT_API
UninitializedException
:
public
OSMScoutException
58
{
59
private
:
60
std::string objectName;
61
std::string description;
62
63
public
:
64
explicit
UninitializedException
(
const
std::string& objectName);
65
66
const
char
*
what
() const
OSMSCOUT_NOEXCEPT
override;
67
68
std
::
string
GetObjectName
() const;
69
std
::
string
GetDescription
() const override;
70
};
71
72
class
OSMSCOUT_API
IOException
: public
OSMScoutException
73
{
74
private
:
75
std::string filename;
76
std::string semanticError;
77
std::string errorMsg;
78
std::string description;
79
80
public
:
81
IOException
(
const
std::string& filename,
82
const
std::string& semanticError,
83
const
std::system_error& error);
84
IOException
(
const
std::string& filename,
85
const
std::string& semanticError,
86
const
std::exception& error);
87
IOException
(
const
std::string& filename,
88
const
std::string& semanticError);
89
IOException
(
const
std::string& filename,
90
const
std::string& semanticError,
91
const
std::string& errorMsg);
92
93
const
char
*
what
() const
OSMSCOUT_NOEXCEPT
override;
94
95
std
::
string
GetFilename
() const;
96
std
::
string
GetSemanticError
() const;
97
std
::
string
GetErrorMsg
() const;
98
std
::
string
GetDescription
() const override;
99
};
100
}
101
102
#endif
CoreImportExport.h
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
OSMSCOUT_NOEXCEPT
#define OSMSCOUT_NOEXCEPT
Definition
Exception.h:37
osmscout::IOException::IOException
IOException(const std::string &filename, const std::string &semanticError, const std::string &errorMsg)
osmscout::IOException::GetSemanticError
std::string GetSemanticError() const
osmscout::IOException::IOException
IOException(const std::string &filename, const std::string &semanticError, const std::system_error &error)
osmscout::IOException::GetDescription
std::string GetDescription() const override
osmscout::IOException::what
const char * what() const OSMSCOUT_NOEXCEPT override
osmscout::IOException::GetErrorMsg
std::string GetErrorMsg() const
osmscout::IOException::IOException
IOException(const std::string &filename, const std::string &semanticError, const std::exception &error)
osmscout::IOException::IOException
IOException(const std::string &filename, const std::string &semanticError)
osmscout::IOException::GetFilename
std::string GetFilename() const
osmscout::OSMScoutException
Definition
Exception.h:48
osmscout::OSMScoutException::GetDescription
virtual std::string GetDescription() const
osmscout::UninitializedException::UninitializedException
UninitializedException(const std::string &objectName)
osmscout::UninitializedException::what
const char * what() const OSMSCOUT_NOEXCEPT override
osmscout::UninitializedException::GetDescription
std::string GetDescription() const override
osmscout::UninitializedException::GetObjectName
std::string GetObjectName() const
osmscout
Definition
Area.h:39
std
STL namespace.
Generated by
1.17.0