GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
Loading...
Searching...
No Matches
exception.h
Go to the documentation of this file.
1
2namespace clarisma {
3// Copyright (c) 2024 Clarisma / GeoDesk contributors
4// SPDX-License-Identifier: LGPL-3.0-only
5
6#pragma once
7
8#define DECLARE_EXCEPTION(EXCEPTION_NAME) \
9class EXCEPTION_NAME : public std::runtime_error \
10{ \
11public: \
12 explicit EXCEPTION_NAME(const char* message) \
13 : std::runtime_error(message) {} \
14 explicit EXCEPTION_NAME(const std::string& message) \
15 : std::runtime_error(message) {} \
16 template <typename... Args> \
17 explicit EXCEPTION_NAME(const char* message, Args... args) \
18 : std::runtime_error(Format::format(message, args...)) {} \
19};
20
21#define DECLARE_EXCEPTION_WITH_BASE(EXCEPTION_NAME, BASE_CLASS) \
22class EXCEPTION_NAME : public BASE_CLASS \
23{ \
24public: \
25 explicit EXCEPTION_NAME(const char* message) \
26 : BASE_CLASS(message) {} \
27 explicit EXCEPTION_NAME(const std::string& message) \
28 : BASE_CLASS(message) {} \
29 template <typename... Args> \
30 explicit EXCEPTION_NAME(const char* message, Args... args) \
31 : BASE_CLASS(Format::format(message, args...)) {} \
32};
33
34} // namespace clarisma
Definition Arena.h:17