Loading...
Searching...
No Matches
enforce.hpp
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <string>
#include "error.hpp"
namespace Exiv2::Internal {
template <typename exception_t, typename... T>
constexpr void enforce(bool condition, T&&... args) {
if (!condition) {
throw exception_t(std::forward<T>(args)...);
}
}
template <typename... T>
constexpr void enforce(bool condition, Exiv2::ErrorCode err_code, T&&... args) {
enforce<Exiv2::Error>(condition, err_code, std::forward<T>(args)...);
}
} // namespace Exiv2::Internal
error.hpp
Error class for exceptions, log message class.
Exiv2::Internal
Helper structure for the Matroska tags lookup table.
Definition matroskavideo.hpp:39
Exiv2::Internal::enforce
constexpr void enforce(bool condition, T &&... args)
Ensure that condition is true, otherwise throw an exception of the type exception_t.
Definition enforce.hpp:34
Exiv2::ErrorCode
ErrorCode
Complete list of all Exiv2 error codes.
Definition error.hpp:162