zxing-cpp v3.0
Loading...
Searching...
No Matches
ZXing::Error Class Reference

#include <Error.h>

Public Types

enum class  Type : uint8_t

Public Member Functions

Type type () const noexcept
const std::string & msg () const noexcept
 operator bool () const noexcept
std::string location () const
 Error ()=default
 Error (Type type, std::string msg={})
 Error (const char *file, short line, Type type, std::string msg={})
bool operator== (const Error &o) const noexcept
bool operator!= (const Error &o) const noexcept

Static Public Attributes

static constexpr auto Format = Type::Format
static constexpr auto Checksum = Type::Checksum
static constexpr auto Unsupported = Type::Unsupported

Detailed Description

The Error class is a value type for the error() member of Barcode.

The use-case of this class is to communicate whether or not a particular Barcode symbol is in error. It is (primarily) not meant to be thrown as an exception and therefore not derived from std::exception. The library code may throw (and catch!) objects of this class as a convenient means of flow control (c++23's std::expected will allow to replace those use-cases with something similarly convenient). In those situations, the author is advised to make sure any thrown Error object is caught before leaking into user/wrapper code, i.e. the functions of the public API should be considered noexcept with respect to this class.

Member Enumeration Documentation

◆ Type

enum class ZXing::Error::Type : uint8_t
strong
Enumerator
None 

No error.

Format 

Format error (i.e. the decoded data is not valid for the detected symbology).

Checksum 

Checksum error (i.e. the decoded data does not pass the checksum validation).

Unsupported 

Unsupported error (i.e. a particular feature detected is not supported by zxing-cpp).

Constructor & Destructor Documentation

◆ Error() [1/3]

ZXing::Error::Error ( )
default

◆ Error() [2/3]

ZXing::Error::Error ( Type type,
std::string msg = {} )
inline

◆ Error() [3/3]

ZXing::Error::Error ( const char * file,
short line,
Type type,
std::string msg = {} )
inline

Member Function Documentation

◆ type()

Type ZXing::Error::type ( ) const
inlinenoexcept

◆ msg()

const std::string & ZXing::Error::msg ( ) const
inlinenoexcept

◆ operator bool()

ZXing::Error::operator bool ( ) const
inlineexplicitnoexcept

◆ location()

std::string ZXing::Error::location ( ) const

The source code location where the error was detected (if available).

◆ operator==()

bool ZXing::Error::operator== ( const Error & o) const
inlinenoexcept

◆ operator!=()

bool ZXing::Error::operator!= ( const Error & o) const
inlinenoexcept

Member Data Documentation

◆ Format

auto ZXing::Error::Format = Type::Format
staticconstexpr

◆ Checksum

auto ZXing::Error::Checksum = Type::Checksum
staticconstexpr

◆ Unsupported

auto ZXing::Error::Unsupported = Type::Unsupported
staticconstexpr

The documentation for this class was generated from the following file: