diff options
Diffstat (limited to 'fxbarcode')
75 files changed, 413 insertions, 438 deletions
diff --git a/fxbarcode/BC_UtilCodingConvert.cpp b/fxbarcode/BC_UtilCodingConvert.cpp index f0f497a07b..77c52f2074 100644 --- a/fxbarcode/BC_UtilCodingConvert.cpp +++ b/fxbarcode/BC_UtilCodingConvert.cpp @@ -10,43 +10,42 @@ CBC_UtilCodingConvert::CBC_UtilCodingConvert() {} CBC_UtilCodingConvert::~CBC_UtilCodingConvert() {} -void CBC_UtilCodingConvert::UnicodeToLocale(const CFX_WideString& src, - CFX_ByteString& dst) { - dst = CFX_ByteString::FromUnicode(src); +void CBC_UtilCodingConvert::UnicodeToLocale(const WideString& src, + ByteString& dst) { + dst = ByteString::FromUnicode(src); } -void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src, - CFX_ByteString& dst) { - CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC()); +void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src, + ByteString& dst) { + WideString unicode = WideString::FromLocal(src.AsStringView()); dst = unicode.UTF8Encode(); } -void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src, +void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src, std::vector<uint8_t>& dst) { - CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC()); - CFX_ByteString utf8 = unicode.UTF8Encode(); + WideString unicode = WideString::FromLocal(src.AsStringView()); + ByteString utf8 = unicode.UTF8Encode(); dst = std::vector<uint8_t>(utf8.begin(), utf8.end()); } void CBC_UtilCodingConvert::Utf8ToLocale(const std::vector<uint8_t>& src, - CFX_ByteString& dst) { - CFX_ByteString utf8; + ByteString& dst) { + ByteString utf8; for (uint8_t value : src) utf8 += value; - CFX_WideString unicode = CFX_WideString::FromUTF8(utf8.AsStringC()); - dst = CFX_ByteString::FromUnicode(unicode); + WideString unicode = WideString::FromUTF8(utf8.AsStringView()); + dst = ByteString::FromUnicode(unicode); } void CBC_UtilCodingConvert::Utf8ToLocale(const uint8_t* src, int32_t count, - CFX_ByteString& dst) { - CFX_WideString unicode = - CFX_WideString::FromUTF8(CFX_ByteStringC(src, count)); - dst = CFX_ByteString::FromUnicode(unicode); + ByteString& dst) { + WideString unicode = WideString::FromUTF8(ByteStringView(src, count)); + dst = ByteString::FromUnicode(unicode); } -void CBC_UtilCodingConvert::UnicodeToUTF8(const CFX_WideString& src, - CFX_ByteString& dst) { +void CBC_UtilCodingConvert::UnicodeToUTF8(const WideString& src, + ByteString& dst) { dst = src.UTF8Encode(); } diff --git a/fxbarcode/BC_UtilCodingConvert.h b/fxbarcode/BC_UtilCodingConvert.h index de6b30eb7c..8600cd14b5 100644 --- a/fxbarcode/BC_UtilCodingConvert.h +++ b/fxbarcode/BC_UtilCodingConvert.h @@ -15,19 +15,16 @@ class CBC_UtilCodingConvert { public: CBC_UtilCodingConvert(); virtual ~CBC_UtilCodingConvert(); - static void UnicodeToLocale(const CFX_WideString& source, - CFX_ByteString& result); - static void LocaleToUtf8(const CFX_ByteString& source, - CFX_ByteString& result); - static void LocaleToUtf8(const CFX_ByteString& source, + static void UnicodeToLocale(const WideString& source, ByteString& result); + static void LocaleToUtf8(const ByteString& source, ByteString& result); + static void LocaleToUtf8(const ByteString& source, std::vector<uint8_t>& result); static void Utf8ToLocale(const std::vector<uint8_t>& source, - CFX_ByteString& result); + ByteString& result); static void Utf8ToLocale(const uint8_t* source, int32_t count, - CFX_ByteString& result); - static void UnicodeToUTF8(const CFX_WideString& source, - CFX_ByteString& result); + ByteString& result); + static void UnicodeToUTF8(const WideString& source, ByteString& result); }; #endif // FXBARCODE_BC_UTILCODINGCONVERT_H_ diff --git a/fxbarcode/BC_Utils.cpp b/fxbarcode/BC_Utils.cpp index 284322e832..1d09e24736 100644 --- a/fxbarcode/BC_Utils.cpp +++ b/fxbarcode/BC_Utils.cpp @@ -8,7 +8,7 @@ #include "fxbarcode/utils.h" -bool BC_FX_ByteString_Replace(CFX_ByteString& dst, +bool BC_FX_ByteString_Replace(ByteString& dst, uint32_t first, uint32_t last, int32_t count, @@ -23,12 +23,11 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst, return true; } -void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c) { +void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c) { for (int32_t i = 0; i < count; i++) dst += c; } -void BC_FX_ByteString_Append(CFX_ByteString& dst, - const std::vector<uint8_t>& ba) { +void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba) { for (uint8_t value : ba) dst += value; } diff --git a/fxbarcode/cbc_codabar.cpp b/fxbarcode/cbc_codabar.cpp index a8729b64c6..0795ff295d 100644 --- a/fxbarcode/cbc_codabar.cpp +++ b/fxbarcode/cbc_codabar.cpp @@ -47,16 +47,15 @@ bool CBC_Codabar::SetWideNarrowRatio(int8_t ratio) { return GetOnedCodaBarWriter()->SetWideNarrowRatio(ratio); } -bool CBC_Codabar::Encode(const CFX_WideStringC& contents) { +bool CBC_Codabar::Encode(const WideStringView& contents) { if (contents.IsEmpty()) return false; BCFORMAT format = BCFORMAT_CODABAR; int32_t outWidth = 0; int32_t outHeight = 0; - CFX_WideString filtercontents = - GetOnedCodaBarWriter()->FilterContents(contents); - CFX_ByteString byteString = filtercontents.UTF8Encode(); + WideString filtercontents = GetOnedCodaBarWriter()->FilterContents(contents); + ByteString byteString = filtercontents.UTF8Encode(); m_renderContents = filtercontents; auto* pWriter = GetOnedCodaBarWriter(); std::unique_ptr<uint8_t, FxFreeDeleter> data( @@ -64,16 +63,16 @@ bool CBC_Codabar::Encode(const CFX_WideStringC& contents) { if (!data) return false; - return pWriter->RenderResult(filtercontents.AsStringC(), data.get(), + return pWriter->RenderResult(filtercontents.AsStringView(), data.get(), outWidth); } bool CBC_Codabar::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) { auto* pWriter = GetOnedCodaBarWriter(); - CFX_WideString renderCon = - pWriter->encodedContents(m_renderContents.AsStringC()); - return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringC()); + WideString renderCon = + pWriter->encodedContents(m_renderContents.AsStringView()); + return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringView()); } BC_TYPE CBC_Codabar::GetType() { diff --git a/fxbarcode/cbc_codabar.h b/fxbarcode/cbc_codabar.h index 092b840f49..827fc28d0f 100644 --- a/fxbarcode/cbc_codabar.h +++ b/fxbarcode/cbc_codabar.h @@ -20,7 +20,7 @@ class CBC_Codabar : public CBC_OneCode { ~CBC_Codabar() override; // CBC_OneCode: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; @@ -33,7 +33,7 @@ class CBC_Codabar : public CBC_OneCode { private: CBC_OnedCodaBarWriter* GetOnedCodaBarWriter(); - CFX_WideString m_renderContents; + WideString m_renderContents; }; #endif // FXBARCODE_CBC_CODABAR_H_ diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp index d802b28a17..7ba623542d 100644 --- a/fxbarcode/cbc_code128.cpp +++ b/fxbarcode/cbc_code128.cpp @@ -35,7 +35,7 @@ bool CBC_Code128::SetTextLocation(BC_TEXT_LOC location) { return GetOnedCode128Writer()->SetTextLocation(location); } -bool CBC_Code128::Encode(const CFX_WideStringC& contents) { +bool CBC_Code128::Encode(const WideStringView& contents) { if (contents.IsEmpty()) return false; @@ -43,25 +43,25 @@ bool CBC_Code128::Encode(const CFX_WideStringC& contents) { int32_t outWidth = 0; int32_t outHeight = 0; auto* pWriter = GetOnedCode128Writer(); - CFX_WideString content(contents); + WideString content(contents); if (contents.GetLength() % 2 && pWriter->GetType() == BC_CODE128_C) content += '0'; - CFX_WideString encodeContents = pWriter->FilterContents(content.AsStringC()); + WideString encodeContents = pWriter->FilterContents(content.AsStringView()); m_renderContents = encodeContents; - CFX_ByteString byteString = encodeContents.UTF8Encode(); + ByteString byteString = encodeContents.UTF8Encode(); std::unique_ptr<uint8_t, FxFreeDeleter> data( pWriter->Encode(byteString, format, outWidth, outHeight)); if (!data) return false; - return pWriter->RenderResult(encodeContents.AsStringC(), data.get(), + return pWriter->RenderResult(encodeContents.AsStringView(), data.get(), outWidth); } bool CBC_Code128::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) { return GetOnedCode128Writer()->RenderDeviceResult( - device, matrix, m_renderContents.AsStringC()); + device, matrix, m_renderContents.AsStringView()); } BC_TYPE CBC_Code128::GetType() { diff --git a/fxbarcode/cbc_code128.h b/fxbarcode/cbc_code128.h index 571ee7e5a0..b057aff2af 100644 --- a/fxbarcode/cbc_code128.h +++ b/fxbarcode/cbc_code128.h @@ -20,7 +20,7 @@ class CBC_Code128 : public CBC_OneCode { ~CBC_Code128() override; // CBC_OneCode: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; @@ -30,7 +30,7 @@ class CBC_Code128 : public CBC_OneCode { private: CBC_OnedCode128Writer* GetOnedCode128Writer(); - CFX_WideString m_renderContents; + WideString m_renderContents; }; #endif // FXBARCODE_CBC_CODE128_H_ diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp index a46af14b9a..9715c25828 100644 --- a/fxbarcode/cbc_code39.cpp +++ b/fxbarcode/cbc_code39.cpp @@ -31,7 +31,7 @@ CBC_Code39::CBC_Code39() CBC_Code39::~CBC_Code39() {} -bool CBC_Code39::Encode(const CFX_WideStringC& contents) { +bool CBC_Code39::Encode(const WideStringView& contents) { if (contents.IsEmpty()) return false; @@ -39,25 +39,25 @@ bool CBC_Code39::Encode(const CFX_WideStringC& contents) { int32_t outWidth = 0; int32_t outHeight = 0; auto* pWriter = GetOnedCode39Writer(); - CFX_WideString filtercontents = pWriter->FilterContents(contents); - CFX_WideString renderContents = pWriter->RenderTextContents(contents); + WideString filtercontents = pWriter->FilterContents(contents); + WideString renderContents = pWriter->RenderTextContents(contents); m_renderContents = renderContents; - CFX_ByteString byteString = filtercontents.UTF8Encode(); + ByteString byteString = filtercontents.UTF8Encode(); std::unique_ptr<uint8_t, FxFreeDeleter> data( pWriter->Encode(byteString, format, outWidth, outHeight)); if (!data) return false; - return pWriter->RenderResult(renderContents.AsStringC(), data.get(), + return pWriter->RenderResult(renderContents.AsStringView(), data.get(), outWidth); } bool CBC_Code39::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) { auto* pWriter = GetOnedCode39Writer(); - CFX_WideString renderCon; - if (!pWriter->encodedContents(m_renderContents.AsStringC(), &renderCon)) + WideString renderCon; + if (!pWriter->encodedContents(m_renderContents.AsStringView(), &renderCon)) return false; - return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringC()); + return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringView()); } BC_TYPE CBC_Code39::GetType() { diff --git a/fxbarcode/cbc_code39.h b/fxbarcode/cbc_code39.h index 66974c0947..937673c740 100644 --- a/fxbarcode/cbc_code39.h +++ b/fxbarcode/cbc_code39.h @@ -21,7 +21,7 @@ class CBC_Code39 : public CBC_OneCode { ~CBC_Code39() override; // CBC_OneCode: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; @@ -32,7 +32,7 @@ class CBC_Code39 : public CBC_OneCode { private: CBC_OnedCode39Writer* GetOnedCode39Writer(); - CFX_WideString m_renderContents; + WideString m_renderContents; }; #endif // FXBARCODE_CBC_CODE39_H_ diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h index f1a7b03ae2..aab98da32b 100644 --- a/fxbarcode/cbc_codebase.h +++ b/fxbarcode/cbc_codebase.h @@ -26,7 +26,7 @@ class CBC_CodeBase { virtual ~CBC_CodeBase(); virtual BC_TYPE GetType() = 0; - virtual bool Encode(const CFX_WideStringC& contents) = 0; + virtual bool Encode(const WideStringView& contents) = 0; virtual bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) = 0; diff --git a/fxbarcode/cbc_datamatrix.cpp b/fxbarcode/cbc_datamatrix.cpp index 91ed10e8e0..c9e23fa7ae 100644 --- a/fxbarcode/cbc_datamatrix.cpp +++ b/fxbarcode/cbc_datamatrix.cpp @@ -31,12 +31,12 @@ CBC_DataMatrix::CBC_DataMatrix() CBC_DataMatrix::~CBC_DataMatrix() {} -bool CBC_DataMatrix::Encode(const CFX_WideStringC& contents) { +bool CBC_DataMatrix::Encode(const WideStringView& contents) { int32_t outWidth = 0; int32_t outHeight = 0; auto* pWriter = GetDataMatrixWriter(); std::unique_ptr<uint8_t, FxFreeDeleter> data( - pWriter->Encode(CFX_WideString(contents), outWidth, outHeight)); + pWriter->Encode(WideString(contents), outWidth, outHeight)); if (!data) return false; return pWriter->RenderResult(data.get(), outWidth, outHeight); diff --git a/fxbarcode/cbc_datamatrix.h b/fxbarcode/cbc_datamatrix.h index 9f6c914fb4..3fe1c09326 100644 --- a/fxbarcode/cbc_datamatrix.h +++ b/fxbarcode/cbc_datamatrix.h @@ -20,7 +20,7 @@ class CBC_DataMatrix : public CBC_CodeBase { ~CBC_DataMatrix() override; // CBC_OneCode: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; diff --git a/fxbarcode/cbc_ean13.cpp b/fxbarcode/cbc_ean13.cpp index 3606527142..16725323f4 100644 --- a/fxbarcode/cbc_ean13.cpp +++ b/fxbarcode/cbc_ean13.cpp @@ -31,15 +31,15 @@ CBC_EAN13::CBC_EAN13() CBC_EAN13::~CBC_EAN13() {} -CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) { +WideString CBC_EAN13::Preprocess(const WideStringView& contents) { auto* pWriter = GetOnedEAN13Writer(); - CFX_WideString encodeContents = pWriter->FilterContents(contents); + WideString encodeContents = pWriter->FilterContents(contents); int32_t length = encodeContents.GetLength(); if (length <= 12) { for (int32_t i = 0; i < 12 - length; i++) encodeContents = wchar_t('0') + encodeContents; - CFX_ByteString byteString = encodeContents.UTF8Encode(); + ByteString byteString = encodeContents.UTF8Encode(); int32_t checksum = pWriter->CalcChecksum(byteString); byteString += checksum - 0 + '0'; encodeContents = byteString.UTF8Decode(); @@ -50,29 +50,29 @@ CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) { return encodeContents; } -bool CBC_EAN13::Encode(const CFX_WideStringC& contents) { +bool CBC_EAN13::Encode(const WideStringView& contents) { if (contents.IsEmpty()) return false; BCFORMAT format = BCFORMAT_EAN_13; int32_t outWidth = 0; int32_t outHeight = 0; - CFX_WideString encodeContents = Preprocess(contents); - CFX_ByteString byteString = encodeContents.UTF8Encode(); + WideString encodeContents = Preprocess(contents); + ByteString byteString = encodeContents.UTF8Encode(); m_renderContents = encodeContents; auto* pWriter = GetOnedEAN13Writer(); std::unique_ptr<uint8_t, FxFreeDeleter> data( pWriter->Encode(byteString, format, outWidth, outHeight)); if (!data) return false; - return pWriter->RenderResult(encodeContents.AsStringC(), data.get(), + return pWriter->RenderResult(encodeContents.AsStringView(), data.get(), outWidth); } bool CBC_EAN13::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) { - return GetOnedEAN13Writer()->RenderDeviceResult(device, matrix, - m_renderContents.AsStringC()); + return GetOnedEAN13Writer()->RenderDeviceResult( + device, matrix, m_renderContents.AsStringView()); } BC_TYPE CBC_EAN13::GetType() { diff --git a/fxbarcode/cbc_ean13.h b/fxbarcode/cbc_ean13.h index 8a62151685..609f8b0dc2 100644 --- a/fxbarcode/cbc_ean13.h +++ b/fxbarcode/cbc_ean13.h @@ -21,16 +21,16 @@ class CBC_EAN13 : public CBC_OneCode { ~CBC_EAN13() override; // CBC_OneCode: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; private: CBC_OnedEAN13Writer* GetOnedEAN13Writer(); - CFX_WideString Preprocess(const CFX_WideStringC& contents); + WideString Preprocess(const WideStringView& contents); - CFX_WideString m_renderContents; + WideString m_renderContents; }; #endif // FXBARCODE_CBC_EAN13_H_ diff --git a/fxbarcode/cbc_ean8.cpp b/fxbarcode/cbc_ean8.cpp index 7fbe07fd7f..796f3a526b 100644 --- a/fxbarcode/cbc_ean8.cpp +++ b/fxbarcode/cbc_ean8.cpp @@ -30,15 +30,15 @@ CBC_EAN8::CBC_EAN8() : CBC_OneCode(pdfium::MakeUnique<CBC_OnedEAN8Writer>()) {} CBC_EAN8::~CBC_EAN8() {} -CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) { +WideString CBC_EAN8::Preprocess(const WideStringView& contents) { auto* pWriter = GetOnedEAN8Writer(); - CFX_WideString encodeContents = pWriter->FilterContents(contents); + WideString encodeContents = pWriter->FilterContents(contents); int32_t length = encodeContents.GetLength(); if (length <= 7) { for (int32_t i = 0; i < 7 - length; i++) encodeContents = wchar_t('0') + encodeContents; - CFX_ByteString byteString = encodeContents.UTF8Encode(); + ByteString byteString = encodeContents.UTF8Encode(); int32_t checksum = pWriter->CalcChecksum(byteString); encodeContents += wchar_t(checksum - 0 + '0'); } @@ -48,29 +48,29 @@ CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) { return encodeContents; } -bool CBC_EAN8::Encode(const CFX_WideStringC& contents) { +bool CBC_EAN8::Encode(const WideStringView& contents) { if (contents.IsEmpty()) return false; BCFORMAT format = BCFORMAT_EAN_8; int32_t outWidth = 0; int32_t outHeight = 0; - CFX_WideString encodeContents = Preprocess(contents); - CFX_ByteString byteString = encodeContents.UTF8Encode(); + WideString encodeContents = Preprocess(contents); + ByteString byteString = encodeContents.UTF8Encode(); m_renderContents = encodeContents; auto* pWriter = GetOnedEAN8Writer(); std::unique_ptr<uint8_t, FxFreeDeleter> data( pWriter->Encode(byteString, format, outWidth, outHeight)); if (!data) return false; - return pWriter->RenderResult(encodeContents.AsStringC(), data.get(), + return pWriter->RenderResult(encodeContents.AsStringView(), data.get(), outWidth); } bool CBC_EAN8::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) { - return GetOnedEAN8Writer()->RenderDeviceResult(device, matrix, - m_renderContents.AsStringC()); + return GetOnedEAN8Writer()->RenderDeviceResult( + device, matrix, m_renderContents.AsStringView()); } BC_TYPE CBC_EAN8::GetType() { diff --git a/fxbarcode/cbc_ean8.h b/fxbarcode/cbc_ean8.h index df0ca6246a..4127650c44 100644 --- a/fxbarcode/cbc_ean8.h +++ b/fxbarcode/cbc_ean8.h @@ -20,15 +20,15 @@ class CBC_EAN8 : public CBC_OneCode { ~CBC_EAN8() override; // CBC_OneCode: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; private: CBC_OnedEAN8Writer* GetOnedEAN8Writer(); - CFX_WideString Preprocess(const CFX_WideStringC& contents); - CFX_WideString m_renderContents; + WideString Preprocess(const WideStringView& contents); + WideString m_renderContents; }; #endif // FXBARCODE_CBC_EAN8_H_ diff --git a/fxbarcode/cbc_onecode.cpp b/fxbarcode/cbc_onecode.cpp index 2d64704f7e..fb8cb05ef8 100644 --- a/fxbarcode/cbc_onecode.cpp +++ b/fxbarcode/cbc_onecode.cpp @@ -30,11 +30,11 @@ CBC_OneCode::CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter) CBC_OneCode::~CBC_OneCode() {} -bool CBC_OneCode::CheckContentValidity(const CFX_WideStringC& contents) { +bool CBC_OneCode::CheckContentValidity(const WideStringView& contents) { return GetOneDimWriter()->CheckContentValidity(contents); } -CFX_WideString CBC_OneCode::FilterContents(const CFX_WideStringC& contents) { +WideString CBC_OneCode::FilterContents(const WideStringView& contents) { return GetOneDimWriter()->FilterContents(contents); } diff --git a/fxbarcode/cbc_onecode.h b/fxbarcode/cbc_onecode.h index e6b5b7b511..eae618ec6b 100644 --- a/fxbarcode/cbc_onecode.h +++ b/fxbarcode/cbc_onecode.h @@ -21,8 +21,8 @@ class CBC_OneCode : public CBC_CodeBase { explicit CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter); ~CBC_OneCode() override; - virtual bool CheckContentValidity(const CFX_WideStringC& contents); - virtual CFX_WideString FilterContents(const CFX_WideStringC& contents); + virtual bool CheckContentValidity(const WideStringView& contents); + virtual WideString FilterContents(const WideStringView& contents); virtual void SetPrintChecksum(bool checksum); virtual void SetDataLength(int32_t length); diff --git a/fxbarcode/cbc_pdf417i.cpp b/fxbarcode/cbc_pdf417i.cpp index 545a7d8cbf..4e7e063a44 100644 --- a/fxbarcode/cbc_pdf417i.cpp +++ b/fxbarcode/cbc_pdf417i.cpp @@ -40,12 +40,12 @@ void CBC_PDF417I::SetTruncated(bool truncated) { GetPDF417Writer()->SetTruncated(truncated); } -bool CBC_PDF417I::Encode(const CFX_WideStringC& contents) { +bool CBC_PDF417I::Encode(const WideStringView& contents) { int32_t outWidth = 0; int32_t outHeight = 0; auto* pWriter = GetPDF417Writer(); std::unique_ptr<uint8_t, FxFreeDeleter> data( - pWriter->Encode(CFX_WideString(contents), outWidth, outHeight)); + pWriter->Encode(WideString(contents), outWidth, outHeight)); if (!data) return false; return pWriter->RenderResult(data.get(), outWidth, outHeight); diff --git a/fxbarcode/cbc_pdf417i.h b/fxbarcode/cbc_pdf417i.h index 73f99d3579..5bd7a26eeb 100644 --- a/fxbarcode/cbc_pdf417i.h +++ b/fxbarcode/cbc_pdf417i.h @@ -20,7 +20,7 @@ class CBC_PDF417I : public CBC_CodeBase { ~CBC_PDF417I() override; // CBC_CodeBase: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; diff --git a/fxbarcode/cbc_qrcode.cpp b/fxbarcode/cbc_qrcode.cpp index 297ce77212..0f3a65ef3a 100644 --- a/fxbarcode/cbc_qrcode.cpp +++ b/fxbarcode/cbc_qrcode.cpp @@ -37,13 +37,13 @@ bool CBC_QRCode::SetErrorCorrectionLevel(int32_t level) { return GetQRCodeWriter()->SetErrorCorrectionLevel(level); } -bool CBC_QRCode::Encode(const CFX_WideStringC& contents) { +bool CBC_QRCode::Encode(const WideStringView& contents) { int32_t outWidth = 0; int32_t outHeight = 0; CBC_QRCodeWriter* pWriter = GetQRCodeWriter(); std::unique_ptr<uint8_t, FxFreeDeleter> data( - pWriter->Encode(CFX_WideString(contents), - pWriter->GetErrorCorrectionLevel(), outWidth, outHeight)); + pWriter->Encode(WideString(contents), pWriter->GetErrorCorrectionLevel(), + outWidth, outHeight)); if (!data) return false; return pWriter->RenderResult(data.get(), outWidth, outHeight); diff --git a/fxbarcode/cbc_qrcode.h b/fxbarcode/cbc_qrcode.h index 638726769c..509de8a8d8 100644 --- a/fxbarcode/cbc_qrcode.h +++ b/fxbarcode/cbc_qrcode.h @@ -20,7 +20,7 @@ class CBC_QRCode : public CBC_CodeBase { ~CBC_QRCode() override; // CBC_CodeBase: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; diff --git a/fxbarcode/cbc_upca.cpp b/fxbarcode/cbc_upca.cpp index f4c273f764..69cedce580 100644 --- a/fxbarcode/cbc_upca.cpp +++ b/fxbarcode/cbc_upca.cpp @@ -30,15 +30,15 @@ CBC_UPCA::CBC_UPCA() : CBC_OneCode(pdfium::MakeUnique<CBC_OnedUPCAWriter>()) {} CBC_UPCA::~CBC_UPCA() {} -CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) { +WideString CBC_UPCA::Preprocess(const WideStringView& contents) { CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter(); - CFX_WideString encodeContents = pWriter->FilterContents(contents); + WideString encodeContents = pWriter->FilterContents(contents); int32_t length = encodeContents.GetLength(); if (length <= 11) { for (int32_t i = 0; i < 11 - length; i++) encodeContents = wchar_t('0') + encodeContents; - CFX_ByteString byteString = encodeContents.UTF8Encode(); + ByteString byteString = encodeContents.UTF8Encode(); int32_t checksum = pWriter->CalcChecksum(byteString); byteString += checksum - 0 + '0'; encodeContents = byteString.UTF8Decode(); @@ -49,15 +49,15 @@ CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) { return encodeContents; } -bool CBC_UPCA::Encode(const CFX_WideStringC& contents) { +bool CBC_UPCA::Encode(const WideStringView& contents) { if (contents.IsEmpty()) return false; BCFORMAT format = BCFORMAT_UPC_A; int32_t outWidth = 0; int32_t outHeight = 0; - CFX_WideString encodeContents = Preprocess(contents); - CFX_ByteString byteString = encodeContents.UTF8Encode(); + WideString encodeContents = Preprocess(contents); + ByteString byteString = encodeContents.UTF8Encode(); m_renderContents = encodeContents; CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter(); @@ -66,14 +66,14 @@ bool CBC_UPCA::Encode(const CFX_WideStringC& contents) { pWriter->Encode(byteString, format, outWidth, outHeight)); if (!data) return false; - return pWriter->RenderResult(encodeContents.AsStringC(), data.get(), + return pWriter->RenderResult(encodeContents.AsStringView(), data.get(), outWidth); } bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) { - return GetOnedUPCAWriter()->RenderDeviceResult(device, matrix, - m_renderContents.AsStringC()); + return GetOnedUPCAWriter()->RenderDeviceResult( + device, matrix, m_renderContents.AsStringView()); } BC_TYPE CBC_UPCA::GetType() { diff --git a/fxbarcode/cbc_upca.h b/fxbarcode/cbc_upca.h index 5955230c46..29c4d7d9e6 100644 --- a/fxbarcode/cbc_upca.h +++ b/fxbarcode/cbc_upca.h @@ -20,15 +20,15 @@ class CBC_UPCA : public CBC_OneCode { ~CBC_UPCA() override; // CBC_CodeBase: - bool Encode(const CFX_WideStringC& contents) override; + bool Encode(const WideStringView& contents) override; bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix) override; BC_TYPE GetType() override; private: CBC_OnedUPCAWriter* GetOnedUPCAWriter(); - CFX_WideString Preprocess(const CFX_WideStringC& contents); - CFX_WideString m_renderContents; + WideString Preprocess(const WideStringView& contents); + WideString m_renderContents; }; #endif // FXBARCODE_CBC_UPCA_H_ diff --git a/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/fxbarcode/datamatrix/BC_Base256Encoder.cpp index 0cbd3fdb10..b7dd69c0f7 100644 --- a/fxbarcode/datamatrix/BC_Base256Encoder.cpp +++ b/fxbarcode/datamatrix/BC_Base256Encoder.cpp @@ -34,7 +34,7 @@ int32_t CBC_Base256Encoder::getEncodingMode() { return BASE256_ENCODATION; } void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { - CFX_WideString buffer; + WideString buffer; buffer += L'\0'; while (context.hasMoreCharacters()) { wchar_t c = context.getCurrentChar(); diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp index 8a55c922ed..348315e149 100644 --- a/fxbarcode/datamatrix/BC_C40Encoder.cpp +++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp @@ -31,7 +31,7 @@ namespace { -CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) { +WideString EncodeToCodewords(const WideString& sb, int32_t startPos) { wchar_t c1 = sb[startPos]; wchar_t c2 = sb[startPos + 1]; wchar_t c3 = sb[startPos + 2]; @@ -39,7 +39,7 @@ CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) { wchar_t cw[2]; cw[0] = static_cast<wchar_t>(v / 256); cw[1] = static_cast<wchar_t>(v % 256); - return CFX_WideString(cw, FX_ArraySize(cw)); + return WideString(cw, FX_ArraySize(cw)); } } // namespace @@ -50,7 +50,7 @@ int32_t CBC_C40Encoder::getEncodingMode() { return C40_ENCODATION; } void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { - CFX_WideString buffer; + WideString buffer; while (context.hasMoreCharacters()) { wchar_t c = context.getCurrentChar(); context.m_pos++; @@ -98,12 +98,12 @@ void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { handleEOD(context, buffer, e); } void CBC_C40Encoder::writeNextTriplet(CBC_EncoderContext& context, - CFX_WideString& buffer) { + WideString& buffer) { context.writeCodewords(EncodeToCodewords(buffer, 0)); buffer.Delete(0, 3); } void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context, - CFX_WideString& buffer, + WideString& buffer, int32_t& e) { int32_t unwritten = (buffer.GetLength() / 3) * 2; int32_t rest = buffer.GetLength() % 3; @@ -142,7 +142,7 @@ void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context, } context.signalEncoderChange(ASCII_ENCODATION); } -int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { +int32_t CBC_C40Encoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) { if (c == ' ') { sb += (wchar_t)'\3'; return 1; @@ -187,7 +187,7 @@ int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { } int32_t CBC_C40Encoder::BacktrackOneCharacter(CBC_EncoderContext* context, - CFX_WideString* buffer, + WideString* buffer, int32_t lastCharSize) { if (context->m_pos < 1) return -1; @@ -200,7 +200,7 @@ int32_t CBC_C40Encoder::BacktrackOneCharacter(CBC_EncoderContext* context, context->m_pos--; wchar_t c = context->getCurrentChar(); int32_t e = BCExceptionNO; - CFX_WideString removed; + WideString removed; int32_t len = encodeChar(c, removed, e); if (e != BCExceptionNO) return -1; diff --git a/fxbarcode/datamatrix/BC_C40Encoder.h b/fxbarcode/datamatrix/BC_C40Encoder.h index 550d226efb..5ddad92009 100644 --- a/fxbarcode/datamatrix/BC_C40Encoder.h +++ b/fxbarcode/datamatrix/BC_C40Encoder.h @@ -7,10 +7,9 @@ #ifndef FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_ #define FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_ +#include "core/fxcrt/widestring.h" #include "fxbarcode/datamatrix/BC_Encoder.h" -class CFX_WideString; - class CBC_C40Encoder : public CBC_Encoder { public: CBC_C40Encoder(); @@ -20,13 +19,12 @@ class CBC_C40Encoder : public CBC_Encoder { int32_t getEncodingMode() override; void Encode(CBC_EncoderContext& context, int32_t& e) override; - static void writeNextTriplet(CBC_EncoderContext& context, - CFX_WideString& buffer); + static void writeNextTriplet(CBC_EncoderContext& context, WideString& buffer); virtual void handleEOD(CBC_EncoderContext& context, - CFX_WideString& buffer, + WideString& buffer, int32_t& e); - virtual int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e); + virtual int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e); private: // Moves back by 1 position in |context| and adjusts |buffer| accordingly @@ -34,7 +32,7 @@ class CBC_C40Encoder : public CBC_Encoder { // |context| after adjusting the position. If the character cannot be encoded, // return -1. int32_t BacktrackOneCharacter(CBC_EncoderContext* context, - CFX_WideString* buffer, + WideString* buffer, int32_t lastCharSize); }; diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp index 98af282f8f..d4f9ad3479 100644 --- a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp +++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp @@ -108,15 +108,15 @@ bool CBC_DataMatrixWriter::SetErrorCorrectionLevel(int32_t level) { return true; } -uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents, +uint8_t* CBC_DataMatrixWriter::Encode(const WideString& contents, int32_t& outWidth, int32_t& outHeight) { if (outWidth < 0 || outHeight < 0) return nullptr; - CFX_WideString ecLevel; + WideString ecLevel; int32_t e = BCExceptionNO; - CFX_WideString encoded = + WideString encoded = CBC_HighLevelEncoder::encodeHighLevel(contents, ecLevel, false, e); if (e != BCExceptionNO) return nullptr; @@ -124,7 +124,7 @@ uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents, CBC_SymbolInfo::lookup(encoded.GetLength(), false, e); if (e != BCExceptionNO) return nullptr; - CFX_WideString codewords = + WideString codewords = CBC_ErrorCorrection::encodeECC200(encoded, symbolInfo, e); if (e != BCExceptionNO) return nullptr; diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.h b/fxbarcode/datamatrix/BC_DataMatrixWriter.h index 84b83fe7a3..ba2c54762e 100644 --- a/fxbarcode/datamatrix/BC_DataMatrixWriter.h +++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.h @@ -18,7 +18,7 @@ class CBC_DataMatrixWriter : public CBC_TwoDimWriter { CBC_DataMatrixWriter(); ~CBC_DataMatrixWriter() override; - uint8_t* Encode(const CFX_WideString& contents, + uint8_t* Encode(const WideString& contents, int32_t& outWidth, int32_t& outHeight); diff --git a/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/fxbarcode/datamatrix/BC_DefaultPlacement.cpp index 934d79503c..3f1b35864f 100644 --- a/fxbarcode/datamatrix/BC_DefaultPlacement.cpp +++ b/fxbarcode/datamatrix/BC_DefaultPlacement.cpp @@ -23,7 +23,7 @@ #include "fxbarcode/datamatrix/BC_DefaultPlacement.h" #include "fxbarcode/datamatrix/BC_Encoder.h" -CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords, +CBC_DefaultPlacement::CBC_DefaultPlacement(WideString codewords, int32_t numcols, int32_t numrows) { m_codewords = codewords; diff --git a/fxbarcode/datamatrix/BC_DefaultPlacement.h b/fxbarcode/datamatrix/BC_DefaultPlacement.h index 17ecac9f5c..12ea852136 100644 --- a/fxbarcode/datamatrix/BC_DefaultPlacement.h +++ b/fxbarcode/datamatrix/BC_DefaultPlacement.h @@ -13,9 +13,7 @@ class CBC_DefaultPlacement { public: - CBC_DefaultPlacement(CFX_WideString codewords, - int32_t numcols, - int32_t numrows); + CBC_DefaultPlacement(WideString codewords, int32_t numcols, int32_t numrows); virtual ~CBC_DefaultPlacement(); int32_t getNumrows(); @@ -27,7 +25,7 @@ class CBC_DefaultPlacement { void place(); private: - CFX_WideString m_codewords; + WideString m_codewords; int32_t m_numrows; int32_t m_numcols; std::vector<uint8_t> m_bits; diff --git a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp index 7407efb47e..438c87a38f 100644 --- a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp +++ b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp @@ -33,10 +33,10 @@ namespace { -CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) { +WideString EncodeToCodewords(const WideString& sb, int32_t startPos) { int32_t len = sb.GetLength() - startPos; if (len == 0) - return CFX_WideString(); + return WideString(); wchar_t c1 = sb[startPos]; wchar_t c2 = len >= 2 ? sb[startPos + 1] : 0; @@ -48,10 +48,10 @@ CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) { cw[0] = static_cast<wchar_t>((v >> 16) & 255); cw[1] = static_cast<wchar_t>((v >> 8) & 255); cw[2] = static_cast<wchar_t>(v & 255); - return CFX_WideString(cw, std::min(len, kBuflen)); + return WideString(cw, std::min(len, kBuflen)); } -bool HandleEOD(CBC_EncoderContext* context, const CFX_WideString& buffer) { +bool HandleEOD(CBC_EncoderContext* context, const WideString& buffer) { int32_t count = buffer.GetLength(); if (count == 0) return true; @@ -72,7 +72,7 @@ bool HandleEOD(CBC_EncoderContext* context, const CFX_WideString& buffer) { } int32_t restChars = count - 1; - CFX_WideString encoded = EncodeToCodewords(buffer, 0); + WideString encoded = EncodeToCodewords(buffer, 0); if (encoded.IsEmpty()) return false; @@ -105,7 +105,7 @@ bool HandleEOD(CBC_EncoderContext* context, const CFX_WideString& buffer) { return true; } -void encodeChar(wchar_t c, CFX_WideString* sb, int32_t& e) { +void encodeChar(wchar_t c, WideString* sb, int32_t& e) { if (c >= ' ' && c <= '?') { *sb += c; } else if (c >= '@' && c <= '^') { @@ -126,7 +126,7 @@ int32_t CBC_EdifactEncoder::getEncodingMode() { } void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { - CFX_WideString buffer; + WideString buffer; while (context.hasMoreCharacters()) { wchar_t c = context.getCurrentChar(); encodeChar(c, &buffer, e); @@ -136,7 +136,7 @@ void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) { context.m_pos++; int32_t count = buffer.GetLength(); if (count >= 4) { - CFX_WideString encoded = EncodeToCodewords(buffer, 0); + WideString encoded = EncodeToCodewords(buffer, 0); if (encoded.IsEmpty()) { e = BCExceptionGeneric; return; diff --git a/fxbarcode/datamatrix/BC_EncoderContext.cpp b/fxbarcode/datamatrix/BC_EncoderContext.cpp index eaf3768f49..6e1671035a 100644 --- a/fxbarcode/datamatrix/BC_EncoderContext.cpp +++ b/fxbarcode/datamatrix/BC_EncoderContext.cpp @@ -28,12 +28,12 @@ #include "fxbarcode/datamatrix/BC_SymbolInfo.h" #include "fxbarcode/utils.h" -CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString& msg, - const CFX_WideString& ecLevel, +CBC_EncoderContext::CBC_EncoderContext(const WideString& msg, + const WideString& ecLevel, int32_t& e) { - CFX_ByteString dststr; + ByteString dststr; CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr); - CFX_WideString sb; + WideString sb; FX_STRSIZE c = dststr.GetLength(); for (FX_STRSIZE i = 0; i < c; i++) { wchar_t ch = static_cast<wchar_t>(dststr[i] & 0xff); @@ -66,7 +66,7 @@ wchar_t CBC_EncoderContext::getCurrent() { return m_msg[m_pos]; } -void CBC_EncoderContext::writeCodewords(const CFX_WideString& codewords) { +void CBC_EncoderContext::writeCodewords(const WideString& codewords) { m_codewords += codewords; } diff --git a/fxbarcode/datamatrix/BC_EncoderContext.h b/fxbarcode/datamatrix/BC_EncoderContext.h index ef4c38ebab..1289a45e68 100644 --- a/fxbarcode/datamatrix/BC_EncoderContext.h +++ b/fxbarcode/datamatrix/BC_EncoderContext.h @@ -8,14 +8,14 @@ #define FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_ #include "core/fxcrt/cfx_unowned_ptr.h" -#include "core/fxcrt/cfx_widestring.h" +#include "core/fxcrt/widestring.h" class CBC_SymbolInfo; class CBC_EncoderContext { public: - CBC_EncoderContext(const CFX_WideString& msg, - const CFX_WideString& ecLevel, + CBC_EncoderContext(const WideString& msg, + const WideString& ecLevel, int32_t& e); ~CBC_EncoderContext(); @@ -23,7 +23,7 @@ class CBC_EncoderContext { void setSkipAtEnd(int32_t count); wchar_t getCurrentChar(); wchar_t getCurrent(); - void writeCodewords(const CFX_WideString& codewords); + void writeCodewords(const WideString& codewords); void writeCodeword(wchar_t codeword); FX_STRSIZE getCodewordCount(); void signalEncoderChange(int32_t encoding); @@ -34,8 +34,8 @@ class CBC_EncoderContext { void updateSymbolInfo(int32_t len, int32_t& e); void resetSymbolInfo(); - CFX_WideString m_msg; - CFX_WideString m_codewords; + WideString m_msg; + WideString m_codewords; FX_STRSIZE m_pos; int32_t m_newEncoding; CFX_UnownedPtr<CBC_SymbolInfo> m_symbolInfo; diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp index c45eadcf9a..35077ee628 100644 --- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp +++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp @@ -119,22 +119,21 @@ void CBC_ErrorCorrection::Initialize() { void CBC_ErrorCorrection::Finalize() {} CBC_ErrorCorrection::CBC_ErrorCorrection() {} CBC_ErrorCorrection::~CBC_ErrorCorrection() {} -CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, - CBC_SymbolInfo* symbolInfo, - int32_t& e) { +WideString CBC_ErrorCorrection::encodeECC200(WideString codewords, + CBC_SymbolInfo* symbolInfo, + int32_t& e) { if (pdfium::base::checked_cast<int32_t>(codewords.GetLength()) != symbolInfo->dataCapacity()) { e = BCExceptionIllegalArgument; - return CFX_WideString(); + return WideString(); } - CFX_WideString sb; + WideString sb; sb += codewords; int32_t blockCount = symbolInfo->getInterleavedBlockCount(); if (blockCount == 1) { - CFX_WideString ecc = - createECCBlock(codewords, symbolInfo->errorCodewords(), e); + WideString ecc = createECCBlock(codewords, symbolInfo->errorCodewords(), e); if (e != BCExceptionNO) - return CFX_WideString(); + return WideString(); sb += ecc; } else { std::vector<int32_t> dataSizes(blockCount); @@ -149,13 +148,13 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, } } for (int32_t block = 0; block < blockCount; block++) { - CFX_WideString temp; + WideString temp; for (int32_t d = block; d < symbolInfo->dataCapacity(); d += blockCount) { temp += (wchar_t)codewords[d]; } - CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e); + WideString ecc = createECCBlock(temp, errorSizes[block], e); if (e != BCExceptionNO) - return CFX_WideString(); + return WideString(); int32_t pos = 0; for (int32_t l = block; l < errorSizes[block] * blockCount; l += blockCount) { @@ -165,16 +164,16 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, } return sb; } -CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, - int32_t numECWords, - int32_t& e) { +WideString CBC_ErrorCorrection::createECCBlock(WideString codewords, + int32_t numECWords, + int32_t& e) { return createECCBlock(codewords, 0, codewords.GetLength(), numECWords, e); } -CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, - int32_t start, - int32_t len, - int32_t numECWords, - int32_t& e) { +WideString CBC_ErrorCorrection::createECCBlock(WideString codewords, + int32_t start, + int32_t len, + int32_t numECWords, + int32_t& e) { static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t); size_t table = 0; while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords) @@ -182,7 +181,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, if (table >= kFactorTableNum) { e = BCExceptionIllegalArgument; - return CFX_WideString(); + return WideString(); } uint16_t* ecc = FX_Alloc(uint16_t, numECWords); memset(ecc, 0, numECWords * sizeof(uint16_t)); @@ -202,7 +201,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, ecc[0] = 0; } } - CFX_WideString strecc; + WideString strecc; for (int32_t j = 0; j < numECWords; j++) { strecc += (wchar_t)ecc[numECWords - j - 1]; } diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.h b/fxbarcode/datamatrix/BC_ErrorCorrection.h index 97a2e48e2d..361b205ef4 100644 --- a/fxbarcode/datamatrix/BC_ErrorCorrection.h +++ b/fxbarcode/datamatrix/BC_ErrorCorrection.h @@ -7,7 +7,7 @@ #ifndef FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_ #define FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_ -#include "core/fxcrt/cfx_widestring.h" +#include "core/fxcrt/widestring.h" class CBC_SymbolInfo; @@ -18,9 +18,9 @@ class CBC_ErrorCorrection { static void Initialize(); static void Finalize(); - static CFX_WideString encodeECC200(CFX_WideString codewords, - CBC_SymbolInfo* symbolInfo, - int32_t& e); + static WideString encodeECC200(WideString codewords, + CBC_SymbolInfo* symbolInfo, + int32_t& e); private: static int32_t MODULO_VALUE; @@ -28,14 +28,14 @@ class CBC_ErrorCorrection { static int32_t ALOG[256]; private: - static CFX_WideString createECCBlock(CFX_WideString codewords, - int32_t numECWords, - int32_t& e); - static CFX_WideString createECCBlock(CFX_WideString codewords, - int32_t start, - int32_t len, - int32_t numECWords, - int32_t& e); + static WideString createECCBlock(WideString codewords, + int32_t numECWords, + int32_t& e); + static WideString createECCBlock(WideString codewords, + int32_t start, + int32_t len, + int32_t numECWords, + int32_t& e); }; #endif // FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_ diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index b8c63946db..56a8847066 100644 --- a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -58,22 +58,21 @@ const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004; CBC_HighLevelEncoder::CBC_HighLevelEncoder() {} CBC_HighLevelEncoder::~CBC_HighLevelEncoder() {} -std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage( - CFX_WideString msg) { - CFX_ByteString bytestr; +std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(WideString msg) { + ByteString bytestr; CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr); m_bytearray.insert(m_bytearray.end(), bytestr.begin(), bytestr.end()); return m_bytearray; } // static -CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, - CFX_WideString ecLevel, - bool allowRectangular, - int32_t& e) { +WideString CBC_HighLevelEncoder::encodeHighLevel(WideString msg, + WideString ecLevel, + bool allowRectangular, + int32_t& e) { CBC_EncoderContext context(msg, ecLevel, e); if (e != BCExceptionNO) - return CFX_WideString(); + return WideString(); context.setAllowRectangular(allowRectangular); if ((msg.Left(6) == MACRO_05_HEADER) && (msg.Last() == MACRO_TRAILER)) { @@ -117,7 +116,7 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, context.writeCodeword(0x00fe); } } - CFX_WideString codewords = context.m_codewords; + WideString codewords = context.m_codewords; if (pdfium::base::checked_cast<int32_t>(codewords.GetLength()) < capacity) { codewords += PAD; } @@ -128,7 +127,7 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, } return codewords; } -int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, +int32_t CBC_HighLevelEncoder::lookAheadTest(WideString msg, int32_t startpos, int32_t currentMode) { if (startpos >= pdfium::base::checked_cast<int32_t>(msg.GetLength())) { @@ -279,7 +278,7 @@ bool CBC_HighLevelEncoder::isDigit(wchar_t ch) { bool CBC_HighLevelEncoder::isExtendedASCII(wchar_t ch) { return ch >= 128 && ch <= 255; } -int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, +int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(WideString msg, int32_t startpos) { int32_t count = 0; int32_t len = msg.GetLength(); diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/fxbarcode/datamatrix/BC_HighLevelEncoder.h index 0b7ff9bf0e..50cfc8c592 100644 --- a/fxbarcode/datamatrix/BC_HighLevelEncoder.h +++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.h @@ -9,7 +9,7 @@ #include <vector> -#include "core/fxcrt/cfx_widestring.h" +#include "core/fxcrt/widestring.h" #define ASCII_ENCODATION 0 #define C40_ENCODATION 1 @@ -23,18 +23,18 @@ class CBC_HighLevelEncoder { CBC_HighLevelEncoder(); ~CBC_HighLevelEncoder(); - std::vector<uint8_t>& getBytesForMessage(CFX_WideString msg); + std::vector<uint8_t>& getBytesForMessage(WideString msg); - static CFX_WideString encodeHighLevel(CFX_WideString msg, - CFX_WideString ecLevel, - bool allowRectangular, - int32_t& e); - static int32_t lookAheadTest(CFX_WideString msg, + static WideString encodeHighLevel(WideString msg, + WideString ecLevel, + bool allowRectangular, + int32_t& e); + static int32_t lookAheadTest(WideString msg, int32_t startpos, int32_t currentMode); static bool isDigit(wchar_t ch); static bool isExtendedASCII(wchar_t ch); - static int32_t determineConsecutiveDigitCount(CFX_WideString msg, + static int32_t determineConsecutiveDigitCount(WideString msg, int32_t startpos); static const wchar_t LATCH_TO_C40; diff --git a/fxbarcode/datamatrix/BC_TextEncoder.cpp b/fxbarcode/datamatrix/BC_TextEncoder.cpp index 451c7b84d1..a78310ed21 100644 --- a/fxbarcode/datamatrix/BC_TextEncoder.cpp +++ b/fxbarcode/datamatrix/BC_TextEncoder.cpp @@ -33,7 +33,7 @@ CBC_TextEncoder::~CBC_TextEncoder() {} int32_t CBC_TextEncoder::getEncodingMode() { return TEXT_ENCODATION; } -int32_t CBC_TextEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { +int32_t CBC_TextEncoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) { if (c == ' ') { sb += (wchar_t)'\3'; return 1; diff --git a/fxbarcode/datamatrix/BC_TextEncoder.h b/fxbarcode/datamatrix/BC_TextEncoder.h index c4ba3c3e09..9d4cdafe10 100644 --- a/fxbarcode/datamatrix/BC_TextEncoder.h +++ b/fxbarcode/datamatrix/BC_TextEncoder.h @@ -16,7 +16,7 @@ class CBC_TextEncoder : public CBC_C40Encoder { // CBC_C40Encoder int32_t getEncodingMode() override; - int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override; + int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e) override; }; #endif // FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_ diff --git a/fxbarcode/datamatrix/BC_X12Encoder.cpp b/fxbarcode/datamatrix/BC_X12Encoder.cpp index 625ff90290..a080a71eac 100644 --- a/fxbarcode/datamatrix/BC_X12Encoder.cpp +++ b/fxbarcode/datamatrix/BC_X12Encoder.cpp @@ -36,7 +36,7 @@ int32_t CBC_X12Encoder::getEncodingMode() { return X12_ENCODATION; } void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { - CFX_WideString buffer; + WideString buffer; while (context.hasMoreCharacters()) { wchar_t c = context.getCurrentChar(); context.m_pos++; @@ -58,7 +58,7 @@ void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { handleEOD(context, buffer, e); } void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context, - CFX_WideString& buffer, + WideString& buffer, int32_t& e) { context.updateSymbolInfo(e); if (e != BCExceptionNO) { @@ -79,7 +79,7 @@ void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context, context.signalEncoderChange(ASCII_ENCODATION); } } -int32_t CBC_X12Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) { +int32_t CBC_X12Encoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) { if (c == '\r') { sb += (wchar_t)'\0'; } else if (c == '*') { diff --git a/fxbarcode/datamatrix/BC_X12Encoder.h b/fxbarcode/datamatrix/BC_X12Encoder.h index 146f739f84..324b78bdcc 100644 --- a/fxbarcode/datamatrix/BC_X12Encoder.h +++ b/fxbarcode/datamatrix/BC_X12Encoder.h @@ -18,9 +18,9 @@ class CBC_X12Encoder : public CBC_C40Encoder { int32_t getEncodingMode() override; void Encode(CBC_EncoderContext& context, int32_t& e) override; void handleEOD(CBC_EncoderContext& context, - CFX_WideString& buffer, + WideString& buffer, int32_t& e) override; - int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override; + int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e) override; }; #endif // FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_ diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp index 1f96c4575b..e09e0ce5aa 100644 --- a/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/fxbarcode/oned/BC_OneDimWriter.cpp @@ -89,7 +89,7 @@ wchar_t CBC_OneDimWriter::Upper(wchar_t ch) { return ch; } -uint8_t* CBC_OneDimWriter::EncodeWithHint(const CFX_ByteString& contents, +uint8_t* CBC_OneDimWriter::EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, @@ -98,7 +98,7 @@ uint8_t* CBC_OneDimWriter::EncodeWithHint(const CFX_ByteString& contents, return EncodeImpl(contents, outWidth); } -uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, +uint8_t* CBC_OneDimWriter::Encode(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight) { @@ -127,7 +127,7 @@ int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, return numAdded; } -void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, +void CBC_OneDimWriter::CalcTextInfo(const ByteString& text, FXTEXT_CHARPOS* charPos, CFX_Font* cFont, float geWidth, @@ -176,7 +176,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device, const CFX_Matrix* matrix, - const CFX_ByteString str, + const ByteString str, float geWidth, FXTEXT_CHARPOS* pCharPos, float locX, @@ -201,7 +201,7 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device, m_fontColor, FXTEXT_CLEARTYPE); } -bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, +bool CBC_OneDimWriter::ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, @@ -209,7 +209,7 @@ bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, if (!device || !m_pFont) return false; - CFX_ByteString str = FX_UTF8Encode(contents); + ByteString str = FX_UTF8Encode(contents); int32_t iLen = str.GetLength(); std::vector<FXTEXT_CHARPOS> charpos(iLen); float charsLen = 0; @@ -260,7 +260,7 @@ bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, bool CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, - const CFX_WideStringC& contents) { + const WideStringView& contents) { if (m_output.empty()) return false; @@ -283,7 +283,7 @@ bool CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, ShowChars(contents, device, matrix, m_barWidth, m_multiple); } -bool CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents, +bool CBC_OneDimWriter::RenderResult(const WideStringView& contents, uint8_t* code, int32_t codeLength) { if (codeLength < 1) @@ -338,7 +338,7 @@ void CBC_OneDimWriter::RenderVerticalBars(int32_t outputX, } } -CFX_WideString CBC_OneDimWriter::RenderTextContents( - const CFX_WideStringC& contents) { - return CFX_WideString(); +WideString CBC_OneDimWriter::RenderTextContents( + const WideStringView& contents) { + return WideString(); } diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h index 2d604b5b51..880f60f0b8 100644 --- a/fxbarcode/oned/BC_OneDimWriter.h +++ b/fxbarcode/oned/BC_OneDimWriter.h @@ -24,12 +24,12 @@ class CBC_OneDimWriter : public CBC_Writer { CBC_OneDimWriter(); ~CBC_OneDimWriter() override; - virtual bool RenderResult(const CFX_WideStringC& contents, + virtual bool RenderResult(const WideStringView& contents, uint8_t* code, int32_t codeLength); - virtual bool CheckContentValidity(const CFX_WideStringC& contents) = 0; - virtual CFX_WideString FilterContents(const CFX_WideStringC& contents) = 0; - virtual CFX_WideString RenderTextContents(const CFX_WideStringC& contents); + virtual bool CheckContentValidity(const WideStringView& contents) = 0; + virtual WideString FilterContents(const WideStringView& contents) = 0; + virtual WideString RenderTextContents(const WideStringView& contents); virtual void SetPrintChecksum(bool checksum); virtual void SetDataLength(int32_t length); virtual void SetCalcChecksum(bool state); @@ -37,37 +37,37 @@ class CBC_OneDimWriter : public CBC_Writer { virtual void SetFontStyle(int32_t style); virtual void SetFontColor(FX_ARGB color); - uint8_t* Encode(const CFX_ByteString& contents, + uint8_t* Encode(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight); bool RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, - const CFX_WideStringC& contents); + const WideStringView& contents); bool SetFont(CFX_Font* cFont); protected: - virtual uint8_t* EncodeWithHint(const CFX_ByteString& contents, + virtual uint8_t* EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t hints); - virtual uint8_t* EncodeImpl(const CFX_ByteString& contents, + virtual uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) = 0; - virtual void CalcTextInfo(const CFX_ByteString& text, + virtual void CalcTextInfo(const ByteString& text, FXTEXT_CHARPOS* charPos, CFX_Font* cFont, float geWidth, int32_t fontSize, float& charsLen); - virtual bool ShowChars(const CFX_WideStringC& contents, + virtual bool ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple); virtual void ShowDeviceChars(CFX_RenderDevice* device, const CFX_Matrix* matrix, - const CFX_ByteString str, + const ByteString str, float geWidth, FXTEXT_CHARPOS* pCharPos, float locX, diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 03a733a8c2..4c5ad67194 100644 --- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -95,15 +95,15 @@ bool CBC_OnedCodaBarWriter::FindChar(wchar_t ch, bool isContent) { } bool CBC_OnedCodaBarWriter::CheckContentValidity( - const CFX_WideStringC& contents) { + const WideStringView& contents) { return std::all_of( contents.begin(), contents.end(), [this](const wchar_t& ch) { return this->FindChar(ch, false); }); } -CFX_WideString CBC_OnedCodaBarWriter::FilterContents( - const CFX_WideStringC& contents) { - CFX_WideString filtercontents; +WideString CBC_OnedCodaBarWriter::FilterContents( + const WideStringView& contents) { + WideString filtercontents; wchar_t ch; for (FX_STRSIZE index = 0; index < contents.GetLength(); index++) { ch = contents[index]; @@ -118,7 +118,7 @@ CFX_WideString CBC_OnedCodaBarWriter::FilterContents( return filtercontents; } -uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const CFX_ByteString& contents, +uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, @@ -129,9 +129,9 @@ uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const CFX_ByteString& contents, hints); } -uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const CFX_ByteString& contents, +uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const ByteString& contents, int32_t& outLength) { - CFX_ByteString data = m_chStart + contents + m_chEnd; + ByteString data = m_chStart + contents + m_chEnd; m_iContentLen = data.GetLength(); uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength()); char ch; @@ -188,16 +188,16 @@ uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const CFX_ByteString& contents, return result; } -CFX_WideString CBC_OnedCodaBarWriter::encodedContents( - const CFX_WideStringC& contents) { - CFX_WideString strStart(static_cast<wchar_t>(m_chStart)); - CFX_WideString strEnd(static_cast<wchar_t>(m_chEnd)); +WideString CBC_OnedCodaBarWriter::encodedContents( + const WideStringView& contents) { + WideString strStart(static_cast<wchar_t>(m_chStart)); + WideString strEnd(static_cast<wchar_t>(m_chEnd)); return strStart + contents + strEnd; } -bool CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents, +bool CBC_OnedCodaBarWriter::RenderResult(const WideStringView& contents, uint8_t* code, int32_t codeLength) { - return CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(), - code, codeLength); + return CBC_OneDimWriter::RenderResult( + encodedContents(contents).AsStringView(), code, codeLength); } diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h index 6a5f315073..ab354ef0a7 100644 --- a/fxbarcode/oned/BC_OnedCodaBarWriter.h +++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h @@ -18,18 +18,17 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter { ~CBC_OnedCodaBarWriter() override; // CBC_OneDimWriter - uint8_t* EncodeImpl(const CFX_ByteString& contents, - int32_t& outLength) override; - uint8_t* EncodeWithHint(const CFX_ByteString& contents, + uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override; + uint8_t* EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t hints) override; - bool RenderResult(const CFX_WideStringC& contents, + bool RenderResult(const WideStringView& contents, uint8_t* code, int32_t codeLength) override; - bool CheckContentValidity(const CFX_WideStringC& contents) override; - CFX_WideString FilterContents(const CFX_WideStringC& contents) override; + bool CheckContentValidity(const WideStringView& contents) override; + WideString FilterContents(const WideStringView& contents) override; void SetDataLength(int32_t length) override; virtual bool SetStartChar(char start); @@ -38,7 +37,7 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter { virtual bool SetWideNarrowRatio(int8_t ratio); virtual bool FindChar(wchar_t ch, bool isContent); - CFX_WideString encodedContents(const CFX_WideStringC& contents); + WideString encodedContents(const WideStringView& contents); private: char m_chStart; diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp index 1e9f98b9e7..61ec77b020 100644 --- a/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -84,7 +84,7 @@ CBC_OnedCode128Writer::CBC_OnedCode128Writer(BC_TYPE type) CBC_OnedCode128Writer::~CBC_OnedCode128Writer() {} bool CBC_OnedCode128Writer::CheckContentValidity( - const CFX_WideStringC& contents) { + const WideStringView& contents) { for (const auto& ch : contents) { int32_t patternIndex = static_cast<int32_t>(ch); if (patternIndex < 32 || patternIndex > 126 || patternIndex == 34) @@ -93,9 +93,9 @@ bool CBC_OnedCode128Writer::CheckContentValidity( return true; } -CFX_WideString CBC_OnedCode128Writer::FilterContents( - const CFX_WideStringC& contents) { - CFX_WideString filterChineseChar; +WideString CBC_OnedCode128Writer::FilterContents( + const WideStringView& contents) { + WideString filterChineseChar; for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if (ch > 175) { @@ -105,7 +105,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents( filterChineseChar += ch; } const wchar_t limit = m_codeFormat == BC_CODE128_B ? 126 : 106; - CFX_WideString filtercontents; + WideString filtercontents; for (const auto& ch : filterChineseChar) { if (ch >= 32 && ch <= limit) filtercontents += ch; @@ -121,7 +121,7 @@ bool CBC_OnedCode128Writer::SetTextLocation(BC_TEXT_LOC location) { return true; } -uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const CFX_ByteString& contents, +uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, @@ -132,7 +132,7 @@ uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const CFX_ByteString& contents, hints); } -uint8_t* CBC_OnedCode128Writer::EncodeImpl(const CFX_ByteString& contents, +uint8_t* CBC_OnedCode128Writer::EncodeImpl(const ByteString& contents, int32_t& outLength) { if (contents.GetLength() < 1 || contents.GetLength() > 80) return nullptr; @@ -168,7 +168,7 @@ uint8_t* CBC_OnedCode128Writer::EncodeImpl(const CFX_ByteString& contents, } // static -int32_t CBC_OnedCode128Writer::Encode128B(const CFX_ByteString& contents, +int32_t CBC_OnedCode128Writer::Encode128B(const ByteString& contents, std::vector<int32_t>* patterns) { int32_t checkWeight = 1; patterns->push_back(CODE_START_B); @@ -182,7 +182,7 @@ int32_t CBC_OnedCode128Writer::Encode128B(const CFX_ByteString& contents, } // static -int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString& contents, +int32_t CBC_OnedCode128Writer::Encode128C(const ByteString& contents, std::vector<int32_t>* patterns) { int32_t checkWeight = 1; patterns->push_back(CODE_START_C); diff --git a/fxbarcode/oned/BC_OnedCode128Writer.h b/fxbarcode/oned/BC_OnedCode128Writer.h index a80ac647f0..3edb65a72a 100644 --- a/fxbarcode/oned/BC_OnedCode128Writer.h +++ b/fxbarcode/oned/BC_OnedCode128Writer.h @@ -19,21 +19,20 @@ class CBC_OnedCode128Writer : public CBC_OneDimWriter { ~CBC_OnedCode128Writer() override; // Exposed for testing. - static int32_t Encode128B(const CFX_ByteString& contents, + static int32_t Encode128B(const ByteString& contents, std::vector<int32_t>* patterns); - static int32_t Encode128C(const CFX_ByteString& contents, + static int32_t Encode128C(const ByteString& contents, std::vector<int32_t>* patterns); // CBC_OneDimWriter - uint8_t* EncodeWithHint(const CFX_ByteString& contents, + uint8_t* EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t hints) override; - uint8_t* EncodeImpl(const CFX_ByteString& contents, - int32_t& outLength) override; - bool CheckContentValidity(const CFX_WideStringC& contents) override; - CFX_WideString FilterContents(const CFX_WideStringC& contents) override; + uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override; + bool CheckContentValidity(const WideStringView& contents) override; + WideString FilterContents(const WideStringView& contents) override; bool SetTextLocation(BC_TEXT_LOC location); diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp index 72d7dc4df8..2e02e01583 100644 --- a/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -48,7 +48,7 @@ CBC_OnedCode39Writer::CBC_OnedCode39Writer() : m_iWideNarrRatio(3) {} CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {} bool CBC_OnedCode39Writer::CheckContentValidity( - const CFX_WideStringC& contents) { + const WideStringView& contents) { for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || @@ -61,9 +61,9 @@ bool CBC_OnedCode39Writer::CheckContentValidity( return true; } -CFX_WideString CBC_OnedCode39Writer::FilterContents( - const CFX_WideStringC& contents) { - CFX_WideString filtercontents; +WideString CBC_OnedCode39Writer::FilterContents( + const WideStringView& contents) { + WideString filtercontents; for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) { @@ -84,9 +84,9 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents( return filtercontents; } -CFX_WideString CBC_OnedCode39Writer::RenderTextContents( - const CFX_WideStringC& contents) { - CFX_WideString renderContents; +WideString CBC_OnedCode39Writer::RenderTextContents( + const WideStringView& contents) { + WideString renderContents; for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { wchar_t ch = contents[i]; if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) { @@ -120,7 +120,7 @@ bool CBC_OnedCode39Writer::SetWideNarrowRatio(int8_t ratio) { return true; } -uint8_t* CBC_OnedCode39Writer::EncodeWithHint(const CFX_ByteString& contents, +uint8_t* CBC_OnedCode39Writer::EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, @@ -137,7 +137,7 @@ void CBC_OnedCode39Writer::ToIntArray(int32_t a, int8_t* toReturn) { } } -char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents) { +char CBC_OnedCode39Writer::CalcCheckSum(const ByteString& contents) { FX_STRSIZE length = contents.GetLength(); if (length > 80) return '*'; @@ -160,7 +160,7 @@ char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents) { return CHECKSUM_STRING[checksum]; } -uint8_t* CBC_OnedCode39Writer::EncodeImpl(const CFX_ByteString& contents, +uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents, int32_t& outlength) { char checksum = CalcCheckSum(contents); if (checksum == '*') @@ -169,7 +169,7 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const CFX_ByteString& contents, int8_t widths[9] = {0}; int32_t wideStrideNum = 3; int32_t narrStrideNum = 9 - wideStrideNum; - CFX_ByteString encodedContents = contents; + ByteString encodedContents = contents; if (m_bCalcChecksum) encodedContents += checksum; m_iContentLen = encodedContents.GetLength(); @@ -227,12 +227,12 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const CFX_ByteString& contents, return result.release(); } -bool CBC_OnedCode39Writer::encodedContents(const CFX_WideStringC& contents, - CFX_WideString* result) { - *result = CFX_WideString(contents); +bool CBC_OnedCode39Writer::encodedContents(const WideStringView& contents, + WideString* result) { + *result = WideString(contents); if (m_bCalcChecksum && m_bPrintChecksum) { - CFX_WideString checksumContent = FilterContents(contents); - CFX_ByteString str = checksumContent.UTF8Encode(); + WideString checksumContent = FilterContents(contents); + ByteString str = checksumContent.UTF8Encode(); char checksum; checksum = CalcCheckSum(str); if (checksum == '*') @@ -243,12 +243,12 @@ bool CBC_OnedCode39Writer::encodedContents(const CFX_WideStringC& contents, return true; } -bool CBC_OnedCode39Writer::RenderResult(const CFX_WideStringC& contents, +bool CBC_OnedCode39Writer::RenderResult(const WideStringView& contents, uint8_t* code, int32_t codeLength) { - CFX_WideString encodedCon; + WideString encodedCon; if (!encodedContents(contents, &encodedCon)) return false; - return CBC_OneDimWriter::RenderResult(encodedCon.AsStringC(), code, + return CBC_OneDimWriter::RenderResult(encodedCon.AsStringView(), code, codeLength); } diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h index fe57d3ca9a..ffed6d9c07 100644 --- a/fxbarcode/oned/BC_OnedCode39Writer.h +++ b/fxbarcode/oned/BC_OnedCode39Writer.h @@ -16,28 +16,27 @@ class CBC_OnedCode39Writer : public CBC_OneDimWriter { ~CBC_OnedCode39Writer() override; // CBC_OneDimWriter - uint8_t* EncodeWithHint(const CFX_ByteString& contents, + uint8_t* EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t hints) override; - uint8_t* EncodeImpl(const CFX_ByteString& contents, - int32_t& outLength) override; - bool RenderResult(const CFX_WideStringC& contents, + uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override; + bool RenderResult(const WideStringView& contents, uint8_t* code, int32_t codeLength) override; - bool CheckContentValidity(const CFX_WideStringC& contents) override; - CFX_WideString FilterContents(const CFX_WideStringC& contents) override; - CFX_WideString RenderTextContents(const CFX_WideStringC& contents) override; + bool CheckContentValidity(const WideStringView& contents) override; + WideString FilterContents(const WideStringView& contents) override; + WideString RenderTextContents(const WideStringView& contents) override; virtual bool SetTextLocation(BC_TEXT_LOC loction); virtual bool SetWideNarrowRatio(int8_t ratio); - bool encodedContents(const CFX_WideStringC& contents, CFX_WideString* result); + bool encodedContents(const WideStringView& contents, WideString* result); private: void ToIntArray(int32_t a, int8_t* toReturn); - char CalcCheckSum(const CFX_ByteString& contents); + char CalcCheckSum(const ByteString& contents); int8_t m_iWideNarrRatio; }; diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 2d9759b9eb..6de7c2cb20 100644 --- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -56,14 +56,12 @@ CBC_OnedEAN13Writer::CBC_OnedEAN13Writer() { } CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {} -bool CBC_OnedEAN13Writer::CheckContentValidity( - const CFX_WideStringC& contents) { +bool CBC_OnedEAN13Writer::CheckContentValidity(const WideStringView& contents) { return std::all_of(contents.begin(), contents.end(), std::iswdigit); } -CFX_WideString CBC_OnedEAN13Writer::FilterContents( - const CFX_WideStringC& contents) { - CFX_WideString filtercontents; +WideString CBC_OnedEAN13Writer::FilterContents(const WideStringView& contents) { + WideString filtercontents; wchar_t ch; for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { ch = contents[i]; @@ -78,11 +76,11 @@ CFX_WideString CBC_OnedEAN13Writer::FilterContents( return filtercontents; } -int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) { +int32_t CBC_OnedEAN13Writer::CalcChecksum(const ByteString& contents) { return EANCalcChecksum(contents); } -uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const CFX_ByteString& contents, +uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, @@ -93,7 +91,7 @@ uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const CFX_ByteString& contents, hints); } -uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents, +uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const ByteString& contents, int32_t& outLength) { if (contents.GetLength() != 13) return nullptr; @@ -136,7 +134,7 @@ uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents, return result.release(); } -bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, +bool CBC_OnedEAN13Writer::ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, @@ -146,12 +144,12 @@ bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents, int32_t leftPadding = 7 * multiple; int32_t leftPosition = 3 * multiple + leftPadding; - CFX_ByteString str = FX_UTF8Encode(contents); + ByteString str = FX_UTF8Encode(contents); int32_t iLen = str.GetLength(); std::vector<FXTEXT_CHARPOS> charpos(iLen); int32_t iFontSize = (int32_t)fabs(m_fFontSize); int32_t iTextHeight = iFontSize + 1; - CFX_ByteString tempStr = str.Mid(1, 6); + ByteString tempStr = str.Mid(1, 6); int32_t strWidth = multiple * 42; CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.h b/fxbarcode/oned/BC_OnedEAN13Writer.h index 826d1610a0..c874610a64 100644 --- a/fxbarcode/oned/BC_OnedEAN13Writer.h +++ b/fxbarcode/oned/BC_OnedEAN13Writer.h @@ -20,20 +20,19 @@ class CBC_OnedEAN13Writer : public CBC_OneDimWriter { ~CBC_OnedEAN13Writer() override; // CBC_OneDimWriter - uint8_t* EncodeWithHint(const CFX_ByteString& contents, + uint8_t* EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t hints) override; - uint8_t* EncodeImpl(const CFX_ByteString& contents, - int32_t& outLength) override; - bool CheckContentValidity(const CFX_WideStringC& contents) override; - CFX_WideString FilterContents(const CFX_WideStringC& contents) override; + uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override; + bool CheckContentValidity(const WideStringView& contents) override; + WideString FilterContents(const WideStringView& contents) override; - int32_t CalcChecksum(const CFX_ByteString& contents); + int32_t CalcChecksum(const ByteString& contents); protected: - bool ShowChars(const CFX_WideStringC& contents, + bool ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp index d4d438fe04..f92a1627b6 100644 --- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -63,13 +63,12 @@ bool CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) { return false; } -bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) { +bool CBC_OnedEAN8Writer::CheckContentValidity(const WideStringView& contents) { return std::all_of(contents.begin(), contents.end(), std::iswdigit); } -CFX_WideString CBC_OnedEAN8Writer::FilterContents( - const CFX_WideStringC& contents) { - CFX_WideString filtercontents; +WideString CBC_OnedEAN8Writer::FilterContents(const WideStringView& contents) { + WideString filtercontents; wchar_t ch; for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { ch = contents[i]; @@ -84,11 +83,11 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents( return filtercontents; } -int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) { +int32_t CBC_OnedEAN8Writer::CalcChecksum(const ByteString& contents) { return EANCalcChecksum(contents); } -uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const CFX_ByteString& contents, +uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, @@ -99,7 +98,7 @@ uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const CFX_ByteString& contents, hints); } -uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const CFX_ByteString& contents, +uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const ByteString& contents, int32_t& outLength) { if (contents.GetLength() != 8) return nullptr; @@ -136,7 +135,7 @@ uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const CFX_ByteString& contents, return result.release(); } -bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, +bool CBC_OnedEAN8Writer::ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, @@ -145,10 +144,10 @@ bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents, return false; int32_t leftPosition = 3 * multiple; - CFX_ByteString str = FX_UTF8Encode(contents); + ByteString str = FX_UTF8Encode(contents); FX_STRSIZE iLength = str.GetLength(); std::vector<FXTEXT_CHARPOS> charpos(iLength); - CFX_ByteString tempStr = str.Left(4); + ByteString tempStr = str.Left(4); FX_STRSIZE iLen = tempStr.GetLength(); int32_t strWidth = 7 * multiple * 4; float blank = 0.0; diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.h b/fxbarcode/oned/BC_OnedEAN8Writer.h index 70c8fd4641..77a3602f67 100644 --- a/fxbarcode/oned/BC_OnedEAN8Writer.h +++ b/fxbarcode/oned/BC_OnedEAN8Writer.h @@ -21,22 +21,21 @@ class CBC_OnedEAN8Writer : public CBC_OneDimWriter { ~CBC_OnedEAN8Writer() override; // CBC_OneDimWriter - uint8_t* EncodeWithHint(const CFX_ByteString& contents, + uint8_t* EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t hints) override; - uint8_t* EncodeImpl(const CFX_ByteString& contents, - int32_t& outLength) override; - bool CheckContentValidity(const CFX_WideStringC& contents) override; - CFX_WideString FilterContents(const CFX_WideStringC& contents) override; + uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override; + bool CheckContentValidity(const WideStringView& contents) override; + WideString FilterContents(const WideStringView& contents) override; void SetDataLength(int32_t length) override; bool SetTextLocation(BC_TEXT_LOC location); - int32_t CalcChecksum(const CFX_ByteString& contents); + int32_t CalcChecksum(const ByteString& contents); protected: - bool ShowChars(const CFX_WideStringC& contents, + bool ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, diff --git a/fxbarcode/oned/BC_OnedEANChecksum.cpp b/fxbarcode/oned/BC_OnedEANChecksum.cpp index 744a60827e..64aa1c5f43 100644 --- a/fxbarcode/oned/BC_OnedEANChecksum.cpp +++ b/fxbarcode/oned/BC_OnedEANChecksum.cpp @@ -6,7 +6,7 @@ #include "core/fxcrt/fx_extension.h" -int32_t EANCalcChecksum(const CFX_ByteString& contents) { +int32_t EANCalcChecksum(const ByteString& contents) { int32_t odd = 0; int32_t even = 0; FX_STRSIZE parity = 1; diff --git a/fxbarcode/oned/BC_OnedEANChecksum.h b/fxbarcode/oned/BC_OnedEANChecksum.h index 47d2d6bd91..5dd24bc269 100644 --- a/fxbarcode/oned/BC_OnedEANChecksum.h +++ b/fxbarcode/oned/BC_OnedEANChecksum.h @@ -7,6 +7,6 @@ #include "core/fxcrt/fx_string.h" -int32_t EANCalcChecksum(const CFX_ByteString& contents); +int32_t EANCalcChecksum(const ByteString& contents); #endif // FXBARCODE_ONED_BC_ONEDEANCHECKSUM_H_ diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp index fac4a1b0a3..51858452e9 100644 --- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -42,7 +42,7 @@ void CBC_OnedUPCAWriter::Init() { CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {} -bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) { +bool CBC_OnedUPCAWriter::CheckContentValidity(const WideStringView& contents) { for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) { if (contents[i] < '0' || contents[i] > '9') return false; @@ -50,9 +50,8 @@ bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) { return true; } -CFX_WideString CBC_OnedUPCAWriter::FilterContents( - const CFX_WideStringC& contents) { - CFX_WideString filtercontents; +WideString CBC_OnedUPCAWriter::FilterContents(const WideStringView& contents) { + WideString filtercontents; wchar_t ch; for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) { ch = contents[i]; @@ -67,7 +66,7 @@ CFX_WideString CBC_OnedUPCAWriter::FilterContents( return filtercontents; } -int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) { +int32_t CBC_OnedUPCAWriter::CalcChecksum(const ByteString& contents) { int32_t odd = 0; int32_t even = 0; FX_STRSIZE j = 1; @@ -84,7 +83,7 @@ int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) { return checksum; } -uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const CFX_ByteString& contents, +uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, @@ -92,18 +91,18 @@ uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const CFX_ByteString& contents, if (format != BCFORMAT_UPC_A) return nullptr; - CFX_ByteString toEAN13String = '0' + contents; + ByteString toEAN13String = '0' + contents; m_iDataLenth = 13; return m_subWriter->EncodeWithHint(toEAN13String, BCFORMAT_EAN_13, outWidth, outHeight, hints); } -uint8_t* CBC_OnedUPCAWriter::EncodeImpl(const CFX_ByteString& contents, +uint8_t* CBC_OnedUPCAWriter::EncodeImpl(const ByteString& contents, int32_t& outLength) { return nullptr; } -bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, +bool CBC_OnedUPCAWriter::ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, @@ -113,10 +112,10 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, int32_t leftPadding = 7 * multiple; int32_t leftPosition = 10 * multiple + leftPadding; - CFX_ByteString str = FX_UTF8Encode(contents); + ByteString str = FX_UTF8Encode(contents); int32_t iLen = str.GetLength(); std::vector<FXTEXT_CHARPOS> charpos(iLen); - CFX_ByteString tempStr = str.Mid(1, 5); + ByteString tempStr = str.Mid(1, 5); float strWidth = (float)35 * multiple; float blank = 0.0; diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.h b/fxbarcode/oned/BC_OnedUPCAWriter.h index 80f6196748..a854ef4665 100644 --- a/fxbarcode/oned/BC_OnedUPCAWriter.h +++ b/fxbarcode/oned/BC_OnedUPCAWriter.h @@ -24,21 +24,20 @@ class CBC_OnedUPCAWriter : public CBC_OneDimWriter { ~CBC_OnedUPCAWriter() override; // CBC_OneDimWriter - uint8_t* EncodeWithHint(const CFX_ByteString& contents, + uint8_t* EncodeWithHint(const ByteString& contents, BCFORMAT format, int32_t& outWidth, int32_t& outHeight, int32_t hints) override; - uint8_t* EncodeImpl(const CFX_ByteString& contents, - int32_t& outLength) override; - bool CheckContentValidity(const CFX_WideStringC& contents) override; - CFX_WideString FilterContents(const CFX_WideStringC& contents) override; + uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override; + bool CheckContentValidity(const WideStringView& contents) override; + WideString FilterContents(const WideStringView& contents) override; void Init(); - int32_t CalcChecksum(const CFX_ByteString& contents); + int32_t CalcChecksum(const ByteString& contents); protected: - bool ShowChars(const CFX_WideStringC& contents, + bool ShowChars(const WideStringView& contents, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, diff --git a/fxbarcode/pdf417/BC_PDF417.cpp b/fxbarcode/pdf417/BC_PDF417.cpp index 3f492f9c10..9b73b49a26 100644 --- a/fxbarcode/pdf417/BC_PDF417.cpp +++ b/fxbarcode/pdf417/BC_PDF417.cpp @@ -399,7 +399,7 @@ CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() { return m_barcodeMatrix.get(); } -bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, +bool CBC_PDF417::generateBarcodeLogic(WideString msg, int32_t errorCorrectionLevel) { int32_t errorCorrectionCodeWords = CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount( @@ -408,7 +408,7 @@ bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, return false; int32_t e = BCExceptionNO; - CFX_WideString highLevel = + WideString highLevel = CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e); if (e != BCExceptionNO) return false; @@ -425,19 +425,19 @@ bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, return false; int32_t n = sourceCodeWords + pad + 1; - CFX_WideString sb; + WideString sb; sb += (wchar_t)n; sb += highLevel; for (int32_t i = 0; i < pad; i++) sb += (wchar_t)900; - CFX_WideString dataCodewords(sb); - CFX_WideString ec; + WideString dataCodewords(sb); + WideString ec; if (!CBC_PDF417ErrorCorrection::generateErrorCorrection( dataCodewords, errorCorrectionLevel, &ec)) { return false; } - CFX_WideString fullCodewords = dataCodewords + ec; + WideString fullCodewords = dataCodewords + ec; m_barcodeMatrix = pdfium::MakeUnique<CBC_BarcodeMatrix>(rows, cols); encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel, m_barcodeMatrix.get()); @@ -498,7 +498,7 @@ void CBC_PDF417::encodeChar(int32_t pattern, logic->addBar(last, width); } -void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, +void CBC_PDF417::encodeLowLevel(WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, diff --git a/fxbarcode/pdf417/BC_PDF417.h b/fxbarcode/pdf417/BC_PDF417.h index e6140a8fd7..6014df0e3b 100644 --- a/fxbarcode/pdf417/BC_PDF417.h +++ b/fxbarcode/pdf417/BC_PDF417.h @@ -23,7 +23,7 @@ class CBC_PDF417 { virtual ~CBC_PDF417(); CBC_BarcodeMatrix* getBarcodeMatrix(); - bool generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel); + bool generateBarcodeLogic(WideString msg, int32_t errorCorrectionLevel); void setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, @@ -45,7 +45,7 @@ class CBC_PDF417 { int32_t c, int32_t r); static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic); - void encodeLowLevel(CFX_WideString fullCodewords, + void encodeLowLevel(WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp index 1d8258e720..ade3eb584d 100644 --- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp +++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp @@ -132,9 +132,9 @@ int32_t CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount( } bool CBC_PDF417ErrorCorrection::generateErrorCorrection( - const CFX_WideString& dataCodewords, + const WideString& dataCodewords, int32_t errorCorrectionLevel, - CFX_WideString* result) { + WideString* result) { assert(result); assert(result->IsEmpty()); diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h index 3a84ef5845..3e28162653 100644 --- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h +++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h @@ -17,9 +17,9 @@ class CBC_PDF417ErrorCorrection { virtual ~CBC_PDF417ErrorCorrection(); static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel); - static bool generateErrorCorrection(const CFX_WideString& dataCodewords, + static bool generateErrorCorrection(const WideString& dataCodewords, int32_t errorCorrectionLevel, - CFX_WideString* result); + WideString* result); }; #endif // FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_ diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index c531716e4f..1450b37ea9 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -55,24 +55,23 @@ void CBC_PDF417HighLevelEncoder::Initialize() { void CBC_PDF417HighLevelEncoder::Finalize() {} -CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( - CFX_WideString wideMsg, - Compaction compaction, - int32_t& e) { - CFX_ByteString bytes; +WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(WideString wideMsg, + Compaction compaction, + int32_t& e) { + ByteString bytes; CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes); - CFX_WideString msg; + WideString msg; int32_t len = bytes.GetLength(); for (int32_t i = 0; i < len; i++) { wchar_t ch = (wchar_t)(bytes[i] & 0xff); if (ch == '?' && bytes[i] != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; - return CFX_WideString(); + return WideString(); } msg += ch; } std::vector<uint8_t> byteArr(bytes.begin(), bytes.end()); - CFX_WideString sb; + WideString sb; len = msg.GetLength(); int32_t p = 0; int32_t textSubMode = SUBMODE_ALPHA; @@ -145,12 +144,12 @@ void CBC_PDF417HighLevelEncoder::Inverse() { } } -int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, +int32_t CBC_PDF417HighLevelEncoder::encodeText(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb, + WideString& sb, int32_t initialSubmode) { - CFX_WideString tmp; + WideString tmp; int32_t submode = initialSubmode; int32_t idx = 0; while (true) { @@ -262,7 +261,7 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes, int32_t startpos, int32_t count, int32_t startmode, - CFX_WideString& sb) { + WideString& sb) { if (count == 1 && startmode == TEXT_COMPACTION) { sb += (wchar_t)SHIFT_TO_BYTE; } @@ -295,16 +294,16 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes, sb += (wchar_t)ch; } } -void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, +void CBC_PDF417HighLevelEncoder::encodeNumeric(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb) { + WideString& sb) { int32_t idx = 0; BigInteger num900 = 900; while (idx < count) { - CFX_WideString tmp; + WideString tmp; int32_t len = 44 < count - idx ? 44 : count - idx; - CFX_ByteString part = + ByteString part = ((wchar_t)'1' + msg.Mid(startpos + idx, len)).UTF8Encode(); BigInteger bigint = stringToBigInteger(part.c_str()); do { @@ -337,7 +336,7 @@ bool CBC_PDF417HighLevelEncoder::isText(wchar_t ch) { return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126); } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount( - CFX_WideString msg, + WideString msg, int32_t startpos) { int32_t count = 0; int32_t len = msg.GetLength(); @@ -355,7 +354,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount( return count; } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount( - CFX_WideString msg, + WideString msg, int32_t startpos) { int32_t len = msg.GetLength(); int32_t idx = startpos; @@ -384,7 +383,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount( return idx - startpos; } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount( - CFX_WideString msg, + WideString msg, std::vector<uint8_t>* bytes, int32_t startpos, int32_t& e) { diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h index 32482dc22b..2701c810fb 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h @@ -14,9 +14,9 @@ class CBC_PDF417HighLevelEncoder { public: - static CFX_WideString encodeHighLevel(CFX_WideString msg, - Compaction compaction, - int32_t& e); + static WideString encodeHighLevel(WideString msg, + Compaction compaction, + int32_t& e); static void Inverse(); static void Initialize(); static void Finalize(); @@ -35,31 +35,31 @@ class CBC_PDF417HighLevelEncoder { static uint8_t TEXT_PUNCTUATION_RAW[]; static int32_t MIXED[128]; static int32_t PUNCTUATION[128]; - static int32_t encodeText(CFX_WideString msg, + static int32_t encodeText(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb, + WideString& sb, int32_t initialSubmode); static void encodeBinary(std::vector<uint8_t>* bytes, int32_t startpos, int32_t count, int32_t startmode, - CFX_WideString& sb); - static void encodeNumeric(CFX_WideString msg, + WideString& sb); + static void encodeNumeric(WideString msg, int32_t startpos, int32_t count, - CFX_WideString& sb); + WideString& sb); static bool isDigit(wchar_t ch); static bool isAlphaUpper(wchar_t ch); static bool isAlphaLower(wchar_t ch); static bool isMixed(wchar_t ch); static bool isPunctuation(wchar_t ch); static bool isText(wchar_t ch); - static int32_t determineConsecutiveDigitCount(CFX_WideString msg, + static int32_t determineConsecutiveDigitCount(WideString msg, int32_t startpos); - static int32_t determineConsecutiveTextCount(CFX_WideString msg, + static int32_t determineConsecutiveTextCount(WideString msg, int32_t startpos); - static int32_t determineConsecutiveBinaryCount(CFX_WideString msg, + static int32_t determineConsecutiveBinaryCount(WideString msg, std::vector<uint8_t>* bytes, int32_t startpos, int32_t& e); diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp index 14311742f1..ad4a59af40 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp @@ -47,8 +47,8 @@ TEST(PDF417HighLevelEncoder, EncodeBinary) { for (size_t j = 0; j < input_length; ++j) { input_array[j] = ptr->input[j]; } - CFX_WideString expected(ptr->expected, ptr->expected_length); - CFX_WideString result; + WideString expected(ptr->expected, ptr->expected_length); + WideString result; CBC_PDF417HighLevelEncoder::encodeBinary( &input_array, ptr->offset, ptr->count, ptr->startmode, result); EXPECT_EQ(expected, result) << " for case number " << i; @@ -109,9 +109,9 @@ TEST(PDF417HighLevelEncoder, EncodeNumeric) { CBC_PDF417HighLevelEncoder::Initialize(); for (size_t i = 0; i < FX_ArraySize(encode_numeric_cases); ++i) { EncodeNumericCase* ptr = &encode_numeric_cases[i]; - CFX_WideString input(ptr->input); - CFX_WideString expected(ptr->expected, ptr->expected_length); - CFX_WideString result; + WideString input(ptr->input); + WideString expected(ptr->expected, ptr->expected_length); + WideString result; CBC_PDF417HighLevelEncoder::encodeNumeric(input, ptr->offset, ptr->count, result); EXPECT_EQ(expected, result) << " for case number " << i; @@ -156,7 +156,7 @@ TEST(PDF417HighLevelEncoder, ConsecutiveDigitCount) { CBC_PDF417HighLevelEncoder::Initialize(); for (size_t i = 0; i < FX_ArraySize(consecutive_digit_cases); ++i) { ConsecutiveDigitCase* ptr = &consecutive_digit_cases[i]; - CFX_WideString input(ptr->input); + WideString input(ptr->input); int actual_count = CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(input, ptr->offset); @@ -217,7 +217,7 @@ TEST(PDF417HighLevelEncoder, ConsecutiveTextCount) { CBC_PDF417HighLevelEncoder::Initialize(); for (size_t i = 0; i < FX_ArraySize(consecutive_text_cases); ++i) { ConsecutiveTextCase* ptr = &consecutive_text_cases[i]; - CFX_WideString input(ptr->input); + WideString input(ptr->input); int actual_count = CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input, ptr->offset); diff --git a/fxbarcode/pdf417/BC_PDF417Writer.cpp b/fxbarcode/pdf417/BC_PDF417Writer.cpp index 2f6fc9e1b0..4fec974737 100644 --- a/fxbarcode/pdf417/BC_PDF417Writer.cpp +++ b/fxbarcode/pdf417/BC_PDF417Writer.cpp @@ -48,7 +48,7 @@ void CBC_PDF417Writer::SetTruncated(bool truncated) { m_bTruncated = truncated; } -uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents, +uint8_t* CBC_PDF417Writer::Encode(const WideString& contents, int32_t& outWidth, int32_t& outHeight) { CBC_PDF417 encoder; diff --git a/fxbarcode/pdf417/BC_PDF417Writer.h b/fxbarcode/pdf417/BC_PDF417Writer.h index 39418715ce..ef5961653e 100644 --- a/fxbarcode/pdf417/BC_PDF417Writer.h +++ b/fxbarcode/pdf417/BC_PDF417Writer.h @@ -18,7 +18,7 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter { CBC_PDF417Writer(); ~CBC_PDF417Writer() override; - uint8_t* Encode(const CFX_WideString& contents, + uint8_t* Encode(const WideString& contents, int32_t& outWidth, int32_t& outHeight); diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/fxbarcode/qrcode/BC_QRCodeWriter.cpp index c679e9fca6..eb35af3867 100644 --- a/fxbarcode/qrcode/BC_QRCodeWriter.cpp +++ b/fxbarcode/qrcode/BC_QRCodeWriter.cpp @@ -55,7 +55,7 @@ bool CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) { return true; } -uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, +uint8_t* CBC_QRCodeWriter::Encode(const WideString& contents, int32_t ecLevel, int32_t& outWidth, int32_t& outHeight) { diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.h b/fxbarcode/qrcode/BC_QRCodeWriter.h index 1a0502d72e..3b3efc90ca 100644 --- a/fxbarcode/qrcode/BC_QRCodeWriter.h +++ b/fxbarcode/qrcode/BC_QRCodeWriter.h @@ -17,7 +17,7 @@ class CBC_QRCodeWriter : public CBC_TwoDimWriter { static void ReleaseAll(); - uint8_t* Encode(const CFX_WideString& contents, + uint8_t* Encode(const WideString& contents, int32_t ecLevel, int32_t& outWidth, int32_t& outHeight); diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index 4c488418d9..e1a4917792 100644 --- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -41,7 +41,7 @@ #include "fxbarcode/qrcode/BC_QRCoderVersion.h" #include "third_party/base/ptr_util.h" -using ModeStringPair = std::pair<CBC_QRCoderMode*, CFX_ByteString>; +using ModeStringPair = std::pair<CBC_QRCoderMode*, ByteString>; namespace { @@ -61,7 +61,7 @@ int32_t GetAlphaNumericCode(int32_t code) { return g_alphaNumericTable[code_index]; } -void AppendNumericBytes(const CFX_ByteString& content, +void AppendNumericBytes(const ByteString& content, CBC_QRCoderBitVector* bits, int32_t& e) { int32_t length = content.GetLength(); @@ -84,7 +84,7 @@ void AppendNumericBytes(const CFX_ByteString& content, } } -void AppendAlphaNumericBytes(const CFX_ByteString& content, +void AppendAlphaNumericBytes(const ByteString& content, CBC_QRCoderBitVector* bits, int32_t& e) { int32_t length = content.GetLength(); @@ -110,7 +110,7 @@ void AppendAlphaNumericBytes(const CFX_ByteString& content, } } -void AppendGBKBytes(const CFX_ByteString& content, +void AppendGBKBytes(const ByteString& content, CBC_QRCoderBitVector* bits, int32_t& e) { int32_t length = content.GetLength(); @@ -130,15 +130,15 @@ void AppendGBKBytes(const CFX_ByteString& content, } } -void Append8BitBytes(const CFX_ByteString& content, +void Append8BitBytes(const ByteString& content, CBC_QRCoderBitVector* bits, - CFX_ByteString encoding, + ByteString encoding, int32_t& e) { for (FX_STRSIZE i = 0; i < content.GetLength(); i++) bits->AppendBits(content[i], 8); } -void AppendKanjiBytes(const CFX_ByteString& content, +void AppendKanjiBytes(const ByteString& content, CBC_QRCoderBitVector* bits, int32_t& e) { std::vector<uint8_t> bytes; @@ -184,10 +184,10 @@ bool AppendLengthInfo(int32_t numLetters, return true; } -void AppendBytes(const CFX_ByteString& content, +void AppendBytes(const ByteString& content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, - CFX_ByteString encoding, + ByteString encoding, int32_t& e) { if (mode == CBC_QRCoderMode::sNUMERIC) AppendNumericBytes(content, bits, e); @@ -423,7 +423,7 @@ void MergeString(std::vector<ModeStringPair>* result, MergeString(result, versionNum, e); } -void SplitString(const CFX_ByteString& content, +void SplitString(const ByteString& content, std::vector<ModeStringPair>* result) { FX_STRSIZE index = 0; while (index < content.GetLength()) { @@ -484,8 +484,7 @@ void SplitString(const CFX_ByteString& content, SplitString(content.Right(content.GetLength() - index), result); } -CBC_QRCoderMode* ChooseMode(const CFX_ByteString& content, - CFX_ByteString encoding) { +CBC_QRCoderMode* ChooseMode(const ByteString& content, ByteString encoding) { if (encoding.Compare("SHIFT_JIS") == 0) return CBC_QRCoderMode::sKANJI; @@ -566,11 +565,11 @@ CBC_QRCoderEncoder::CBC_QRCoderEncoder() {} CBC_QRCoderEncoder::~CBC_QRCoderEncoder() {} // static -bool CBC_QRCoderEncoder::Encode(const CFX_WideString& content, +bool CBC_QRCoderEncoder::Encode(const WideString& content, const CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder* qrCode) { - CFX_ByteString encoding = "utf8"; - CFX_ByteString utf8Data; + ByteString encoding = "utf8"; + ByteString utf8Data; CBC_UtilCodingConvert::UnicodeToUTF8(content, utf8Data); CBC_QRCoderMode* mode = ChooseMode(utf8Data, encoding); CBC_QRCoderBitVector dataBits; diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.h b/fxbarcode/qrcode/BC_QRCoderEncoder.h index 6bba889bd4..3acbd1bde8 100644 --- a/fxbarcode/qrcode/BC_QRCoderEncoder.h +++ b/fxbarcode/qrcode/BC_QRCoderEncoder.h @@ -20,7 +20,7 @@ class CBC_QRCoderEncoder { CBC_QRCoderEncoder(); ~CBC_QRCoderEncoder(); - static bool Encode(const CFX_WideString& content, + static bool Encode(const WideString& content, const CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder* qrCode); }; diff --git a/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h index e153c64395..ff7563ccfe 100644 --- a/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h +++ b/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h @@ -25,7 +25,7 @@ class CBC_QRCoderErrorCorrectionLevel { int32_t Ordinal() const { return m_ordinal; } int32_t GetBits() const { return m_bits; } - CFX_ByteString GetName() const { return m_name; } + ByteString GetName() const { return m_name; } private: CBC_QRCoderErrorCorrectionLevel(int32_t ordinal, @@ -35,7 +35,7 @@ class CBC_QRCoderErrorCorrectionLevel { int32_t m_ordinal; int32_t m_bits; - CFX_ByteString m_name; + ByteString m_name; }; #endif // FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_ diff --git a/fxbarcode/qrcode/BC_QRCoderMode.cpp b/fxbarcode/qrcode/BC_QRCoderMode.cpp index 5f9ce5bf25..0f8c227843 100644 --- a/fxbarcode/qrcode/BC_QRCoderMode.cpp +++ b/fxbarcode/qrcode/BC_QRCoderMode.cpp @@ -39,7 +39,7 @@ CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = nullptr; CBC_QRCoderMode::CBC_QRCoderMode(std::vector<int32_t> charCountBits, int32_t bits, - CFX_ByteString name) + ByteString name) : m_characterCountBitsForVersions(std::move(charCountBits)), m_bits(bits), m_name(name) {} @@ -107,7 +107,7 @@ int32_t CBC_QRCoderMode::GetBits() const { return m_bits; } -CFX_ByteString CBC_QRCoderMode::GetName() const { +ByteString CBC_QRCoderMode::GetName() const { return m_name; } diff --git a/fxbarcode/qrcode/BC_QRCoderMode.h b/fxbarcode/qrcode/BC_QRCoderMode.h index 6669cbfbc9..9f2844da97 100644 --- a/fxbarcode/qrcode/BC_QRCoderMode.h +++ b/fxbarcode/qrcode/BC_QRCoderMode.h @@ -24,7 +24,7 @@ class CBC_QRCoderMode { int32_t GetCharacterCountBits(int32_t number, int32_t& e) const; int32_t GetBits() const; - CFX_ByteString GetName() const; + ByteString GetName() const; static CBC_QRCoderMode* sBYTE; static CBC_QRCoderMode* sNUMERIC; @@ -41,11 +41,11 @@ class CBC_QRCoderMode { CBC_QRCoderMode(); CBC_QRCoderMode(std::vector<int32_t> charCountBits, int32_t bits, - CFX_ByteString name); + ByteString name); std::vector<int32_t> m_characterCountBitsForVersions; const int32_t m_bits; - const CFX_ByteString m_name; + const ByteString m_name; }; #endif // FXBARCODE_QRCODE_BC_QRCODERMODE_H_ diff --git a/fxbarcode/utils.h b/fxbarcode/utils.h index df7d1f08d1..7d5bc0a6d8 100644 --- a/fxbarcode/utils.h +++ b/fxbarcode/utils.h @@ -11,14 +11,13 @@ #include "core/fxcrt/fx_string.h" -bool BC_FX_ByteString_Replace(CFX_ByteString& dst, +bool BC_FX_ByteString_Replace(ByteString& dst, uint32_t first, uint32_t last, int32_t count, char c); -void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c); -void BC_FX_ByteString_Append(CFX_ByteString& dst, - const std::vector<uint8_t>& ba); +void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c); +void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba); #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_) #include <limits> |