summaryrefslogtreecommitdiff
path: root/fxbarcode/oned
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode/oned')
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp22
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.h22
-rw-r--r--fxbarcode/oned/BC_OnedCodaBarWriter.cpp28
-rw-r--r--fxbarcode/oned/BC_OnedCodaBarWriter.h13
-rw-r--r--fxbarcode/oned/BC_OnedCode128Writer.cpp18
-rw-r--r--fxbarcode/oned/BC_OnedCode128Writer.h13
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.cpp38
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.h17
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.cpp20
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.h13
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.cpp19
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.h13
-rw-r--r--fxbarcode/oned/BC_OnedEANChecksum.cpp2
-rw-r--r--fxbarcode/oned/BC_OnedEANChecksum.h2
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.cpp21
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.h13
16 files changed, 132 insertions, 142 deletions
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,