Files
handleaiuinew/env/3DAI/include/zxing/Reader.h
T
2024-05-18 23:53:26 +08:00

39 lines
923 B
C++

/*
* Copyright 2016 Nu-book Inc.
* Copyright 2016 ZXing authors
*/
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "DecodeHints.h"
#include "Result.h"
namespace ZXing {
class BinaryBitmap;
class DecodeHints;
class Reader
{
protected:
const DecodeHints& _hints;
public:
const bool supportsInversion;
explicit Reader(const DecodeHints& hints, bool supportsInversion = false) : _hints(hints), supportsInversion(supportsInversion) {}
explicit Reader(DecodeHints&& hints) = delete;
virtual ~Reader() = default;
virtual Result decode(const BinaryBitmap& image) const = 0;
// WARNING: this API is experimental and may change/disappear
virtual Results decode(const BinaryBitmap& image, [[maybe_unused]] int maxSymbols) const {
auto res = decode(image);
return res.isValid() || (_hints.returnErrors() && res.format() != BarcodeFormat::None) ? Results{std::move(res)} : Results{};
}
};
} // ZXing