build result

This commit is contained in:
Henry Schimke
2023-04-23 11:23:56 -05:00
parent b4f99b3195
commit cb7050a5dd
4 changed files with 58 additions and 63 deletions

View File

@@ -1,6 +1,6 @@
use std::{any::Any, rc::Rc};
use crate::{common::ECIStringBuilder, Exceptions};
use crate::{common::ECIStringBuilder, Exceptions, RXingResult};
use super::StructuredAppendInfo;
@@ -64,59 +64,6 @@ where
}
}
// DecoderResult(const DecoderResult &) = delete;
// DecoderResult& operator=(const DecoderResult &) = delete;
// }
// public:
// DecoderResult() = default;
// DecoderResult(Error error) : _error(std::move(error)) {}
// DecoderResult(Content&& bytes) : _content(std::move(bytes)) {}
// DecoderResult(DecoderResult&&) noexcept = default;
// DecoderResult& operator=(DecoderResult&&) noexcept = default;
// bool isValid(bool includeErrors = false) const
// {
// return includeErrors || (_content.symbology.code != 0 && !_error);
// }
// const Content& content() const & { return _content; }
// Content&& content() && { return std::move(_content); }
// to keep the unit tests happy for now:
// std::wstring text() const { return _content.utfW(); }
// std::string symbologyIdentifier() const { return _content.symbology.toString(false); }
// Simple macro to set up getter/setter methods that save lots of boilerplate.
// It sets up a standard 'const & () const', 2 setters for setting lvalues via
// copy and 2 for setting rvalues via move. They are provided each to work
// either on lvalues (normal 'void (...)') or on rvalues (returning '*this' as
// rvalue). The latter can be used to optionally initialize a temporary in a
// return statement, e.g.
// return DecoderResult(bytes, text).setEcLevel(level);
// #define ZX_PROPERTY(TYPE, GETTER, SETTER) \
// const TYPE& GETTER() const & { return _##GETTER; } \
// TYPE&& GETTER() && { return std::move(_##GETTER); } \
// void SETTER(const TYPE& v) & { _##GETTER = v; } \
// void SETTER(TYPE&& v) & { _##GETTER = std::move(v); } \
// DecoderResult&& SETTER(const TYPE& v) && { _##GETTER = v; return std::move(*this); } \
// DecoderResult&& SETTER(TYPE&& v) && { _##GETTER = std::move(v); return std::move(*this); }
// ZX_PROPERTY(std::string, ecLevel, setEcLevel)
// ZX_PROPERTY(int, lineCount, setLineCount)
// ZX_PROPERTY(int, versionNumber, setVersionNumber)
// ZX_PROPERTY(StructuredAppendInfo, structuredAppend, setStructuredAppend)
// ZX_PROPERTY(Error, error, setError)
// ZX_PROPERTY(bool, isMirrored, setIsMirrored)
// ZX_PROPERTY(bool, readerInit, setReaderInit)
// ZX_PROPERTY(std::shared_ptr<CustomData>, extra, setExtra)
// #undef ZX_PROPERTY
// };
impl<T> DecoderResult<T>
where
T: Copy + Clone + Default + Eq + PartialEq,

View File

@@ -21,7 +21,9 @@
// import java.nio.charset.Charset;
// import java.nio.charset.StandardCharsets;
use std::{collections::HashMap, fmt};
use std::{collections::HashMap, fmt::{self, Display}};
use crate::BarcodeFormat;
use super::{CharacterSet, Eci, StringUtils};
@@ -126,10 +128,10 @@ impl ECIStringBuilder {
/// Change the current encoding characterset, finding an eci to do so
pub fn switch_encoding(&mut self, charset: CharacterSet) {
//self.append_eci(Eci::from(charset))
if (false && !self.has_eci) {
if false && !self.has_eci {
self.eci_positions.clear();
}
if (false || !self.has_eci)
if false || !self.has_eci
//{self.eci_positions.push_back({eci, Size(bytes)});}
{
self.append_eci(Eci::from(charset))
@@ -322,4 +324,4 @@ impl Default for SymbologyIdentifier {
aiFlag: AIFlag::None,
}
}
}
}