Exiv2
Functions
enforce.hpp File Reference

Port of D's enforce() to C++ & Exiv2. More...

#include <string>
#include "error.hpp"
+ Include dependency graph for enforce.hpp:

Functions

template<typename exception_t , typename T >
void enforce (bool condition, const T &arg1)
 Ensure that condition is true, otherwise throw an exception of the type exception_t. More...
 
void enforce (bool condition, int err_code)
 Ensure that condition is true, otherwise throw an Exiv2::Error with the given error_code.
 
template<typename T >
void enforce (bool condition, int err_code, const T &arg1)
 Ensure that condition is true, otherwise throw an Exiv2::Error with the given error_code & arg1.
 
template<typename T , typename U >
void enforce (bool condition, int err_code, const T &arg1, const U &arg2)
 Ensure that condition is true, otherwise throw an Exiv2::Error with the given error_code, arg1 & arg2.
 
template<typename T , typename U , typename V >
void enforce (bool condition, int err_code, const T &arg1, const U &arg2, const V &arg3)
 Ensure that condition is true, otherwise throw an Exiv2::Error with the given error_code, arg1, arg2 & arg3.
 

Detailed Description

Port of D's enforce() to C++ & Exiv2.

Author
Dan Čermák (D4N) dan.cermak@cgc-instruments.com
Date
11-March-18, D4N: created

Function Documentation

◆ enforce()

template<typename exception_t , typename T >
void enforce ( bool  condition,
const T &  arg1 
)
inline

Ensure that condition is true, otherwise throw an exception of the type exception_t.

Template Parameters
exception_tException type that is thrown, must provide a constructor that accepts a single argument to which arg1 is forwarded.
Todo:
once we have C++>=11 use variadic templates and std::forward to remove all overloads of enforce

Referenced by Exiv2::TiffImage::printStructure(), Exiv2::MrwImage::readMetadata(), and Exiv2::PsdImage::readMetadata().