diff options
Diffstat (limited to 'xfa')
181 files changed, 2508 insertions, 2571 deletions
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp index 9fc7990ca3..999380b401 100644 --- a/xfa/fde/cfde_texteditengine.cpp +++ b/xfa/fde/cfde_texteditengine.cpp @@ -38,7 +38,7 @@ class InsertOperation : public CFDE_TextEditEngine::Operation { public: InsertOperation(CFDE_TextEditEngine* engine, size_t start_idx, - const CFX_WideString& added_text) + const WideString& added_text) : engine_(engine), start_idx_(start_idx), added_text_(added_text) {} ~InsertOperation() override {} @@ -56,14 +56,14 @@ class InsertOperation : public CFDE_TextEditEngine::Operation { private: CFX_UnownedPtr<CFDE_TextEditEngine> engine_; size_t start_idx_; - CFX_WideString added_text_; + WideString added_text_; }; class DeleteOperation : public CFDE_TextEditEngine::Operation { public: DeleteOperation(CFDE_TextEditEngine* engine, size_t start_idx, - const CFX_WideString& removed_text) + const WideString& removed_text) : engine_(engine), start_idx_(start_idx), removed_text_(removed_text) {} ~DeleteOperation() override {} @@ -81,15 +81,15 @@ class DeleteOperation : public CFDE_TextEditEngine::Operation { private: CFX_UnownedPtr<CFDE_TextEditEngine> engine_; size_t start_idx_; - CFX_WideString removed_text_; + WideString removed_text_; }; class ReplaceOperation : public CFDE_TextEditEngine::Operation { public: ReplaceOperation(CFDE_TextEditEngine* engine, size_t start_idx, - const CFX_WideString& removed_text, - const CFX_WideString& added_text) + const WideString& removed_text, + const WideString& added_text) : insert_op_(engine, start_idx, added_text), delete_op_(engine, start_idx, removed_text) {} @@ -195,7 +195,7 @@ void CFDE_TextEditEngine::SetMaxEditOperationsForTesting(size_t max) { } void CFDE_TextEditEngine::AdjustGap(size_t idx, size_t length) { - static const size_t char_size = sizeof(CFX_WideString::CharType); + static const size_t char_size = sizeof(WideString::CharType); // Move the gap, if necessary. if (idx < gap_position_) { @@ -222,7 +222,7 @@ void CFDE_TextEditEngine::AdjustGap(size_t idx, size_t length) { } } -size_t CFDE_TextEditEngine::CountCharsExceedingSize(const CFX_WideString& text, +size_t CFDE_TextEditEngine::CountCharsExceedingSize(const WideString& text, size_t num_to_check) { if (!limit_horizontal_area_ && !limit_vertical_area_) return 0; @@ -245,7 +245,7 @@ size_t CFDE_TextEditEngine::CountCharsExceedingSize(const CFX_WideString& text, text_out->SetStyles(style); size_t length = text.GetLength(); - CFX_WideStringC temp(text.c_str(), length); + WideStringView temp(text.c_str(), length); float vertical_height = line_spacing_ * visible_line_count_; size_t chars_exceeding_size = 0; @@ -253,7 +253,7 @@ size_t CFDE_TextEditEngine::CountCharsExceedingSize(const CFX_WideString& text, for (size_t i = 0; i < num_to_check; i++) { // This does a lot of string copying .... // TODO(dsinclair): make CalcLogicSize take a WideStringC instead. - text_out->CalcLogicSize(CFX_WideString(temp), text_rect); + text_out->CalcLogicSize(WideString(temp), text_rect); if (limit_horizontal_area_ && text_rect.width <= available_width_) break; @@ -269,7 +269,7 @@ size_t CFDE_TextEditEngine::CountCharsExceedingSize(const CFX_WideString& text, } void CFDE_TextEditEngine::Insert(size_t idx, - const CFX_WideString& text, + const WideString& text, RecordOperation add_operation) { if (idx > text_length_) idx = text_length_; @@ -289,15 +289,15 @@ void CFDE_TextEditEngine::Insert(size_t idx, AdjustGap(idx, length); if (validation_enabled_ || limit_horizontal_area_ || limit_vertical_area_) { - CFX_WideString str; + WideString str; if (gap_position_ > 0) - str += CFX_WideStringC(content_.data(), gap_position_); + str += WideStringView(content_.data(), gap_position_); str += text; if (text_length_ - gap_position_ > 0) { - str += CFX_WideStringC(content_.data() + gap_position_ + gap_size_, - text_length_ - gap_position_); + str += WideStringView(content_.data() + gap_position_ + gap_size_, + text_length_ - gap_position_); } if (validation_enabled_ && delegate_ && !delegate_->OnValidate(str)) { @@ -328,12 +328,12 @@ void CFDE_TextEditEngine::Insert(size_t idx, pdfium::MakeUnique<InsertOperation>(this, gap_position_, text)); } - CFX_WideString previous_text; + WideString previous_text; if (delegate_) previous_text = GetText(); // Copy the new text into the gap. - static const size_t char_size = sizeof(CFX_WideString::CharType); + static const size_t char_size = sizeof(WideString::CharType); memcpy(content_.data() + gap_position_, text.c_str(), length * char_size); gap_position_ += length; gap_size_ -= length; @@ -623,32 +623,32 @@ void CFDE_TextEditEngine::SetSelection(size_t start_idx, size_t end_idx) { selection_.end_idx = end_idx; } -CFX_WideString CFDE_TextEditEngine::GetSelectedText() const { +WideString CFDE_TextEditEngine::GetSelectedText() const { if (!has_selection_) return L""; - CFX_WideString text; + WideString text; if (selection_.start_idx < gap_position_) { if (selection_.end_idx < gap_position_) { - text += CFX_WideStringC(content_.data() + selection_.start_idx, - selection_.end_idx - selection_.start_idx + 1); + text += WideStringView(content_.data() + selection_.start_idx, + selection_.end_idx - selection_.start_idx + 1); return text; } - text += CFX_WideStringC(content_.data() + selection_.start_idx, - gap_position_ - selection_.start_idx); - text += CFX_WideStringC( + text += WideStringView(content_.data() + selection_.start_idx, + gap_position_ - selection_.start_idx); + text += WideStringView( content_.data() + gap_position_ + gap_size_, selection_.end_idx - (gap_position_ - selection_.start_idx) + 1); return text; } - text += CFX_WideStringC(content_.data() + gap_size_ + selection_.start_idx, - selection_.end_idx - selection_.start_idx + 1); + text += WideStringView(content_.data() + gap_size_ + selection_.start_idx, + selection_.end_idx - selection_.start_idx + 1); return text; } -CFX_WideString CFDE_TextEditEngine::DeleteSelectedText( +WideString CFDE_TextEditEngine::DeleteSelectedText( RecordOperation add_operation) { if (!has_selection_) return L""; @@ -657,24 +657,24 @@ CFX_WideString CFDE_TextEditEngine::DeleteSelectedText( selection_.end_idx - selection_.start_idx + 1, add_operation); } -CFX_WideString CFDE_TextEditEngine::Delete(size_t start_idx, - size_t length, - RecordOperation add_operation) { +WideString CFDE_TextEditEngine::Delete(size_t start_idx, + size_t length, + RecordOperation add_operation) { if (start_idx >= text_length_) return L""; length = std::min(length, text_length_ - start_idx); AdjustGap(start_idx + length, 0); - CFX_WideString ret; - ret += CFX_WideStringC(content_.data() + start_idx, length); + WideString ret; + ret += WideStringView(content_.data() + start_idx, length); if (add_operation == RecordOperation::kInsertRecord) { AddOperationRecord( pdfium::MakeUnique<DeleteOperation>(this, start_idx, ret)); } - CFX_WideString previous_text = GetText(); + WideString previous_text = GetText(); gap_position_ = start_idx; gap_size_ += length; @@ -688,23 +688,23 @@ CFX_WideString CFDE_TextEditEngine::Delete(size_t start_idx, return ret; } -void CFDE_TextEditEngine::ReplaceSelectedText(const CFX_WideString& rep) { +void CFDE_TextEditEngine::ReplaceSelectedText(const WideString& rep) { size_t start_idx = selection_.start_idx; - CFX_WideString txt = DeleteSelectedText(RecordOperation::kSkipRecord); + WideString txt = DeleteSelectedText(RecordOperation::kSkipRecord); Insert(gap_position_, rep, RecordOperation::kSkipRecord); AddOperationRecord( pdfium::MakeUnique<ReplaceOperation>(this, start_idx, txt, rep)); } -CFX_WideString CFDE_TextEditEngine::GetText() const { - CFX_WideString str; +WideString CFDE_TextEditEngine::GetText() const { + WideString str; if (gap_position_ > 0) - str += CFX_WideStringC(content_.data(), gap_position_); + str += WideStringView(content_.data(), gap_position_); if (text_length_ - gap_position_ > 0) { - str += CFX_WideStringC(content_.data() + gap_position_ + gap_size_, - text_length_ - gap_position_); + str += WideStringView(content_.data() + gap_position_ + gap_size_, + text_length_ - gap_position_); } return str; } diff --git a/xfa/fde/cfde_texteditengine.h b/xfa/fde/cfde_texteditengine.h index aa8a24381d..750b62a2e1 100644 --- a/xfa/fde/cfde_texteditengine.h +++ b/xfa/fde/cfde_texteditengine.h @@ -66,9 +66,9 @@ class CFDE_TextEditEngine { virtual ~Delegate() = default; virtual void NotifyTextFull() = 0; virtual void OnCaretChanged() = 0; - virtual void OnTextChanged(const CFX_WideString& prevText) = 0; + virtual void OnTextChanged(const WideString& prevText) = 0; virtual void OnSelChanged() = 0; - virtual bool OnValidate(const CFX_WideString& wsText) = 0; + virtual bool OnValidate(const WideString& wsText) = 0; virtual void SetScrollOffset(float fScrollOffset) = 0; }; @@ -84,13 +84,13 @@ class CFDE_TextEditEngine { void Clear(); void Insert(size_t idx, - const CFX_WideString& text, + const WideString& text, RecordOperation add_operation = RecordOperation::kInsertRecord); - CFX_WideString Delete( + WideString Delete( size_t start_idx, size_t length, RecordOperation add_operation = RecordOperation::kInsertRecord); - CFX_WideString GetText() const; + WideString GetText() const; size_t GetLength() const; // Non-const so we can force a layout. @@ -147,10 +147,10 @@ class CFDE_TextEditEngine { std::pair<size_t, size_t> GetSelection() const { return {selection_.start_idx, selection_.end_idx}; } - CFX_WideString GetSelectedText() const; - CFX_WideString DeleteSelectedText( + WideString GetSelectedText() const; + WideString DeleteSelectedText( RecordOperation add_operation = RecordOperation::kInsertRecord); - void ReplaceSelectedText(const CFX_WideString& str); + void ReplaceSelectedText(const WideString& str); void Layout(); @@ -183,8 +183,7 @@ class CFDE_TextEditEngine { void SetCombTextWidth(); void AdjustGap(size_t idx, size_t length); void RebuildPieces(); - size_t CountCharsExceedingSize(const CFX_WideString& str, - size_t num_to_check); + size_t CountCharsExceedingSize(const WideString& str, size_t num_to_check); void AddOperationRecord(std::unique_ptr<Operation> op); bool IsAlignedRight() const { @@ -210,7 +209,7 @@ class CFDE_TextEditEngine { FX_ARGB font_color_; float font_size_; float line_spacing_; - std::vector<CFX_WideString::CharType> content_; + std::vector<WideString::CharType> content_; size_t text_length_; size_t gap_position_; size_t gap_size_; diff --git a/xfa/fde/cfde_texteditengine_unittest.cpp b/xfa/fde/cfde_texteditengine_unittest.cpp index 2084914bbf..48ed647945 100644 --- a/xfa/fde/cfde_texteditengine_unittest.cpp +++ b/xfa/fde/cfde_texteditengine_unittest.cpp @@ -20,9 +20,9 @@ class CFDE_TextEditEngineTest : public testing::Test { void NotifyTextFull() override { text_is_full = true; } void OnCaretChanged() override {} - void OnTextChanged(const CFX_WideString& prevText) override {} + void OnTextChanged(const WideString& prevText) override {} void OnSelChanged() override {} - bool OnValidate(const CFX_WideString& wsText) override { + bool OnValidate(const WideString& wsText) override { return !fail_validation; } void SetScrollOffset(float fScrollOffset) override {} diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp index 7ccc9688da..3cf4ed36e0 100644 --- a/xfa/fde/cfde_textout.cpp +++ b/xfa/fde/cfde_textout.cpp @@ -191,13 +191,13 @@ void CFDE_TextOut::SetLineBreakTolerance(float fTolerance) { m_pTxtBreak->SetLineBreakTolerance(m_fTolerance); } -void CFDE_TextOut::CalcLogicSize(const CFX_WideString& str, CFX_SizeF& size) { +void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_SizeF& size) { CFX_RectF rtText(0.0f, 0.0f, size.width, size.height); CalcLogicSize(str, rtText); size = rtText.Size(); } -void CFDE_TextOut::CalcLogicSize(const CFX_WideString& str, CFX_RectF& rect) { +void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF& rect) { if (str.IsEmpty()) { rect.width = 0.0f; rect.height = 0.0f; @@ -278,7 +278,7 @@ bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus, } void CFDE_TextOut::DrawLogicText(CFX_RenderDevice* device, - const CFX_WideStringC& str, + const WideStringView& str, const CFX_RectF& rect) { ASSERT(m_pFont && m_fFontSize >= 1.0f); @@ -292,7 +292,7 @@ void CFDE_TextOut::DrawLogicText(CFX_RenderDevice* device, m_ttoLines.clear(); m_wsText.clear(); - LoadText(CFX_WideString(str), rect); + LoadText(WideString(str), rect); Reload(rect); DoAlignment(rect); @@ -321,7 +321,7 @@ void CFDE_TextOut::DrawLogicText(CFX_RenderDevice* device, device->RestoreState(false); } -void CFDE_TextOut::LoadText(const CFX_WideString& str, const CFX_RectF& rect) { +void CFDE_TextOut::LoadText(const WideString& str, const CFX_RectF& rect) { ASSERT(!str.IsEmpty()); m_wsText = str; diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h index 89c8eac28d..b936eb4415 100644 --- a/xfa/fde/cfde_textout.h +++ b/xfa/fde/cfde_textout.h @@ -95,10 +95,10 @@ class CFDE_TextOut { void SetMatrix(const CFX_Matrix& matrix) { m_Matrix = matrix; } void SetLineBreakTolerance(float fTolerance); - void CalcLogicSize(const CFX_WideString& str, CFX_SizeF& size); - void CalcLogicSize(const CFX_WideString& str, CFX_RectF& rect); + void CalcLogicSize(const WideString& str, CFX_SizeF& size); + void CalcLogicSize(const WideString& str, CFX_RectF& rect); void DrawLogicText(CFX_RenderDevice* device, - const CFX_WideStringC& str, + const WideStringView& str, const CFX_RectF& rect); int32_t GetTotalLines() const { return m_iTotalLines; } @@ -107,7 +107,7 @@ class CFDE_TextOut { float& fStartPos, float& fWidth, float& fHeight); - void LoadText(const CFX_WideString& str, const CFX_RectF& rect); + void LoadText(const WideString& str, const CFX_RectF& rect); void Reload(const CFX_RectF& rect); void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect); @@ -131,7 +131,7 @@ class CFDE_TextOut { std::vector<int32_t> m_CharWidths; FX_ARGB m_TxtColor; uint32_t m_dwTxtBkStyles; - CFX_WideString m_wsText; + WideString m_wsText; CFX_Matrix m_Matrix; std::deque<CFDE_TTOLine> m_ttoLines; int32_t m_iCurLine; diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp index df95a3588a..87b07691a4 100644 --- a/xfa/fgas/crt/cfgas_formatstring.cpp +++ b/xfa/fgas/crt/cfgas_formatstring.cpp @@ -97,10 +97,10 @@ int32_t ConvertHex(int32_t iKeyValue, wchar_t ch) { return iKeyValue; } -CFX_WideString GetLiteralText(const wchar_t* pStrPattern, - int32_t* iPattern, - int32_t iLenPattern) { - CFX_WideString wsOutput; +WideString GetLiteralText(const wchar_t* pStrPattern, + int32_t* iPattern, + int32_t iLenPattern) { + WideString wsOutput; if (pStrPattern[*iPattern] != '\'') return wsOutput; @@ -135,9 +135,9 @@ CFX_WideString GetLiteralText(const wchar_t* pStrPattern, return wsOutput; } -CFX_WideString GetLiteralTextReverse(const wchar_t* pStrPattern, - int32_t* iPattern) { - CFX_WideString wsOutput; +WideString GetLiteralTextReverse(const wchar_t* pStrPattern, + int32_t* iPattern) { + WideString wsOutput; if (pStrPattern[*iPattern] != '\'') return wsOutput; @@ -173,8 +173,8 @@ CFX_WideString GetLiteralTextReverse(const wchar_t* pStrPattern, return wsOutput; } -bool GetNumericDotIndex(const CFX_WideString& wsNum, - const CFX_WideString& wsDotSymbol, +bool GetNumericDotIndex(const WideString& wsNum, + const WideString& wsDotSymbol, int32_t* iDotIndex) { int32_t ccf = 0; int32_t iLenf = wsNum.GetLength(); @@ -221,8 +221,8 @@ bool ExtractCountDigitsWithOptional(const wchar_t* str, return true; } -bool ParseLocaleDate(const CFX_WideString& wsDate, - const CFX_WideString& wsDatePattern, +bool ParseLocaleDate(const WideString& wsDate, + const WideString& wsDatePattern, IFX_Locale* pLocale, CFX_DateTime* datetime, int32_t* cc) { @@ -234,10 +234,10 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, int32_t len = wsDate.GetLength(); const wchar_t* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); - CFX_WideStringC wsDateSymbols(gs_wsDateSymbols); + WideStringView wsDateSymbols(gs_wsDateSymbols); while (*cc < len && ccf < lenf) { if (strf[ccf] == '\'') { - CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); + WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (*cc + iLiteralLen > len || wcsncmp(str + *cc, wsLiteral.c_str(), iLiteralLen)) { @@ -254,7 +254,7 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -273,7 +273,7 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, return false; } else if (symbol == L"MMM" || symbol == L"MMMM") { for (uint16_t i = 0; i < 12; i++) { - CFX_WideString wsMonthName = pLocale->GetMonthName(i, symbol == L"MMM"); + WideString wsMonthName = pLocale->GetMonthName(i, symbol == L"MMM"); if (wsMonthName.IsEmpty()) continue; if (!wcsncmp(wsMonthName.c_str(), str + *cc, wsMonthName.GetLength())) { @@ -284,7 +284,7 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, } } else if (symbol == L"EEE" || symbol == L"EEEE") { for (uint16_t i = 0; i < 7; i++) { - CFX_WideString wsDayName = pLocale->GetDayName(i, symbol == L"EEE"); + WideString wsDayName = pLocale->GetDayName(i, symbol == L"EEE"); if (wsDayName.IsEmpty()) continue; if (!wcsncmp(wsDayName.c_str(), str + *cc, wsDayName.GetLength())) { @@ -338,8 +338,8 @@ void ResolveZone(FX_TIMEZONE tzDiff, *wMinute = iMinuteDiff % 60; } -bool ParseLocaleTime(const CFX_WideString& wsTime, - const CFX_WideString& wsTimePattern, +bool ParseLocaleTime(const WideString& wsTime, + const WideString& wsTimePattern, IFX_Locale* pLocale, CFX_DateTime* datetime, int32_t* cc) { @@ -354,10 +354,10 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, int lenf = wsTimePattern.GetLength(); bool bHasA = false; bool bPM = false; - CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols); + WideStringView wsTimeSymbols(gs_wsTimeSymbols); while (*cc < len && ccf < lenf) { if (strf[ccf] == '\'') { - CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); + WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (*cc + iLiteralLen > len || wcsncmp(str + *cc, wsLiteral.c_str(), iLiteralLen)) { @@ -375,7 +375,7 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -415,16 +415,16 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, if (!ExtractCountDigits(str, len, 3, cc, &millisecond)) return false; } else if (symbol == L"A") { - CFX_WideString wsAM = pLocale->GetMeridiemName(true); - CFX_WideString wsPM = pLocale->GetMeridiemName(false); + WideString wsAM = pLocale->GetMeridiemName(true); + WideString wsPM = pLocale->GetMeridiemName(false); if ((*cc + pdfium::base::checked_cast<int32_t>(wsAM.GetLength()) <= len) && - (CFX_WideStringC(str + *cc, wsAM.GetLength()) == wsAM)) { + (WideStringView(str + *cc, wsAM.GetLength()) == wsAM)) { *cc += wsAM.GetLength(); bHasA = true; } else if ((*cc + pdfium::base::checked_cast<int32_t>(wsPM.GetLength()) <= len) && - (CFX_WideStringC(str + *cc, wsPM.GetLength()) == wsPM)) { + (WideStringView(str + *cc, wsPM.GetLength()) == wsPM)) { *cc += wsPM.GetLength(); bHasA = true; bPM = true; @@ -433,7 +433,7 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, if (*cc + 3 > len) continue; - CFX_WideString tz(str[(*cc)++]); + WideString tz(str[(*cc)++]); tz += str[(*cc)++]; tz += str[(*cc)++]; if (tz == L"GMT") { @@ -480,7 +480,7 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, return !!(*cc); } -int32_t GetNumTrailingLimit(const CFX_WideString& wsFormat, +int32_t GetNumTrailingLimit(const WideString& wsFormat, int iDotPos, bool* bTrimTailZeros) { if (iDotPos < 0) @@ -553,23 +553,23 @@ uint16_t GetWeekOfYear(uint16_t year, uint16_t month, uint16_t day) { return week_index; } -CFX_WideString NumToString(size_t fmt_size, int32_t value) { - CFX_WideString str; +WideString NumToString(size_t fmt_size, int32_t value) { + WideString str; str.Format(fmt_size == 1 ? L"%d" : fmt_size == 2 ? L"%02d" : L"%03d", value); return str; } -CFX_WideString DateFormat(const CFX_WideString& wsDatePattern, - IFX_Locale* pLocale, - const CFX_DateTime& datetime) { - CFX_WideString wsResult; +WideString DateFormat(const WideString& wsDatePattern, + IFX_Locale* pLocale, + const CFX_DateTime& datetime) { + WideString wsResult; int32_t year = datetime.GetYear(); uint8_t month = datetime.GetMonth(); uint8_t day = datetime.GetDay(); int32_t ccf = 0; const wchar_t* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); - CFX_WideStringC wsDateSymbols(gs_wsDateSymbols); + WideStringView wsDateSymbols(gs_wsDateSymbols); while (ccf < lenf) { if (strf[ccf] == '\'') { wsResult += GetLiteralText(strf, &ccf, lenf); @@ -581,7 +581,7 @@ CFX_WideString DateFormat(const CFX_WideString& wsDatePattern, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -621,10 +621,10 @@ CFX_WideString DateFormat(const CFX_WideString& wsDatePattern, return wsResult; } -CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, - IFX_Locale* pLocale, - const CFX_DateTime& datetime) { - CFX_WideString wsResult; +WideString TimeFormat(const WideString& wsTimePattern, + IFX_Locale* pLocale, + const CFX_DateTime& datetime) { + WideString wsResult; uint8_t hour = datetime.GetHour(); uint8_t minute = datetime.GetMinute(); uint8_t second = datetime.GetSecond(); @@ -639,7 +639,7 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, bPM = true; } - CFX_WideStringC wsTimeSymbols(gs_wsTimeSymbols); + WideStringView wsTimeSymbols(gs_wsTimeSymbols); while (ccf < lenf) { if (strf[ccf] == '\'') { wsResult += GetLiteralText(strf, &ccf, lenf); @@ -651,7 +651,7 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, continue; } - CFX_WideString symbol; + WideString symbol; symbol.Reserve(4); symbol += strf[ccf++]; while (ccf < lenf && strf[ccf] == symbol[0]) @@ -685,7 +685,7 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, if (tz.tzHour != 0 || tz.tzMinute != 0) { wsResult += tz.tzHour < 0 ? L"-" : L"+"; - CFX_WideString wsTimezone; + WideString wsTimezone; wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute); wsResult += wsTimezone; } @@ -694,16 +694,16 @@ CFX_WideString TimeFormat(const CFX_WideString& wsTimePattern, return wsResult; } -CFX_WideString FormatDateTimeInternal(const CFX_DateTime& dt, - const CFX_WideString& wsDatePattern, - const CFX_WideString& wsTimePattern, - bool bDateFirst, - IFX_Locale* pLocale) { - CFX_WideString wsDateOut; +WideString FormatDateTimeInternal(const CFX_DateTime& dt, + const WideString& wsDatePattern, + const WideString& wsTimePattern, + bool bDateFirst, + IFX_Locale* pLocale) { + WideString wsDateOut; if (!wsDatePattern.IsEmpty()) wsDateOut = DateFormat(wsDatePattern, pLocale, dt); - CFX_WideString wsTimeOut; + WideString wsTimeOut; if (!wsTimePattern.IsEmpty()) wsTimeOut = TimeFormat(wsTimePattern, pLocale, dt); @@ -712,8 +712,7 @@ CFX_WideString FormatDateTimeInternal(const CFX_DateTime& dt, } // namespace -bool FX_DateFromCanonical(const CFX_WideString& wsDate, - CFX_DateTime* datetime) { +bool FX_DateFromCanonical(const WideString& wsDate, CFX_DateTime* datetime) { const wchar_t* str = wsDate.c_str(); int len = wsDate.GetLength(); if (len > 10) @@ -762,7 +761,7 @@ bool FX_DateFromCanonical(const CFX_WideString& wsDate, return true; } -bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, +bool FX_TimeFromCanonical(const WideStringView& wsTime, CFX_DateTime* datetime, IFX_Locale* pLocale) { if (wsTime.GetLength() == 0) @@ -840,8 +839,8 @@ CFGAS_FormatString::CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr) CFGAS_FormatString::~CFGAS_FormatString() {} void CFGAS_FormatString::SplitFormatString( - const CFX_WideString& wsFormatString, - std::vector<CFX_WideString>* wsPatterns) { + const WideString& wsFormatString, + std::vector<WideString>* wsPatterns) { int32_t iStrLen = wsFormatString.GetLength(); const wchar_t* pStr = wsFormatString.c_str(); const wchar_t* pToken = pStr; @@ -849,32 +848,31 @@ void CFGAS_FormatString::SplitFormatString( bool iQuote = false; while (true) { if (pStr >= pEnd) { - wsPatterns->push_back(CFX_WideString(pToken, pStr - pToken)); + wsPatterns->push_back(WideString(pToken, pStr - pToken)); return; } if (*pStr == '\'') { iQuote = !iQuote; } else if (*pStr == L'|' && !iQuote) { - wsPatterns->push_back(CFX_WideString(pToken, pStr - pToken)); + wsPatterns->push_back(WideString(pToken, pStr - pToken)); pToken = pStr + 1; } pStr++; } } -FX_LOCALECATEGORY CFGAS_FormatString::GetCategory( - const CFX_WideString& wsPattern) { +FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(const WideString& wsPattern) { FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const wchar_t* pStr = wsPattern.c_str(); bool bBraceOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); + WideStringView wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { GetLiteralText(pStr, &ccf, iLenf); } else if (!bBraceOpen && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsCategory(pStr[ccf]); + WideString wsCategory(pStr[ccf]); ccf++; while (true) { if (ccf == iLenf) @@ -889,7 +887,7 @@ FX_LOCALECATEGORY CFGAS_FormatString::GetCategory( ccf++; } - uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringC(), false); + uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringView(), false); if (dwHash == FX_LOCALECATEGORY_DateHash) { if (eCategory == FX_LOCALECATEGORY_Time) return FX_LOCALECATEGORY_DateTime; @@ -917,22 +915,21 @@ FX_LOCALECATEGORY CFGAS_FormatString::GetCategory( return eCategory; } -CFX_WideString CFGAS_FormatString::GetTextFormat( - const CFX_WideString& wsPattern, - const CFX_WideStringC& wsCategory) { +WideString CFGAS_FormatString::GetTextFormat(const WideString& wsPattern, + const WideStringView& wsCategory) { int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const wchar_t* pStr = wsPattern.c_str(); bool bBrackOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); - CFX_WideString wsPurgePattern; + WideStringView wsConstChars(gs_wsConstChars); + WideString wsPurgePattern; while (ccf < iLenf) { if (pStr[ccf] == '\'') { int32_t iCurChar = ccf; GetLiteralText(pStr, &ccf, iLenf); - wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1); + wsPurgePattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1); } else if (!bBrackOpen && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsSearchCategory(pStr[ccf]); + WideString wsSearchCategory(pStr[ccf]); ccf++; while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' && pStr[ccf] != '(') { @@ -965,11 +962,10 @@ CFX_WideString CFGAS_FormatString::GetTextFormat( return wsPurgePattern; } -IFX_Locale* CFGAS_FormatString::GetNumericFormat( - const CFX_WideString& wsPattern, - int32_t* iDotIndex, - uint32_t* dwStyle, - CFX_WideString* wsPurgePattern) { +IFX_Locale* CFGAS_FormatString::GetNumericFormat(const WideString& wsPattern, + int32_t* iDotIndex, + uint32_t* dwStyle, + WideString* wsPurgePattern) { *dwStyle = 0; IFX_Locale* pLocale = nullptr; int32_t ccf = 0; @@ -977,14 +973,14 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( const wchar_t* pStr = wsPattern.c_str(); bool bFindDot = false; bool bBrackOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); + WideStringView wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { int32_t iCurChar = ccf; GetLiteralText(pStr, &ccf, iLenf); - *wsPurgePattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1); + *wsPurgePattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1); } else if (!bBrackOpen && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsCategory(pStr[ccf]); + WideString wsCategory(pStr[ccf]); ccf++; while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' && pStr[ccf] != '(') { @@ -999,7 +995,7 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( while (ccf < iLenf) { if (pStr[ccf] == '(') { ccf++; - CFX_WideString wsLCID; + WideString wsLCID; while (ccf < iLenf && pStr[ccf] != ')') wsLCID += pStr[ccf++]; @@ -1008,13 +1004,13 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( bBrackOpen = true; break; } else if (pStr[ccf] == '.') { - CFX_WideString wsSubCategory; + WideString wsSubCategory; ccf++; while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') wsSubCategory += pStr[ccf++]; uint32_t dwSubHash = - FX_HashCode_GetW(wsSubCategory.AsStringC(), false); + FX_HashCode_GetW(wsSubCategory.AsStringView(), false); FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal; for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) { if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) { @@ -1068,14 +1064,14 @@ IFX_Locale* CFGAS_FormatString::GetNumericFormat( return pLocale; } -bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue) { +bool CFGAS_FormatString::ParseText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsValue) { wsValue->clear(); if (wsSrcText.IsEmpty() || wsPattern.IsEmpty()) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); if (wsTextFormat.IsEmpty()) return false; @@ -1088,7 +1084,7 @@ bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText, while (iPattern < iLenPattern && iText < iLenText) { switch (pStrPattern[iPattern]) { case '\'': { - CFX_WideString wsLiteral = + WideString wsLiteral = GetLiteralText(pStrPattern, &iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || @@ -1141,28 +1137,28 @@ bool CFGAS_FormatString::ParseText(const CFX_WideString& wsSrcText, return iPattern == iLenPattern && iText == iLenText; } -bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue) { +bool CFGAS_FormatString::ParseNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsValue) { wsValue->clear(); if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) return false; int32_t dot_index_f = -1; uint32_t dwFormatStyle = 0; - CFX_WideString wsNumFormat; + WideString wsNumFormat; IFX_Locale* pLocale = GetNumericFormat(wsPattern, &dot_index_f, &dwFormatStyle, &wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) return false; int32_t iExponent = 0; - CFX_WideString wsDotSymbol = + WideString wsDotSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal); - CFX_WideString wsGroupSymbol = + WideString wsGroupSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping); int32_t iGroupLen = wsGroupSymbol.GetLength(); - CFX_WideString wsMinus = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus); + WideString wsMinus = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus); int32_t iMinusLen = wsMinus.GetLength(); const wchar_t* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); @@ -1192,7 +1188,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, while (ccf >= 0 && cc >= 0) { switch (strf[ccf]) { case '\'': { - CFX_WideString wsLiteral = GetLiteralTextReverse(strf, &ccf); + WideString wsLiteral = GetLiteralTextReverse(strf, &ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; if (cc < 0 || wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) @@ -1265,7 +1261,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, break; } case '$': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; @@ -1307,7 +1303,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case '%': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; @@ -1371,7 +1367,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, while (cc < len && ccf < lenf) { switch (strf[ccf]) { case '\'': { - CFX_WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); + WideString wsLiteral = GetLiteralText(strf, &ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { @@ -1441,7 +1437,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, break; } case '$': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol); int32_t iSymbolLen = wsSymbol.GetLength(); if (cc + iSymbolLen > len || @@ -1483,7 +1479,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'v': return false; case '%': { - CFX_WideString wsSymbol = + WideString wsSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent); int32_t iSysmbolLen = wsSymbol.GetLength(); if (cc + iSysmbolLen <= len && @@ -1532,7 +1528,7 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, return false; } if (iExponent || bHavePercentSymbol) { - CFX_Decimal decimal = CFX_Decimal(wsValue->AsStringC()); + CFX_Decimal decimal = CFX_Decimal(wsValue->AsStringView()); if (iExponent) { decimal = decimal * CFX_Decimal(FXSYS_pow(10, static_cast<float>(iExponent)), 3); @@ -1549,27 +1545,27 @@ bool CFGAS_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( - const CFX_WideString& wsPattern, + const WideString& wsPattern, IFX_Locale** pLocale, - CFX_WideString* wsDatePattern, - CFX_WideString* wsTimePattern) { + WideString* wsDatePattern, + WideString* wsTimePattern) { *pLocale = nullptr; - CFX_WideString wsTempPattern; + WideString wsTempPattern; FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); const wchar_t* pStr = wsPattern.c_str(); int32_t iFindCategory = 0; bool bBraceOpen = false; - CFX_WideStringC wsConstChars(gs_wsConstChars); + WideStringView wsConstChars(gs_wsConstChars); while (ccf < iLenf) { if (pStr[ccf] == '\'') { int32_t iCurChar = ccf; GetLiteralText(pStr, &ccf, iLenf); - wsTempPattern += CFX_WideStringC(pStr + iCurChar, ccf - iCurChar + 1); + wsTempPattern += WideStringView(pStr + iCurChar, ccf - iCurChar + 1); } else if (!bBraceOpen && iFindCategory != 3 && !wsConstChars.Contains(pStr[ccf])) { - CFX_WideString wsCategory(pStr[ccf]); + WideString wsCategory(pStr[ccf]); ccf++; while (ccf < iLenf && pStr[ccf] != '{' && pStr[ccf] != '.' && pStr[ccf] != '(') { @@ -1602,7 +1598,7 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( while (ccf < iLenf) { if (pStr[ccf] == '(') { ccf++; - CFX_WideString wsLCID; + WideString wsLCID; while (ccf < iLenf && pStr[ccf] != ')') wsLCID += pStr[ccf++]; @@ -1611,13 +1607,13 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( bBraceOpen = true; break; } else if (pStr[ccf] == '.') { - CFX_WideString wsSubCategory; + WideString wsSubCategory; ccf++; while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') wsSubCategory += pStr[ccf++]; uint32_t dwSubHash = - FX_HashCode_GetW(wsSubCategory.AsStringC(), false); + FX_HashCode_GetW(wsSubCategory.AsStringView(), false); FX_LOCALEDATETIMESUBCATEGORY eSubCategory = FX_LOCALEDATETIMESUBCATEGORY_Medium; for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) { @@ -1685,16 +1681,16 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat( return (FX_DATETIMETYPE)iFindCategory; } -bool CFGAS_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, +bool CFGAS_FormatString::ParseDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, CFX_DateTime* dtValue) { dtValue->Reset(); if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) return false; - CFX_WideString wsDatePattern; - CFX_WideString wsTimePattern; + WideString wsDatePattern; + WideString wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, &pLocale, &wsDatePattern, &wsTimePattern); @@ -1730,9 +1726,9 @@ bool CFGAS_FormatString::ParseDateTime(const CFX_WideString& wsSrcDateTime, return true; } -bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern) { - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); +bool CFGAS_FormatString::ParseZero(const WideString& wsSrcText, + const WideString& wsPattern) { + WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); int32_t iText = 0; int32_t iPattern = 0; @@ -1742,7 +1738,7 @@ bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText, int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { - CFX_WideString wsLiteral = + WideString wsLiteral = GetLiteralText(pStrPattern, &iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || @@ -1762,9 +1758,9 @@ bool CFGAS_FormatString::ParseZero(const CFX_WideString& wsSrcText, return iPattern == iLenPattern && iText == iLenText; } -bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern) { - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); +bool CFGAS_FormatString::ParseNull(const WideString& wsSrcText, + const WideString& wsPattern) { + WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); int32_t iText = 0; int32_t iPattern = 0; @@ -1774,7 +1770,7 @@ bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText, int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { - CFX_WideString wsLiteral = + WideString wsLiteral = GetLiteralText(pStrPattern, &iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || @@ -1794,9 +1790,9 @@ bool CFGAS_FormatString::ParseNull(const CFX_WideString& wsSrcText, return iPattern == iLenPattern && iText == iLenText; } -bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsOutput) { if (wsPattern.IsEmpty()) return false; @@ -1804,7 +1800,7 @@ bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText, if (iLenText == 0) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"text"); int32_t iText = 0; int32_t iPattern = 0; @@ -1856,15 +1852,15 @@ bool CFGAS_FormatString::FormatText(const CFX_WideString& wsSrcText, return iText == iLenText; } -bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatStrNum(const WideStringView& wsInputNum, + const WideString& wsPattern, + WideString* wsOutput) { if (wsInputNum.IsEmpty() || wsPattern.IsEmpty()) return false; int32_t dot_index_f = -1; uint32_t dwNumStyle = 0; - CFX_WideString wsNumFormat; + WideString wsNumFormat; IFX_Locale* pLocale = GetNumericFormat(wsPattern, &dot_index_f, &dwNumStyle, &wsNumFormat); if (!pLocale || wsNumFormat.IsEmpty()) @@ -1873,12 +1869,12 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, int32_t cc = 0, ccf = 0; const wchar_t* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); - CFX_WideString wsSrcNum(wsInputNum); + WideString wsSrcNum(wsInputNum); wsSrcNum.TrimLeft('0'); if (wsSrcNum.IsEmpty() || wsSrcNum[0] == '.') wsSrcNum.InsertAtFront('0'); - CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringC()); + CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsStringView()); if (dwNumStyle & FX_NUMSTYLE_Percent) { decimal = decimal * CFX_Decimal(100); wsSrcNum = decimal; @@ -1937,7 +1933,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsSrcNum.TrimRight(L"."); } - CFX_WideString wsGroupSymbol = + WideString wsGroupSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping); bool bNeg = false; if (wsSrcNum[0] == '-') { @@ -2010,7 +2006,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, ccf--; break; case 'E': { - CFX_WideString wsExp; + WideString wsExp; wsExp.Format(L"E%+d", exponent); *wsOutput = wsExp + *wsOutput; ccf--; @@ -2114,7 +2110,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return true; } - CFX_WideString wsDotSymbol = + WideString wsDotSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal); if (strf[dot_index_f] == 'V') { *wsOutput += wsDotSymbol; @@ -2168,7 +2164,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, ccf++; break; case 'E': { - CFX_WideString wsExp; + WideString wsExp; wsExp.Format(L"E%+d", exponent); *wsOutput += wsExp; ccf++; @@ -2247,23 +2243,23 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return true; } -bool CFGAS_FormatString::FormatNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsOutput) { if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) return false; - return FormatStrNum(wsSrcNum.AsStringC(), wsPattern, wsOutput); + return FormatStrNum(wsSrcNum.AsStringView(), wsPattern, wsOutput); } -bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, +bool CFGAS_FormatString::FormatDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, - CFX_WideString* wsOutput) { + WideString* wsOutput) { if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty()) return false; - CFX_WideString wsDatePattern; - CFX_WideString wsTimePattern; + WideString wsDatePattern; + WideString wsTimePattern; IFX_Locale* pLocale = nullptr; FX_DATETIMETYPE eCategory = GetDateTimeFormat(wsPattern, &pLocale, &wsDatePattern, &wsTimePattern); @@ -2290,15 +2286,15 @@ bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, return true; } if (eCategory == FX_DATETIMETYPE_Time && - FX_TimeFromCanonical(wsSrcDateTime.AsStringC(), &dt, pLocale)) { + FX_TimeFromCanonical(wsSrcDateTime.AsStringView(), &dt, pLocale)) { *wsOutput = FormatDateTimeInternal(dt, wsDatePattern, wsTimePattern, true, pLocale); return true; } } else { - CFX_WideString wsSrcDate(wsSrcDateTime.c_str(), iT.value()); - CFX_WideStringC wsSrcTime(wsSrcDateTime.c_str() + iT.value() + 1, - wsSrcDateTime.GetLength() - iT.value() - 1); + WideString wsSrcDate(wsSrcDateTime.c_str(), iT.value()); + WideStringView wsSrcTime(wsSrcDateTime.c_str() + iT.value() + 1, + wsSrcDateTime.GetLength() - iT.value() - 1); if (wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty()) return false; if (FX_DateFromCanonical(wsSrcDate, &dt) && @@ -2312,12 +2308,12 @@ bool CFGAS_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, return false; } -bool CFGAS_FormatString::FormatZero(const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatZero(const WideString& wsPattern, + WideString* wsOutput) { if (wsPattern.IsEmpty()) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"zero"); int32_t iPattern = 0; const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); @@ -2334,12 +2330,12 @@ bool CFGAS_FormatString::FormatZero(const CFX_WideString& wsPattern, return true; } -bool CFGAS_FormatString::FormatNull(const CFX_WideString& wsPattern, - CFX_WideString* wsOutput) { +bool CFGAS_FormatString::FormatNull(const WideString& wsPattern, + WideString* wsOutput) { if (wsPattern.IsEmpty()) return false; - CFX_WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); + WideString wsTextFormat = GetTextFormat(wsPattern, L"null"); int32_t iPattern = 0; const wchar_t* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); diff --git a/xfa/fgas/crt/cfgas_formatstring.h b/xfa/fgas/crt/cfgas_formatstring.h index c91f43598e..5eae25dca5 100644 --- a/xfa/fgas/crt/cfgas_formatstring.h +++ b/xfa/fgas/crt/cfgas_formatstring.h @@ -12,8 +12,8 @@ #include "core/fxcrt/ifx_locale.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -bool FX_DateFromCanonical(const CFX_WideString& wsDate, CFX_DateTime* datetime); -bool FX_TimeFromCanonical(const CFX_WideStringC& wsTime, +bool FX_DateFromCanonical(const WideString& wsDate, CFX_DateTime* datetime); +bool FX_TimeFromCanonical(const WideStringView& wsTime, CFX_DateTime* datetime, IFX_Locale* pLocale); @@ -22,52 +22,50 @@ class CFGAS_FormatString { explicit CFGAS_FormatString(CXFA_LocaleMgr* pLocaleMgr); ~CFGAS_FormatString(); - void SplitFormatString(const CFX_WideString& wsFormatString, - std::vector<CFX_WideString>* wsPatterns); - FX_LOCALECATEGORY GetCategory(const CFX_WideString& wsPattern); + void SplitFormatString(const WideString& wsFormatString, + std::vector<WideString>* wsPatterns); + FX_LOCALECATEGORY GetCategory(const WideString& wsPattern); - bool ParseText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue); - bool ParseNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsValue); - bool ParseDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, + bool ParseText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsValue); + bool ParseNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsValue); + bool ParseDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, CFX_DateTime* dtValue); - bool ParseZero(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern); - bool ParseNull(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern); + bool ParseZero(const WideString& wsSrcText, const WideString& wsPattern); + bool ParseNull(const WideString& wsSrcText, const WideString& wsPattern); - bool FormatText(const CFX_WideString& wsSrcText, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput); - bool FormatNum(const CFX_WideString& wsSrcNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput); - bool FormatDateTime(const CFX_WideString& wsSrcDateTime, - const CFX_WideString& wsPattern, + bool FormatText(const WideString& wsSrcText, + const WideString& wsPattern, + WideString* wsOutput); + bool FormatNum(const WideString& wsSrcNum, + const WideString& wsPattern, + WideString* wsOutput); + bool FormatDateTime(const WideString& wsSrcDateTime, + const WideString& wsPattern, FX_DATETIMETYPE eDateTimeType, - CFX_WideString* wsOutput); - bool FormatZero(const CFX_WideString& wsPattern, CFX_WideString* wsOutput); - bool FormatNull(const CFX_WideString& wsPattern, CFX_WideString* wsOutput); + WideString* wsOutput); + bool FormatZero(const WideString& wsPattern, WideString* wsOutput); + bool FormatNull(const WideString& wsPattern, WideString* wsOutput); private: - CFX_WideString GetTextFormat(const CFX_WideString& wsPattern, - const CFX_WideStringC& wsCategory); - IFX_Locale* GetNumericFormat(const CFX_WideString& wsPattern, + WideString GetTextFormat(const WideString& wsPattern, + const WideStringView& wsCategory); + IFX_Locale* GetNumericFormat(const WideString& wsPattern, int32_t* iDotIndex, uint32_t* dwStyle, - CFX_WideString* wsPurgePattern); - bool FormatStrNum(const CFX_WideStringC& wsInputNum, - const CFX_WideString& wsPattern, - CFX_WideString* wsOutput); - FX_DATETIMETYPE GetDateTimeFormat(const CFX_WideString& wsPattern, + WideString* wsPurgePattern); + bool FormatStrNum(const WideStringView& wsInputNum, + const WideString& wsPattern, + WideString* wsOutput); + FX_DATETIMETYPE GetDateTimeFormat(const WideString& wsPattern, IFX_Locale** pLocale, - CFX_WideString* wsDatePattern, - CFX_WideString* wsTimePattern); + WideString* wsDatePattern, + WideString* wsTimePattern); CXFA_LocaleMgr* m_pLocaleMgr; }; diff --git a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp index 3adcedf7b2..b3d42f655e 100644 --- a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp +++ b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp @@ -43,7 +43,7 @@ class CFGAS_FormatStringTest : public testing::Test { // Note, this re-creates the fmt on each call. If you need to multiple // times store it locally. - CFGAS_FormatString* fmt(const CFX_WideString& locale) { + CFGAS_FormatString* fmt(const WideString& locale) { mgr_ = pdfium::MakeUnique<CXFA_LocaleMgr>(nullptr, locale); fmt_ = pdfium::MakeUnique<CFGAS_FormatString>(mgr_.get()); return fmt_.get(); @@ -112,7 +112,7 @@ TEST_F(CFGAS_FormatStringTest, DateFormat) { // of DDD, DDDD, MMM, MMMM, E, e, gg, YYY, YYYYY. for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatDateTime(tests[i].input, tests[i].pattern, FX_DATETIMETYPE_Date, &result)); @@ -161,7 +161,7 @@ TEST_F(CFGAS_FormatStringTest, TimeFormat) { SetTZ("UTC+2"); for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatDateTime(tests[i].input, tests[i].pattern, FX_DATETIMETYPE_Time, &result)); @@ -191,7 +191,7 @@ TEST_F(CFGAS_FormatStringTest, DateTimeFormat) { L"At 10:30 GMT on Jul 16, 1999"}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatDateTime(tests[i].input, tests[i].pattern, FX_DATETIMETYPE_TimeDate, &result)); @@ -288,7 +288,7 @@ TEST_F(CFGAS_FormatStringTest, DateParse) { // } TEST_F(CFGAS_FormatStringTest, SplitFormatString) { - std::vector<CFX_WideString> results; + std::vector<WideString> results; fmt(L"en")->SplitFormatString( L"null{'No data'} | null{} | text{999*9999} | text{999*999*9999}", &results); @@ -416,7 +416,7 @@ TEST_F(CFGAS_FormatStringTest, NumParse) { }; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->ParseNum(tests[i].input, tests[i].pattern, &result)) << " TEST: " << i; @@ -512,7 +512,7 @@ TEST_F(CFGAS_FormatStringTest, NumFormat) { }; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatNum(tests[i].input, tests[i].pattern, &result)) << " TEST: " << i; @@ -538,7 +538,7 @@ TEST_F(CFGAS_FormatStringTest, TextParse) { {L"en", L"A1C-1234-D text", L"000-9999-X 'text'", L"A1C1234D"}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->ParseText(tests[i].input, tests[i].pattern, &result)); EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i; @@ -547,7 +547,7 @@ TEST_F(CFGAS_FormatStringTest, TextParse) { TEST_F(CFGAS_FormatStringTest, InvalidTextParse) { // Input does not match mask. - CFX_WideString result; + WideString result; EXPECT_FALSE(fmt(L"en")->ParseText(L"123-4567-8", L"AAA-9999-X", &result)); } @@ -568,7 +568,7 @@ TEST_F(CFGAS_FormatStringTest, TextFormat) { }; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale) ->FormatText(tests[i].input, tests[i].pattern, &result)); EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i; @@ -599,7 +599,7 @@ TEST_F(CFGAS_FormatStringTest, NullFormat) { } tests[] = {{L"en", L"null{'n/a'}", L"n/a"}, {L"en", L"null{}", L""}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE(fmt(tests[i].locale)->FormatNull(tests[i].pattern, &result)); EXPECT_STREQ(tests[i].output, result.c_str()) << " TEST: " << i; } @@ -635,7 +635,7 @@ TEST_F(CFGAS_FormatStringTest, ZeroFormat) { {L"en", L"0", L"zero{}", L""}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { - CFX_WideString result; + WideString result; EXPECT_TRUE( fmt(tests[i].locale) ->FormatZero(/* tests[i].input,*/ tests[i].pattern, &result)); diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 9cb772ecba..f2405e9844 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -172,14 +172,14 @@ uint32_t GetFontHashCode(uint16_t wCodePage, uint32_t dwFontStyles) { uint32_t GetFontFamilyHash(const wchar_t* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - CFX_WideString wsFont(pszFontFamily); + WideString wsFont(pszFontFamily); if (dwFontStyles & FX_FONTSTYLE_Bold) wsFont += L"Bold"; if (dwFontStyles & FX_FONTSTYLE_Italic) wsFont += L"Italic"; wsFont += wCodePage; - return FX_HashCode_GetW(wsFont.AsStringC(), false); + return FX_HashCode_GetW(wsFont.AsStringView(), false); } } // namespace @@ -307,8 +307,8 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( void* buffer[3] = {pSrcFont.Get(), (void*)(uintptr_t)dwFontStyles, (void*)(uintptr_t)wCodePage}; - uint32_t dwHash = FX_HashCode_GetA( - CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false); + uint32_t dwHash = + FX_HashCode_GetA(ByteStringView((uint8_t*)buffer, sizeof(buffer)), false); auto it = m_DeriveFonts.find(dwHash); if (it != m_DeriveFonts.end() && it->second) return it->second; @@ -627,7 +627,7 @@ CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {} -CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { +ByteString CFX_FontSourceEnum_File::GetNextFile() { FX_FileHandle* pCurHandle = !m_FolderQueue.empty() ? m_FolderQueue.back().pFileHandle : nullptr; if (!pCurHandle) { @@ -639,10 +639,10 @@ CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { hpp.bsParentPath = m_FolderPaths.back(); m_FolderQueue.push_back(hpp); } - CFX_ByteString bsName; + ByteString bsName; bool bFolder; - CFX_ByteString bsFolderSeparator = - CFX_ByteString::FromUnicode(CFX_WideString(kFolderSeparator)); + ByteString bsFolderSeparator = + ByteString::FromUnicode(WideString(kFolderSeparator)); while (true) { if (!FX_GetNextFile(pCurHandle, &bsName, &bFolder)) { FX_CloseFolder(pCurHandle); @@ -684,7 +684,7 @@ CFX_RetainPtr<CFX_CRTFileAccess> CFX_FontSourceEnum_File::GetNext() { if (m_wsNext.GetLength() == 0) return nullptr; - auto pAccess = pdfium::MakeRetain<CFX_CRTFileAccess>(m_wsNext.AsStringC()); + auto pAccess = pdfium::MakeRetain<CFX_CRTFileAccess>(m_wsNext.AsStringView()); m_wsNext = GetNextFile().UTF8Decode(); return pAccess; } @@ -722,8 +722,8 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { if (!pFontStream) continue; - CFX_WideString wsFaceName = - CFX_WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); + WideString wsFaceName = + WideString::FromLocal(pFontMapper->GetFaceName(i).c_str()); RegisterFaces(pFontStream, &wsFaceName); } return !m_InstalledFonts.empty(); @@ -759,10 +759,10 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const wchar_t* pszFontFamily) { - CFX_ByteString bsHash; + ByteString bsHash; bsHash.Format("%d, %d", wCodePage, dwFontStyles); - bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily)); - uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); + bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); + uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash]; if (!pFontArray->empty()) return (*pFontArray)[0]; @@ -773,7 +773,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage( auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>(); sortedFontInfos = pNewFonts.get(); MatchFonts(sortedFontInfos, wCodePage, dwFontStyles, - CFX_WideString(pszFontFamily), 0); + WideString(pszFontFamily), 0); m_Hash2CandidateList[dwHash] = std::move(pNewFonts); } if (sortedFontInfos->empty()) @@ -800,13 +800,13 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode); uint16_t wCodePage = x ? x->wCodePage : 0xFFFF; uint16_t wBitField = x ? x->wBitField : 0x03E7; - CFX_ByteString bsHash; + ByteString bsHash; if (wCodePage == 0xFFFF) bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles); else bsHash.Format("%d, %d", wCodePage, dwFontStyles); - bsHash += FX_UTF8Encode(CFX_WideStringC(pszFontFamily)); - uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); + bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); + uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); std::vector<CFX_RetainPtr<CFGAS_GEFont>>* pFonts = &m_Hash2Fonts[dwHash]; for (size_t i = 0; i < pFonts->size(); ++i) { if (VerifyUnicode((*pFonts)[i], wUnicode)) @@ -818,7 +818,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByUnicode( auto pNewFonts = pdfium::MakeUnique<std::vector<CFX_FontDescriptorInfo>>(); sortedFontInfos = pNewFonts.get(); MatchFonts(sortedFontInfos, wCodePage, dwFontStyles, - CFX_WideString(pszFontFamily), wUnicode); + WideString(pszFontFamily), wUnicode); m_Hash2CandidateList[dwHash] = std::move(pNewFonts); } for (const auto& info : *sortedFontInfos) { @@ -876,7 +876,7 @@ bool CFGAS_FontMgr::VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, } CFX_RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont( - const CFX_WideString& wsFaceName, + const WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); @@ -993,7 +993,7 @@ CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( } CFX_RetainPtr<IFX_SeekableReadStream> CFGAS_FontMgr::CreateFontStream( - const CFX_ByteString& bsFaceName) { + const ByteString& bsFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); if (!pFontMapper) @@ -1015,7 +1015,7 @@ void CFGAS_FontMgr::MatchFonts( std::vector<CFX_FontDescriptorInfo>* pMatchedFonts, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode) { pMatchedFonts->clear(); for (const auto& pFont : m_InstalledFonts) { @@ -1033,7 +1033,7 @@ void CFGAS_FontMgr::MatchFonts( int32_t CFGAS_FontMgr::CalcPenalty(CFX_FontDescriptor* pInstalled, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode) { int32_t nPenalty = 30000; if (FontName.GetLength() != 0) { @@ -1122,8 +1122,7 @@ void CFGAS_FontMgr::RemoveFont(const CFX_RetainPtr<CFGAS_GEFont>& pEFont) { } } -void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, - const CFX_WideString* pFaceName) { +void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, const WideString* pFaceName) { if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0) return; @@ -1147,18 +1146,17 @@ void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, table.clear(); } GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames); - pFont->m_wsFamilyNames.push_back( - CFX_ByteString(pFace->family_name).UTF8Decode()); + pFont->m_wsFamilyNames.push_back(ByteString(pFace->family_name).UTF8Decode()); pFont->m_wsFaceName = pFaceName ? *pFaceName - : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); + : WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); pFont->m_nFaceIndex = pFace->face_index; m_InstalledFonts.push_back(std::move(pFont)); } void CFGAS_FontMgr::RegisterFaces( const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, - const CFX_WideString* pFaceName) { + const WideString* pFaceName) { int32_t index = 0; int32_t num_faces = 0; do { @@ -1194,12 +1192,12 @@ uint32_t CFGAS_FontMgr::GetFlags(FXFT_Face pFace) { } void CFGAS_FontMgr::GetNames(const uint8_t* name_table, - std::vector<CFX_WideString>& Names) { + std::vector<WideString>& Names) { if (!name_table) return; uint8_t* lpTable = (uint8_t*)name_table; - CFX_WideString wsFamily; + WideString wsFamily; uint8_t* sp = lpTable + 2; uint8_t* lpNameRecord = lpTable + 6; uint16_t nNameCount = GetUInt16(sp); @@ -1267,8 +1265,8 @@ void CFGAS_FontMgr::GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB) { CSB[1] = pOS2->ulCodePageRange2; } -int32_t CFGAS_FontMgr::IsPartName(const CFX_WideString& Name1, - const CFX_WideString& Name2) { +int32_t CFGAS_FontMgr::IsPartName(const WideString& Name1, + const WideString& Name2) { if (Name1.Contains(Name2.c_str())) return 1; return 0; diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index ca3cf1c710..8e970361b4 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -131,8 +131,8 @@ class CFX_FontDescriptor { ~CFX_FontDescriptor(); int32_t m_nFaceIndex; - CFX_WideString m_wsFaceName; - std::vector<CFX_WideString> m_wsFamilyNames; + WideString m_wsFaceName; + std::vector<WideString> m_wsFamilyNames; uint32_t m_dwFontStyles; uint32_t m_dwUsb[4]; uint32_t m_dwCsb[2]; @@ -161,7 +161,7 @@ struct FX_HandleParentPath { bsParentPath = x.bsParentPath; } FX_FileHandle* pFileHandle; - CFX_ByteString bsParentPath; + ByteString bsParentPath; }; class CFX_FontSourceEnum_File { @@ -173,11 +173,11 @@ class CFX_FontSourceEnum_File { CFX_RetainPtr<CFX_CRTFileAccess> GetNext(); private: - CFX_ByteString GetNextFile(); + ByteString GetNextFile(); - CFX_WideString m_wsNext; + WideString m_wsNext; std::vector<FX_HandleParentPath> m_FolderQueue; - std::vector<CFX_ByteString> m_FolderPaths; + std::vector<ByteString> m_FolderPaths; }; class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { @@ -203,28 +203,28 @@ class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { bool EnumFonts(); bool EnumFontsFromFontMapper(); bool EnumFontsFromFiles(); - void RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName); + void RegisterFace(FXFT_Face pFace, const WideString* pFaceName); void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, - const CFX_WideString* pFaceName); - void GetNames(const uint8_t* name_table, std::vector<CFX_WideString>& Names); + const WideString* pFaceName); + void GetNames(const uint8_t* name_table, std::vector<WideString>& Names); std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode); bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode); - int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); + int32_t IsPartName(const WideString& Name1, const WideString& Name2); void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode = 0xFFFE); int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, uint16_t wCodePage, uint32_t dwFontStyles, - const CFX_WideString& FontName, + const WideString& FontName, wchar_t wcUnicode = 0xFFFE); - CFX_RetainPtr<CFGAS_GEFont> LoadFont(const CFX_WideString& wsFaceName, + CFX_RetainPtr<CFGAS_GEFont> LoadFont(const WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount); FXFT_Face LoadFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, @@ -234,7 +234,7 @@ class CFGAS_FontMgr : public CFX_Observable<CFGAS_FontMgr> { IFX_SystemFontInfo* pSystemFontInfo, uint32_t index); CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( - const CFX_ByteString& bsFaceName); + const ByteString& bsFaceName); CFX_FontSourceEnum_File* const m_pFontSource; std::vector<std::unique_ptr<CFX_FontDescriptor>> m_InstalledFonts; diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp index 151aec7d9e..c710ed96b0 100644 --- a/xfa/fgas/font/cfgas_gefont.cpp +++ b/xfa/fgas/font/cfgas_gefont.cpp @@ -102,9 +102,9 @@ bool CFGAS_GEFont::LoadFontInternal(const wchar_t* pszFontFamily, uint16_t wCodePage) { if (m_pFont) return false; - CFX_ByteString csFontFamily; + ByteString csFontFamily; if (pszFontFamily) - csFontFamily = CFX_ByteString::FromUnicode(pszFontFamily); + csFontFamily = ByteString::FromUnicode(pszFontFamily); uint32_t dwFlags = 0; if (dwFontStyles & FX_FONTSTYLE_FixedPitch) dwFlags |= FXFONT_FIXED_PITCH; @@ -173,13 +173,13 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::Derive(uint32_t dwFontStyles, return pdfium::MakeRetain<CFGAS_GEFont>(pFont, dwFontStyles); } -CFX_WideString CFGAS_GEFont::GetFamilyName() const { +WideString CFGAS_GEFont::GetFamilyName() const { if (!m_pFont->GetSubstFont() || m_pFont->GetSubstFont()->m_Family.GetLength() == 0) { - return CFX_WideString::FromLocal(m_pFont->GetFamilyName().AsStringC()); + return WideString::FromLocal(m_pFont->GetFamilyName().AsStringView()); } - return CFX_WideString::FromLocal( - m_pFont->GetSubstFont()->m_Family.AsStringC()); + return WideString::FromLocal( + m_pFont->GetSubstFont()->m_Family.AsStringView()); } uint32_t CFGAS_GEFont::GetFontStyles() const { @@ -330,7 +330,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(wchar_t wUnicode, if (!m_pFontMgr || !bRecursive) return 0xFFFF; - CFX_WideString wsFamily = GetFamilyName(); + WideString wsFamily = GetFamilyName(); CFX_RetainPtr<CFGAS_GEFont> pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), wsFamily.c_str()); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h index cc9e56a110..13ac48f9cb 100644 --- a/xfa/fgas/font/cfgas_gefont.h +++ b/xfa/fgas/font/cfgas_gefont.h @@ -89,7 +89,7 @@ class CFGAS_GEFont : public CFX_Retainable { bool bRecursive, CFX_RetainPtr<CFGAS_GEFont>* ppFont, bool bCharCode = false); - CFX_WideString GetFamilyName() const; + WideString GetFamilyName() const; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ bool m_bUseLogFontStyle; diff --git a/xfa/fgas/layout/cfx_breakline.cpp b/xfa/fgas/layout/cfx_breakline.cpp index 9eb0211119..d3fce06d6f 100644 --- a/xfa/fgas/layout/cfx_breakline.cpp +++ b/xfa/fgas/layout/cfx_breakline.cpp @@ -35,7 +35,7 @@ const CFX_BreakPiece* CFX_BreakLine::GetPiece(int32_t index) const { return &m_LinePieces[index]; } -void CFX_BreakLine::GetString(CFX_WideString& wsStr) const { +void CFX_BreakLine::GetString(WideString& wsStr) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_LineChars); wchar_t* pBuf = wsStr.GetBuffer(iCount); for (int32_t i = 0; i < iCount; i++) diff --git a/xfa/fgas/layout/cfx_breakline.h b/xfa/fgas/layout/cfx_breakline.h index 138ee3104e..8826976517 100644 --- a/xfa/fgas/layout/cfx_breakline.h +++ b/xfa/fgas/layout/cfx_breakline.h @@ -24,7 +24,7 @@ class CFX_BreakLine { int32_t CountPieces() const; const CFX_BreakPiece* GetPiece(int32_t index) const; - void GetString(CFX_WideString& wsStr) const; + void GetString(WideString& wsStr) const; int32_t GetLineEnd() const; void Clear(); diff --git a/xfa/fgas/layout/cfx_breakpiece.cpp b/xfa/fgas/layout/cfx_breakpiece.cpp index 70ac66e8ba..364c117e89 100644 --- a/xfa/fgas/layout/cfx_breakpiece.cpp +++ b/xfa/fgas/layout/cfx_breakpiece.cpp @@ -34,8 +34,8 @@ CFX_Char* CFX_BreakPiece::GetChar(int32_t index) const { return &(*m_pChars)[m_iStartChar + index]; } -CFX_WideString CFX_BreakPiece::GetString() const { - CFX_WideString ret; +WideString CFX_BreakPiece::GetString() const { + WideString ret; ret.Reserve(m_iChars); for (int32_t i = m_iStartChar; i < m_iStartChar + m_iChars; i++) ret += static_cast<wchar_t>((*m_pChars)[i].char_code()); diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h index 668245f3c0..bbf4558eb1 100644 --- a/xfa/fgas/layout/cfx_breakpiece.h +++ b/xfa/fgas/layout/cfx_breakpiece.h @@ -25,7 +25,7 @@ class CFX_BreakPiece { int32_t GetLength() const { return m_iChars; } CFX_Char* GetChar(int32_t index) const; - CFX_WideString GetString() const; + WideString GetString() const; std::vector<int32_t> GetWidths() const; CFX_BreakType m_dwStatus; diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h index 699815ab98..f5ad90838f 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.h +++ b/xfa/fgas/layout/cfx_rtfbreak.h @@ -31,7 +31,7 @@ struct FX_RTFTEXTOBJ { FX_RTFTEXTOBJ(); ~FX_RTFTEXTOBJ(); - CFX_WideString pStr; + WideString pStr; std::vector<int32_t> pWidths; CFX_RetainPtr<CFGAS_GEFont> pFont; const CFX_RectF* pRect; diff --git a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp index 8997edc083..bda52fc76a 100644 --- a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp @@ -39,7 +39,7 @@ class CFX_RTFBreakTest : public testing::Test { TEST_F(CFX_RTFBreakTest, AddChars) { auto b = CreateBreak(FX_LAYOUTSTYLE_ExpandTab); - CFX_WideString str(L"Input String."); + WideString str(L"Input String."); for (const auto& c : str) EXPECT_EQ(CFX_BreakType::None, b->AppendChar(c)); diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h index 72614bc2e7..959cd8eb48 100644 --- a/xfa/fgas/layout/cfx_txtbreak.h +++ b/xfa/fgas/layout/cfx_txtbreak.h @@ -41,7 +41,7 @@ struct FX_TXTRUN { CFDE_TextEditEngine* pEdtEngine; const FDE_TEXTEDITPIECE* pIdentity; - CFX_WideString wsStr; + WideString wsStr; int32_t* pWidths; int32_t iLength; CFX_RetainPtr<CFGAS_GEFont> pFont; diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp index 166827dcb1..1f2a978171 100644 --- a/xfa/fwl/cfwl_barcode.cpp +++ b/xfa/fwl/cfwl_barcode.cpp @@ -67,7 +67,7 @@ void CFWL_Barcode::SetType(BC_TYPE type) { m_dwStatus = XFA_BCS_NeedUpdate; } -void CFWL_Barcode::SetText(const CFX_WideString& wsText) { +void CFWL_Barcode::SetText(const WideString& wsText) { m_pBarcodeEngine.reset(); m_dwStatus = XFA_BCS_NeedUpdate; CFWL_Edit::SetText(wsText); @@ -204,7 +204,7 @@ void CFWL_Barcode::GenerateBarcodeImageCache() { if (m_dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED) m_pBarcodeEngine->SetTruncated(m_bTruncated); - m_dwStatus = m_pBarcodeEngine->Encode(GetText().AsStringC()) + m_dwStatus = m_pBarcodeEngine->Encode(GetText().AsStringView()) ? XFA_BCS_EncodeSuccess : 0; } diff --git a/xfa/fwl/cfwl_barcode.h b/xfa/fwl/cfwl_barcode.h index 48bdeabdd3..2fc79608b3 100644 --- a/xfa/fwl/cfwl_barcode.h +++ b/xfa/fwl/cfwl_barcode.h @@ -49,7 +49,7 @@ class CFWL_Barcode : public CFWL_Edit { void OnProcessEvent(CFWL_Event* pEvent) override; // CFWL_Edit - void SetText(const CFX_WideString& wsText) override; + void SetText(const WideString& wsText) override; void SetType(BC_TYPE type); bool IsProtectedType() const; diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index cbfbd9a447..143d797fbd 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -69,7 +69,7 @@ FWL_Type CFWL_ComboBox::GetClassID() const { return FWL_Type::ComboBox; } -void CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { +void CFWL_ComboBox::AddString(const WideStringView& wsText) { m_pListBox->AddString(wsText); } @@ -208,7 +208,7 @@ void CFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pEdit->SetThemeProvider(pThemeProvider); } -CFX_WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const { +WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const { CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>( m_pListBox->GetItem(m_pListBox.get(), iIndex)); return pItem ? pItem->GetText() : L""; @@ -219,7 +219,7 @@ void CFWL_ComboBox::SetCurSel(int32_t iSel) { bool bClearSel = iSel < 0 || iSel >= iCount; if (IsDropDownStyle() && m_pEdit) { if (bClearSel) { - m_pEdit->SetText(CFX_WideString()); + m_pEdit->SetText(WideString()); } else { CFWL_ListItem* hItem = m_pListBox->GetItem(this, iSel); m_pEdit->SetText(hItem ? hItem->GetText() : L""); @@ -245,7 +245,7 @@ void CFWL_ComboBox::RemoveStates(uint32_t dwStates) { CFWL_Widget::RemoveStates(dwStates); } -void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { +void CFWL_ComboBox::SetEditText(const WideString& wsText) { if (!m_pEdit) return; @@ -253,7 +253,7 @@ void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { m_pEdit->Update(); } -CFX_WideString CFWL_ComboBox::GetEditText() const { +WideString CFWL_ComboBox::GetEditText() const { if (m_pEdit) return m_pEdit->GetText(); if (!m_pListBox) @@ -348,7 +348,7 @@ void CFWL_ComboBox::ShowDropList(bool bActivate) { } void CFWL_ComboBox::MatchEditText() { - CFX_WideString wsText = m_pEdit->GetText(); + WideString wsText = m_pEdit->GetText(); int32_t iMatch = m_pListBox->MatchItem(wsText); if (iMatch != m_iCurSel) { m_pListBox->ChangeSelected(iMatch); @@ -861,7 +861,7 @@ void CFWL_ComboBox::DoSubCtrlKey(CFWL_MessageKey* pMsg) { int32_t iCurSel = m_iCurSel; bool bDropDown = IsDropDownStyle(); if (bDropDown && m_pEdit) { - CFX_WideString wsText = m_pEdit->GetText(); + WideString wsText = m_pEdit->GetText(); iCurSel = m_pListBox->MatchItem(wsText); if (iCurSel >= 0) { CFWL_ListItem* hItem = m_pListBox->GetItem(this, iCurSel); @@ -990,7 +990,7 @@ void CFWL_ComboBox::DisForm_OnKey(CFWL_MessageKey* pMsg) { bool bMatchEqual = false; int32_t iCurSel = m_iCurSel; if (m_pEdit) { - CFX_WideString wsText = m_pEdit->GetText(); + WideString wsText = m_pEdit->GetText(); iCurSel = pComboList->MatchItem(wsText); if (iCurSel >= 0) { CFWL_ListItem* item = m_pListBox->GetSelItem(iCurSel); diff --git a/xfa/fwl/cfwl_combobox.h b/xfa/fwl/cfwl_combobox.h index 7242b1f450..923e2d8b9a 100644 --- a/xfa/fwl/cfwl_combobox.h +++ b/xfa/fwl/cfwl_combobox.h @@ -59,16 +59,16 @@ class CFWL_ComboBox : public CFWL_Widget { void OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; - CFX_WideString GetTextByIndex(int32_t iIndex) const; + WideString GetTextByIndex(int32_t iIndex) const; int32_t GetCurSel() const { return m_iCurSel; } void SetCurSel(int32_t iSel); - void AddString(const CFX_WideStringC& wsText); + void AddString(const WideStringView& wsText); void RemoveAt(int32_t iIndex); void RemoveAll(); - void SetEditText(const CFX_WideString& wsText); - CFX_WideString GetEditText() const; + void SetEditText(const WideString& wsText); + WideString GetEditText() const; void OpenDropDownList(bool bActivate); @@ -83,11 +83,9 @@ class CFWL_ComboBox : public CFWL_Widget { return EditCanCopy(); } bool EditCanSelectAll() const { return m_pEdit->GetTextLength() > 0; } - bool EditCopy(CFX_WideString& wsCopy) const { return m_pEdit->Copy(wsCopy); } - bool EditCut(CFX_WideString& wsCut) { return m_pEdit->Cut(wsCut); } - bool EditPaste(const CFX_WideString& wsPaste) { - return m_pEdit->Paste(wsPaste); - } + bool EditCopy(WideString& wsCopy) const { return m_pEdit->Copy(wsCopy); } + bool EditCut(WideString& wsCut) { return m_pEdit->Cut(wsCut); } + bool EditPaste(const WideString& wsPaste) { return m_pEdit->Paste(wsPaste); } void EditSelectAll() { m_pEdit->SelectAll(); } void EditDelete() { m_pEdit->ClearText(); } void EditDeSelect() { m_pEdit->ClearSelection(); } diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp index f334f027e7..1180acf5c8 100644 --- a/xfa/fwl/cfwl_combolist.cpp +++ b/xfa/fwl/cfwl_combolist.cpp @@ -25,14 +25,14 @@ CFWL_ComboList::CFWL_ComboList( ASSERT(pOuter); } -int32_t CFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { +int32_t CFWL_ComboList::MatchItem(const WideString& wsMatch) { if (wsMatch.IsEmpty()) return -1; int32_t iCount = CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* hItem = GetItem(this, i); - CFX_WideString wsText = hItem ? hItem->GetText() : L""; + WideString wsText = hItem ? hItem->GetText() : L""; auto pos = wsText.Find(wsMatch.c_str()); if (pos.has_value() && pos.value() == 0) return i; diff --git a/xfa/fwl/cfwl_combolist.h b/xfa/fwl/cfwl_combolist.h index b7ba6b5780..a4d513559e 100644 --- a/xfa/fwl/cfwl_combolist.h +++ b/xfa/fwl/cfwl_combolist.h @@ -22,7 +22,7 @@ class CFWL_ComboList : public CFWL_ListBox { // CFWL_ListBox. void OnProcessMessage(CFWL_Message* pMessage) override; - int32_t MatchItem(const CFX_WideString& wsMatch); + int32_t MatchItem(const WideString& wsMatch); void ChangeSelected(int32_t iSel); diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index c8d7c5dc19..cd58dc7f92 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp @@ -160,7 +160,7 @@ void CFWL_DateTimePicker::SetCurSel(int32_t iYear, m_pMonthCal->SetSelect(iYear, iMonth, iDay); } -void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { +void CFWL_DateTimePicker::SetEditText(const WideString& wsText) { if (!m_pEdit) return; @@ -171,7 +171,7 @@ void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { DispatchEvent(&ev); } -CFX_WideString CFWL_DateTimePicker::GetEditText() const { +WideString CFWL_DateTimePicker::GetEditText() const { return m_pEdit ? m_pEdit->GetText() : L""; } @@ -211,7 +211,7 @@ void CFWL_DateTimePicker::DrawDropDownButton(CXFA_Graphics* pGraphics, void CFWL_DateTimePicker::FormatDateString(int32_t iYear, int32_t iMonth, int32_t iDay, - CFX_WideString& wsText) { + WideString& wsText) { if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_ShortDateFormat) == FWL_STYLEEXT_DTP_ShortDateFormat) { wsText.Format(L"%d-%d-%d", iYear, iMonth, iDay); @@ -307,7 +307,7 @@ void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear, m_iMonth = iMonth; m_iDay = iDay; - CFX_WideString wsText; + WideString wsText; FormatDateString(m_iYear, m_iMonth, m_iDay, wsText); m_pEdit->SetText(wsText); m_pEdit->Update(); diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h index ece489e276..276fea451d 100644 --- a/xfa/fwl/cfwl_datetimepicker.h +++ b/xfa/fwl/cfwl_datetimepicker.h @@ -49,8 +49,8 @@ class CFWL_DateTimePicker : public CFWL_Widget { void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - void SetEditText(const CFX_WideString& wsText); - CFX_WideString GetEditText() const; + void SetEditText(const WideString& wsText); + WideString GetEditText() const; bool HasSelection() const { return m_pEdit->HasSelection(); } // Returns <start, end> indices of the selection. @@ -75,7 +75,7 @@ class CFWL_DateTimePicker : public CFWL_Widget { void FormatDateString(int32_t iYear, int32_t iMonth, int32_t iDay, - CFX_WideString& wsText); + WideString& wsText); void ResetEditAlignment(); void InitProxyForm(); void OnFocusChanged(CFWL_Message* pMsg, bool bSet); diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index ffe324cefd..1bec1503fc 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -189,12 +189,12 @@ void CFWL_Edit::DrawSpellCheck(CXFA_Graphics* pGraphics, pGraphics->ConcatMatrix(pMatrix); CFWL_EventCheckWord checkWordEvent(this); - CFX_ByteString sLatinWord; + ByteString sLatinWord; CXFA_Path pathSpell; int32_t nStart = 0; float fOffSetX = m_rtEngine.left - m_fScrollOffsetX; float fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; - CFX_WideString wsSpell = GetText(); + WideString wsSpell = GetText(); int32_t nContentLen = wsSpell.GetLength(); for (int i = 0; i < nContentLen; i++) { if (FxEditIsLatinWord(wsSpell[i])) { @@ -270,7 +270,7 @@ void CFWL_Edit::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pProperties->m_pThemeProvider = pThemeProvider; } -void CFWL_Edit::SetText(const CFX_WideString& wsText) { +void CFWL_Edit::SetText(const WideString& wsText) { m_EdtEngine.Clear(); m_EdtEngine.Insert(0, wsText); } @@ -279,7 +279,7 @@ int32_t CFWL_Edit::GetTextLength() const { return m_EdtEngine.GetLength(); } -CFX_WideString CFWL_Edit::GetText() const { +WideString CFWL_Edit::GetText() const { return m_EdtEngine.GetText(); } @@ -322,7 +322,7 @@ void CFWL_Edit::SetAliasChar(wchar_t wAlias) { m_EdtEngine.SetAliasChar(wAlias); } -bool CFWL_Edit::Copy(CFX_WideString& wsCopy) { +bool CFWL_Edit::Copy(WideString& wsCopy) { if (!m_EdtEngine.HasSelection()) return false; @@ -330,7 +330,7 @@ bool CFWL_Edit::Copy(CFX_WideString& wsCopy) { return true; } -bool CFWL_Edit::Cut(CFX_WideString& wsCut) { +bool CFWL_Edit::Cut(WideString& wsCut) { if (!m_EdtEngine.HasSelection()) return false; @@ -338,7 +338,7 @@ bool CFWL_Edit::Cut(CFX_WideString& wsCut) { return true; } -bool CFWL_Edit::Paste(const CFX_WideString& wsPaste) { +bool CFWL_Edit::Paste(const WideString& wsPaste) { if (m_EdtEngine.HasSelection()) m_EdtEngine.ReplaceSelectedText(wsPaste); else @@ -396,7 +396,7 @@ void CFWL_Edit::OnCaretChanged() { } } -void CFWL_Edit::OnTextChanged(const CFX_WideString& prevText) { +void CFWL_Edit::OnTextChanged(const WideString& prevText) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VAlignMask) UpdateVAlignment(); @@ -412,7 +412,7 @@ void CFWL_Edit::OnSelChanged() { RepaintRect(GetClientRect()); } -bool CFWL_Edit::OnValidate(const CFX_WideString& wsText) { +bool CFWL_Edit::OnValidate(const WideString& wsText) { CFWL_Widget* pDst = GetOuter(); if (!pDst) pDst = this; @@ -1050,7 +1050,7 @@ bool CFWL_Edit::ValidateNumberChar(wchar_t cNum) { if (!m_bSetRange) return true; - CFX_WideString wsText = m_EdtEngine.GetText(); + WideString wsText = m_EdtEngine.GetText(); if (wsText.IsEmpty()) return cNum != L'0'; @@ -1060,9 +1060,9 @@ bool CFWL_Edit::ValidateNumberChar(wchar_t cNum) { return false; int32_t nLen = wsText.GetLength(); - CFX_WideString l = wsText.Left(m_CursorPosition); - CFX_WideString r = wsText.Right(nLen - m_CursorPosition); - CFX_WideString wsNew = l + cNum + r; + WideString l = wsText.Left(m_CursorPosition); + WideString r = wsText.Right(nLen - m_CursorPosition); + WideString wsNew = l + cNum + r; return wsNew.GetInteger() <= m_iMax; } @@ -1369,7 +1369,7 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) { if (pMsg->m_dwFlags & kEditingModifier) break; - m_EdtEngine.Insert(m_CursorPosition, CFX_WideString(c)); + m_EdtEngine.Insert(m_CursorPosition, WideString(c)); SetCursorPosition(m_CursorPosition + 1); break; } diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h index 310cb81578..e85baaaa38 100644 --- a/xfa/fwl/cfwl_edit.h +++ b/xfa/fwl/cfwl_edit.h @@ -65,10 +65,10 @@ class CFWL_Edit : public CFWL_Widget, public CFDE_TextEditEngine::Delegate { void OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; - virtual void SetText(const CFX_WideString& wsText); + virtual void SetText(const WideString& wsText); int32_t GetTextLength() const; - CFX_WideString GetText() const; + WideString GetText() const; void ClearText(); void SelectAll(); @@ -80,9 +80,9 @@ class CFWL_Edit : public CFWL_Widget, public CFDE_TextEditEngine::Delegate { int32_t GetLimit() const; void SetLimit(int32_t nLimit); void SetAliasChar(wchar_t wAlias); - bool Copy(CFX_WideString& wsCopy); - bool Cut(CFX_WideString& wsCut); - bool Paste(const CFX_WideString& wsPaste); + bool Copy(WideString& wsCopy); + bool Cut(WideString& wsCut); + bool Paste(const WideString& wsPaste); bool Undo(); bool Redo(); bool CanUndo(); @@ -93,9 +93,9 @@ class CFWL_Edit : public CFWL_Widget, public CFDE_TextEditEngine::Delegate { // CFDE_TextEditEngine::Delegate void NotifyTextFull() override; void OnCaretChanged() override; - void OnTextChanged(const CFX_WideString& prevText) override; + void OnTextChanged(const WideString& prevText) override; void OnSelChanged() override; - bool OnValidate(const CFX_WideString& wsText) override; + bool OnValidate(const WideString& wsText) override; void SetScrollOffset(float fScrollOffset) override; protected: @@ -171,8 +171,8 @@ class CFWL_Edit : public CFWL_Widget, public CFDE_TextEditEngine::Delegate { std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar; std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar; std::unique_ptr<CFWL_Caret> m_pCaret; - CFX_WideString m_wsCache; - CFX_WideString m_wsFont; + WideString m_wsCache; + WideString m_wsFont; }; #endif // XFA_FWL_CFWL_EDIT_H_ diff --git a/xfa/fwl/cfwl_eventcheckword.h b/xfa/fwl/cfwl_eventcheckword.h index 3de1e75c24..fafe3d3278 100644 --- a/xfa/fwl/cfwl_eventcheckword.h +++ b/xfa/fwl/cfwl_eventcheckword.h @@ -14,7 +14,7 @@ class CFWL_EventCheckWord : public CFWL_Event { explicit CFWL_EventCheckWord(CFWL_Widget* pSrcTarget); ~CFWL_EventCheckWord() override; - CFX_ByteString bsWord; + ByteString bsWord; bool bCheckWord; }; diff --git a/xfa/fwl/cfwl_eventtextchanged.h b/xfa/fwl/cfwl_eventtextchanged.h index 8ae27627b5..4494f08075 100644 --- a/xfa/fwl/cfwl_eventtextchanged.h +++ b/xfa/fwl/cfwl_eventtextchanged.h @@ -14,7 +14,7 @@ class CFWL_EventTextChanged : public CFWL_Event { explicit CFWL_EventTextChanged(CFWL_Widget* pSrcTarget); ~CFWL_EventTextChanged() override; - CFX_WideString wsPrevText; + WideString wsPrevText; }; #endif // XFA_FWL_CFWL_EVENTTEXTCHANGED_H_ diff --git a/xfa/fwl/cfwl_eventvalidate.h b/xfa/fwl/cfwl_eventvalidate.h index 512161212a..b8feff1120 100644 --- a/xfa/fwl/cfwl_eventvalidate.h +++ b/xfa/fwl/cfwl_eventvalidate.h @@ -14,7 +14,7 @@ class CFWL_EventValidate : public CFWL_Event { explicit CFWL_EventValidate(CFWL_Widget* pSrcTarget); ~CFWL_EventValidate() override; - CFX_WideString wsInsert; + WideString wsInsert; bool bValidate; }; diff --git a/xfa/fwl/cfwl_form.cpp b/xfa/fwl/cfwl_form.cpp index 5e59f274b4..4761693d3e 100644 --- a/xfa/fwl/cfwl_form.cpp +++ b/xfa/fwl/cfwl_form.cpp @@ -45,8 +45,8 @@ FWL_Type CFWL_Form::GetClassID() const { return FWL_Type::Form; } -bool CFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { - if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) +bool CFWL_Form::IsInstance(const WideStringView& wsClass) const { + if (wsClass == WideStringView(FWL_CLASS_Form)) return true; return CFWL_Widget::IsInstance(wsClass); } diff --git a/xfa/fwl/cfwl_form.h b/xfa/fwl/cfwl_form.h index 78fee4b915..014ed22798 100644 --- a/xfa/fwl/cfwl_form.h +++ b/xfa/fwl/cfwl_form.h @@ -34,7 +34,7 @@ class CFWL_Form : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - bool IsInstance(const CFX_WideStringC& wsClass) const override; + bool IsInstance(const WideStringView& wsClass) const override; CFX_RectF GetClientRect() override; void Update() override; FWL_WidgetHit HitTest(const CFX_PointF& point) override; diff --git a/xfa/fwl/cfwl_formproxy.cpp b/xfa/fwl/cfwl_formproxy.cpp index 123cf2509a..d03c1488cd 100644 --- a/xfa/fwl/cfwl_formproxy.cpp +++ b/xfa/fwl/cfwl_formproxy.cpp @@ -24,8 +24,8 @@ FWL_Type CFWL_FormProxy::GetClassID() const { return FWL_Type::FormProxy; } -bool CFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const { - if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) +bool CFWL_FormProxy::IsInstance(const WideStringView& wsClass) const { + if (wsClass == WideStringView(FWL_CLASS_FormProxy)) return true; return CFWL_Form::IsInstance(wsClass); } diff --git a/xfa/fwl/cfwl_formproxy.h b/xfa/fwl/cfwl_formproxy.h index 630719505d..498ff42a3e 100644 --- a/xfa/fwl/cfwl_formproxy.h +++ b/xfa/fwl/cfwl_formproxy.h @@ -22,7 +22,7 @@ class CFWL_FormProxy : public CFWL_Form { // CFWL_Widget FWL_Type GetClassID() const override; - bool IsInstance(const CFX_WideStringC& wsClass) const override; + bool IsInstance(const WideStringView& wsClass) const override; void Update() override; void DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index 210ec1f06e..0ddb65bc1a 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -444,7 +444,7 @@ void CFWL_ListBox::DrawItem(CXFA_Graphics* pGraphics, if (!pItem) return; - CFX_WideString wsText = pItem->GetText(); + WideString wsText = pItem->GetText(); if (wsText.GetLength() <= 0) return; @@ -907,9 +907,9 @@ int32_t CFWL_ListBox::GetItemIndex(CFWL_Widget* pWidget, CFWL_ListItem* pItem) { return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; } -CFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd) { +CFWL_ListItem* CFWL_ListBox::AddString(const WideStringView& wsAdd) { m_ItemArray.emplace_back( - pdfium::MakeUnique<CFWL_ListItem>(CFX_WideString(wsAdd))); + pdfium::MakeUnique<CFWL_ListItem>(WideString(wsAdd))); return m_ItemArray.back().get(); } diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h index 4704a8a840..4a7818c38d 100644 --- a/xfa/fwl/cfwl_listbox.h +++ b/xfa/fwl/cfwl_listbox.h @@ -53,7 +53,7 @@ class CFWL_ListBox : public CFWL_Widget { CFWL_ListItem* GetItem(const CFWL_Widget* pWidget, int32_t nIndex) const; int32_t GetItemIndex(CFWL_Widget* pWidget, CFWL_ListItem* pItem); - CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd); + CFWL_ListItem* AddString(const WideStringView& wsAdd); void RemoveAt(int32_t iIndex); void DeleteString(CFWL_ListItem* pItem); void DeleteAll(); diff --git a/xfa/fwl/cfwl_listitem.cpp b/xfa/fwl/cfwl_listitem.cpp index a8ea8a6452..f8a7b753aa 100644 --- a/xfa/fwl/cfwl_listitem.cpp +++ b/xfa/fwl/cfwl_listitem.cpp @@ -6,7 +6,7 @@ #include "xfa/fwl/cfwl_listitem.h" -CFWL_ListItem::CFWL_ListItem(const CFX_WideString& text) +CFWL_ListItem::CFWL_ListItem(const WideString& text) : m_dwStates(0), m_wsText(text) { m_rtItem.Reset(); } diff --git a/xfa/fwl/cfwl_listitem.h b/xfa/fwl/cfwl_listitem.h index aac67fcb51..62c3a98bd7 100644 --- a/xfa/fwl/cfwl_listitem.h +++ b/xfa/fwl/cfwl_listitem.h @@ -12,7 +12,7 @@ class CFWL_ListItem { public: - explicit CFWL_ListItem(const CFX_WideString& text); + explicit CFWL_ListItem(const WideString& text); ~CFWL_ListItem(); CFX_RectF GetRect() const { return m_rtItem; } @@ -21,12 +21,12 @@ class CFWL_ListItem { uint32_t GetStates() const { return m_dwStates; } void SetStates(uint32_t dwStates) { m_dwStates = dwStates; } - CFX_WideString GetText() const { return m_wsText; } + WideString GetText() const { return m_wsText; } private: CFX_RectF m_rtItem; uint32_t m_dwStates; - CFX_WideString m_wsText; + WideString m_wsText; }; #endif // XFA_FWL_CFWL_LISTITEM_H_ diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 11712fefa4..82cef65c3c 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -32,9 +32,9 @@ namespace { -CFX_WideString GetCapacityForDay(IFWL_ThemeProvider* pTheme, - CFWL_ThemePart& params, - uint32_t day) { +WideString GetCapacityForDay(IFWL_ThemeProvider* pTheme, + CFWL_ThemePart& params, + uint32_t day) { ASSERT(day < 7); if (day == 0) @@ -52,9 +52,9 @@ CFX_WideString GetCapacityForDay(IFWL_ThemeProvider* pTheme, return L"Sat"; } -CFX_WideString GetCapacityForMonth(IFWL_ThemeProvider* pTheme, - CFWL_ThemePart& params, - uint32_t month) { +WideString GetCapacityForMonth(IFWL_ThemeProvider* pTheme, + CFWL_ThemePart& params, + uint32_t month) { ASSERT(month < 12); if (month == 0) @@ -430,7 +430,7 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { float fDayMaxW = 0.0f; float fDayMaxH = 0.0f; for (int day = 10; day <= 31; day++) { - CFX_WideString wsDay; + WideString wsDay; wsDay.Format(L"%d", day); CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider, false); fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width; @@ -462,7 +462,7 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { m_szHead.width + MONTHCAL_HEADER_BTN_HMARGIN * 2 + m_szCell.width * 2; fs.width = std::max(fs.width, fMonthMaxW); - CFX_WideString wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay); + WideString wsToday = GetTodayText(m_iYear, m_iMonth, m_iDay); m_wsToday = L"Today" + wsToday; m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider, false); m_szToday.height = (m_szToday.height >= m_szCell.height) ? m_szToday.height @@ -579,7 +579,7 @@ void CFWL_MonthCalendar::ResetDateItem() { if (iDayOfWeek >= 7) iDayOfWeek = 0; - CFX_WideString wsDay; + WideString wsDay; wsDay.Format(L"%d", i + 1); uint32_t dwStates = 0; if (m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == (i + 1)) @@ -674,21 +674,21 @@ void CFWL_MonthCalendar::JumpToToday() { AddSelDay(m_iDay); } -CFX_WideString CFWL_MonthCalendar::GetHeadText(int32_t iYear, int32_t iMonth) { +WideString CFWL_MonthCalendar::GetHeadText(int32_t iYear, int32_t iMonth) { ASSERT(iMonth > 0 && iMonth < 13); static const wchar_t* const pMonth[] = {L"January", L"February", L"March", L"April", L"May", L"June", L"July", L"August", L"September", L"October", L"November", L"December"}; - CFX_WideString wsHead; + WideString wsHead; wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear); return wsHead; } -CFX_WideString CFWL_MonthCalendar::GetTodayText(int32_t iYear, - int32_t iMonth, - int32_t iDay) { - CFX_WideString wsToday; +WideString CFWL_MonthCalendar::GetTodayText(int32_t iYear, + int32_t iMonth, + int32_t iDay) { + WideString wsToday; wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear); return wsToday; } @@ -893,7 +893,7 @@ CFWL_MonthCalendar::DATEINFO::DATEINFO(int32_t day, int32_t dayofweek, uint32_t dwSt, CFX_RectF rc, - CFX_WideString& wsday) + WideString& wsday) : iDay(day), iDayOfWeek(dayofweek), dwStates(dwSt), diff --git a/xfa/fwl/cfwl_monthcalendar.h b/xfa/fwl/cfwl_monthcalendar.h index 6e0d4711f1..50e6843507 100644 --- a/xfa/fwl/cfwl_monthcalendar.h +++ b/xfa/fwl/cfwl_monthcalendar.h @@ -80,14 +80,14 @@ class CFWL_MonthCalendar : public CFWL_Widget { int32_t dayofweek, uint32_t dwSt, CFX_RectF rc, - CFX_WideString& wsday); + WideString& wsday); ~DATEINFO(); int32_t iDay; int32_t iDayOfWeek; uint32_t dwStates; CFX_RectF rect; - CFX_WideString wsDay; + WideString wsDay; }; void DrawBackground(CXFA_Graphics* pGraphics, @@ -141,8 +141,8 @@ class CFWL_MonthCalendar : public CFWL_Widget { void RemoveSelDay(); void AddSelDay(int32_t iDay); void JumpToToday(); - CFX_WideString GetHeadText(int32_t iYear, int32_t iMonth); - CFX_WideString GetTodayText(int32_t iYear, int32_t iMonth, int32_t iDay); + WideString GetHeadText(int32_t iYear, int32_t iMonth); + WideString GetTodayText(int32_t iYear, int32_t iMonth, int32_t iDay); int32_t GetDayAtPoint(const CFX_PointF& point) const; CFX_RectF GetDayRect(int32_t iDay); void OnLButtonDown(CFWL_MessageMouse* pMsg); @@ -163,8 +163,8 @@ class CFWL_MonthCalendar : public CFWL_Widget { CFX_RectF m_rtTodayFlag; CFX_RectF m_rtWeekNum; CFX_RectF m_rtWeekNumSep; - CFX_WideString m_wsHead; - CFX_WideString m_wsToday; + WideString m_wsHead; + WideString m_wsToday; std::vector<std::unique_ptr<DATEINFO>> m_arrDates; int32_t m_iCurYear; int32_t m_iCurMonth; diff --git a/xfa/fwl/cfwl_themetext.h b/xfa/fwl/cfwl_themetext.h index 2a42615d6f..91a3f385df 100644 --- a/xfa/fwl/cfwl_themetext.h +++ b/xfa/fwl/cfwl_themetext.h @@ -15,7 +15,7 @@ class CFWL_ThemeText : public CFWL_ThemePart { public: CFWL_ThemeText() : m_pGraphics(nullptr) {} - CFX_WideString m_wsText; + WideString m_wsText; FDE_TextStyle m_dwTTOStyles; FDE_TextAlignment m_iTTOAlign; CXFA_Graphics* m_pGraphics; diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index 9071f0fb0e..b9b04cf1f4 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -63,7 +63,7 @@ CFWL_Widget::~CFWL_Widget() { m_pWidgetMgr->RemoveWidget(this); } -bool CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { +bool CFWL_Widget::IsInstance(const WideStringView& wsClass) const { return false; } @@ -315,7 +315,7 @@ CFWL_Widget* CFWL_Widget::GetRootOuter() { return pRet; } -CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, +CFX_SizeF CFWL_Widget::CalcTextSize(const WideString& wsText, IFWL_ThemeProvider* pTheme, bool bMultiLine) { if (!pTheme) @@ -336,7 +336,7 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, return CFX_SizeF(rect.width, rect.height); } -void CFWL_Widget::CalcTextRect(const CFX_WideString& wsText, +void CFWL_Widget::CalcTextRect(const WideString& wsText, IFWL_ThemeProvider* pTheme, const FDE_TextStyle& dwTTOStyles, FDE_TextAlignment iTTOAlign, diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h index 1c5f84d62e..16a818e708 100644 --- a/xfa/fwl/cfwl_widget.h +++ b/xfa/fwl/cfwl_widget.h @@ -53,7 +53,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate { ~CFWL_Widget() override; virtual FWL_Type GetClassID() const = 0; - virtual bool IsInstance(const CFX_WideStringC& wsClass) const; + virtual bool IsInstance(const WideStringView& wsClass) const; virtual CFX_RectF GetAutosizedWidgetRect(); virtual CFX_RectF GetWidgetRect(); virtual CFX_RectF GetClientRect(); @@ -127,10 +127,10 @@ class CFWL_Widget : public IFWL_WidgetDelegate { float GetBorderSize(bool bCX); CFX_RectF GetRelativeRect(); IFWL_ThemeProvider* GetAvailableTheme(); - CFX_SizeF CalcTextSize(const CFX_WideString& wsText, + CFX_SizeF CalcTextSize(const WideString& wsText, IFWL_ThemeProvider* pTheme, bool bMultiLine); - void CalcTextRect(const CFX_WideString& wsText, + void CalcTextRect(const WideString& wsText, IFWL_ThemeProvider* pTheme, const FDE_TextStyle& dwTTOStyles, FDE_TextAlignment iTTOAlign, diff --git a/xfa/fwl/cfx_barcode.cpp b/xfa/fwl/cfx_barcode.cpp index 8b51f2d741..9d667c67b9 100644 --- a/xfa/fwl/cfx_barcode.cpp +++ b/xfa/fwl/cfx_barcode.cpp @@ -294,7 +294,7 @@ bool CFX_Barcode::SetTruncated(bool truncated) { : false; } -bool CFX_Barcode::Encode(const CFX_WideStringC& contents) { +bool CFX_Barcode::Encode(const WideStringView& contents) { return m_pBCEngine && m_pBCEngine->Encode(contents); } diff --git a/xfa/fwl/cfx_barcode.h b/xfa/fwl/cfx_barcode.h index 32a6db57cc..eec4648e82 100644 --- a/xfa/fwl/cfx_barcode.h +++ b/xfa/fwl/cfx_barcode.h @@ -27,7 +27,7 @@ class CFX_Barcode { bool Create(BC_TYPE type); BC_TYPE GetType(); - bool Encode(const CFX_WideStringC& contents); + bool Encode(const WideStringView& contents); bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix); diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h index 57438a0551..6a1b9be360 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.h +++ b/xfa/fwl/theme/cfwl_monthcalendartp.h @@ -45,7 +45,7 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { FWLTHEME_STATE GetState(uint32_t dwFWLStates); std::unique_ptr<MCThemeData> m_pThemeData; - CFX_WideString wsResource; + WideString wsResource; private: void SetThemeData(); diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 4d6503f845..1eade9c70b 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -53,7 +53,7 @@ void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { pMatrix->Concat(*pGraphics->GetMatrix()); m_pTextOut->SetMatrix(*pMatrix); m_pTextOut->DrawLogicText(pGraphics->GetRenderDevice(), - CFX_WideStringC(pParams->m_wsText.c_str(), iLen), + WideStringView(pParams->m_wsText.c_str(), iLen), pParams->m_rtPart); } @@ -260,14 +260,14 @@ CFWL_FontData::CFWL_FontData() : m_dwStyles(0), m_dwCodePage(0) {} CFWL_FontData::~CFWL_FontData() {} -bool CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, +bool CFWL_FontData::Equal(const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && m_dwCodePage == wCodePage; } -bool CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, +bool CFWL_FontData::LoadFont(const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t dwCodePage) { m_wsFamily = wsFontFamily; @@ -304,7 +304,7 @@ CFWL_FontManager::CFWL_FontManager() {} CFWL_FontManager::~CFWL_FontManager() {} CFX_RetainPtr<CFGAS_GEFont> CFWL_FontManager::FindFont( - const CFX_WideStringC& wsFontFamily, + const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { for (const auto& pData : m_FontsArray) { diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index 229b9ea7c3..dd36778704 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -106,16 +106,16 @@ class CFWL_FontData { CFWL_FontData(); virtual ~CFWL_FontData(); - bool Equal(const CFX_WideStringC& wsFontFamily, + bool Equal(const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); - bool LoadFont(const CFX_WideStringC& wsFontFamily, + bool LoadFont(const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); CFX_RetainPtr<CFGAS_GEFont> GetFont() const { return m_pFont; } protected: - CFX_WideString m_wsFamily; + WideString m_wsFamily; uint32_t m_dwStyles; uint32_t m_dwCodePage; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ @@ -130,7 +130,7 @@ class CFWL_FontManager { static CFWL_FontManager* GetInstance(); static void DestroyInstance(); - CFX_RetainPtr<CFGAS_GEFont> FindFont(const CFX_WideStringC& wsFontFamily, + CFX_RetainPtr<CFGAS_GEFont> FindFont(const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t dwCodePage); diff --git a/xfa/fxfa/cxfa_deffontmgr.cpp b/xfa/fxfa/cxfa_deffontmgr.cpp index db730677b5..7dd5de90b1 100644 --- a/xfa/fxfa/cxfa_deffontmgr.cpp +++ b/xfa/fxfa/cxfa_deffontmgr.cpp @@ -16,16 +16,16 @@ CXFA_DefFontMgr::~CXFA_DefFontMgr() {} CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont( CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, + const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - CFX_WideString wsFontName(wsFontFamily); + WideString wsFontName(wsFontFamily); CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); CFX_RetainPtr<CFGAS_GEFont> pFont = pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); if (!pFont) { const XFA_FONTINFO* pCurFont = - XFA_GetFontINFOByFontName(wsFontName.AsStringC()); + XFA_GetFontINFOByFontName(wsFontName.AsStringView()); if (pCurFont && pCurFont->pReplaceFont) { uint32_t dwStyle = 0; if (dwFontStyles & FX_FONTSTYLE_Bold) { @@ -42,8 +42,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont( pNameText++; iLength--; } - CFX_WideString wsReplace = - CFX_WideString(pReplace, pNameText - pReplace); + WideString wsReplace = WideString(pReplace, pNameText - pReplace); pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage); if (pFont) break; @@ -61,7 +60,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetFont( CFX_RetainPtr<CFGAS_GEFont> CXFA_DefFontMgr::GetDefaultFont( CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, + const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); diff --git a/xfa/fxfa/cxfa_deffontmgr.h b/xfa/fxfa/cxfa_deffontmgr.h index 5f50ffb08d..3a5ea75460 100644 --- a/xfa/fxfa/cxfa_deffontmgr.h +++ b/xfa/fxfa/cxfa_deffontmgr.h @@ -21,14 +21,13 @@ class CXFA_DefFontMgr { ~CXFA_DefFontMgr(); CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, + const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF); - CFX_RetainPtr<CFGAS_GEFont> GetDefaultFont( - CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); + CFX_RetainPtr<CFGAS_GEFont> GetDefaultFont(CXFA_FFDoc* hDoc, + const WideStringView& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); private: std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_CacheFonts; diff --git a/xfa/fxfa/cxfa_eventparam.h b/xfa/fxfa/cxfa_eventparam.h index 1e7c12a34a..eafd76c6af 100644 --- a/xfa/fxfa/cxfa_eventparam.h +++ b/xfa/fxfa/cxfa_eventparam.h @@ -55,7 +55,7 @@ class CXFA_EventParam { CXFA_WidgetAcc* m_pTarget; XFA_EVENTTYPE m_eType; - CFX_WideString m_wsResult; + WideString m_wsResult; bool m_bCancelAction; int32_t m_iCommitKey; bool m_bKeyDown; @@ -64,14 +64,14 @@ class CXFA_EventParam { int32_t m_iSelEnd; int32_t m_iSelStart; bool m_bShift; - CFX_WideString m_wsChange; - CFX_WideString m_wsFullText; - CFX_WideString m_wsNewContentType; - CFX_WideString m_wsNewText; - CFX_WideString m_wsPrevContentType; - CFX_WideString m_wsPrevText; - CFX_WideString m_wsSoapFaultCode; - CFX_WideString m_wsSoapFaultString; + WideString m_wsChange; + WideString m_wsFullText; + WideString m_wsNewContentType; + WideString m_wsNewText; + WideString m_wsPrevContentType; + WideString m_wsPrevText; + WideString m_wsSoapFaultCode; + WideString m_wsSoapFaultString; bool m_bIsFormReady; }; diff --git a/xfa/fxfa/cxfa_ffbarcode.cpp b/xfa/fxfa/cxfa_ffbarcode.cpp index 03a7c7d915..9686416f89 100644 --- a/xfa/fxfa/cxfa_ffbarcode.cpp +++ b/xfa/fxfa/cxfa_ffbarcode.cpp @@ -95,7 +95,7 @@ const BarCodeInfo g_BarCodeData[] = { // static const BarCodeInfo* CXFA_FFBarcode::GetBarcodeTypeByName( - const CFX_WideStringC& wsName) { + const WideStringView& wsName) { if (wsName.IsEmpty()) return nullptr; @@ -129,7 +129,7 @@ bool CXFA_FFBarcode::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pFWLBarcode->SetText(wsText); UpdateWidgetProperty(); @@ -161,8 +161,8 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { CXFA_FFTextEdit::UpdateWidgetProperty(); auto* pBarCodeWidget = static_cast<CFWL_Barcode*>(m_pNormalWidget.get()); - CFX_WideString wsType = GetDataAcc()->GetBarcodeType(); - const BarCodeInfo* pBarcodeInfo = GetBarcodeTypeByName(wsType.AsStringC()); + WideString wsType = GetDataAcc()->GetBarcodeType(); + const BarCodeInfo* pBarcodeInfo = GetBarcodeTypeByName(wsType.AsStringView()); if (!pBarcodeInfo) return; diff --git a/xfa/fxfa/cxfa_ffbarcode.h b/xfa/fxfa/cxfa_ffbarcode.h index 13e5032594..f03246d18e 100644 --- a/xfa/fxfa/cxfa_ffbarcode.h +++ b/xfa/fxfa/cxfa_ffbarcode.h @@ -85,7 +85,7 @@ struct BarCodeInfo { class CXFA_FFBarcode : public CXFA_FFTextEdit { public: - static const BarCodeInfo* GetBarcodeTypeByName(const CFX_WideStringC& wsName); + static const BarCodeInfo* GetBarcodeTypeByName(const WideStringView& wsName); explicit CXFA_FFBarcode(CXFA_WidgetAcc* pDataAcc); ~CXFA_FFBarcode() override; diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index 950cab5daf..ca5645f8e2 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -52,13 +52,13 @@ bool CXFA_FFComboBox::LoadWidget() { m_pNormalWidget->LockUpdate(); for (const auto& label : m_pDataAcc->GetChoiceListItems(false)) - pComboBox->AddString(label.AsStringC()); + pComboBox->AddString(label.AsStringView()); std::vector<int32_t> iSelArray = m_pDataAcc->GetSelectedItems(); if (!iSelArray.empty()) { pComboBox->SetCurSel(iSelArray.front()); } else { - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); pComboBox->SetEditText(wsText); } @@ -120,15 +120,15 @@ bool CXFA_FFComboBox::CommitData() { bool CXFA_FFComboBox::IsDataChanged() { auto* pFWLcombobox = ToComboBox(m_pNormalWidget.get()); - CFX_WideString wsText = pFWLcombobox->GetEditText(); + WideString wsText = pFWLcombobox->GetEditText(); int32_t iCursel = pFWLcombobox->GetCurSel(); if (iCursel >= 0) { - CFX_WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel); + WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel); if (wsSel == wsText) m_pDataAcc->GetChoiceListItem(wsText, iCursel, true); } - CFX_WideString wsOldValue; + WideString wsOldValue; m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Raw); if (wsOldValue == wsText) return false; @@ -193,7 +193,7 @@ bool CXFA_FFComboBox::UpdateFWLData() { if (!iSelArray.empty()) { pComboBox->SetCurSel(iSelArray.front()); } else { - CFX_WideString wsText; + WideString wsText; pComboBox->SetCurSel(-1); m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); pComboBox->SetEditText(wsText); @@ -241,16 +241,16 @@ bool CXFA_FFComboBox::CanSelectAll() { return ToComboBox(m_pNormalWidget.get())->EditCanSelectAll(); } -bool CXFA_FFComboBox::Copy(CFX_WideString& wsCopy) { +bool CXFA_FFComboBox::Copy(WideString& wsCopy) { return ToComboBox(m_pNormalWidget.get())->EditCopy(wsCopy); } -bool CXFA_FFComboBox::Cut(CFX_WideString& wsCut) { +bool CXFA_FFComboBox::Cut(WideString& wsCut) { return m_pDataAcc->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditCut(wsCut); } -bool CXFA_FFComboBox::Paste(const CFX_WideString& wsPaste) { +bool CXFA_FFComboBox::Paste(const WideString& wsPaste) { return m_pDataAcc->IsChoiceListAllowTextEntry() && ToComboBox(m_pNormalWidget.get())->EditPaste(wsPaste); } @@ -273,7 +273,7 @@ void CXFA_FFComboBox::SetItemState(int32_t nIndex, bool bSelected) { AddInvalidateRect(); } -void CXFA_FFComboBox::InsertItem(const CFX_WideStringC& wsLabel, +void CXFA_FFComboBox::InsertItem(const WideStringView& wsLabel, int32_t nIndex) { ToComboBox(m_pNormalWidget.get())->AddString(wsLabel); m_pNormalWidget->Update(); @@ -291,7 +291,7 @@ void CXFA_FFComboBox::DeleteItem(int32_t nIndex) { } void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget, - const CFX_WideString& wsChanged) { + const WideString& wsChanged) { CXFA_EventParam eParam; m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); eParam.m_wsChange = wsChanged; @@ -335,7 +335,7 @@ void CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) { break; } case CFWL_Event::Type::EditChanged: { - CFX_WideString wsChanged; + WideString wsChanged; OnTextChanged(m_pNormalWidget.get(), wsChanged); break; } diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h index 33e7d7cc1f..81da2c2125 100644 --- a/xfa/fxfa/cxfa_ffcombobox.h +++ b/xfa/fxfa/cxfa_ffcombobox.h @@ -29,9 +29,9 @@ class CXFA_FFComboBox : public CXFA_FFField { bool CanCut() override; bool CanPaste() override; bool CanSelectAll() override; - bool Copy(CFX_WideString& wsCopy) override; - bool Cut(CFX_WideString& wsCut) override; - bool Paste(const CFX_WideString& wsPaste) override; + bool Copy(WideString& wsCopy) override; + bool Cut(WideString& wsCut) override; + bool Paste(const WideString& wsPaste) override; void SelectAll() override; void Delete() override; void DeSelect() override; @@ -44,12 +44,12 @@ class CXFA_FFComboBox : public CXFA_FFField { virtual void OpenDropDownList(); - void OnTextChanged(CFWL_Widget* pWidget, const CFX_WideString& wsChanged); + void OnTextChanged(CFWL_Widget* pWidget, const WideString& wsChanged); void OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp); void OnPreOpen(CFWL_Widget* pWidget); void OnPostOpen(CFWL_Widget* pWidget); void SetItemState(int32_t nIndex, bool bSelected); - void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex); + void InsertItem(const WideStringView& wsLabel, int32_t nIndex); void DeleteItem(int32_t nIndex); private: @@ -62,7 +62,7 @@ class CXFA_FFComboBox : public CXFA_FFField { uint32_t GetAlignment(); void FWLEventSelChange(CXFA_EventParam* pParam); - CFX_WideString m_wsNewValue; + WideString m_wsNewValue; IFWL_WidgetDelegate* m_pOldDelegate; }; diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index cfef664039..643d384efd 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -45,7 +45,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pWidget->SetEditText(wsText); if (CXFA_Value value = m_pDataAcc->GetFormValue()) { @@ -148,7 +148,7 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() { if (IsFocused()) eType = XFA_VALUEPICTURE_Edit; - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, eType); auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get()); @@ -169,9 +169,9 @@ bool CXFA_FFDateTimeEdit::IsDataChanged() { if (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged) return true; - CFX_WideString wsText = + WideString wsText = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get())->GetEditText(); - CFX_WideString wsOldValue; + WideString wsOldValue; m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Edit); return wsOldValue != wsText; } @@ -180,13 +180,13 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, int32_t iYear, int32_t iMonth, int32_t iDay) { - CFX_WideString wsPicture; + WideString wsPicture; m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit); CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr()); date.SetDate(CFX_DateTime(iYear, iMonth, iDay, 0, 0, 0, 0)); - CFX_WideString wsDate; + WideString wsDate; date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), XFA_VALUEPICTURE_Edit); diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 4d998e16d9..b3ff3c9930 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -181,7 +181,7 @@ bool XFA_GetPDFContentsFromPDFXML(CFX_XMLNode* pPDFElement, pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { if (pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); - CFX_WideString wsTagName = pXMLElement->GetName(); + WideString wsTagName = pXMLElement->GetName(); if (wsTagName == L"document") { pDocumentElement = pXMLElement; break; @@ -197,7 +197,7 @@ bool XFA_GetPDFContentsFromPDFXML(CFX_XMLNode* pPDFElement, pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { if (pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); - CFX_WideString wsTagName = pXMLElement->GetName(); + WideString wsTagName = pXMLElement->GetName(); if (wsTagName == L"chunk") { pChunkElement = pXMLElement; break; @@ -207,7 +207,7 @@ bool XFA_GetPDFContentsFromPDFXML(CFX_XMLNode* pPDFElement, if (!pChunkElement) { return false; } - CFX_WideString wsPDFContent = pChunkElement->GetTextData(); + WideString wsPDFContent = pChunkElement->GetTextData(); iBufferSize = Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), nullptr); pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1); @@ -261,7 +261,7 @@ void CXFA_FFDoc::StopLoad() { if (!pDynamicRender) return; - CFX_WideString wsType; + WideString wsType; if (pDynamicRender->TryContent(wsType) && wsType == L"required") m_dwDocType = XFA_DocType::Dynamic; } @@ -333,7 +333,7 @@ void CXFA_FFDoc::CloseDoc() { } CFX_RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage( - const CFX_WideStringC& wsName, + const WideStringView& wsName, int32_t& iImageXDpi, int32_t& iImageYDpi) { if (!m_pPDFDoc) @@ -360,10 +360,10 @@ CFX_RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage( return nullptr; CPDF_NameTree nametree(pXFAImages); - CPDF_Object* pObject = nametree.LookupValue(CFX_WideString(wsName)); + CPDF_Object* pObject = nametree.LookupValue(WideString(wsName)); if (!pObject) { for (size_t i = 0; i < nametree.GetCount(); i++) { - CFX_WideString wsTemp; + WideString wsTemp; CPDF_Object* pTempObject = nametree.LookupValueAndName(i, &wsTemp); if (wsTemp == wsName) { pObject = pTempObject; @@ -399,7 +399,7 @@ bool CXFA_FFDoc::SavePackage(XFA_HashCode code, if (!pNode) return !!pExport->Export(pFile); - CFX_ByteString bsChecksum; + ByteString bsChecksum; if (pCSContext) bsChecksum = pCSContext->GetChecksum(); diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h index 984d8b6507..7984d7425b 100644 --- a/xfa/fxfa/cxfa_ffdoc.h +++ b/xfa/fxfa/cxfa_ffdoc.h @@ -69,7 +69,7 @@ class CXFA_FFDoc { CPDF_Document* GetPDFDoc() const { return m_pPDFDoc.Get(); } CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout); CXFA_FFDocView* GetDocView(); - CFX_RetainPtr<CFX_DIBitmap> GetPDFNamedImage(const CFX_WideStringC& wsName, + CFX_RetainPtr<CFX_DIBitmap> GetPDFNamedImage(const WideStringView& wsName, int32_t& iImageXDpi, int32_t& iImageYDpi); diff --git a/xfa/fxfa/cxfa_ffdochandler.cpp b/xfa/fxfa/cxfa_ffdochandler.cpp index b0a84fa29a..8dbc55050a 100644 --- a/xfa/fxfa/cxfa_ffdochandler.cpp +++ b/xfa/fxfa/cxfa_ffdochandler.cpp @@ -44,7 +44,7 @@ XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) { bool CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, XFA_SCRIPTTYPE eScriptType, - const CFX_WideStringC& wsScript, + const WideStringView& wsScript, CFXJSE_Value* pRetValue, CFXJSE_Value* pThisValue) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); diff --git a/xfa/fxfa/cxfa_ffdochandler.h b/xfa/fxfa/cxfa_ffdochandler.h index 45b2ee07e1..7da03b0148 100644 --- a/xfa/fxfa/cxfa_ffdochandler.h +++ b/xfa/fxfa/cxfa_ffdochandler.h @@ -21,7 +21,7 @@ class CXFA_FFDocHandler { bool RunDocScript(CXFA_FFDoc* hDoc, XFA_SCRIPTTYPE eScriptType, - const CFX_WideStringC& wsScript, + const WideStringView& wsScript, CFXJSE_Value* pRetValue, CFXJSE_Value* pThisObject); }; diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 95faeb3606..56dfeed3ca 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -154,12 +154,12 @@ void CXFA_FFDocView::ShowNullTestMsg() { if (pAppProvider && iCount) { int32_t iRemain = iCount > 7 ? iCount - 7 : 0; iCount -= iRemain; - CFX_WideString wsMsg; + WideString wsMsg; for (int32_t i = 0; i < iCount; i++) { wsMsg += m_arrNullTestMsg[i] + L"\n"; } if (iRemain > 0) { - CFX_WideString wsTemp; + WideString wsTemp; wsTemp.Format( L"Message limit exceeded. Remaining %d " L"validation errors not reported.", @@ -259,7 +259,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, return XFA_EVENTERROR_Error; if (pParam->m_eType == XFA_EVENT_Validate) { - CFX_WideString wsValidateStr(L"preSubmit"); + WideString wsValidateStr(L"preSubmit"); CXFA_Node* pConfigItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config)); if (pConfigItem) { @@ -478,7 +478,7 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, return iRet; } -CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName, +CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const WideString& wsName, CXFA_FFWidget* pRefWidget) { CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr; CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc); @@ -486,9 +486,9 @@ CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName, } CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( - const CFX_WideString& wsName, + const WideString& wsName, CXFA_WidgetAcc* pRefWidgetAcc) { - CFX_WideString wsExpression; + WideString wsExpression; uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); @@ -504,7 +504,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( } XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( - refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle); + refNode, wsExpression.AsStringView(), resoveNodeRS, dwStyle); if (iRet < 1) return nullptr; @@ -735,7 +735,7 @@ void CXFA_FFDocView::RunBindItems() { CXFA_BindItems binditems(item); CXFA_ScriptContext* pScriptContext = pWidgetNode->GetDocument()->GetScriptContext(); - CFX_WideStringC wsRef; + WideStringView wsRef; binditems.GetRef(wsRef); uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | @@ -746,14 +746,14 @@ void CXFA_FFDocView::RunBindItems() { if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || rs.objects.empty()) continue; - CFX_WideStringC wsValueRef, wsLabelRef; + WideStringView wsValueRef, wsLabelRef; binditems.GetValueRef(wsValueRef); binditems.GetLabelRef(wsLabelRef); const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == L"$"; const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$"; - CFX_WideString wsValue; - CFX_WideString wsLabel; + WideString wsValue; + WideString wsLabel; uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false); for (CXFA_Object* refObject : rs.objects) { CXFA_Node* refNode = refObject->AsNode(); diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h index 314ce29393..981491c60a 100644 --- a/xfa/fxfa/cxfa_ffdocview.h +++ b/xfa/fxfa/cxfa_ffdocview.h @@ -60,9 +60,9 @@ class CXFA_FFDocView { CXFA_FFWidget* GetFocusWidget() const; void KillFocus(); bool SetFocus(CXFA_FFWidget* hWidget); - CXFA_FFWidget* GetWidgetByName(const CFX_WideString& wsName, + CXFA_FFWidget* GetWidgetByName(const WideString& wsName, CXFA_FFWidget* pRefWidget); - CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideString& wsName, + CXFA_WidgetAcc* GetWidgetAccByName(const WideString& wsName, CXFA_WidgetAcc* pRefWidgetAcc); CXFA_LayoutProcessor* GetXFALayout() const; void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent); @@ -100,7 +100,7 @@ class CXFA_FFDocView { bool bRecursive, CXFA_Node* pExclude); bool m_bLayoutEvent; - std::vector<CFX_WideString> m_arrNullTestMsg; + std::vector<WideString> m_arrNullTestMsg; CXFA_FFWidget* m_pListFocusWidget; bool m_bInLayoutStatus; diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index bfc9e4edbc..c35cfe18fe 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -687,7 +687,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { if (!script) return 1; - CFX_WideString wsExpression; + WideString wsExpression; script.GetExpression(wsExpression); if (wsExpression.IsEmpty()) return 1; @@ -700,7 +700,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { if (!pAppProvider) return 0; - CFX_WideString wsMessage; + WideString wsMessage; calc.GetMessageText(wsMessage); if (!wsMessage.IsEmpty()) wsMessage += L"\r\n"; diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp index 66e1fdb4d0..1fb66706d7 100644 --- a/xfa/fxfa/cxfa_fflistbox.cpp +++ b/xfa/fxfa/cxfa_fflistbox.cpp @@ -53,7 +53,7 @@ bool CXFA_FFListBox::LoadWidget() { m_pNormalWidget->LockUpdate(); for (const auto& label : m_pDataAcc->GetChoiceListItems(false)) - pListBox->AddString(label.AsStringC()); + pListBox->AddString(label.AsStringView()); uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) @@ -169,10 +169,9 @@ void CXFA_FFListBox::SetItemState(int32_t nIndex, bool bSelected) { AddInvalidateRect(); } -void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, - int32_t nIndex) { - CFX_WideString wsTemp(wsLabel); - ToListBox(m_pNormalWidget.get())->AddString(wsTemp.AsStringC()); +void CXFA_FFListBox::InsertItem(const WideStringView& wsLabel, int32_t nIndex) { + WideString wsTemp(wsLabel); + ToListBox(m_pNormalWidget.get())->AddString(wsTemp.AsStringView()); m_pNormalWidget->Update(); AddInvalidateRect(); } diff --git a/xfa/fxfa/cxfa_fflistbox.h b/xfa/fxfa/cxfa_fflistbox.h index bf97d931d8..f31b122bd1 100644 --- a/xfa/fxfa/cxfa_fflistbox.h +++ b/xfa/fxfa/cxfa_fflistbox.h @@ -24,7 +24,7 @@ class CXFA_FFListBox : public CXFA_FFField { void OnSelectChanged(CFWL_Widget* pWidget); void SetItemState(int32_t nIndex, bool bSelected); - void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex); + void InsertItem(const WideStringView& wsLabel, int32_t nIndex); void DeleteItem(int32_t nIndex); private: diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp index 9c2ac91e80..9aac64ab6d 100644 --- a/xfa/fxfa/cxfa_ffnotify.cpp +++ b/xfa/fxfa/cxfa_ffnotify.cpp @@ -287,11 +287,11 @@ void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) { pDocView->UpdateDocView(); } -CFX_WideString CXFA_FFNotify::GetCurrentDateTime() { +WideString CXFA_FFNotify::GetCurrentDateTime() { CFX_DateTime dataTime; dataTime.Now(); - CFX_WideString wsDateTime; + WideString wsDateTime; wsDateTime.Format(L"%d%02d%02dT%02d%02d%02d", dataTime.GetYear(), dataTime.GetMonth(), dataTime.GetDay(), dataTime.GetHour(), dataTime.GetMinute(), dataTime.GetSecond()); diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h index 12aca5ede3..01adc33c1c 100644 --- a/xfa/fxfa/cxfa_ffnotify.h +++ b/xfa/fxfa/cxfa_ffnotify.h @@ -62,7 +62,7 @@ class CXFA_FFNotify { CXFA_FFWidgetHandler* GetWidgetHandler(); CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem); void OpenDropDownList(CXFA_FFWidget* hWidget); - CFX_WideString GetCurrentDateTime(); + WideString GetCurrentDateTime(); void ResetData(CXFA_WidgetData* pWidgetData = nullptr); int32_t GetLayoutStatus(); void RunNodeInitialize(CXFA_Node* pNode); diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp index 4da98ac7fd..9b87c406d7 100644 --- a/xfa/fxfa/cxfa_ffnumericedit.cpp +++ b/xfa/fxfa/cxfa_ffnumericedit.cpp @@ -33,7 +33,7 @@ bool CXFA_FFNumericEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pWidget->SetText(wsText); UpdateWidgetProperty(); @@ -75,9 +75,8 @@ void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFTextEdit::OnProcessEvent(pEvent); } -bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, - CFX_WideString& wsText) { - CFX_WideString wsPattern; +bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, WideString& wsText) { + WideString wsPattern; m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit); if (!wsPattern.IsEmpty()) return true; @@ -88,7 +87,7 @@ bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, int32_t iFracs = 0; m_pDataAcc->GetFracDigits(iFracs); - CFX_WideString wsFormat; + WideString wsFormat; CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc.Get()); widgetValue.GetNumericFormat(wsFormat, iLeads, iFracs); return widgetValue.ValidateNumericTemp(wsText, wsFormat, diff --git a/xfa/fxfa/cxfa_ffnumericedit.h b/xfa/fxfa/cxfa_ffnumericedit.h index ece0a49604..fb06fd4d34 100644 --- a/xfa/fxfa/cxfa_ffnumericedit.h +++ b/xfa/fxfa/cxfa_ffnumericedit.h @@ -25,7 +25,7 @@ class CXFA_FFNumericEdit : public CXFA_FFTextEdit { void OnProcessEvent(CFWL_Event* pEvent) override; private: - bool OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText); + bool OnValidate(CFWL_Widget* pWidget, WideString& wsText); }; #endif // XFA_FXFA_CXFA_FFNUMERICEDIT_H_ diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp index 594d71db0d..1de900c2f7 100644 --- a/xfa/fxfa/cxfa_ffpageview.cpp +++ b/xfa/fxfa/cxfa_ffpageview.cpp @@ -311,7 +311,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( if (pTraversal) { CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse); if (pTraverse) { - CFX_WideString wsTraverseWidgetName; + WideString wsTraverseWidgetName; if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) { return FindWidgetByName(wsTraverseWidgetName, pWidget); } @@ -320,7 +320,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( return nullptr; } CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::FindWidgetByName( - const CFX_WideString& wsWidgetName, + const WideString& wsWidgetName, CXFA_FFWidget* pRefWidget) { return pRefWidget->GetDocView()->GetWidgetByName(wsWidgetName, pRefWidget); } diff --git a/xfa/fxfa/cxfa_ffpageview.h b/xfa/fxfa/cxfa_ffpageview.h index f2451fbd26..4e79ad5e3c 100644 --- a/xfa/fxfa/cxfa_ffpageview.h +++ b/xfa/fxfa/cxfa_ffpageview.h @@ -92,7 +92,7 @@ class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { protected: CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget); - CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName, + CXFA_FFWidget* FindWidgetByName(const WideString& wsWidgetName, CXFA_FFWidget* pRefWidget); void CreateTabOrderWidgetArray(); void CreateSpaceOrderWidgetArray(std::vector<CXFA_FFWidget*>* WidgetArray); diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp index 46105f135b..e050a69e86 100644 --- a/xfa/fxfa/cxfa_ffpasswordedit.cpp +++ b/xfa/fxfa/cxfa_ffpasswordedit.cpp @@ -31,7 +31,7 @@ bool CXFA_FFPasswordEdit::LoadWidget() { m_pNormalWidget->SetDelegate(this); m_pNormalWidget->LockUpdate(); - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pWidget->SetText(wsText); UpdateWidgetProperty(); @@ -49,7 +49,7 @@ void CXFA_FFPasswordEdit::UpdateWidgetProperty() { FWL_STYLEEXT_EDT_Password; dwExtendedStyle |= UpdateUIProperty(); - CFX_WideString wsPassWord; + WideString wsPassWord; m_pDataAcc->GetPasswordChar(wsPassWord); if (!wsPassWord.IsEmpty()) pWidget->SetAliasChar(wsPassWord[0]); diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index 63079cfaa0..2fac858a12 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -135,7 +135,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { return; bool bRichText; - CFX_WideString wsRollover; + WideString wsRollover; if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) { if (!m_pRollProvider) { m_pRollProvider = pdfium::MakeUnique<CXFA_TextProvider>( @@ -144,7 +144,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() { m_pRolloverTextLayout = pdfium::MakeUnique<CXFA_TextLayout>(m_pRollProvider.get()); } - CFX_WideString wsDown; + WideString wsDown; if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) { if (!m_pDownProvider) { m_pDownProvider = pdfium::MakeUnique<CXFA_TextProvider>( diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index 35c20fab6f..e27971d5df 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -47,7 +47,7 @@ bool CXFA_FFTextEdit::LoadWidget() { m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pFWLEdit->SetText(wsText); m_pNormalWidget->UnlockUpdate(); @@ -173,8 +173,7 @@ bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { } bool CXFA_FFTextEdit::CommitData() { - CFX_WideString wsText = - static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText(); + WideString wsText = static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText(); if (m_pDataAcc->SetValue(wsText, XFA_VALUEPICTURE_Edit)) { m_pDataAcc->UpdateUIDisplay(this); return true; @@ -183,7 +182,7 @@ bool CXFA_FFTextEdit::CommitData() { return false; } -void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { +void CXFA_FFTextEdit::ValidateNumberField(const WideString& wsText) { CXFA_WidgetAcc* pAcc = GetDataAcc(); if (!pAcc || pAcc->GetUIType() != XFA_Element::NumericEdit) return; @@ -192,10 +191,10 @@ void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { if (!pAppProvider) return; - CFX_WideString wsSomField; + WideString wsSomField; pAcc->GetNode()->GetSOMExpression(wsSomField); - CFX_WideString wsMessage; + WideString wsMessage; wsMessage.Format(L"%s can not contain %s", wsText.c_str(), wsSomField.c_str()); pAppProvider->MsgBox(wsMessage, pAppProvider->GetAppTitle(), XFA_MBICON_Error, @@ -272,10 +271,10 @@ bool CXFA_FFTextEdit::UpdateFWLData() { bUpdate = true; } - CFX_WideString wsText; + WideString wsText; m_pDataAcc->GetValue(wsText, eType); - CFX_WideString wsOldText = pEdit->GetText(); + WideString wsOldText = pEdit->GetText(); if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) { pEdit->SetText(wsText); bUpdate = true; @@ -287,8 +286,8 @@ bool CXFA_FFTextEdit::UpdateFWLData() { } void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, - const CFX_WideString& wsChanged, - const CFX_WideString& wsPrevText) { + const WideString& wsChanged, + const WideString& wsPrevText) { m_dwStatus |= XFA_WidgetStatus_TextEditValueChanged; CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; @@ -318,7 +317,7 @@ void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) { m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam); } -bool CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { +bool CXFA_FFTextEdit::CheckWord(const ByteStringView& sWord) { return sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit; } @@ -332,7 +331,7 @@ void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { case CFWL_Event::Type::TextChanged: { CFWL_EventTextChanged* event = static_cast<CFWL_EventTextChanged*>(pEvent); - CFX_WideString wsChange; + WideString wsChange; OnTextChanged(m_pNormalWidget.get(), wsChange, event->wsPrevText); break; } @@ -341,9 +340,9 @@ void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { break; } case CFWL_Event::Type::CheckWord: { - CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); + WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); CFWL_EventCheckWord* event = static_cast<CFWL_EventCheckWord*>(pEvent); - event->bCheckWord = CheckWord(event->bsWord.AsStringC()); + event->bCheckWord = CheckWord(event->bsWord.AsStringView()); break; } default: diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h index 2a3da37350..9735b9e7d8 100644 --- a/xfa/fxfa/cxfa_fftextedit.h +++ b/xfa/fxfa/cxfa_fftextedit.h @@ -37,10 +37,10 @@ class CXFA_FFTextEdit : public CXFA_FFField { const CFX_Matrix& matrix) override; void OnTextChanged(CFWL_Widget* pWidget, - const CFX_WideString& wsChanged, - const CFX_WideString& wsPrevText); + const WideString& wsChanged, + const WideString& wsPrevText); void OnTextFull(CFWL_Widget* pWidget); - bool CheckWord(const CFX_ByteStringC& sWord); + bool CheckWord(const ByteStringView& sWord); protected: uint32_t GetAlignment(); @@ -51,7 +51,7 @@ class CXFA_FFTextEdit : public CXFA_FFField { bool CommitData() override; bool UpdateFWLData() override; bool IsDataChanged() override; - void ValidateNumberField(const CFX_WideString& wsText); + void ValidateNumberField(const WideString& wsText); }; #endif // XFA_FXFA_CXFA_FFTEXTEDIT_H_ diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 26ab37d53c..07d089b6c4 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -966,7 +966,7 @@ CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() { return m_pDataAcc.Get(); } -bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) { +bool CXFA_FFWidget::GetToolTip(WideString& wsToolTip) { if (CXFA_Assist assist = m_pDataAcc->GetAssist()) { if (CXFA_ToolTip toolTip = assist.GetToolTip()) { return toolTip.GetTip(wsToolTip); @@ -1032,7 +1032,7 @@ void CXFA_FFWidget::AddInvalidateRect() { m_pDocView->AddInvalidateRect(m_pPageView, rtWidget); } -bool CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) { +bool CXFA_FFWidget::GetCaptionText(WideString& wsCap) { CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout(); if (!pCapTextlayout) { return false; @@ -1168,15 +1168,15 @@ bool CXFA_FFWidget::CanDeSelect() { return CanCopy(); } -bool CXFA_FFWidget::Copy(CFX_WideString& wsCopy) { +bool CXFA_FFWidget::Copy(WideString& wsCopy) { return false; } -bool CXFA_FFWidget::Cut(CFX_WideString& wsCut) { +bool CXFA_FFWidget::Cut(WideString& wsCut) { return false; } -bool CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) { +bool CXFA_FFWidget::Paste(const WideString& wsPaste) { return false; } @@ -1187,12 +1187,12 @@ void CXFA_FFWidget::Delete() {} void CXFA_FFWidget::DeSelect() {} void CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf, - std::vector<CFX_ByteString>* pWords) { + std::vector<ByteString>* pWords) { pWords->clear(); } bool CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace) { + const ByteStringView& bsReplace) { return false; } @@ -1869,8 +1869,8 @@ char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { out[j] = '\0'; return out; } -FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) { - CFX_WideString wsContentType(wsType); +FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) { + WideString wsContentType(wsType); wsContentType.MakeLower(); if (wsContentType == L"image/jpg") return FXCODEC_IMAGE_JPG; @@ -1890,24 +1890,24 @@ CFX_RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc, bool& bNameImage, int32_t& iImageXDpi, int32_t& iImageYDpi) { - CFX_WideString wsHref; - CFX_WideString wsImage; + WideString wsHref; + WideString wsImage; pImage->GetHref(wsHref); pImage->GetContent(wsImage); if (wsHref.IsEmpty() && wsImage.IsEmpty()) return nullptr; - CFX_WideString wsContentType; + WideString wsContentType; pImage->GetContentType(wsContentType); FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); - CFX_ByteString bsContent; + ByteString bsContent; uint8_t* pImageBuffer = nullptr; CFX_RetainPtr<IFX_SeekableReadStream> pImageFileRead; if (wsImage.GetLength() > 0) { XFA_ATTRIBUTEENUM iEncoding = (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { - CFX_ByteString bsData = wsImage.UTF8Encode(); + ByteString bsData = wsImage.UTF8Encode(); int32_t iLength = bsData.GetLength(); pImageBuffer = FX_Alloc(uint8_t, iLength); int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); @@ -1916,16 +1916,16 @@ CFX_RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc, pdfium::MakeRetain<CFX_MemoryStream>(pImageBuffer, iRead, false); } } else { - bsContent = CFX_ByteString::FromUnicode(wsImage); + bsContent = ByteString::FromUnicode(wsImage); pImageFileRead = pdfium::MakeRetain<CFX_MemoryStream>( const_cast<uint8_t*>(bsContent.raw_str()), bsContent.GetLength(), false); } } else { - CFX_WideString wsURL = wsHref; + WideString wsURL = wsHref; if (wsURL.Left(7) != L"http://" && wsURL.Left(6) != L"ftp://") { CFX_RetainPtr<CFX_DIBitmap> pBitmap = - pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi); + pDoc->GetPDFNamedImage(wsURL.AsStringView(), iImageXDpi, iImageYDpi); if (pBitmap) { bNameImage = true; return pBitmap; diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index f2ca86f774..41bb94164b 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -61,7 +61,7 @@ CFX_RetainPtr<CFX_DIBitmap> XFA_LoadImageFromBuffer( int32_t& iImageXDpi, int32_t& iImageYDpi); -FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType); +FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType); char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len); void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, @@ -126,17 +126,17 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { virtual bool CanSelectAll(); virtual bool CanDelete(); virtual bool CanDeSelect(); - virtual bool Copy(CFX_WideString& wsCopy); - virtual bool Cut(CFX_WideString& wsCut); - virtual bool Paste(const CFX_WideString& wsPaste); + virtual bool Copy(WideString& wsCopy); + virtual bool Cut(WideString& wsCut); + virtual bool Paste(const WideString& wsPaste); virtual void SelectAll(); virtual void Delete(); virtual void DeSelect(); // TODO(tsepez): Implement or remove. - void GetSuggestWords(CFX_PointF pointf, std::vector<CFX_ByteString>* pWords); + void GetSuggestWords(CFX_PointF pointf, std::vector<ByteString>* pWords); bool ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace); + const ByteStringView& bsReplace); CXFA_FFPageView* GetPageView() const { return m_pPageView; } void SetPageView(CXFA_FFPageView* pPageView) { m_pPageView = pPageView; } @@ -146,7 +146,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved); CXFA_WidgetAcc* GetDataAcc(); - bool GetToolTip(CFX_WideString& wsToolTip); + bool GetToolTip(WideString& wsToolTip); CXFA_FFDocView* GetDocView(); void SetDocView(CXFA_FFDocView* pDocView); @@ -154,7 +154,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { CXFA_FFApp* GetApp(); IXFA_AppProvider* GetAppProvider(); void AddInvalidateRect(); - bool GetCaptionText(CFX_WideString& wsCap); + bool GetCaptionText(WideString& wsCap); bool IsFocused() const { return !!(m_dwStatus & XFA_WidgetStatus_Focused); } CFX_PointF Rotate2Normal(const CFX_PointF& point); CFX_Matrix GetRotateMatrix(); diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp index 81e296f8a4..b47ce6b21d 100644 --- a/xfa/fxfa/cxfa_fontmgr.cpp +++ b/xfa/fxfa/cxfa_fontmgr.cpp @@ -1700,8 +1700,7 @@ const XFA_FONTINFO g_XFAFontsMap[] = { } // namespace -CFX_WideString XFA_LocalFontNameToEnglishName( - const CFX_WideStringC& wsLocalName) { +WideString XFA_LocalFontNameToEnglishName(const WideStringView& wsLocalName) { uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true); const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap); const XFA_FONTINFO* pFontInfo = @@ -1711,15 +1710,15 @@ CFX_WideString XFA_LocalFontNameToEnglishName( }); if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash) return pFontInfo->pPsName; - return CFX_WideString(wsLocalName); + return WideString(wsLocalName); } const XFA_FONTINFO* XFA_GetFontINFOByFontName( - const CFX_WideStringC& wsFontName) { - CFX_WideString wsFontNameTemp(wsFontName); + const WideStringView& wsFontName) { + WideString wsFontNameTemp(wsFontName); wsFontNameTemp.Remove(L' '); uint32_t dwCurFontNameHash = - FX_HashCode_GetW(wsFontNameTemp.AsStringC(), true); + FX_HashCode_GetW(wsFontNameTemp.AsStringView(), true); const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap); const XFA_FONTINFO* pFontInfo = std::lower_bound(g_XFAFontsMap, pEnd, dwCurFontNameHash, @@ -1737,25 +1736,25 @@ CXFA_FontMgr::~CXFA_FontMgr() {} CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont( CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, + const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false); - CFX_ByteString bsKey; + ByteString bsKey; bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); auto iter = m_FontMap.find(bsKey); if (iter != m_FontMap.end()) return iter->second; - CFX_WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily); + WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily); auto it = m_PDFFontMgrMap.find(hDoc); CXFA_PDFFontMgr* pMgr = it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr; CPDF_Font* pPDFFont = nullptr; CFX_RetainPtr<CFGAS_GEFont> pFont; if (pMgr) { - pFont = - pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, true); + pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, &pPDFFont, + true); if (pFont) return pFont; } @@ -1764,7 +1763,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont( if (!pFont && pMgr) { pPDFFont = nullptr; - pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, + pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, &pPDFFont, false); if (pFont) return pFont; diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h index f66ca8f314..e5db565147 100644 --- a/xfa/fxfa/cxfa_fontmgr.h +++ b/xfa/fxfa/cxfa_fontmgr.h @@ -29,10 +29,8 @@ struct XFA_FONTINFO { uint16_t wCodePage; }; -CFX_WideString XFA_LocalFontNameToEnglishName( - const CFX_WideStringC& wsLocalName); -const XFA_FONTINFO* XFA_GetFontINFOByFontName( - const CFX_WideStringC& wsFontName); +WideString XFA_LocalFontNameToEnglishName(const WideStringView& wsLocalName); +const XFA_FONTINFO* XFA_GetFontINFOByFontName(const WideStringView& wsFontName); class CXFA_FontMgr { public: @@ -40,7 +38,7 @@ class CXFA_FontMgr { ~CXFA_FontMgr(); CFX_RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, + const WideStringView& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF); void LoadDocFonts(CXFA_FFDoc* hDoc); @@ -50,7 +48,7 @@ class CXFA_FontMgr { private: std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr; std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap; - std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap; + std::map<ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap; }; #endif // XFA_FXFA_CXFA_FONTMGR_H_ diff --git a/xfa/fxfa/cxfa_fwltheme.cpp b/xfa/fxfa/cxfa_fwltheme.cpp index ec0ce4586a..35456eff16 100644 --- a/xfa/fxfa/cxfa_fwltheme.cpp +++ b/xfa/fxfa/cxfa_fwltheme.cpp @@ -116,7 +116,7 @@ void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { mtPart.Concat(*pMatrix); m_pTextOut->SetMatrix(mtPart); - m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringC(), + m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringView(), pParams->m_rtPart); return; } @@ -141,7 +141,7 @@ void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { mtPart.Concat(*pMatrix); m_pTextOut->SetMatrix(mtPart); - m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringC(), + m_pTextOut->DrawLogicText(pRenderDevice, pParams->m_wsText.AsStringView(), pParams->m_rtPart); } diff --git a/xfa/fxfa/cxfa_fwltheme.h b/xfa/fxfa/cxfa_fwltheme.h index 9fbb068cc3..48fb744cb2 100644 --- a/xfa/fxfa/cxfa_fwltheme.h +++ b/xfa/fxfa/cxfa_fwltheme.h @@ -60,7 +60,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { std::unique_ptr<CFWL_BarcodeTP> m_pBarcodeTP; std::unique_ptr<CFDE_TextOut> m_pTextOut; CFX_RetainPtr<CFGAS_GEFont> m_pCalendarFont; - CFX_WideString m_wsResource; + WideString m_wsResource; CFX_UnownedPtr<CXFA_FFApp> const m_pApp; CFX_RectF m_Rect; }; diff --git a/xfa/fxfa/cxfa_linkuserdata.h b/xfa/fxfa/cxfa_linkuserdata.h index b3ee74a051..7a9648c9b5 100644 --- a/xfa/fxfa/cxfa_linkuserdata.h +++ b/xfa/fxfa/cxfa_linkuserdata.h @@ -22,7 +22,7 @@ class CXFA_LinkUserData : public CFX_Retainable { explicit CXFA_LinkUserData(wchar_t* pszText); ~CXFA_LinkUserData() override; - CFX_WideString m_wsURLContent; + WideString m_wsURLContent; }; #endif // XFA_FXFA_CXFA_LINKUSERDATA_H_ diff --git a/xfa/fxfa/cxfa_pdffontmgr.cpp b/xfa/fxfa/cxfa_pdffontmgr.cpp index 30af697e26..9a90e54dec 100644 --- a/xfa/fxfa/cxfa_pdffontmgr.cpp +++ b/xfa/fxfa/cxfa_pdffontmgr.cpp @@ -28,7 +28,7 @@ CXFA_PDFFontMgr::CXFA_PDFFontMgr(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {} CXFA_PDFFontMgr::~CXFA_PDFFontMgr() {} CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::FindFont( - const CFX_ByteString& strPsName, + const ByteString& strPsName, bool bBold, bool bItalic, CPDF_Font** pDstPDFFont, @@ -46,13 +46,13 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::FindFont( if (!pFontSetDict) return nullptr; - CFX_ByteString name = strPsName; + ByteString name = strPsName; name.Remove(' '); CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr(); for (const auto& it : *pFontSetDict) { - const CFX_ByteString& key = it.first; + const ByteString& key = it.first; CPDF_Object* pObj = it.second.get(); - if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key, + if (!PsNameMatchDRFontName(name.AsStringView(), bBold, bItalic, key, bStrictMatch)) { continue; } @@ -74,21 +74,20 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::FindFont( } CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::GetFont( - const CFX_WideStringC& wsFontFamily, + const WideStringView& wsFontFamily, uint32_t dwFontStyles, CPDF_Font** pPDFFont, bool bStrictMatch) { uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false); - CFX_ByteString strKey; + ByteString strKey; strKey.Format("%u%u", dwHashCode, dwFontStyles); auto it = m_FontMap.find(strKey); if (it != m_FontMap.end()) return it->second; - CFX_ByteString bsPsName = - CFX_ByteString::FromUnicode(CFX_WideString(wsFontFamily)); + ByteString bsPsName = ByteString::FromUnicode(WideString(wsFontFamily)); bool bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold; bool bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic; - CFX_ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic); + ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic); CFX_RetainPtr<CFGAS_GEFont> pFont = FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch); if (pFont) @@ -96,10 +95,9 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_PDFFontMgr::GetFont( return pFont; } -CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName( - const CFX_ByteString& strPsName, - bool bBold, - bool bItalic) { +ByteString CXFA_PDFFontMgr::PsNameToFontName(const ByteString& strPsName, + bool bBold, + bool bItalic) { for (size_t i = 0; i < FX_ArraySize(g_XFAPDFFontName); ++i) { if (strPsName == g_XFAPDFFontName[i][0]) { size_t index = 1; @@ -113,12 +111,12 @@ CFX_ByteString CXFA_PDFFontMgr::PsNameToFontName( return strPsName; } -bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, +bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const ByteStringView& bsPsName, bool bBold, bool bItalic, - const CFX_ByteString& bsDRFontName, + const ByteString& bsDRFontName, bool bStrictMatch) { - CFX_ByteString bsDRName = bsDRFontName; + ByteString bsDRName = bsDRFontName; bsDRName.Remove('-'); FX_STRSIZE iPsLen = bsPsName.GetLength(); auto nIndex = bsDRName.Find(bsPsName); @@ -152,7 +150,7 @@ bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, return false; if (iDifferLength > 1) { - CFX_ByteString bsDRTailer = bsDRName.Right(iDifferLength); + ByteString bsDRTailer = bsDRName.Right(iDifferLength); if (bsDRTailer == "MT" || bsDRTailer == "PSMT" || bsDRTailer == "Regular" || bsDRTailer == "Reg") { return true; diff --git a/xfa/fxfa/cxfa_pdffontmgr.h b/xfa/fxfa/cxfa_pdffontmgr.h index df8ab28e08..4c8941f8f0 100644 --- a/xfa/fxfa/cxfa_pdffontmgr.h +++ b/xfa/fxfa/cxfa_pdffontmgr.h @@ -25,7 +25,7 @@ class CXFA_PDFFontMgr : public CFX_Observable<CXFA_PDFFontMgr> { explicit CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); ~CXFA_PDFFontMgr(); - CFX_RetainPtr<CFGAS_GEFont> GetFont(const CFX_WideStringC& wsFontFamily, + CFX_RetainPtr<CFGAS_GEFont> GetFont(const WideStringView& wsFontFamily, uint32_t dwFontStyles, CPDF_Font** pPDFFont, bool bStrictMatch); @@ -36,23 +36,23 @@ class CXFA_PDFFontMgr : public CFX_Observable<CXFA_PDFFontMgr> { void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont, CPDF_Font* pPDFFont); private: - CFX_RetainPtr<CFGAS_GEFont> FindFont(const CFX_ByteString& strFamilyName, + CFX_RetainPtr<CFGAS_GEFont> FindFont(const ByteString& strFamilyName, bool bBold, bool bItalic, CPDF_Font** pPDFFont, bool bStrictMatch); - CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, - bool bBold, - bool bItalic); - bool PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, + ByteString PsNameToFontName(const ByteString& strPsName, + bool bBold, + bool bItalic); + bool PsNameMatchDRFontName(const ByteStringView& bsPsName, bool bBold, bool bItalic, - const CFX_ByteString& bsDRFontName, + const ByteString& bsDRFontName, bool bStrictMatch); CFX_UnownedPtr<CXFA_FFDoc> const m_pDoc; std::map<CFX_RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont; - std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap; + std::map<ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap; }; #endif // XFA_FXFA_CXFA_PDFFONTMGR_H_ diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index 9c4e36739d..bbc61d40f2 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -79,7 +79,7 @@ CFX_XMLNode* CXFA_TextLayout::GetXMLContainerNode() { pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { if (pXMLChild->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild); - CFX_WideString wsTag = pXMLElement->GetLocalTagName(); + WideString wsTag = pXMLElement->GetLocalTagName(); if (wsTag == L"body" || wsTag == L"html") { pXMLContainer = pXMLChild; break; @@ -237,7 +237,7 @@ void CXFA_TextLayout::InitBreak(CFX_CSSComputedStyle* pStyle, m_pBreak->SetCharSpace(pStyle->GetLetterSpacing().GetValue()); } -int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) { +int32_t CXFA_TextLayout::GetText(WideString& wsText) { GetTextDataNode(); wsText.clear(); if (!m_bRichText) @@ -676,7 +676,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode, } } - CFX_WideString wsText = pNode->GetContent(); + WideString wsText = pNode->GetContent(); wsText.TrimRight(L" "); bool bRet = AppendChar(wsText, fLinePos, fSpaceAbove, bSavePieces); if (bRet && m_pLoader) @@ -704,7 +704,7 @@ bool CXFA_TextLayout::LoadRichText( bool bContentNode = false; float fSpaceBelow = 0; CFX_RetainPtr<CFX_CSSComputedStyle> pStyle; - CFX_WideString wsName; + WideString wsName; if (bEndBreak) { bool bCurOl = false; bool bCurLi = false; @@ -749,7 +749,7 @@ bool CXFA_TextLayout::LoadRichText( if (wsName == L"a") { ASSERT(pElement); - CFX_WideString wsLinkContent = pElement->GetString(L"href"); + WideString wsLinkContent = pElement->GetString(L"href"); if (!wsLinkContent.IsEmpty()) { pLinkData = pdfium::MakeRetain<CXFA_LinkUserData>( wsLinkContent.GetBuffer(wsLinkContent.GetLength())); @@ -761,7 +761,7 @@ bool CXFA_TextLayout::LoadRichText( bContentNode ? pParentStyle.Get() : pStyle.Get()); bool bSpaceRun = m_textParser.IsSpaceRun( bContentNode ? pParentStyle.Get() : pStyle.Get()); - CFX_WideString wsText; + WideString wsText; if (bContentNode && iTabCount == 0) { wsText = static_cast<CFX_XMLText*>(pXMLNode)->GetText(); } else if (wsName == L"br") { @@ -771,7 +771,7 @@ bool CXFA_TextLayout::LoadRichText( if (bIsOl) wsText.Format(L"%d. ", iLiCount); else - wsText = 0x00B7 + CFX_WideStringC(L" ", 1); + wsText = 0x00B7 + WideStringView(L" ", 1); } else if (!bContentNode) { if (iTabCount > 0) { while (iTabCount-- > 0) @@ -874,7 +874,7 @@ bool CXFA_TextLayout::LoadRichText( return true; } -bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText, +bool CXFA_TextLayout::AppendChar(const WideString& wsText, float& fLinePos, float fSpaceAbove, bool bSavePieces) { @@ -915,7 +915,7 @@ bool CXFA_TextLayout::IsEnd(bool bSavePieces) { return false; } -void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) { +void CXFA_TextLayout::ProcessText(WideString& wsText) { int32_t iLen = wsText.GetLength(); if (iLen == 0) return; diff --git a/xfa/fxfa/cxfa_textlayout.h b/xfa/fxfa/cxfa_textlayout.h index 338d3bea50..50ee83fd75 100644 --- a/xfa/fxfa/cxfa_textlayout.h +++ b/xfa/fxfa/cxfa_textlayout.h @@ -33,7 +33,7 @@ class CXFA_TextLayout { explicit CXFA_TextLayout(CXFA_TextProvider* pTextProvider); ~CXFA_TextLayout(); - int32_t GetText(CFX_WideString& wsText); + int32_t GetText(WideString& wsText); float GetLayoutHeight(); float StartLayout(float fWidth = -1); bool DoLayout(int32_t iBlockIndex, @@ -85,7 +85,7 @@ class CXFA_TextLayout { bool bEndBreak = true, bool bIsOl = false, int32_t iLiCount = 0); - bool AppendChar(const CFX_WideString& wsText, + bool AppendChar(const WideString& wsText, float& fLinePos, float fSpaceAbove, bool bSavePieces); @@ -95,7 +95,7 @@ class CXFA_TextLayout { bool bEndBreak = false); void EndBreak(CFX_BreakType dwStatus, float& fLinePos, bool bDefault); bool IsEnd(bool bSavePieces); - void ProcessText(CFX_WideString& wsText); + void ProcessText(WideString& wsText); void UpdateAlign(float fHeight, float fBottom); void RenderString(CFX_RenderDevice* pDevice, CXFA_PieceLine* pPieceLine, diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp index 659ec9cc6d..3c78a8686d 100644 --- a/xfa/fxfa/cxfa_textparser.cpp +++ b/xfa/fxfa/cxfa_textparser.cpp @@ -244,7 +244,7 @@ void CXFA_TextParser::ParseRichText(CFX_XMLNode* pXMLNode, } } -bool CXFA_TextParser::TagValidate(const CFX_WideString& wsName) const { +bool CXFA_TextParser::TagValidate(const WideString& wsName) const { static const uint32_t s_XFATagName[] = { 0x61, // a 0x62, // b @@ -263,21 +263,21 @@ bool CXFA_TextParser::TagValidate(const CFX_WideString& wsName) const { static const int32_t s_iCount = FX_ArraySize(s_XFATagName); return std::binary_search(s_XFATagName, s_XFATagName + s_iCount, - FX_HashCode_GetW(wsName.AsStringC(), true)); + FX_HashCode_GetW(wsName.AsStringView(), true)); } std::unique_ptr<CXFA_TextParser::TagProvider> CXFA_TextParser::ParseTagInfo( CFX_XMLNode* pXMLNode) { auto tagProvider = pdfium::MakeUnique<TagProvider>(); - CFX_WideString wsName; + WideString wsName; if (pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); wsName = pXMLElement->GetLocalTagName(); tagProvider->SetTagName(wsName); tagProvider->m_bTagAvailable = TagValidate(wsName); - CFX_WideString wsValue = pXMLElement->GetString(L"style"); + WideString wsValue = pXMLElement->GetString(L"style"); if (!wsValue.IsEmpty()) tagProvider->SetAttribute(L"style", wsValue); } else if (pXMLNode->GetType() == FX_XMLNODE_Text) { @@ -293,21 +293,21 @@ int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const { } float CXFA_TextParser::GetTabInterval(CFX_CSSComputedStyle* pStyle) const { - CFX_WideString wsValue; + WideString wsValue; if (pStyle && pStyle->GetCustomStyle(L"tab-interval", wsValue)) - return CXFA_Measurement(wsValue.AsStringC()).ToUnit(XFA_UNIT_Pt); + return CXFA_Measurement(wsValue.AsStringView()).ToUnit(XFA_UNIT_Pt); return 36; } int32_t CXFA_TextParser::CountTabs(CFX_CSSComputedStyle* pStyle) const { - CFX_WideString wsValue; + WideString wsValue; if (pStyle && pStyle->GetCustomStyle(L"xfa-tab-count", wsValue)) return wsValue.GetInteger(); return 0; } bool CXFA_TextParser::IsSpaceRun(CFX_CSSComputedStyle* pStyle) const { - CFX_WideString wsValue; + WideString wsValue; if (pStyle && pStyle->GetCustomStyle(L"xfa-spacerun", wsValue)) { wsValue.MakeLower(); return wsValue == L"yes"; @@ -318,7 +318,7 @@ bool CXFA_TextParser::IsSpaceRun(CFX_CSSComputedStyle* pStyle) const { CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont( CXFA_TextProvider* pTextProvider, CFX_CSSComputedStyle* pStyle) const { - CFX_WideStringC wsFamily = L"Courier"; + WideStringView wsFamily = L"Courier"; uint32_t dwStyle = 0; CXFA_Font font = pTextProvider->GetFontNode(); if (font) { @@ -332,7 +332,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont( if (pStyle) { int32_t iCount = pStyle->CountFontFamilies(); if (iCount > 0) - wsFamily = pStyle->GetFontFamily(iCount - 1).AsStringC(); + wsFamily = pStyle->GetFontFamily(iCount - 1).AsStringView(); dwStyle = 0; if (pStyle->GetFontWeight() > FXFONT_FW_NORMAL) @@ -361,7 +361,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, CFX_CSSComputedStyle* pStyle, CFX_XMLNode* pXMLNode) const { if (pStyle) { - CFX_WideString wsValue; + WideString wsValue; if (pStyle->GetCustomStyle(L"xfa-font-horizontal-scale", wsValue)) return wsValue.GetInteger(); @@ -387,7 +387,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider, int32_t CXFA_TextParser::GetVerScale(CXFA_TextProvider* pTextProvider, CFX_CSSComputedStyle* pStyle) const { if (pStyle) { - CFX_WideString wsValue; + WideString wsValue; if (pStyle->GetCustomStyle(L"xfa-font-vertical-scale", wsValue)) return wsValue.GetInteger(); } @@ -418,7 +418,7 @@ void CXFA_TextParser::GetUnderline(CXFA_TextProvider* pTextProvider, else if (dwDecoration & CFX_CSSTEXTDECORATION_Underline) iUnderline = 1; - CFX_WideString wsValue; + WideString wsValue; if (pStyle->GetCustomStyle(L"underlinePeriod", wsValue)) { if (wsValue == L"word") iPeriod = XFA_ATTRIBUTEENUM_Word; @@ -487,7 +487,7 @@ float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider, bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFX_XMLNode* pXMLNode, - CFX_WideString& wsValue) { + WideString& wsValue) { wsValue.clear(); if (!pXMLNode) return false; @@ -495,13 +495,13 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, bool bRet = false; if (pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLNode); - CFX_WideString wsAttr = pElement->GetString(L"xfa:embed"); + WideString wsAttr = pElement->GetString(L"xfa:embed"); if (wsAttr.IsEmpty()) return false; if (wsAttr[0] == L'#') wsAttr.Delete(0); - CFX_WideString ws = pElement->GetString(L"xfa:embedType"); + WideString ws = pElement->GetString(L"xfa:embedType"); if (ws.IsEmpty()) ws = L"som"; else @@ -537,7 +537,7 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle, if (!pStyle || !pTabstopContext) return false; - CFX_WideString wsValue; + WideString wsValue; if (!pStyle->GetCustomStyle(L"xfa-tab-stops", wsValue) && !pStyle->GetCustomStyle(L"tab-stops", wsValue)) { return false; @@ -547,7 +547,7 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle, const wchar_t* pTabStops = wsValue.c_str(); int32_t iCur = 0; int32_t iLast = 0; - CFX_WideString wsAlign; + WideString wsAlign; TabStopStatus eStatus = TabStopStatus::None; wchar_t ch; while (iCur < iLength) { @@ -563,7 +563,7 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle, break; case TabStopStatus::Alignment: if (ch == ' ') { - wsAlign = CFX_WideStringC(pTabStops + iLast, iCur - iLast); + wsAlign = WideStringView(pTabStops + iLast, iCur - iLast); eStatus = TabStopStatus::StartLeader; iCur++; while (iCur < iLength && pTabStops[iCur] <= ' ') @@ -598,8 +598,8 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle, break; case TabStopStatus::Location: if (ch == ' ') { - uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true); - CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); + uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringView(), true); + CXFA_Measurement ms(WideStringView(pTabStops + iLast, iCur - iLast)); float fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); wsAlign.clear(); @@ -613,8 +613,8 @@ bool CXFA_TextParser::GetTabstops(CFX_CSSComputedStyle* pStyle, } if (!wsAlign.IsEmpty()) { - uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringC(), true); - CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); + uint32_t dwHashCode = FX_HashCode_GetW(wsAlign.AsStringView(), true); + CXFA_Measurement ms(WideStringView(pTabStops + iLast, iCur - iLast)); float fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); } diff --git a/xfa/fxfa/cxfa_textparser.h b/xfa/fxfa/cxfa_textparser.h index 567aff0189..ee5c38d2af 100644 --- a/xfa/fxfa/cxfa_textparser.h +++ b/xfa/fxfa/cxfa_textparser.h @@ -78,11 +78,11 @@ class CXFA_TextParser { bool GetEmbbedObj(CXFA_TextProvider* pTextProvider, CFX_XMLNode* pXMLNode, - CFX_WideString& wsValue); + WideString& wsValue); CXFA_TextParseContext* GetParseContextFromMap(CFX_XMLNode* pXMLNode); protected: - bool TagValidate(const CFX_WideString& str) const; + bool TagValidate(const WideString& str) const; private: class TagProvider { @@ -90,15 +90,14 @@ class CXFA_TextParser { TagProvider(); ~TagProvider(); - CFX_WideString GetTagName() { return m_wsTagName; } + WideString GetTagName() { return m_wsTagName; } - void SetTagName(const CFX_WideString& wsName) { m_wsTagName = wsName; } - void SetAttribute(const CFX_WideString& wsAttr, - const CFX_WideString& wsValue) { + void SetTagName(const WideString& wsName) { m_wsTagName = wsName; } + void SetAttribute(const WideString& wsAttr, const WideString& wsValue) { m_Attributes.insert({wsAttr, wsValue}); } - CFX_WideString GetAttribute(const CFX_WideString& wsAttr) { + WideString GetAttribute(const WideString& wsAttr) { return m_Attributes[wsAttr]; } @@ -106,8 +105,8 @@ class CXFA_TextParser { bool m_bContent; private: - CFX_WideString m_wsTagName; - std::map<CFX_WideString, CFX_WideString> m_Attributes; + WideString m_wsTagName; + std::map<WideString, WideString> m_Attributes; }; void InitCSSData(CXFA_TextProvider* pTextProvider); diff --git a/xfa/fxfa/cxfa_textpiece.h b/xfa/fxfa/cxfa_textpiece.h index a1f100cf0b..4ea5a4158c 100644 --- a/xfa/fxfa/cxfa_textpiece.h +++ b/xfa/fxfa/cxfa_textpiece.h @@ -21,7 +21,7 @@ class CXFA_TextPiece { CXFA_TextPiece(); ~CXFA_TextPiece(); - CFX_WideString szText; + WideString szText; std::vector<int32_t> Widths; int32_t iChars; int32_t iHorScale; diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index 16a2b58a8a..9f1ecd51c3 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -43,7 +43,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { - CFX_WideString wsContentType; + WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); if (wsContentType == L"text/html") bRichText = true; @@ -80,7 +80,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { CXFA_Node* pChildNode = pValueNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode && pChildNode->GetElementType() == XFA_Element::ExData) { - CFX_WideString wsContentType; + WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); if (wsContentType == L"text/html") bRichText = true; @@ -95,7 +95,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pNode) { - CFX_WideStringC wsName; + WideStringView wsName; pNode->TryCData(XFA_ATTRIBUTE_Name, wsName); if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover") return pNode; @@ -135,8 +135,8 @@ bool CXFA_TextProvider::IsCheckButtonAndAutoWidth() { bool CXFA_TextProvider::GetEmbbedObj(bool bURI, bool bRaw, - const CFX_WideString& wsAttr, - CFX_WideString& wsValue) { + const WideString& wsAttr, + WideString& wsValue) { if (m_eType != XFA_TEXTPROVIDERTYPE_Text) return false; @@ -149,11 +149,12 @@ bool CXFA_TextProvider::GetEmbbedObj(bool bURI, CXFA_Node* pIDNode = nullptr; CXFA_WidgetAcc* pEmbAcc = nullptr; if (pParent) - pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringC()); + pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringView()); if (!pIDNode) { pIDNode = pDocument->GetNodeByID( - ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr.AsStringC()); + ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), + wsAttr.AsStringView()); } if (pIDNode) pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData()); diff --git a/xfa/fxfa/cxfa_textprovider.h b/xfa/fxfa/cxfa_textprovider.h index 0772490d90..d648b94495 100644 --- a/xfa/fxfa/cxfa_textprovider.h +++ b/xfa/fxfa/cxfa_textprovider.h @@ -39,8 +39,8 @@ class CXFA_TextProvider { CXFA_FFDoc* GetDocNode() { return m_pWidgetAcc->GetDoc(); } bool GetEmbbedObj(bool bURI, bool bRaw, - const CFX_WideString& wsAttr, - CFX_WideString& wsValue); + const WideString& wsAttr, + WideString& wsValue); private: CXFA_WidgetAcc* m_pWidgetAcc; diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 972a95eac4..791b814d9e 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -160,15 +160,15 @@ CXFA_WidgetAcc::CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode) CXFA_WidgetAcc::~CXFA_WidgetAcc() {} -bool CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) { +bool CXFA_WidgetAcc::GetName(WideString& wsName, int32_t iNameType) { if (iNameType == 0) { m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName); return !wsName.IsEmpty(); } m_pNode->GetSOMExpression(wsName); if (iNameType == 2 && wsName.GetLength() >= 15) { - CFX_WideStringC wsPre = L"xfa[0].form[0]."; - if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) + WideStringView wsPre = L"xfa[0].form[0]."; + if (wsPre == WideStringView(wsName.c_str(), wsPre.GetLength())) wsName.Delete(0, wsPre.GetLength()); } return true; @@ -187,13 +187,13 @@ bool CXFA_WidgetAcc::ProcessValueChanged() { } void CXFA_WidgetAcc::ResetData() { - CFX_WideString wsValue; + WideString wsValue; XFA_Element eUIType = GetUIType(); switch (eUIType) { case XFA_Element::ImageEdit: { CXFA_Value imageValue = GetDefaultValue(); CXFA_Image image = imageValue.GetImage(); - CFX_WideString wsContentType, wsHref; + WideString wsContentType, wsHref; if (image) { image.GetContent(wsValue); image.GetContentType(wsContentType); @@ -222,7 +222,7 @@ void CXFA_WidgetAcc::ResetData() { if (!pItems) continue; - CFX_WideString itemText; + WideString itemText; if (pItems->CountChildren(XFA_Element::Unknown) > 1) itemText = pItems->GetChild(1, XFA_Element::Unknown)->GetContent(); @@ -244,15 +244,15 @@ void CXFA_WidgetAcc::ResetData() { } } -void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType, - const CFX_WideString& wsHref, - const CFX_WideString& wsData) { +void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType, + const WideString& wsHref, + const WideString& wsData) { CXFA_Image image = GetFormValue().GetImage(); if (image) { - image.SetContentType(CFX_WideString(wsContentType)); + image.SetContentType(WideString(wsContentType)); image.SetHref(wsHref); } - CFX_WideString wsFormatValue(wsData); + WideString wsFormatValue(wsData); GetFormatDataValue(wsData, wsFormatValue); m_pNode->SetContent(wsData, wsFormatValue, true); CXFA_Node* pBind = GetDatasets(); @@ -367,8 +367,8 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, if (!pAppProvider) { return; } - CFX_WideString wsTitle = pAppProvider->GetAppTitle(); - CFX_WideString wsScriptMsg; + WideString wsTitle = pAppProvider->GetAppTitle(); + WideString wsScriptMsg; validate.GetScriptMessageText(wsScriptMsg); int32_t eScriptTest = validate.GetScriptTest(); if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) { @@ -397,9 +397,9 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, bool bVersionFlag) { - CFX_WideString wsRawValue = GetRawValue(); + WideString wsRawValue = GetRawValue(); if (!wsRawValue.IsEmpty()) { - CFX_WideString wsPicture; + WideString wsPicture; validate.GetPicture(wsPicture); if (wsPicture.IsEmpty()) return XFA_EVENTERROR_NotExist; @@ -415,9 +415,9 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, if (!pAppProvider) return XFA_EVENTERROR_NotExist; - CFX_WideString wsFormatMsg; + WideString wsFormatMsg; validate.GetFormatMessageText(wsFormatMsg); - CFX_WideString wsTitle = pAppProvider->GetAppTitle(); + WideString wsTitle = pAppProvider->GetAppTitle(); int32_t eFormatTest = validate.GetFormatTest(); if (eFormatTest == XFA_ATTRIBUTEENUM_Error) { if (wsFormatMsg.IsEmpty()) @@ -448,7 +448,7 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, int32_t iFlags, bool bVersionFlag) { - CFX_WideString wsValue; + WideString wsValue; GetValue(wsValue, XFA_VALUEPICTURE_Raw); if (!wsValue.IsEmpty()) return XFA_EVENTERROR_Success; @@ -456,7 +456,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, return XFA_EVENTERROR_Success; int32_t eNullTest = validate.GetNullTest(); - CFX_WideString wsNullMsg; + WideString wsNullMsg; validate.GetNullMessageText(wsNullMsg); if (iFlags & 0x01) { int32_t iRet = XFA_EVENTERROR_Success; @@ -480,8 +480,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, if (!pAppProvider) return XFA_EVENTERROR_NotExist; - CFX_WideString wsCaptionName; - CFX_WideString wsTitle = pAppProvider->GetAppTitle(); + WideString wsCaptionName; + WideString wsTitle = pAppProvider->GetAppTitle(); switch (eNullTest) { case XFA_ATTRIBUTEENUM_Error: { if (wsNullMsg.IsEmpty()) { @@ -514,8 +514,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, return XFA_EVENTERROR_Success; } -CFX_WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { - CFX_WideString wsCaptionName; +WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { + WideString wsCaptionName; if (!bVersionFlag) { if (CXFA_Caption caption = GetCaption()) { @@ -531,10 +531,9 @@ CFX_WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { return wsCaptionName; } -CFX_WideString CXFA_WidgetAcc::GetValidateMessage(bool bError, - bool bVersionFlag) { - CFX_WideString wsCaptionName = GetValidateCaptionName(bVersionFlag); - CFX_WideString wsMessage; +WideString CXFA_WidgetAcc::GetValidateMessage(bool bError, bool bVersionFlag) { + WideString wsCaptionName = GetValidateCaptionName(bVersionFlag); + WideString wsMessage; if (bVersionFlag) { wsMessage.Format(L"%s validation failed", wsCaptionName.c_str()); return wsMessage; @@ -609,7 +608,7 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, if (script.GetRunAt() == XFA_ATTRIBUTEENUM_Server) return XFA_EVENTERROR_Disabled; - CFX_WideString wsExpression; + WideString wsExpression; script.GetExpression(wsExpression); if (wsExpression.IsEmpty()) return XFA_EVENTERROR_NotExist; @@ -630,8 +629,8 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, auto pTmpRetValue = pdfium::MakeUnique<CFXJSE_Value>(pContext->GetRuntime()); ++m_nRecursionDepth; bool bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, - wsExpression.AsStringC(), pTmpRetValue.get(), - m_pNode); + wsExpression.AsStringView(), + pTmpRetValue.get(), m_pNode); --m_nRecursionDepth; int32_t iRet = XFA_EVENTERROR_Error; if (bRet) { @@ -820,7 +819,7 @@ bool CXFA_WidgetAcc::CalculateWidgetAutoSize(CFX_SizeF& size) { void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { float fFontSize = GetFontSize(); - CFX_WideString wsText; + WideString wsText; GetValue(wsText, XFA_VALUEPICTURE_Display); if (wsText.IsEmpty()) { size.height += fFontSize; @@ -1218,7 +1217,7 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) { static_cast<CXFA_FieldLayoutData*>(m_pLayoutData.get()); int32_t iLinesCount = 0; float fHeight = m_pLayoutData->m_fWidgetHeight; - CFX_WideString wsText; + WideString wsText; GetValue(wsText, XFA_VALUEPICTURE_Display); if (wsText.IsEmpty()) { iLinesCount = 1; @@ -1495,7 +1494,7 @@ CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() { } CFX_RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() { - CFX_WideStringC wsFontName = L"Courier"; + WideStringView wsFontName = L"Courier"; uint32_t dwFontStyle = 0; if (CXFA_Font font = GetFont(false)) { if (font.IsBold()) diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 38b17ef63f..54fd36077d 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -37,13 +37,13 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode); ~CXFA_WidgetAcc(); - bool GetName(CFX_WideString& wsName, int32_t iNameType = 0); + bool GetName(WideString& wsName, int32_t iNameType = 0); bool ProcessValueChanged(); void ResetData(); - void SetImageEdit(const CFX_WideString& wsContentType, - const CFX_WideString& wsHref, - const CFX_WideString& wsData); + void SetImageEdit(const WideString& wsContentType, + const WideString& wsHref, + const WideString& wsData); CXFA_WidgetAcc* GetExclGroup(); CXFA_FFDocView* GetDocView(); @@ -92,8 +92,8 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { int32_t ProcessNullTestValidate(CXFA_Validate validate, int32_t iFlags, bool bVersionFlag); - CFX_WideString GetValidateCaptionName(bool bVersionFlag); - CFX_WideString GetValidateMessage(bool bError, bool bVersionFlag); + WideString GetValidateCaptionName(bool bVersionFlag); + WideString GetValidateMessage(bool bError, bool bVersionFlag); void CalcCaptionSize(CFX_SizeF& szCap); bool CalculateFieldAutoSize(CFX_SizeF& size); bool CalculateWidgetAutoSize(CFX_SizeF& size); diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp index f49d98ab61..6af7bb7445 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp @@ -338,8 +338,8 @@ const uint8_t g_sAltTable_Time[] = { static_assert(FX_ArraySize(g_sAltTable_Time) == L'a' - L'A' + 1, "Invalid g_sAltTable_Time size."); -void AlternateDateTimeSymbols(CFX_WideString& wsPattern, - const CFX_WideString& wsAltSymbols, +void AlternateDateTimeSymbols(WideString& wsPattern, + const WideString& wsAltSymbols, const uint8_t* pAltTable) { int32_t nLength = wsPattern.GetLength(); bool bInConstRange = false; @@ -368,9 +368,8 @@ void AlternateDateTimeSymbols(CFX_WideString& wsPattern, } } -bool PatternStringType(const CFX_ByteStringC& szPattern, - uint32_t& patternType) { - CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern); +bool PatternStringType(const ByteStringView& szPattern, uint32_t& patternType) { + WideString wsPattern = WideString::FromUTF8(szPattern); if (L"datetime" == wsPattern.Left(8)) { patternType = XFA_VT_DATETIME; return true; @@ -474,19 +473,19 @@ bool IsWhitespace(char c) { IFX_Locale* LocaleFromString(CXFA_Document* pDoc, CXFA_LocaleMgr* pMgr, - const CFX_ByteStringC& szLocale) { + const ByteStringView& szLocale) { if (!szLocale.IsEmpty()) - return pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale)); + return pMgr->GetLocaleByName(WideString::FromUTF8(szLocale)); CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); ASSERT(pThisNode); return CXFA_WidgetData(pThisNode).GetLocal(); } -CFX_WideString FormatFromString(IFX_Locale* pLocale, - const CFX_ByteStringC& szFormat) { +WideString FormatFromString(IFX_Locale* pLocale, + const ByteStringView& szFormat) { if (!szFormat.IsEmpty()) - return CFX_WideString::FromUTF8(szFormat); + return WideString::FromUTF8(szFormat); return pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default); } @@ -514,12 +513,12 @@ bool IsPartOfNumberW(wchar_t ch) { return std::iswdigit(ch) || ch == L'-' || ch == L'.'; } -CFX_ByteString GUIDString(bool bSeparator) { +ByteString GUIDString(bool bSeparator) { uint8_t data[16]; FX_Random_GenerateMT(reinterpret_cast<uint32_t*>(data), 4); data[6] = (data[6] & 0x0F) | 0x40; - CFX_ByteString bsStr; + ByteString bsStr; char* pBuf = bsStr.GetBuffer(40); for (int32_t i = 0; i < 16; ++i, pBuf += 2) { if (bSeparator && (i == 4 || i == 6 || i == 8 || i == 10)) @@ -535,7 +534,7 @@ CFX_ByteString GUIDString(bool bSeparator) { // static void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Abs"); @@ -557,7 +556,7 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1) { @@ -604,7 +603,7 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate); jsObjectValue->GetObjectProperty( - propertyValue->ToString().AsStringC(), newPropertyValue.get()); + propertyValue->ToString().AsStringView(), newPropertyValue.get()); if (newPropertyValue->IsNull()) continue; @@ -624,7 +623,7 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Ceil"); @@ -642,7 +641,7 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); @@ -678,7 +677,7 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, for (int32_t j = 2; j < iLength; j++) { argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); jsObjectValue->GetObjectProperty( - propertyValue->ToString().AsStringC(), newPropertyValue.get()); + propertyValue->ToString().AsStringView(), newPropertyValue.get()); iCount += newPropertyValue->IsNull() ? 0 : 1; } } @@ -696,7 +695,7 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Floor"); @@ -714,7 +713,7 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); @@ -754,7 +753,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, for (int32_t j = 2; j < iLength; j++) { argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); jsObjectValue->GetObjectProperty( - propertyValue->ToString().AsStringC(), newPropertyValue.get()); + propertyValue->ToString().AsStringView(), newPropertyValue.get()); if (newPropertyValue->IsNull()) continue; @@ -788,7 +787,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); @@ -828,7 +827,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, for (int32_t j = 2; j < iLength; j++) { argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); jsObjectValue->GetObjectProperty( - propertyValue->ToString().AsStringC(), newPropertyValue.get()); + propertyValue->ToString().AsStringView(), newPropertyValue.get()); if (newPropertyValue->IsNull()) continue; @@ -862,7 +861,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { @@ -897,7 +896,7 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); @@ -943,7 +942,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc == 0) { @@ -987,7 +986,7 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, for (int32_t j = 2; j < iLength; j++) { argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); jsObjectValue->GetObjectProperty( - propertyValue->ToString().AsStringC(), newPropertyValue.get()); + propertyValue->ToString().AsStringView(), newPropertyValue.get()); if (newPropertyValue->IsNull()) continue; @@ -1018,7 +1017,7 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 0) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Date"); @@ -1029,20 +1028,21 @@ void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, time(¤tTime); struct tm* pTmStruct = gmtime(¤tTime); - CFX_ByteString bufferYear; - CFX_ByteString bufferMon; - CFX_ByteString bufferDay; + ByteString bufferYear; + ByteString bufferMon; + ByteString bufferDay; bufferYear.Format("%d", pTmStruct->tm_year + 1900); bufferMon.Format("%02d", pTmStruct->tm_mon + 1); bufferDay.Format("%02d", pTmStruct->tm_mday); - CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; - args.GetReturnValue()->SetInteger(DateString2Num(bufferCurrent.AsStringC())); + ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; + args.GetReturnValue()->SetInteger( + DateString2Num(bufferCurrent.AsStringView())); } // static void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { @@ -1056,8 +1056,8 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, return; } - CFX_ByteString dateString = ValueToUTF8String(dateValue.get()); - CFX_ByteString formatString; + ByteString dateString = ValueToUTF8String(dateValue.get()); + ByteString formatString; if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, formatValue.get())) { @@ -1067,7 +1067,7 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, formatString = ValueToUTF8String(formatValue.get()); } - CFX_ByteString localString; + ByteString localString; if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, localValue.get())) { @@ -1077,16 +1077,16 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, localString = ValueToUTF8String(localValue.get()); } - CFX_ByteString szIsoDateString = - Local2IsoDate(pThis, dateString.AsStringC(), formatString.AsStringC(), - localString.AsStringC()); + ByteString szIsoDateString = + Local2IsoDate(pThis, dateString.AsStringView(), + formatString.AsStringView(), localString.AsStringView()); args.GetReturnValue()->SetInteger( - DateString2Num(szIsoDateString.AsStringC())); + DateString2Num(szIsoDateString.AsStringView())); } // static void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { @@ -1107,7 +1107,7 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, iStyle = 0; } - CFX_ByteString szLocal; + ByteString szLocal; if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (argLocal->IsNull()) { @@ -1117,14 +1117,14 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, szLocal = ValueToUTF8String(argLocal.get()); } - CFX_ByteString formatStr = - GetStandardDateFormat(pThis, iStyle, szLocal.AsStringC()); - args.GetReturnValue()->SetString(formatStr.AsStringC()); + ByteString formatStr = + GetStandardDateFormat(pThis, iStyle, szLocal.AsStringView()); + args.GetReturnValue()->SetString(formatStr.AsStringView()); } // static void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr) @@ -1136,13 +1136,13 @@ void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, args.GetReturnValue()->SetNull(); return; } - CFX_ByteString szArgString = ValueToUTF8String(argOne.get()); - args.GetReturnValue()->SetInteger(DateString2Num(szArgString.AsStringC())); + ByteString szArgString = ValueToUTF8String(argOne.get()); + args.GetReturnValue()->SetInteger(DateString2Num(szArgString.AsStringView())); } // static void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { @@ -1158,7 +1158,7 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, CXFA_Document* pDoc = pContext->GetDocument(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); - CFX_ByteString szArgString = ValueToUTF8String(argOne.get()); + ByteString szArgString = ValueToUTF8String(argOne.get()); auto pos = szArgString.Find('T', 0); if (!pos.has_value() || pos.value() == szArgString.GetLength() - 1) { args.GetReturnValue()->SetInteger(0); @@ -1167,7 +1167,7 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, szArgString = szArgString.Right(szArgString.GetLength() - (pos.value() + 1)); CXFA_LocaleValue timeValue( - XFA_VT_TIME, CFX_WideString::FromUTF8(szArgString.AsStringC()), pMgr); + XFA_VT_TIME, WideString::FromUTF8(szArgString.AsStringView()), pMgr); if (!timeValue.IsValid()) { args.GetReturnValue()->SetInteger(0); return; @@ -1196,7 +1196,7 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { @@ -1217,7 +1217,7 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, iStyle = 0; } - CFX_ByteString szLocal; + ByteString szLocal; if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (argLocal->IsNull()) { @@ -1227,14 +1227,14 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, szLocal = ValueToUTF8String(argLocal.get()); } - CFX_ByteString formatStr = - GetLocalDateFormat(pThis, iStyle, szLocal.AsStringC(), false); - args.GetReturnValue()->SetString(formatStr.AsStringC()); + ByteString formatStr = + GetLocalDateFormat(pThis, iStyle, szLocal.AsStringView(), false); + args.GetReturnValue()->SetString(formatStr.AsStringView()); } // static void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { @@ -1255,7 +1255,7 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, iStyle = 0; } - CFX_ByteString szLocal; + ByteString szLocal; if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (argLocal->IsNull()) { @@ -1265,14 +1265,14 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, szLocal = ValueToUTF8String(argLocal.get()); } - CFX_ByteString formatStr = - GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringC(), false); - args.GetReturnValue()->SetString(formatStr.AsStringC()); + ByteString formatStr = + GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringView(), false); + args.GetReturnValue()->SetString(formatStr.AsStringView()); } // static void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { @@ -1291,7 +1291,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, return; } - CFX_ByteString formatString; + ByteString formatString; if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, formatValue.get())) { @@ -1301,7 +1301,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, formatString = ValueToUTF8String(formatValue.get()); } - CFX_ByteString localString; + ByteString localString; if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, localValue.get())) { @@ -1403,17 +1403,17 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, } } - CFX_ByteString szIsoDateString; + ByteString szIsoDateString; szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay); - CFX_ByteString szLocalDateString = - IsoDate2Local(pThis, szIsoDateString.AsStringC(), - formatString.AsStringC(), localString.AsStringC()); - args.GetReturnValue()->SetString(szLocalDateString.AsStringC()); + ByteString szLocalDateString = + IsoDate2Local(pThis, szIsoDateString.AsStringView(), + formatString.AsStringView(), localString.AsStringView()); + args.GetReturnValue()->SetString(szLocalDateString.AsStringView()); } // static void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { @@ -1433,7 +1433,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, return; } - CFX_ByteString formatString; + ByteString formatString; if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (formatValue->IsNull()) { @@ -1443,7 +1443,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, formatString = ValueToUTF8String(formatValue.get()); } - CFX_ByteString localString; + ByteString localString; if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (localValue->IsNull()) { @@ -1453,14 +1453,15 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, localString = ValueToUTF8String(localValue.get()); } - CFX_ByteString szGMTTimeString = Num2AllTime( - pThis, iTime, formatString.AsStringC(), localString.AsStringC(), true); - args.GetReturnValue()->SetString(szGMTTimeString.AsStringC()); + ByteString szGMTTimeString = + Num2AllTime(pThis, iTime, formatString.AsStringView(), + localString.AsStringView(), true); + args.GetReturnValue()->SetString(szGMTTimeString.AsStringView()); } // static void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { @@ -1479,7 +1480,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, return; } - CFX_ByteString formatString; + ByteString formatString; if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (formatValue->IsNull()) { @@ -1489,7 +1490,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, formatString = ValueToUTF8String(formatValue.get()); } - CFX_ByteString localString; + ByteString localString; if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (localValue->IsNull()) { @@ -1499,15 +1500,15 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, localString = ValueToUTF8String(localValue.get()); } - CFX_ByteString szLocalTimeString = - Num2AllTime(pThis, static_cast<int32_t>(fTime), formatString.AsStringC(), - localString.AsStringC(), false); - args.GetReturnValue()->SetString(szLocalTimeString.AsStringC()); + ByteString szLocalTimeString = Num2AllTime(pThis, static_cast<int32_t>(fTime), + formatString.AsStringView(), + localString.AsStringView(), false); + args.GetReturnValue()->SetString(szLocalTimeString.AsStringView()); } // static void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 0) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Time"); @@ -1524,7 +1525,7 @@ void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { @@ -1532,7 +1533,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, return; } - CFX_ByteString timeString; + ByteString timeString; std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, timeValue.get())) { args.GetReturnValue()->SetNull(); @@ -1540,7 +1541,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, } timeString = ValueToUTF8String(timeValue.get()); - CFX_ByteString formatString; + ByteString formatString; if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, formatValue.get())) { @@ -1550,7 +1551,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, formatString = ValueToUTF8String(formatValue.get()); } - CFX_ByteString localString; + ByteString localString; if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, localValue.get())) { @@ -1569,19 +1570,19 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, CXFA_WidgetData widgetData(pThisNode); pLocale = widgetData.GetLocal(); } else { - pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(localString.AsStringC())); + pLocale = + pMgr->GetLocaleByName(WideString::FromUTF8(localString.AsStringView())); } - CFX_WideString wsFormat; + WideString wsFormat; if (formatString.IsEmpty()) wsFormat = pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default); else - wsFormat = CFX_WideString::FromUTF8(formatString.AsStringC()); + wsFormat = WideString::FromUTF8(formatString.AsStringView()); wsFormat = L"time{" + wsFormat + L"}"; CXFA_LocaleValue localeValue(XFA_VT_TIME, - CFX_WideString::FromUTF8(timeString.AsStringC()), + WideString::FromUTF8(timeString.AsStringView()), wsFormat, pLocale, pMgr); if (!localeValue.IsValid()) { args.GetReturnValue()->SetInteger(0); @@ -1610,7 +1611,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { @@ -1630,7 +1631,7 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, iStyle = 0; } - CFX_ByteString szLocal; + ByteString szLocal; if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (argLocal->IsNull()) { @@ -1640,9 +1641,9 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, szLocal = ValueToUTF8String(argLocal.get()); } - CFX_ByteString formatStr = - GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringC()); - args.GetReturnValue()->SetString(formatStr.AsStringC()); + ByteString formatStr = + GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringView()); + args.GetReturnValue()->SetString(formatStr.AsStringView()); } // static @@ -1913,80 +1914,75 @@ bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const char* pData, } // static -CFX_ByteString CXFA_FM2JSContext::Local2IsoDate( - CFXJSE_Value* pThis, - const CFX_ByteStringC& szDate, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale) { +ByteString CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis, + const ByteStringView& szDate, + const ByteStringView& szFormat, + const ByteStringView& szLocale) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) - return CFX_ByteString(); + return ByteString(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale); if (!pLocale) - return CFX_ByteString(); + return ByteString(); - CFX_WideString wsFormat = FormatFromString(pLocale, szFormat); - CFX_DateTime dt = - CXFA_LocaleValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), wsFormat, - pLocale, pMgr) - .GetDate(); + WideString wsFormat = FormatFromString(pLocale, szFormat); + CFX_DateTime dt = CXFA_LocaleValue(XFA_VT_DATE, WideString::FromUTF8(szDate), + wsFormat, pLocale, pMgr) + .GetDate(); - CFX_ByteString strIsoDate; + ByteString strIsoDate; strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay()); return strIsoDate; } // static -CFX_ByteString CXFA_FM2JSContext::IsoDate2Local( - CFXJSE_Value* pThis, - const CFX_ByteStringC& szDate, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale) { +ByteString CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis, + const ByteStringView& szDate, + const ByteStringView& szFormat, + const ByteStringView& szLocale) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) - return CFX_ByteString(); + return ByteString(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale); if (!pLocale) - return CFX_ByteString(); + return ByteString(); - CFX_WideString wsFormat = FormatFromString(pLocale, szFormat); - CFX_WideString wsRet; - CXFA_LocaleValue(XFA_VT_DATE, CFX_WideString::FromUTF8(szDate), pMgr) + WideString wsFormat = FormatFromString(pLocale, szFormat); + WideString wsRet; + CXFA_LocaleValue(XFA_VT_DATE, WideString::FromUTF8(szDate), pMgr) .FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display); return wsRet.UTF8Encode(); } // static -CFX_ByteString CXFA_FM2JSContext::IsoTime2Local( - CFXJSE_Value* pThis, - const CFX_ByteStringC& szTime, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale) { +ByteString CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis, + const ByteStringView& szTime, + const ByteStringView& szFormat, + const ByteStringView& szLocale) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) - return CFX_ByteString(); + return ByteString(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale); if (!pLocale) - return CFX_ByteString(); + return ByteString(); - CFX_WideString wsFormat = { - L"time{", FormatFromString(pLocale, szFormat).AsStringC(), L"}"}; - CXFA_LocaleValue widgetValue(XFA_VT_TIME, CFX_WideString::FromUTF8(szTime), - pMgr); - CFX_WideString wsRet; + WideString wsFormat = { + L"time{", FormatFromString(pLocale, szFormat).AsStringView(), L"}"}; + CXFA_LocaleValue widgetValue(XFA_VT_TIME, WideString::FromUTF8(szTime), pMgr); + WideString wsRet; widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display); return wsRet.UTF8Encode(); } // static -int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) { +int32_t CXFA_FM2JSContext::DateString2Num(const ByteStringView& szDateString) { int32_t iLength = szDateString.GetLength(); int32_t iYear = 0; int32_t iMonth = 0; @@ -2043,21 +2039,20 @@ int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) { } // static -CFX_ByteString CXFA_FM2JSContext::GetLocalDateFormat( - CFXJSE_Value* pThis, - int32_t iStyle, - const CFX_ByteStringC& szLocale, - bool bStandard) { +ByteString CXFA_FM2JSContext::GetLocalDateFormat(CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocale, + bool bStandard) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) - return CFX_ByteString(); + return ByteString(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale); if (!pLocale) - return CFX_ByteString(); + return ByteString(); - CFX_WideString strRet = pLocale->GetDatePattern(SubCategoryFromInt(iStyle)); + WideString strRet = pLocale->GetDatePattern(SubCategoryFromInt(iStyle)); if (!bStandard) { AlternateDateTimeSymbols(strRet, pLocale->GetDateTimeSymbols(), g_sAltTable_Date); @@ -2066,21 +2061,20 @@ CFX_ByteString CXFA_FM2JSContext::GetLocalDateFormat( } // static -CFX_ByteString CXFA_FM2JSContext::GetLocalTimeFormat( - CFXJSE_Value* pThis, - int32_t iStyle, - const CFX_ByteStringC& szLocale, - bool bStandard) { +ByteString CXFA_FM2JSContext::GetLocalTimeFormat(CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocale, + bool bStandard) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) - return CFX_ByteString(); + return ByteString(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); IFX_Locale* pLocale = LocaleFromString(pDoc, pMgr, szLocale); if (!pLocale) - return CFX_ByteString(); + return ByteString(); - CFX_WideString strRet = pLocale->GetTimePattern(SubCategoryFromInt(iStyle)); + WideString strRet = pLocale->GetTimePattern(SubCategoryFromInt(iStyle)); if (!bStandard) { AlternateDateTimeSymbols(strRet, pLocale->GetDateTimeSymbols(), g_sAltTable_Time); @@ -2089,27 +2083,27 @@ CFX_ByteString CXFA_FM2JSContext::GetLocalTimeFormat( } // static -CFX_ByteString CXFA_FM2JSContext::GetStandardDateFormat( +ByteString CXFA_FM2JSContext::GetStandardDateFormat( CFXJSE_Value* pThis, int32_t iStyle, - const CFX_ByteStringC& szLocalStr) { + const ByteStringView& szLocalStr) { return GetLocalDateFormat(pThis, iStyle, szLocalStr, true); } // static -CFX_ByteString CXFA_FM2JSContext::GetStandardTimeFormat( +ByteString CXFA_FM2JSContext::GetStandardTimeFormat( CFXJSE_Value* pThis, int32_t iStyle, - const CFX_ByteStringC& szLocalStr) { + const ByteStringView& szLocalStr) { return GetLocalTimeFormat(pThis, iStyle, szLocalStr, true); } // static -CFX_ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis, - int32_t iTime, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale, - bool bGM) { +ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis, + int32_t iTime, + const ByteStringView& szFormat, + const ByteStringView& szLocale, + bool bGM) { int32_t iHour = 0; int32_t iMin = 0; int32_t iSec = 0; @@ -2127,9 +2121,9 @@ CFX_ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis, iSec += iZoneSec; } - CFX_ByteString strIsoTime; + ByteString strIsoTime; strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec); - return IsoTime2Local(pThis, strIsoTime.AsStringC(), szFormat, szLocale); + return IsoTime2Local(pThis, strIsoTime.AsStringView(), szFormat, szLocale); } // static @@ -2148,7 +2142,7 @@ void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, // static void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { @@ -2201,7 +2195,7 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { @@ -2232,7 +2226,7 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { @@ -2273,7 +2267,7 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 5) { @@ -2330,7 +2324,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); @@ -2373,7 +2367,7 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { @@ -2408,7 +2402,7 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 5) { @@ -2466,7 +2460,7 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { @@ -2501,7 +2495,7 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { @@ -2532,7 +2526,7 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { @@ -2563,7 +2557,7 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); @@ -2610,17 +2604,17 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); } else { jsObjectValue->GetObjectProperty( - propertyValue->ToString().AsStringC(), newPropertyValue.get()); + propertyValue->ToString().AsStringView(), newPropertyValue.get()); } - CFX_ByteString bsChosen = ValueToUTF8String(newPropertyValue.get()); - args.GetReturnValue()->SetString(bsChosen.AsStringC()); + ByteString bsChosen = ValueToUTF8String(newPropertyValue.get()); + args.GetReturnValue()->SetString(bsChosen.AsStringView()); bFound = true; } } else { iValueIndex++; if (iValueIndex == iIndex) { - CFX_ByteString bsChosen = ValueToUTF8String(argIndexValue.get()); - args.GetReturnValue()->SetString(bsChosen.AsStringC()); + ByteString bsChosen = ValueToUTF8String(argIndexValue.get()); + args.GetReturnValue()->SetString(bsChosen.AsStringView()); bFound = true; } } @@ -2632,7 +2626,7 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Exists"); @@ -2643,7 +2637,7 @@ void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"HasValue"); @@ -2657,14 +2651,14 @@ void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, return; } - CFX_ByteString valueStr = argOne->ToString(); + ByteString valueStr = argOne->ToString(); valueStr.TrimLeft(); args.GetReturnValue()->SetInteger(!valueStr.IsEmpty()); } // static void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() < 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Oneof"); @@ -2687,7 +2681,7 @@ void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Within"); @@ -2711,17 +2705,17 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, return; } - CFX_ByteString oneString = ValueToUTF8String(argOne.get()); - CFX_ByteString lowString = ValueToUTF8String(argLow.get()); - CFX_ByteString heightString = ValueToUTF8String(argHigh.get()); + ByteString oneString = ValueToUTF8String(argOne.get()); + ByteString lowString = ValueToUTF8String(argLow.get()); + ByteString heightString = ValueToUTF8String(argHigh.get()); args.GetReturnValue()->SetInteger( - (oneString.Compare(lowString.AsStringC()) >= 0) && - (oneString.Compare(heightString.AsStringC()) <= 0)); + (oneString.Compare(lowString.AsStringView()) >= 0) && + (oneString.Compare(heightString.AsStringView()) <= 0)); } // static void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"If"); @@ -2735,7 +2729,7 @@ void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { @@ -2745,7 +2739,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, v8::Isolate* pIsolate = pContext->GetScriptRuntime(); std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0); - CFX_ByteString utf8ScriptString = ValueToUTF8String(scriptValue.get()); + ByteString utf8ScriptString = ValueToUTF8String(scriptValue.get()); if (utf8ScriptString.IsEmpty()) { args.GetReturnValue()->SetNull(); return; @@ -2753,7 +2747,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, CFX_WideTextBuf wsJavaScriptBuf; if (!CXFA_FM2JSContext::Translate( - CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), + WideString::FromUTF8(utf8ScriptString.AsStringView()).AsStringView(), &wsJavaScriptBuf)) { pContext->ThrowCompilerErrorException(); return; @@ -2763,15 +2757,15 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, CFXJSE_Context::Create(pIsolate, nullptr, nullptr)); auto returnValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate); - pNewContext->ExecuteScript(FX_UTF8Encode(wsJavaScriptBuf.AsStringC()).c_str(), - returnValue.get()); + pNewContext->ExecuteScript( + FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).c_str(), returnValue.get()); args.GetReturnValue()->Assign(returnValue.get()); } // static void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); @@ -2829,7 +2823,7 @@ void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"UnitType"); @@ -2842,7 +2836,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, return; } - CFX_ByteString unitspanString = ValueToUTF8String(unitspanValue.get()); + ByteString unitspanString = ValueToUTF8String(unitspanValue.get()); if (unitspanString.IsEmpty()) { args.GetReturnValue()->SetString("in"); return; @@ -2860,8 +2854,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, VALUETYPE_ISIN, }; unitspanString.MakeLower(); - CFX_WideString wsTypeString = - CFX_WideString::FromUTF8(unitspanString.AsStringC()); + WideString wsTypeString = WideString::FromUTF8(unitspanString.AsStringView()); const wchar_t* pData = wsTypeString.c_str(); int32_t u = 0; int32_t uLen = wsTypeString.GetLength(); @@ -2937,7 +2930,7 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { @@ -2951,7 +2944,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, return; } - CFX_ByteString unitspanString = ValueToUTF8String(unitspanValue.get()); + ByteString unitspanString = ValueToUTF8String(unitspanValue.get()); const char* pData = unitspanString.c_str(); if (!pData) { args.GetReturnValue()->SetInteger(0); @@ -2974,7 +2967,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, ++u; FX_STRSIZE uLen = unitspanString.GetLength(); - CFX_ByteString strFirstUnit; + ByteString strFirstUnit; while (u < uLen) { if (pData[u] == ' ') break; @@ -2984,10 +2977,10 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, } strFirstUnit.MakeLower(); - CFX_ByteString strUnit; + ByteString strUnit; if (argc > 1) { std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, args, 1); - CFX_ByteString unitTempString = ValueToUTF8String(unitValue.get()); + ByteString unitTempString = ValueToUTF8String(unitValue.get()); const char* pChar = unitTempString.c_str(); FX_STRSIZE uVal = 0; while (IsWhitespace(pChar[uVal])) @@ -3076,7 +3069,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"At"); @@ -3090,20 +3083,20 @@ void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, return; } - CFX_ByteString stringTwo = ValueToUTF8String(argTwo.get()); + ByteString stringTwo = ValueToUTF8String(argTwo.get()); if (stringTwo.IsEmpty()) { args.GetReturnValue()->SetInteger(1); return; } - CFX_ByteString stringOne = ValueToUTF8String(argOne.get()); - auto pos = stringOne.Find(stringTwo.AsStringC()); + ByteString stringOne = ValueToUTF8String(argOne.get()); + auto pos = stringOne.Find(stringTwo.AsStringView()); args.GetReturnValue()->SetInteger(pos.has_value() ? pos.value() + 1 : 0); } // static void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1) { @@ -3111,7 +3104,7 @@ void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, return; } - CFX_ByteString resultString; + ByteString resultString; bool bAllNull = true; for (int32_t i = 0; i < argc; i++) { std::unique_ptr<CFXJSE_Value> value = GetSimpleValue(pThis, args, i); @@ -3127,12 +3120,12 @@ void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, return; } - args.GetReturnValue()->SetString(resultString.AsStringC()); + args.GetReturnValue()->SetString(resultString.AsStringView()); } // static void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { @@ -3147,11 +3140,11 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, return; } - CFX_WideString decoded = DecodeURL( - CFX_WideString::FromUTF8(ValueToUTF8String(argOne.get()).AsStringC())); + WideString decoded = DecodeURL( + WideString::FromUTF8(ValueToUTF8String(argOne.get()).AsStringView())); args.GetReturnValue()->SetString( - FX_UTF8Encode(decoded.AsStringC()).AsStringC()); + FX_UTF8Encode(decoded.AsStringView()).AsStringView()); return; } @@ -3162,12 +3155,12 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, return; } - CFX_ByteString toDecodeString = ValueToUTF8String(argOne.get()); - CFX_ByteString identifyString = ValueToUTF8String(argTwo.get()); - CFX_WideString decoded; + ByteString toDecodeString = ValueToUTF8String(argOne.get()); + ByteString identifyString = ValueToUTF8String(argTwo.get()); + WideString decoded; - CFX_WideString toDecodeWideString = - CFX_WideString::FromUTF8(toDecodeString.AsStringC()); + WideString toDecodeWideString = + WideString::FromUTF8(toDecodeString.AsStringView()); if (identifyString.EqualNoCase("html")) decoded = DecodeHTML(toDecodeWideString); @@ -3177,11 +3170,11 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, decoded = DecodeURL(toDecodeWideString); args.GetReturnValue()->SetString( - FX_UTF8Encode(decoded.AsStringC()).AsStringC()); + FX_UTF8Encode(decoded.AsStringView()).AsStringView()); } // static -CFX_WideString CXFA_FM2JSContext::DecodeURL(const CFX_WideString& wsURLString) { +WideString CXFA_FM2JSContext::DecodeURL(const WideString& wsURLString) { const wchar_t* pData = wsURLString.c_str(); FX_STRSIZE i = 0; CFX_WideTextBuf wsResultBuf; @@ -3206,7 +3199,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeURL(const CFX_WideString& wsURLString) { } else if (ch <= 'f' && ch >= 'a') { chTemp += (ch - 'a' + 10) * (!iCount ? 16 : 1); } else { - return CFX_WideString(); + return WideString(); } ++iCount; } @@ -3218,8 +3211,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeURL(const CFX_WideString& wsURLString) { } // static -CFX_WideString CXFA_FM2JSContext::DecodeHTML( - const CFX_WideString& wsHTMLString) { +WideString CXFA_FM2JSContext::DecodeHTML(const WideString& wsHTMLString) { wchar_t strString[9]; FX_STRSIZE iStrIndex = 0; FX_STRSIZE iLen = wsHTMLString.GetLength(); @@ -3241,7 +3233,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeHTML( ++i; ch = pData[i]; if (ch != 'x' && ch != 'X') { - return CFX_WideString(); + return WideString(); } ++i; @@ -3256,7 +3248,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeHTML( } else if (ch <= 'F' && ch >= 'A') { iCode += ch - 'A' + 10; } else { - return CFX_WideString(); + return WideString(); } ++i; // TODO(dsinclair): Postmultiply seems wrong, start at zero @@ -3290,7 +3282,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeHTML( } // static -CFX_WideString CXFA_FM2JSContext::DecodeXML(const CFX_WideString& wsXMLString) { +WideString CXFA_FM2JSContext::DecodeXML(const WideString& wsXMLString) { wchar_t strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsXMLString.GetLength(); @@ -3315,7 +3307,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeXML(const CFX_WideString& wsXMLString) { ++i; ch = pData[i]; if (ch != 'x' && ch != 'X') { - return CFX_WideString(); + return WideString(); } ++i; @@ -3330,7 +3322,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeXML(const CFX_WideString& wsXMLString) { } else if (ch <= 'F' && ch >= 'A') { iCode += ch - 'A' + 10; } else { - return CFX_WideString(); + return WideString(); } ++i; iCode *= 16; @@ -3387,7 +3379,7 @@ CFX_WideString CXFA_FM2JSContext::DecodeXML(const CFX_WideString& wsXMLString) { // static void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { @@ -3402,9 +3394,9 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, return; } - CFX_WideString encoded = EncodeURL(ValueToUTF8String(argOne.get())); + WideString encoded = EncodeURL(ValueToUTF8String(argOne.get())); args.GetReturnValue()->SetString( - FX_UTF8Encode(encoded.AsStringC()).AsStringC()); + FX_UTF8Encode(encoded.AsStringView()).AsStringView()); return; } @@ -3415,9 +3407,9 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, return; } - CFX_ByteString toEncodeString = ValueToUTF8String(argOne.get()); - CFX_ByteString identifyString = ValueToUTF8String(argTwo.get()); - CFX_WideString encoded; + ByteString toEncodeString = ValueToUTF8String(argOne.get()); + ByteString identifyString = ValueToUTF8String(argTwo.get()); + WideString encoded; if (identifyString.EqualNoCase("html")) encoded = EncodeHTML(toEncodeString); else if (identifyString.EqualNoCase("xml")) @@ -3426,13 +3418,12 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, encoded = EncodeURL(toEncodeString); args.GetReturnValue()->SetString( - FX_UTF8Encode(encoded.AsStringC()).AsStringC()); + FX_UTF8Encode(encoded.AsStringView()).AsStringView()); } // static -CFX_WideString CXFA_FM2JSContext::EncodeURL(const CFX_ByteString& szURLString) { - CFX_WideString wsURLString = - CFX_WideString::FromUTF8(szURLString.AsStringC()); +WideString CXFA_FM2JSContext::EncodeURL(const ByteString& szURLString) { + WideString wsURLString = WideString::FromUTF8(szURLString.AsStringView()); CFX_WideTextBuf wsResultBuf; wchar_t strEncode[4]; strEncode[0] = '%'; @@ -3494,7 +3485,7 @@ CFX_WideString CXFA_FM2JSContext::EncodeURL(const CFX_ByteString& szURLString) { wsResultBuf.AppendChar(ch); } else { const wchar_t iRadix = 16; - CFX_WideString strTmp; + WideString strTmp; while (ch >= iRadix) { wchar_t tmp = strCode[ch % iRadix]; ch /= iRadix; @@ -3529,10 +3520,8 @@ CFX_WideString CXFA_FM2JSContext::EncodeURL(const CFX_ByteString& szURLString) { } // static -CFX_WideString CXFA_FM2JSContext::EncodeHTML( - const CFX_ByteString& szHTMLString) { - CFX_WideString wsHTMLString = - CFX_WideString::FromUTF8(szHTMLString.AsStringC()); +WideString CXFA_FM2JSContext::EncodeHTML(const ByteString& szHTMLString) { + WideString wsHTMLString = WideString::FromUTF8(szHTMLString.AsStringView()); const wchar_t* strCode = L"0123456789abcdef"; wchar_t strEncode[9]; strEncode[0] = '&'; @@ -3548,7 +3537,7 @@ CFX_WideString CXFA_FM2JSContext::EncodeHTML( const wchar_t* pData = wsHTMLString.c_str(); while (i < iLen) { uint32_t ch = pData[i]; - CFX_WideString htmlReserve; + WideString htmlReserve; if (HTMLCode2STR(ch, &htmlReserve)) { wsResultBuf.AppendChar(L'&'); wsResultBuf << htmlReserve; @@ -3578,9 +3567,8 @@ CFX_WideString CXFA_FM2JSContext::EncodeHTML( } // static -CFX_WideString CXFA_FM2JSContext::EncodeXML(const CFX_ByteString& szXMLString) { - CFX_WideString wsXMLString = - CFX_WideString::FromUTF8(szXMLString.AsStringC()); +WideString CXFA_FM2JSContext::EncodeXML(const ByteString& szXMLString) { + WideString wsXMLString = WideString::FromUTF8(szXMLString.AsStringView()); CFX_WideTextBuf wsResultBuf; wchar_t strEncode[9]; strEncode[0] = '&'; @@ -3595,27 +3583,27 @@ CFX_WideString CXFA_FM2JSContext::EncodeXML(const CFX_ByteString& szXMLString) { switch (ch) { case '"': wsResultBuf.AppendChar('&'); - wsResultBuf << CFX_WideStringC(L"quot"); + wsResultBuf << WideStringView(L"quot"); wsResultBuf.AppendChar(';'); break; case '&': wsResultBuf.AppendChar('&'); - wsResultBuf << CFX_WideStringC(L"amp"); + wsResultBuf << WideStringView(L"amp"); wsResultBuf.AppendChar(';'); break; case '\'': wsResultBuf.AppendChar('&'); - wsResultBuf << CFX_WideStringC(L"apos"); + wsResultBuf << WideStringView(L"apos"); wsResultBuf.AppendChar(';'); break; case '<': wsResultBuf.AppendChar('&'); - wsResultBuf << CFX_WideStringC(L"lt"); + wsResultBuf << WideStringView(L"lt"); wsResultBuf.AppendChar(';'); break; case '>': wsResultBuf.AppendChar('&'); - wsResultBuf << CFX_WideStringC(L"gt"); + wsResultBuf << WideStringView(L"gt"); wsResultBuf.AppendChar(';'); break; default: { @@ -3646,10 +3634,10 @@ CFX_WideString CXFA_FM2JSContext::EncodeXML(const CFX_ByteString& szXMLString) { } // static -bool CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, +bool CXFA_FM2JSContext::HTMLSTR2Code(const WideStringView& pData, uint32_t* iCode) { auto cmpFunc = [](const XFA_FMHtmlReserveCode& iter, - const CFX_WideStringC& val) { + const WideStringView& val) { // TODO(tsepez): check usage of c_str() below. return wcscmp(val.unterminated_c_str(), iter.m_htmlReserve) > 0; }; @@ -3666,7 +3654,7 @@ bool CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, // static bool CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode, - CFX_WideString* wsHTMLReserve) { + WideString* wsHTMLReserve) { auto cmpFunc = [](const XFA_FMHtmlReserveCode iter, const uint32_t& val) { return iter.m_uCode < val; }; @@ -3682,7 +3670,7 @@ bool CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode, // static void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() < 2) { @@ -3691,10 +3679,10 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, } std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); - CFX_ByteString szPattern = ValueToUTF8String(argOne.get()); + ByteString szPattern = ValueToUTF8String(argOne.get()); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); - CFX_ByteString szValue = ValueToUTF8String(argTwo.get()); + ByteString szValue = ValueToUTF8String(argTwo.get()); CXFA_Document* pDoc = pContext->GetDocument(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); @@ -3704,9 +3692,9 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, CXFA_WidgetData widgetData(pThisNode); IFX_Locale* pLocale = widgetData.GetLocal(); uint32_t patternType; - CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern.AsStringC()); - CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); - if (!PatternStringType(szPattern.AsStringC(), patternType)) { + WideString wsPattern = WideString::FromUTF8(szPattern.AsStringView()); + WideString wsValue = WideString::FromUTF8(szValue.AsStringView()); + if (!PatternStringType(szPattern.AsStringView(), patternType)) { switch (patternType) { case XFA_VT_DATETIME: { auto iTChar = wsPattern.Find(L'T'); @@ -3714,10 +3702,10 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, args.GetReturnValue()->SetString(""); return; } - CFX_WideString wsDatePattern(L"date{"); + WideString wsDatePattern(L"date{"); wsDatePattern += wsPattern.Left(iTChar.value()) + L"} "; - CFX_WideString wsTimePattern(L"time{"); + WideString wsTimePattern(L"time{"); wsTimePattern += wsPattern.Right(wsPattern.GetLength() - (iTChar.value() + 1)) + L"}"; @@ -3736,7 +3724,7 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, wsPattern = L"num{" + wsPattern + L"}"; } break; default: { - CFX_WideString wsTestPattern; + WideString wsTestPattern; wsTestPattern = L"num{" + wsPattern + L"}"; CXFA_LocaleValue tempLocaleValue(XFA_VT_FLOAT, wsValue, wsTestPattern, pLocale, pMgr); @@ -3752,19 +3740,19 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, } } CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, pMgr); - CFX_WideString wsRet; + WideString wsRet; if (!localeValue.FormatPatterns(wsRet, wsPattern, pLocale, XFA_VALUEPICTURE_Display)) { args.GetReturnValue()->SetString(""); return; } - args.GetReturnValue()->SetString(wsRet.UTF8Encode().AsStringC()); + args.GetReturnValue()->SetString(wsRet.UTF8Encode().AsStringView()); } // static void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Left"); @@ -3779,14 +3767,14 @@ void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, return; } - CFX_ByteString sourceString = ValueToUTF8String(argOne.get()); + ByteString sourceString = ValueToUTF8String(argOne.get()); int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get())); - args.GetReturnValue()->SetString(sourceString.Left(count).AsStringC()); + args.GetReturnValue()->SetString(sourceString.Left(count).AsStringView()); } // static void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Len"); @@ -3799,13 +3787,13 @@ void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, return; } - CFX_ByteString sourceString = ValueToUTF8String(argOne.get()); + ByteString sourceString = ValueToUTF8String(argOne.get()); args.GetReturnValue()->SetInteger(sourceString.GetLength()); } // static void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { @@ -3820,8 +3808,8 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, } CFX_WideTextBuf lowStringBuf; - CFX_ByteString argString = ValueToUTF8String(argOne.get()); - CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); + ByteString argString = ValueToUTF8String(argOne.get()); + WideString wsArgString = WideString::FromUTF8(argString.AsStringView()); const wchar_t* pData = wsArgString.c_str(); FX_STRSIZE i = 0; while (i < argString.GetLength()) { @@ -3837,12 +3825,12 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, lowStringBuf.AppendChar(0); args.GetReturnValue()->SetString( - FX_UTF8Encode(lowStringBuf.AsStringC()).AsStringC()); + FX_UTF8Encode(lowStringBuf.AsStringView()).AsStringView()); } // static void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Ltrim"); @@ -3855,14 +3843,14 @@ void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, return; } - CFX_ByteString sourceString = ValueToUTF8String(argOne.get()); + ByteString sourceString = ValueToUTF8String(argOne.get()); sourceString.TrimLeft(); - args.GetReturnValue()->SetString(sourceString.AsStringC()); + args.GetReturnValue()->SetString(sourceString.AsStringView()); } // static void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { @@ -3877,8 +3865,8 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } - CFX_ByteString szPattern = ValueToUTF8String(argOne.get()); - CFX_ByteString szValue = ValueToUTF8String(argTwo.get()); + ByteString szPattern = ValueToUTF8String(argOne.get()); + ByteString szValue = ValueToUTF8String(argTwo.get()); CXFA_Document* pDoc = pContext->GetDocument(); CXFA_LocaleMgr* pMgr = pDoc->GetLocalMgr(); CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); @@ -3886,10 +3874,10 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, CXFA_WidgetData widgetData(pThisNode); IFX_Locale* pLocale = widgetData.GetLocal(); - CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern.AsStringC()); - CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); + WideString wsPattern = WideString::FromUTF8(szPattern.AsStringView()); + WideString wsValue = WideString::FromUTF8(szValue.AsStringView()); uint32_t patternType; - if (PatternStringType(szPattern.AsStringC(), patternType)) { + if (PatternStringType(szPattern.AsStringView(), patternType)) { CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, pMgr); if (!localeValue.IsValid()) { @@ -3897,7 +3885,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } args.GetReturnValue()->SetString( - localeValue.GetValue().UTF8Encode().AsStringC()); + localeValue.GetValue().UTF8Encode().AsStringView()); return; } @@ -3908,9 +3896,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, args.GetReturnValue()->SetString(""); return; } - CFX_WideString wsDatePattern(L"date{" + wsPattern.Left(iTChar.value()) + - L"} "); - CFX_WideString wsTimePattern( + WideString wsDatePattern(L"date{" + wsPattern.Left(iTChar.value()) + + L"} "); + WideString wsTimePattern( L"time{" + wsPattern.Right(wsPattern.GetLength() - (iTChar.value() + 1)) + L"}"); wsPattern = wsDatePattern + wsTimePattern; @@ -3921,7 +3909,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } args.GetReturnValue()->SetString( - localeValue.GetValue().UTF8Encode().AsStringC()); + localeValue.GetValue().UTF8Encode().AsStringView()); return; } case XFA_VT_DATE: { @@ -3933,7 +3921,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } args.GetReturnValue()->SetString( - localeValue.GetValue().UTF8Encode().AsStringC()); + localeValue.GetValue().UTF8Encode().AsStringView()); return; } case XFA_VT_TIME: { @@ -3945,7 +3933,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } args.GetReturnValue()->SetString( - localeValue.GetValue().UTF8Encode().AsStringC()); + localeValue.GetValue().UTF8Encode().AsStringView()); return; } case XFA_VT_TEXT: { @@ -3957,7 +3945,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } args.GetReturnValue()->SetString( - localeValue.GetValue().UTF8Encode().AsStringC()); + localeValue.GetValue().UTF8Encode().AsStringView()); return; } case XFA_VT_FLOAT: { @@ -3972,7 +3960,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } default: { - CFX_WideString wsTestPattern; + WideString wsTestPattern; wsTestPattern = L"num{" + wsPattern + L"}"; CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsTestPattern, pLocale, pMgr); @@ -3989,7 +3977,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, return; } args.GetReturnValue()->SetString( - localeValue2.GetValue().UTF8Encode().AsStringC()); + localeValue2.GetValue().UTF8Encode().AsStringView()); return; } } @@ -3997,7 +3985,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 2 || argc > 3) { @@ -4007,14 +3995,14 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); - CFX_ByteString oneString; - CFX_ByteString twoString; + ByteString oneString; + ByteString twoString; if (!ValueIsNull(pThis, argOne.get()) && !ValueIsNull(pThis, argTwo.get())) { oneString = ValueToUTF8String(argOne.get()); twoString = ValueToUTF8String(argTwo.get()); } - CFX_ByteString threeString; + ByteString threeString; if (argc > 2) { std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); threeString = ValueToUTF8String(argThree.get()); @@ -4051,12 +4039,12 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, } } resultString << '\0'; - args.GetReturnValue()->SetString(CFX_ByteStringC(resultString.str().c_str())); + args.GetReturnValue()->SetString(ByteStringView(resultString.str().c_str())); } // static void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Right"); @@ -4071,14 +4059,14 @@ void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, return; } - CFX_ByteString sourceString = ValueToUTF8String(argOne.get()); + ByteString sourceString = ValueToUTF8String(argOne.get()); int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get())); - args.GetReturnValue()->SetString(sourceString.Right(count).AsStringC()); + args.GetReturnValue()->SetString(sourceString.Right(count).AsStringView()); } // static void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Rtrim"); @@ -4091,14 +4079,14 @@ void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, return; } - CFX_ByteString sourceString = ValueToUTF8String(argOne.get()); + ByteString sourceString = ValueToUTF8String(argOne.get()); sourceString.TrimRight(); - args.GetReturnValue()->SetString(sourceString.AsStringC()); + args.GetReturnValue()->SetString(sourceString.AsStringView()); } // static void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Space"); @@ -4119,12 +4107,12 @@ void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, index++; } spaceString << '\0'; - args.GetReturnValue()->SetString(CFX_ByteStringC(spaceString.str().c_str())); + args.GetReturnValue()->SetString(ByteStringView(spaceString.str().c_str())); } // static void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { @@ -4153,11 +4141,11 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, 0, static_cast<int32_t>(ValueToFloat(pThis, precisionValue.get()))); } - CFX_ByteString numberString; - CFX_ByteString formatStr = "%"; + ByteString numberString; + ByteString formatStr = "%"; if (iPrecision) { formatStr += "."; - formatStr += CFX_ByteString::FormatInteger(iPrecision); + formatStr += ByteString::FormatInteger(iPrecision); } formatStr += "f"; numberString.Format(formatStr.c_str(), fNumber); @@ -4180,7 +4168,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, ++i; } resultBuf << '\0'; - args.GetReturnValue()->SetString(CFX_ByteStringC(resultBuf.str().c_str())); + args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str())); return; } @@ -4199,7 +4187,7 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, } resultBuf << pData; } - args.GetReturnValue()->SetString(CFX_ByteStringC(resultBuf.str().c_str())); + args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str())); return; } @@ -4235,12 +4223,12 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, ++i; } resultBuf << '\0'; - args.GetReturnValue()->SetString(CFX_ByteStringC(resultBuf.str().c_str())); + args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str())); } // static void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 3 || argc > 4) { @@ -4248,8 +4236,8 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, return; } - CFX_ByteString sourceString; - CFX_ByteString insertString; + ByteString sourceString; + ByteString insertString; int32_t iLength = 0; int32_t iStart = 0; int32_t iDelete = 0; @@ -4279,19 +4267,19 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, resultString << static_cast<char>(sourceString[i]); ++i; } - resultString << insertString.AsStringC(); + resultString << insertString.AsStringView(); i = iStart + iDelete; while (i < iLength) { resultString << static_cast<char>(sourceString[i]); ++i; } resultString << '\0'; - args.GetReturnValue()->SetString(CFX_ByteStringC(resultString.str().c_str())); + args.GetReturnValue()->SetString(ByteStringView(resultString.str().c_str())); } // static void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Substr"); @@ -4310,7 +4298,7 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, int32_t iStart = 0; int32_t iCount = 0; - CFX_ByteString szSourceStr = ValueToUTF8String(stringValue.get()); + ByteString szSourceStr = ValueToUTF8String(stringValue.get()); int32_t iLength = szSourceStr.GetLength(); if (iLength == 0) { args.GetReturnValue()->SetString(""); @@ -4323,12 +4311,13 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, std::max(0, static_cast<int32_t>(ValueToFloat(pThis, endValue.get()))); iStart -= 1; - args.GetReturnValue()->SetString(szSourceStr.Mid(iStart, iCount).AsStringC()); + args.GetReturnValue()->SetString( + szSourceStr.Mid(iStart, iCount).AsStringView()); } // static void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 0 || argc > 1) { @@ -4341,12 +4330,12 @@ void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); iNum = static_cast<int32_t>(ValueToFloat(pThis, argOne.get())); } - args.GetReturnValue()->SetString(GUIDString(!!iNum).AsStringC()); + args.GetReturnValue()->SetString(GUIDString(!!iNum).AsStringView()); } // static void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { @@ -4361,8 +4350,8 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, } CFX_WideTextBuf upperStringBuf; - CFX_ByteString argString = ValueToUTF8String(argOne.get()); - CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); + ByteString argString = ValueToUTF8String(argOne.get()); + WideString wsArgString = WideString::FromUTF8(argString.AsStringView()); const wchar_t* pData = wsArgString.c_str(); FX_STRSIZE i = 0; while (i < wsArgString.GetLength()) { @@ -4378,12 +4367,12 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, upperStringBuf.AppendChar(0); args.GetReturnValue()->SetString( - FX_UTF8Encode(upperStringBuf.AsStringC()).AsStringC()); + FX_UTF8Encode(upperStringBuf.AsStringView()).AsStringView()); } // static void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { @@ -4410,7 +4399,7 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, static_cast<int32_t>(ValueToFloat(pThis, identifierValue.get())); } - CFX_ByteString localeString; + ByteString localeString; if (argc > 2) { std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2); if (localeValue->IsNull()) { @@ -4425,27 +4414,27 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, return; } - CFX_ByteString numberString; + ByteString numberString; numberString.Format("%.2f", fNumber); args.GetReturnValue()->SetString( - WordUS(numberString, iIdentifier).AsStringC()); + WordUS(numberString, iIdentifier).AsStringView()); } // static -CFX_ByteString CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData) { +ByteString CXFA_FM2JSContext::TrillionUS(const ByteStringView& szData) { std::ostringstream strBuf; - CFX_ByteStringC pUnits[] = {"zero", "one", "two", "three", "four", - "five", "six", "seven", "eight", "nine"}; - CFX_ByteStringC pCapUnits[] = {"Zero", "One", "Two", "Three", "Four", - "Five", "Six", "Seven", "Eight", "Nine"}; - CFX_ByteStringC pTens[] = {"Ten", "Eleven", "Twelve", "Thirteen", - "Fourteen", "Fifteen", "Sixteen", "Seventeen", - "Eighteen", "Nineteen"}; - CFX_ByteStringC pLastTens[] = {"Twenty", "Thirty", "Forty", "Fifty", - "Sixty", "Seventy", "Eighty", "Ninety"}; - CFX_ByteStringC pComm[] = {" Hundred ", " Thousand ", " Million ", - " Billion ", "Trillion"}; + ByteStringView pUnits[] = {"zero", "one", "two", "three", "four", + "five", "six", "seven", "eight", "nine"}; + ByteStringView pCapUnits[] = {"Zero", "One", "Two", "Three", "Four", + "Five", "Six", "Seven", "Eight", "Nine"}; + ByteStringView pTens[] = {"Ten", "Eleven", "Twelve", "Thirteen", + "Fourteen", "Fifteen", "Sixteen", "Seventeen", + "Eighteen", "Nineteen"}; + ByteStringView pLastTens[] = {"Twenty", "Thirty", "Forty", "Fifty", + "Sixty", "Seventy", "Eighty", "Ninety"}; + ByteStringView pComm[] = {" Hundred ", " Thousand ", " Million ", " Billion ", + "Trillion"}; const char* pData = szData.unterminated_c_str(); int32_t iLength = szData.GetLength(); int32_t iComm = 0; @@ -4529,16 +4518,15 @@ CFX_ByteString CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData) { } iIndex += 3; } - return CFX_ByteString(strBuf); + return ByteString(strBuf); } // static -CFX_ByteString CXFA_FM2JSContext::WordUS(const CFX_ByteString& szData, - int32_t iStyle) { +ByteString CXFA_FM2JSContext::WordUS(const ByteString& szData, int32_t iStyle) { const char* pData = szData.c_str(); int32_t iLength = szData.GetLength(); if (iStyle < 0 || iStyle > 2) { - return CFX_ByteString(); + return ByteString(); } std::ostringstream strBuf; @@ -4556,7 +4544,7 @@ CFX_ByteString CXFA_FM2JSContext::WordUS(const CFX_ByteString& szData, if (!iCount && iInteger - iIndex > 0) iCount = 12; - strBuf << TrillionUS(CFX_ByteStringC(pData + iIndex, iCount)); + strBuf << TrillionUS(ByteStringView(pData + iIndex, iCount)); iIndex += iCount; if (iIndex < iInteger) strBuf << " Trillion "; @@ -4573,19 +4561,19 @@ CFX_ByteString CXFA_FM2JSContext::WordUS(const CFX_ByteString& szData, if (!iCount && iLength - iIndex > 0) iCount = 12; - strBuf << TrillionUS(CFX_ByteStringC(pData + iIndex, iCount)); + strBuf << TrillionUS(ByteStringView(pData + iIndex, iCount)); iIndex += iCount; if (iIndex < iLength) strBuf << " Trillion "; } strBuf << " Cents"; } - return CFX_ByteString(strBuf); + return ByteString(strBuf); } // static void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { @@ -4602,21 +4590,21 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, return; std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); - CFX_ByteString urlString = ValueToUTF8String(argOne.get()); - CFX_RetainPtr<IFX_SeekableReadStream> pFile = pAppProvider->DownloadURL( - CFX_WideString::FromUTF8(urlString.AsStringC())); + ByteString urlString = ValueToUTF8String(argOne.get()); + CFX_RetainPtr<IFX_SeekableReadStream> pFile = + pAppProvider->DownloadURL(WideString::FromUTF8(urlString.AsStringView())); if (!pFile) return; int32_t size = pFile->GetSize(); std::vector<uint8_t> dataBuf(size); pFile->ReadBlock(dataBuf.data(), size); - args.GetReturnValue()->SetString(CFX_ByteStringC(dataBuf)); + args.GetReturnValue()->SetString(ByteStringView(dataBuf)); } // static void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); @@ -4634,45 +4622,45 @@ void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, return; std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); - CFX_ByteString bsURL = ValueToUTF8String(argOne.get()); + ByteString bsURL = ValueToUTF8String(argOne.get()); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); - CFX_ByteString bsData = ValueToUTF8String(argTwo.get()); + ByteString bsData = ValueToUTF8String(argTwo.get()); - CFX_ByteString bsContentType; + ByteString bsContentType; if (argc > 2) { std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); bsContentType = ValueToUTF8String(argThree.get()); } - CFX_ByteString bsEncode; + ByteString bsEncode; if (argc > 3) { std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, args, 3); bsEncode = ValueToUTF8String(argFour.get()); } - CFX_ByteString bsHeader; + ByteString bsHeader; if (argc > 4) { std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, args, 4); bsHeader = ValueToUTF8String(argFive.get()); } - CFX_WideString decodedResponse; + WideString decodedResponse; if (!pAppProvider->PostRequestURL( - CFX_WideString::FromUTF8(bsURL.AsStringC()), - CFX_WideString::FromUTF8(bsData.AsStringC()), - CFX_WideString::FromUTF8(bsContentType.AsStringC()), - CFX_WideString::FromUTF8(bsEncode.AsStringC()), - CFX_WideString::FromUTF8(bsHeader.AsStringC()), decodedResponse)) { + WideString::FromUTF8(bsURL.AsStringView()), + WideString::FromUTF8(bsData.AsStringView()), + WideString::FromUTF8(bsContentType.AsStringView()), + WideString::FromUTF8(bsEncode.AsStringView()), + WideString::FromUTF8(bsHeader.AsStringView()), decodedResponse)) { pContext->ThrowServerDeniedException(); return; } - args.GetReturnValue()->SetString(decodedResponse.UTF8Encode().AsStringC()); + args.GetReturnValue()->SetString(decodedResponse.UTF8Encode().AsStringView()); } // static void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); @@ -4690,21 +4678,21 @@ void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, return; std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); - CFX_ByteString bsURL = ValueToUTF8String(argOne.get()); + ByteString bsURL = ValueToUTF8String(argOne.get()); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); - CFX_ByteString bsData = ValueToUTF8String(argTwo.get()); + ByteString bsData = ValueToUTF8String(argTwo.get()); - CFX_ByteString bsEncode; + ByteString bsEncode; if (argc > 2) { std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); bsEncode = ValueToUTF8String(argThree.get()); } if (!pAppProvider->PutRequestURL( - CFX_WideString::FromUTF8(bsURL.AsStringC()), - CFX_WideString::FromUTF8(bsData.AsStringC()), - CFX_WideString::FromUTF8(bsEncode.AsStringC()))) { + WideString::FromUTF8(bsURL.AsStringView()), + WideString::FromUTF8(bsData.AsStringView()), + WideString::FromUTF8(bsEncode.AsStringView()))) { pContext->ThrowServerDeniedException(); return; } @@ -4714,7 +4702,7 @@ void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { @@ -4743,8 +4731,8 @@ void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, } else { for (int32_t i = 2; i < iLeftLength; i++) { lValue->GetObjectPropertyByIdx(i, jsObjectValue.get()); - jsObjectValue->SetObjectProperty(propertyValue->ToString().AsStringC(), - rValue.get()); + jsObjectValue->SetObjectProperty( + propertyValue->ToString().AsStringView(), rValue.get()); } } } else if (lValue->IsObject()) { @@ -4758,7 +4746,7 @@ void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4779,7 +4767,7 @@ void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4800,7 +4788,7 @@ void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4833,7 +4821,7 @@ void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4893,7 +4881,7 @@ bool CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4909,7 +4897,8 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, if (argFirst->IsString() && argSecond->IsString()) { args.GetReturnValue()->SetInteger( - argFirst->ToString().Compare(argSecond->ToString().AsStringC()) == -1); + argFirst->ToString().Compare(argSecond->ToString().AsStringView()) == + -1); return; } @@ -4920,7 +4909,7 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4937,7 +4926,8 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, if (argFirst->IsString() && argSecond->IsString()) { args.GetReturnValue()->SetInteger( - argFirst->ToString().Compare(argSecond->ToString().AsStringC()) != 1); + argFirst->ToString().Compare(argSecond->ToString().AsStringView()) != + 1); return; } @@ -4948,7 +4938,7 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4964,7 +4954,8 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, if (argFirst->IsString() && argSecond->IsString()) { args.GetReturnValue()->SetInteger( - argFirst->ToString().Compare(argSecond->ToString().AsStringC()) == 1); + argFirst->ToString().Compare(argSecond->ToString().AsStringView()) == + 1); return; } @@ -4975,7 +4966,7 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -4992,7 +4983,8 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, if (argFirst->IsString() && argSecond->IsString()) { args.GetReturnValue()->SetInteger( - argFirst->ToString().Compare(argSecond->ToString().AsStringC()) != -1); + argFirst->ToString().Compare(argSecond->ToString().AsStringView()) != + -1); return; } @@ -5003,7 +4995,7 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -5025,7 +5017,7 @@ void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -5046,7 +5038,7 @@ void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -5067,7 +5059,7 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { @@ -5094,7 +5086,7 @@ void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -5111,7 +5103,7 @@ void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -5128,7 +5120,7 @@ void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -5147,7 +5139,7 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); @@ -5164,9 +5156,9 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, iIndexValue = ValueToInteger(pThis, args.GetValue(4).get()); } - CFX_ByteString szName = args.GetUTF8String(2); - CFX_ByteString szSomExp = GenerateSomExpression( - szName.AsStringC(), args.GetInt32(3), iIndexValue, bIsStar); + ByteString szName = args.GetUTF8String(2); + ByteString szSomExp = GenerateSomExpression( + szName.AsStringView(), args.GetInt32(3), iIndexValue, bIsStar); std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); if (argAccessor->IsArray()) { @@ -5187,7 +5179,7 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get()); XFA_RESOLVENODE_RS resoveNodeRS; - if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(), + if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(), resoveNodeRS, true, szName.IsEmpty()) > 0) { ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(), &resolveValues[i - 2], &bAttribute); @@ -5196,8 +5188,8 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, } if (iCounter < 1) { pContext->ThrowPropertyNotInObjectException( - CFX_WideString::FromUTF8(szName.AsStringC()), - CFX_WideString::FromUTF8(szSomExp.AsStringC())); + WideString::FromUTF8(szName.AsStringView()), + WideString::FromUTF8(szSomExp.AsStringView())); return; } @@ -5207,7 +5199,7 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, values[0]->SetInteger(1); if (bAttribute) - values[1]->SetString(szName.AsStringC()); + values[1]->SetString(szName.AsStringView()); else values[1]->SetNull(); @@ -5224,21 +5216,21 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = 0; - CFX_ByteString bsAccessorName = args.GetUTF8String(1); + ByteString bsAccessorName = args.GetUTF8String(1); if (argAccessor->IsObject() || (argAccessor->IsNull() && bsAccessorName.IsEmpty())) { - iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(), + iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), resoveNodeRS, true, szName.IsEmpty()); } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() && GetObjectForName(pThis, argAccessor.get(), - bsAccessorName.AsStringC())) { - iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(), + bsAccessorName.AsStringView())) { + iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), resoveNodeRS, true, szName.IsEmpty()); } if (iRet < 1) { pContext->ThrowPropertyNotInObjectException( - CFX_WideString::FromUTF8(szName.AsStringC()), - CFX_WideString::FromUTF8(szSomExp.AsStringC())); + WideString::FromUTF8(szName.AsStringView()), + WideString::FromUTF8(szSomExp.AsStringView())); return; } @@ -5253,7 +5245,7 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, values[0]->SetInteger(1); if (bAttribute) - values[1]->SetString(szName.AsStringC()); + values[1]->SetString(szName.AsStringView()); else values[1]->SetNull(); @@ -5265,7 +5257,7 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); @@ -5282,9 +5274,9 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, iIndexValue = ValueToInteger(pThis, args.GetValue(4).get()); } - CFX_ByteString szName = args.GetUTF8String(2); - CFX_ByteString szSomExp = GenerateSomExpression( - szName.AsStringC(), args.GetInt32(3), iIndexValue, bIsStar); + ByteString szName = args.GetUTF8String(2); + ByteString szSomExp = GenerateSomExpression( + szName.AsStringView(), args.GetInt32(3), iIndexValue, bIsStar); std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); if (argAccessor->IsArray()) { @@ -5305,7 +5297,7 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, for (int32_t i = 2; i < iLength; i++) { argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get()); XFA_RESOLVENODE_RS resoveNodeRS; - if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(), + if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(), resoveNodeRS, false) > 0) { ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(), &resolveValues[i - 2], &bAttribute); @@ -5314,8 +5306,8 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, } if (iCounter < 1) { pContext->ThrowPropertyNotInObjectException( - CFX_WideString::FromUTF8(szName.AsStringC()), - CFX_WideString::FromUTF8(szSomExp.AsStringC())); + WideString::FromUTF8(szName.AsStringView()), + WideString::FromUTF8(szSomExp.AsStringView())); return; } @@ -5325,7 +5317,7 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, values[0]->SetInteger(1); if (bAttribute) - values[1]->SetString(szName.AsStringC()); + values[1]->SetString(szName.AsStringView()); else values[1]->SetNull(); @@ -5342,21 +5334,21 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = 0; - CFX_ByteString bsAccessorName = args.GetUTF8String(1); + ByteString bsAccessorName = args.GetUTF8String(1); if (argAccessor->IsObject() || (argAccessor->IsNull() && bsAccessorName.IsEmpty())) { - iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(), + iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), resoveNodeRS, false); } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() && GetObjectForName(pThis, argAccessor.get(), - bsAccessorName.AsStringC())) { - iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(), + bsAccessorName.AsStringView())) { + iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), resoveNodeRS, false); } if (iRet < 1) { pContext->ThrowPropertyNotInObjectException( - CFX_WideString::FromUTF8(szName.AsStringC()), - CFX_WideString::FromUTF8(szSomExp.AsStringC())); + WideString::FromUTF8(szName.AsStringView()), + WideString::FromUTF8(szSomExp.AsStringView())); return; } @@ -5371,7 +5363,7 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, values[0]->SetInteger(1); if (bAttribute) - values[1]->SetString(szName.AsStringC()); + values[1]->SetString(szName.AsStringView()); else values[1]->SetNull(); @@ -5383,7 +5375,7 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { @@ -5392,27 +5384,27 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, } std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); - CFX_ByteString argString = ValueToUTF8String(argOne.get()); + ByteString argString = ValueToUTF8String(argOne.get()); if (argString.IsEmpty()) { pContext->ThrowArgumentMismatchException(); return; } - CFX_WideString scriptString = CFX_WideString::FromUTF8(argString.AsStringC()); + WideString scriptString = WideString::FromUTF8(argString.AsStringView()); CFX_WideTextBuf wsJavaScriptBuf; - if (!CXFA_FM2JSContext::Translate(scriptString.AsStringC(), + if (!CXFA_FM2JSContext::Translate(scriptString.AsStringView(), &wsJavaScriptBuf)) { pContext->ThrowCompilerErrorException(); return; } args.GetReturnValue()->SetString( - FX_UTF8Encode(wsJavaScriptBuf.AsStringC()).AsStringC()); + FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).AsStringView()); } // static void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { args.GetReturnValue()->SetBoolean(false); @@ -5425,7 +5417,7 @@ void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { args.GetReturnValue()->SetBoolean(false); @@ -5438,7 +5430,7 @@ void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { @@ -5458,7 +5450,7 @@ void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, return; } - jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(), + jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(), args.GetReturnValue()); return; } @@ -5473,7 +5465,7 @@ void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); @@ -5499,7 +5491,7 @@ void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { @@ -5553,7 +5545,7 @@ void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, // static void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); uint32_t iLength = 0; @@ -5623,7 +5615,7 @@ std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( return simpleValue; } - jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(), + jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(), simpleValue.get()); return simpleValue; } @@ -5658,7 +5650,7 @@ bool CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { } auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate); - jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(), + jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(), newPropertyValue.get()); return newPropertyValue->IsNull(); } @@ -5688,8 +5680,8 @@ bool CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis, return false; if (firstValue->IsString()) { - CFX_ByteString firstString = ValueToUTF8String(firstValue); - CFX_ByteString secondString = ValueToUTF8String(secondValue); + ByteString firstString = ValueToUTF8String(firstValue); + ByteString secondString = ValueToUTF8String(secondValue); return firstString == secondString; } if (firstValue->IsNumber()) { @@ -5753,7 +5745,7 @@ void CXFA_FM2JSContext::unfoldArgs( for (int32_t j = 2; j < iLength; j++) { argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get()); jsObjectValue->GetObjectProperty( - propertyValue->ToString().AsStringC(), + propertyValue->ToString().AsStringView(), (*resultValues)[index].get()); index++; } @@ -5791,41 +5783,40 @@ bool CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pValue, } // static -CFX_ByteString CXFA_FM2JSContext::GenerateSomExpression( - const CFX_ByteStringC& szName, +ByteString CXFA_FM2JSContext::GenerateSomExpression( + const ByteStringView& szName, int32_t iIndexFlags, int32_t iIndexValue, bool bIsStar) { if (bIsStar) - return CFX_ByteString(szName, "[*]"); + return ByteString(szName, "[*]"); if (iIndexFlags == 0) - return CFX_ByteString(szName); + return ByteString(szName); if (iIndexFlags == 1 || iIndexValue == 0) { - return CFX_ByteString(szName, "[") + - CFX_ByteString::FormatInteger(iIndexValue) + "]"; + return ByteString(szName, "[") + ByteString::FormatInteger(iIndexValue) + + "]"; } - CFX_ByteString szSomExp; + ByteString szSomExp; if (iIndexFlags == 2) { szSomExp = (iIndexValue < 0) ? (szName + "[-") : (szName + "[+"); iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue; - szSomExp += CFX_ByteString::FormatInteger(iIndexValue); + szSomExp += ByteString::FormatInteger(iIndexValue); szSomExp += "]"; } else { szSomExp = (iIndexValue < 0) ? (szName + "[") : (szName + "[-"); iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue; - szSomExp += CFX_ByteString::FormatInteger(iIndexValue); + szSomExp += ByteString::FormatInteger(iIndexValue); szSomExp += "]"; } return szSomExp; } // static -bool CXFA_FM2JSContext::GetObjectForName( - CFXJSE_Value* pThis, - CFXJSE_Value* accessorValue, - const CFX_ByteStringC& szAccessorName) { +bool CXFA_FM2JSContext::GetObjectForName(CFXJSE_Value* pThis, + CFXJSE_Value* accessorValue, + const ByteStringView& szAccessorName) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return false; @@ -5836,7 +5827,7 @@ bool CXFA_FM2JSContext::GetObjectForName( XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; int32_t iRet = pScriptContext->ResolveObjects( pScriptContext->GetThisObject(), - CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, + WideString::FromUTF8(szAccessorName).AsStringView(), resoveNodeRS, dwFlags); if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { accessorValue->Assign( @@ -5849,7 +5840,7 @@ bool CXFA_FM2JSContext::GetObjectForName( // static int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, CFXJSE_Value* pRefValue, - const CFX_ByteStringC& bsSomExp, + const ByteStringView& bsSomExp, XFA_RESOLVENODE_RS& resoveNodeRS, bool bdotAccessor, bool bHasNoResolveName) { @@ -5857,7 +5848,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, if (!pDoc) return -1; - CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); + WideString wsSomExpression = WideString::FromUTF8(bsSomExp); CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); CXFA_Object* pNode = nullptr; uint32_t dFlags = 0UL; @@ -5869,7 +5860,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); ASSERT(pNode); if (bHasNoResolveName) { - CFX_WideString wsName; + WideString wsName; if (CXFA_Node* pXFANode = pNode->AsNode()) pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); if (wsName.IsEmpty()) @@ -5888,7 +5879,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); dFlags = XFA_RESOLVENODE_AnyChild; } - return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), + return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringView(), resoveNodeRS, dFlags); } @@ -5954,7 +5945,7 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, return ValueToInteger(pThis, newPropertyValue.get()); } - jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(), + jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(), newPropertyValue.get()); return ValueToInteger(pThis, newPropertyValue.get()); } @@ -5984,7 +5975,7 @@ float CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* arg) { GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); return ValueToFloat(pThis, newPropertyValue.get()); } - jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(), + jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(), newPropertyValue.get()); return ValueToFloat(pThis, newPropertyValue.get()); } @@ -5994,7 +5985,7 @@ float CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* arg) { return ValueToFloat(pThis, newPropertyValue.get()); } if (arg->IsString()) - return (float)XFA_ByteStringToDouble(arg->ToString().AsStringC()); + return (float)XFA_ByteStringToDouble(arg->ToString().AsStringView()); if (arg->IsUndefined()) return 0; @@ -6018,7 +6009,7 @@ double CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); return ValueToDouble(pThis, newPropertyValue.get()); } - jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(), + jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(), newPropertyValue.get()); return ValueToDouble(pThis, newPropertyValue.get()); } @@ -6028,7 +6019,7 @@ double CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, return ValueToDouble(pThis, newPropertyValue.get()); } if (arg->IsString()) - return XFA_ByteStringToDouble(arg->ToString().AsStringC()); + return XFA_ByteStringToDouble(arg->ToString().AsStringView()); if (arg->IsUndefined()) return 0; return arg->ToDouble(); @@ -6064,22 +6055,22 @@ double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, return ValueToDouble(pThis, jsObjectValue.get()); auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate); - jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringC(), + jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(), newPropertyValue.get()); return ValueToDouble(pThis, newPropertyValue.get()); } // static -CFX_ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) { +ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) { if (!arg || arg->IsNull() || arg->IsUndefined()) - return CFX_ByteString(); + return ByteString(); if (arg->IsBoolean()) return arg->ToBoolean() ? "1" : "0"; return arg->ToString(); } // static. -bool CXFA_FM2JSContext::Translate(const CFX_WideStringC& wsFormcalc, +bool CXFA_FM2JSContext::Translate(const WideStringView& wsFormcalc, CFX_WideTextBuf* wsJavascript) { if (wsFormcalc.IsEmpty()) { wsJavascript->Clear(); @@ -6118,7 +6109,7 @@ void CXFA_FM2JSContext::GlobalPropertyGetter(CFXJSE_Value* pValue) { } void CXFA_FM2JSContext::ThrowNoDefaultPropertyException( - const CFX_ByteStringC& name) const { + const ByteStringView& name) const { // TODO(tsepez): check usage of c_str() below. ThrowException(L"%.16S doesn't have a default property.", name.unterminated_c_str()); @@ -6137,8 +6128,8 @@ void CXFA_FM2JSContext::ThrowServerDeniedException() const { } void CXFA_FM2JSContext::ThrowPropertyNotInObjectException( - const CFX_WideString& name, - const CFX_WideString& exp) const { + const WideString& name, + const WideString& exp) const { ThrowException( L"An attempt was made to reference property '%.16s' of a non-object " L"in SOM expression %.16s.", @@ -6146,7 +6137,7 @@ void CXFA_FM2JSContext::ThrowPropertyNotInObjectException( } void CXFA_FM2JSContext::ThrowParamCountMismatchException( - const CFX_WideString& method) const { + const WideString& method) const { ThrowException(L"Incorrect number of parameters calling method '%.16s'.", method.c_str()); } @@ -6156,11 +6147,11 @@ void CXFA_FM2JSContext::ThrowArgumentMismatchException() const { } void CXFA_FM2JSContext::ThrowException(const wchar_t* str, ...) const { - CFX_WideString wsMessage; + WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, str); wsMessage.FormatV(str, arg_ptr); va_end(arg_ptr); ASSERT(!wsMessage.IsEmpty()); - FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC()); + FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView()); } diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h index 37586d080e..ca52ea8271 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h @@ -25,73 +25,73 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { ~CXFA_FM2JSContext() override; static void Abs(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Avg(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Ceil(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Count(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Floor(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Max(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Min(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Mod(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Round(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Sum(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Date(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Date2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void DateFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void IsoDate2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void IsoTime2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void LocalDateFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void LocalTimeFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Num2Date(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Num2GMTime(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Num2Time(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Time(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Time2Num(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void TimeFmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static bool IsIsoDateFormat(const char* pData, @@ -119,258 +119,256 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { int32_t& iMillionSecond, int32_t& iZoneHour, int32_t& iZoneMinute); - static CFX_ByteString Local2IsoDate(CFXJSE_Value* pThis, - const CFX_ByteStringC& szDate, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale); - static CFX_ByteString IsoDate2Local(CFXJSE_Value* pThis, - const CFX_ByteStringC& szDate, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale); - static CFX_ByteString IsoTime2Local(CFXJSE_Value* pThis, - const CFX_ByteStringC& szTime, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale); - static int32_t DateString2Num(const CFX_ByteStringC& szDateString); - static CFX_ByteString GetLocalDateFormat(CFXJSE_Value* pThis, - int32_t iStyle, - const CFX_ByteStringC& szLocalStr, - bool bStandard); - static CFX_ByteString GetLocalTimeFormat(CFXJSE_Value* pThis, - int32_t iStyle, - const CFX_ByteStringC& szLocalStr, - bool bStandard); - static CFX_ByteString GetStandardDateFormat( - CFXJSE_Value* pThis, - int32_t iStyle, - const CFX_ByteStringC& szLocalStr); - static CFX_ByteString GetStandardTimeFormat( - CFXJSE_Value* pThis, - int32_t iStyle, - const CFX_ByteStringC& szLocalStr); - static CFX_ByteString Num2AllTime(CFXJSE_Value* pThis, - int32_t iTime, - const CFX_ByteStringC& szFormat, - const CFX_ByteStringC& szLocale, - bool bGM); + static ByteString Local2IsoDate(CFXJSE_Value* pThis, + const ByteStringView& szDate, + const ByteStringView& szFormat, + const ByteStringView& szLocale); + static ByteString IsoDate2Local(CFXJSE_Value* pThis, + const ByteStringView& szDate, + const ByteStringView& szFormat, + const ByteStringView& szLocale); + static ByteString IsoTime2Local(CFXJSE_Value* pThis, + const ByteStringView& szTime, + const ByteStringView& szFormat, + const ByteStringView& szLocale); + static int32_t DateString2Num(const ByteStringView& szDateString); + static ByteString GetLocalDateFormat(CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocalStr, + bool bStandard); + static ByteString GetLocalTimeFormat(CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocalStr, + bool bStandard); + static ByteString GetStandardDateFormat(CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocalStr); + static ByteString GetStandardTimeFormat(CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocalStr); + static ByteString Num2AllTime(CFXJSE_Value* pThis, + int32_t iTime, + const ByteStringView& szFormat, + const ByteStringView& szLocale, + bool bGM); static void GetLocalTimeZone(int32_t& iHour, int32_t& iMin, int32_t& iSec); static void Apr(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void CTerm(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void FV(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void IPmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void NPV(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Pmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void PPmt(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void PV(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Rate(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Term(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Choose(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Exists(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void HasValue(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Oneof(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Within(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void If(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Eval(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Ref(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void UnitType(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void UnitValue(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void At(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Concat(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Decode(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); - static CFX_WideString DecodeURL(const CFX_WideString& wsURLString); - static CFX_WideString DecodeHTML(const CFX_WideString& wsHTMLString); - static CFX_WideString DecodeXML(const CFX_WideString& wsXMLString); + static WideString DecodeURL(const WideString& wsURLString); + static WideString DecodeHTML(const WideString& wsHTMLString); + static WideString DecodeXML(const WideString& wsXMLString); static void Encode(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); - static CFX_WideString EncodeURL(const CFX_ByteString& szURLString); - static CFX_WideString EncodeHTML(const CFX_ByteString& szHTMLString); - static CFX_WideString EncodeXML(const CFX_ByteString& szXMLString); - static bool HTMLSTR2Code(const CFX_WideStringC& pData, uint32_t* iCode); - static bool HTMLCode2STR(uint32_t iCode, CFX_WideString* wsHTMLReserve); + static WideString EncodeURL(const ByteString& szURLString); + static WideString EncodeHTML(const ByteString& szHTMLString); + static WideString EncodeXML(const ByteString& szXMLString); + static bool HTMLSTR2Code(const WideStringView& pData, uint32_t* iCode); + static bool HTMLCode2STR(uint32_t iCode, WideString* wsHTMLReserve); static void Format(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Left(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Len(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Lower(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Ltrim(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Parse(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Replace(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Right(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Rtrim(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Space(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Str(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Stuff(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Substr(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Uuid(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Upper(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void WordNum(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); - static CFX_ByteString TrillionUS(const CFX_ByteStringC& szData); - static CFX_ByteString WordUS(const CFX_ByteString& szData, int32_t iStyle); + static ByteString TrillionUS(const ByteStringView& szData); + static ByteString WordUS(const ByteString& szData, int32_t iStyle); static void Get(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Post(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void Put(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void assign_value_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void logical_or_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void logical_and_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void equality_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void notequality_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static bool fm_ref_equal(CFXJSE_Value* pThis, CFXJSE_Arguments& args); static void less_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void lessequal_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void greater_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void greaterequal_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void plus_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void minus_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void multiple_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void divide_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void positive_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void negative_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void logical_not_operator(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void dot_accessor(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void dotdot_accessor(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void eval_translation(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void is_fm_object(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void is_fm_array(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void get_fm_value(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void get_fm_jsobj(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void fm_var_filter(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static void concat_fm_object(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static int32_t hvalue_get_array_length(CFXJSE_Value* pThis, @@ -387,16 +385,16 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { CFXJSE_Value* pDefaultValue); static bool SetObjectDefaultValue(CFXJSE_Value* pObjectValue, CFXJSE_Value* pNewValue); - static CFX_ByteString GenerateSomExpression(const CFX_ByteStringC& szName, - int32_t iIndexFlags, - int32_t iIndexValue, - bool bIsStar); + static ByteString GenerateSomExpression(const ByteStringView& szName, + int32_t iIndexFlags, + int32_t iIndexValue, + bool bIsStar); static bool GetObjectForName(CFXJSE_Value* pThis, CFXJSE_Value* accessorValue, - const CFX_ByteStringC& szAccessorName); + const ByteStringView& szAccessorName); static int32_t ResolveObjects(CFXJSE_Value* pThis, CFXJSE_Value* pParentValue, - const CFX_ByteStringC& bsSomExp, + const ByteStringView& bsSomExp, XFA_RESOLVENODE_RS& resoveNodeRS, bool bdotAccessor = true, bool bHasNoResolveName = false); @@ -414,12 +412,12 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static float ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue); static double ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue); - static CFX_ByteString ValueToUTF8String(CFXJSE_Value* pValue); + static ByteString ValueToUTF8String(CFXJSE_Value* pValue); static double ExtractDouble(CFXJSE_Value* pThis, CFXJSE_Value* src, bool* ret); - static bool Translate(const CFX_WideStringC& wsFormcalc, + static bool Translate(const WideStringView& wsFormcalc, CFX_WideTextBuf* wsJavascript); void GlobalPropertyGetter(CFXJSE_Value* pValue); @@ -428,14 +426,14 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } CXFA_Document* GetDocument() const { return m_pDocument.Get(); } - void ThrowNoDefaultPropertyException(const CFX_ByteStringC& name) const; + void ThrowNoDefaultPropertyException(const ByteStringView& name) const; void ThrowCompilerErrorException() const; void ThrowDivideByZeroException() const; void ThrowServerDeniedException() const; - void ThrowPropertyNotInObjectException(const CFX_WideString& name, - const CFX_WideString& exp) const; + void ThrowPropertyNotInObjectException(const WideString& name, + const WideString& exp) const; void ThrowArgumentMismatchException() const; - void ThrowParamCountMismatchException(const CFX_WideString& method) const; + void ThrowParamCountMismatchException(const WideString& method) const; void ThrowException(const wchar_t* str, ...) const; v8::Isolate* m_pIsolate; diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp index 2faa1914b1..a1bbb50271 100644 --- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp @@ -40,8 +40,8 @@ bool CXFA_FMExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { CXFA_FMFunctionDefinition::CXFA_FMFunctionDefinition( uint32_t line, bool isGlobal, - const CFX_WideStringC& wsName, - std::vector<CFX_WideStringC>&& arguments, + const WideStringView& wsName, + std::vector<WideStringView>&& arguments, std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions) : CXFA_FMExpression(line, XFA_FM_EXPTYPE_FUNC), m_wsName(wsName), @@ -61,7 +61,7 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) { } javascript << L"function "; if (!m_wsName.IsEmpty() && m_wsName[0] == L'!') { - CFX_WideString tempName = + WideString tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1); javascript << tempName; } else { @@ -73,9 +73,8 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) { if (bNeedComma) javascript << L", "; if (identifier[0] == L'!') { - CFX_WideString tempIdentifier = - EXCLAMATION_IN_IDENTIFIER + - identifier.Right(identifier.GetLength() - 1); + WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + + identifier.Right(identifier.GetLength() - 1); javascript << tempIdentifier; } else { javascript << identifier; @@ -117,7 +116,7 @@ bool CXFA_FMFunctionDefinition::ToImpliedReturnJS(CFX_WideTextBuf&) { CXFA_FMVarExpression::CXFA_FMVarExpression( uint32_t line, - const CFX_WideStringC& wsName, + const WideStringView& wsName, std::unique_ptr<CXFA_FMExpression> pInit) : CXFA_FMExpression(line, XFA_FM_EXPTYPE_VAR), m_wsName(wsName), @@ -127,7 +126,7 @@ CXFA_FMVarExpression::~CXFA_FMVarExpression() {} bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"var "; - CFX_WideString tempName(m_wsName); + WideString tempName(m_wsName); if (m_wsName[0] == L'!') { tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1); @@ -151,7 +150,7 @@ bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { bool CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L"var "; - CFX_WideString tempName(m_wsName); + WideString tempName(m_wsName); if (m_wsName[0] == L'!') { tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Right(m_wsName.GetLength() - 1); @@ -440,7 +439,7 @@ bool CXFA_FMContinueExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { CXFA_FMForExpression::CXFA_FMForExpression( uint32_t line, - const CFX_WideStringC& wsVariant, + const WideStringView& wsVariant, std::unique_ptr<CXFA_FMSimpleExpression> pAssignment, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, int32_t iDirection, @@ -458,7 +457,7 @@ CXFA_FMForExpression::~CXFA_FMForExpression() {} bool CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"{\nvar "; - CFX_WideString tempVariant; + WideString tempVariant; if (m_wsVariant[0] == L'!') { tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Right(m_wsVariant.GetLength() - 1); @@ -513,7 +512,7 @@ bool CXFA_FMForExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << RUNTIMEFUNCTIONRETURNVALUE; javascript << L" = 0;\n"; javascript << L"{\nvar "; - CFX_WideString tempVariant; + WideString tempVariant; if (m_wsVariant[0] == L'!') { tempVariant = EXCLAMATION_IN_IDENTIFIER + m_wsVariant.Right(m_wsVariant.GetLength() - 1); @@ -567,7 +566,7 @@ bool CXFA_FMForExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { CXFA_FMForeachExpression::CXFA_FMForeachExpression( uint32_t line, - const CFX_WideStringC& wsIdentifier, + const WideStringView& wsIdentifier, std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors, std::unique_ptr<CXFA_FMExpression> pList) : CXFA_FMLoopExpression(line), @@ -581,7 +580,7 @@ bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << L"{\n"; javascript << L"var "; if (m_wsIdentifier[0] == L'!') { - CFX_WideString tempIdentifier = + WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; @@ -613,7 +612,7 @@ bool CXFA_FMForeachExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << RUNTIMEBLOCKTEMPARRAY; javascript << L".length)\n{\n"; if (m_wsIdentifier[0] == L'!') { - CFX_WideString tempIdentifier = + WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; @@ -638,7 +637,7 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << L"{\n"; javascript << L"var "; if (m_wsIdentifier[0] == L'!') { - CFX_WideString tempIdentifier = + WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; @@ -669,7 +668,7 @@ bool CXFA_FMForeachExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << RUNTIMEBLOCKTEMPARRAY; javascript << L".length)\n{\n"; if (m_wsIdentifier[0] == L'!') { - CFX_WideString tempIdentifier = + WideString tempIdentifier = EXCLAMATION_IN_IDENTIFIER + m_wsIdentifier.Right(m_wsIdentifier.GetLength() - 1); javascript << tempIdentifier; diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.h b/xfa/fxfa/fm2js/cxfa_fmexpression.h index 47b2d9cabd..cfbba3af22 100644 --- a/xfa/fxfa/fm2js/cxfa_fmexpression.h +++ b/xfa/fxfa/fm2js/cxfa_fmexpression.h @@ -47,8 +47,8 @@ class CXFA_FMFunctionDefinition : public CXFA_FMExpression { CXFA_FMFunctionDefinition( uint32_t line, bool isGlobal, - const CFX_WideStringC& wsName, - std::vector<CFX_WideStringC>&& arguments, + const WideStringView& wsName, + std::vector<WideStringView>&& arguments, std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions); ~CXFA_FMFunctionDefinition() override; @@ -56,8 +56,8 @@ class CXFA_FMFunctionDefinition : public CXFA_FMExpression { bool ToImpliedReturnJS(CFX_WideTextBuf&) override; private: - CFX_WideStringC m_wsName; - std::vector<CFX_WideStringC> m_pArguments; + WideStringView m_wsName; + std::vector<WideStringView> m_pArguments; std::vector<std::unique_ptr<CXFA_FMExpression>> m_pExpressions; bool m_isGlobal; }; @@ -65,7 +65,7 @@ class CXFA_FMFunctionDefinition : public CXFA_FMExpression { class CXFA_FMVarExpression : public CXFA_FMExpression { public: CXFA_FMVarExpression(uint32_t line, - const CFX_WideStringC& wsName, + const WideStringView& wsName, std::unique_ptr<CXFA_FMExpression> pInit); ~CXFA_FMVarExpression() override; @@ -73,7 +73,7 @@ class CXFA_FMVarExpression : public CXFA_FMExpression { bool ToImpliedReturnJS(CFX_WideTextBuf&) override; private: - CFX_WideStringC m_wsName; + WideStringView m_wsName; std::unique_ptr<CXFA_FMExpression> m_pInit; }; @@ -175,7 +175,7 @@ class CXFA_FMContinueExpression : public CXFA_FMExpression { class CXFA_FMForExpression : public CXFA_FMLoopExpression { public: CXFA_FMForExpression(uint32_t line, - const CFX_WideStringC& wsVariant, + const WideStringView& wsVariant, std::unique_ptr<CXFA_FMSimpleExpression> pAssignment, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, int32_t iDirection, @@ -187,7 +187,7 @@ class CXFA_FMForExpression : public CXFA_FMLoopExpression { bool ToImpliedReturnJS(CFX_WideTextBuf&) override; private: - CFX_WideStringC m_wsVariant; + WideStringView m_wsVariant; std::unique_ptr<CXFA_FMSimpleExpression> m_pAssignment; std::unique_ptr<CXFA_FMSimpleExpression> m_pAccessor; const bool m_bDirection; @@ -200,7 +200,7 @@ class CXFA_FMForeachExpression : public CXFA_FMLoopExpression { // Takes ownership of |pAccessors|. CXFA_FMForeachExpression( uint32_t line, - const CFX_WideStringC& wsIdentifier, + const WideStringView& wsIdentifier, std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors, std::unique_ptr<CXFA_FMExpression> pList); ~CXFA_FMForeachExpression() override; @@ -209,7 +209,7 @@ class CXFA_FMForeachExpression : public CXFA_FMLoopExpression { bool ToImpliedReturnJS(CFX_WideTextBuf&) override; private: - CFX_WideStringC m_wsIdentifier; + WideStringView m_wsIdentifier; std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> m_pAccessors; std::unique_ptr<CXFA_FMExpression> m_pList; }; diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index 1a43e837f4..f6b2a58944 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -122,7 +122,7 @@ const wchar_t* tokenStrings[] = { L"TOKcall", L"TOKstring", L"TOKnumber", L"TOKreserver", }; -XFA_FM_TOKEN TokenizeIdentifier(const CFX_WideStringC& str) { +XFA_FM_TOKEN TokenizeIdentifier(const WideStringView& str) { uint32_t key = FX_HashCode_GetW(str, true); const XFA_FMKeyword* end = std::begin(keyWords) + KEYWORD_END + 1; @@ -145,8 +145,8 @@ CXFA_FMToken::CXFA_FMToken(uint32_t line_num) CXFA_FMToken::~CXFA_FMToken() {} -CFX_WideString CXFA_FMToken::ToDebugString() const { - CFX_WideString str(L"type = "); +WideString CXFA_FMToken::ToDebugString() const { + WideString str(L"type = "); str += tokenStrings[m_type]; str += L", string = "; str += m_string; @@ -155,7 +155,7 @@ CFX_WideString CXFA_FMToken::ToDebugString() const { return str; } -CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc) +CXFA_FMLexer::CXFA_FMLexer(const WideStringView& wsFormCalc) : m_cursor(wsFormCalc.unterminated_c_str()), m_end(m_cursor + wsFormCalc.GetLength() - 1), m_current_line(1), @@ -378,7 +378,7 @@ void CXFA_FMLexer::AdvanceForNumber() { } m_token->m_string = - CFX_WideStringC(m_cursor, static_cast<FX_STRSIZE>(end - m_cursor)); + WideStringView(m_cursor, static_cast<FX_STRSIZE>(end - m_cursor)); m_cursor = end; } @@ -395,7 +395,7 @@ void CXFA_FMLexer::AdvanceForString() { // If the end of the input has been reached it was not escaped. if (m_cursor > m_end) { m_token->m_string = - CFX_WideStringC(start, static_cast<FX_STRSIZE>(m_cursor - start)); + WideStringView(start, static_cast<FX_STRSIZE>(m_cursor - start)); return; } // If the next character is not a " then the end of the string has been @@ -404,7 +404,7 @@ void CXFA_FMLexer::AdvanceForString() { if (!IsFormCalcCharacter(*m_cursor)) { break; } - m_token->m_string = CFX_WideStringC(start, (m_cursor - start)); + m_token->m_string = WideStringView(start, (m_cursor - start)); return; } } @@ -430,7 +430,7 @@ void CXFA_FMLexer::AdvanceForIdentifier() { ++m_cursor; } m_token->m_string = - CFX_WideStringC(start, static_cast<FX_STRSIZE>(m_cursor - start)); + WideStringView(start, static_cast<FX_STRSIZE>(m_cursor - start)); m_token->m_type = TokenizeIdentifier(m_token->m_string); } diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.h b/xfa/fxfa/fm2js/cxfa_fmlexer.h index 39031760d9..b9764c5aba 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.h +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.h @@ -95,16 +95,16 @@ class CXFA_FMToken { explicit CXFA_FMToken(uint32_t line_num); ~CXFA_FMToken(); - CFX_WideString ToDebugString() const; + WideString ToDebugString() const; - CFX_WideStringC m_string; + WideStringView m_string; XFA_FM_TOKEN m_type; uint32_t m_line_num; }; class CXFA_FMLexer { public: - explicit CXFA_FMLexer(const CFX_WideStringC& wsFormcalc); + explicit CXFA_FMLexer(const WideStringView& wsFormcalc); ~CXFA_FMLexer(); std::unique_ptr<CXFA_FMToken> NextToken(); diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp index 65517fb79d..16538503de 100644 --- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp @@ -20,7 +20,7 @@ const unsigned int kMaxParseDepth = 1250; } // namespace -CXFA_FMParser::CXFA_FMParser(const CFX_WideStringC& wsFormcalc) +CXFA_FMParser::CXFA_FMParser(const WideStringView& wsFormcalc) : m_error(false), m_parse_depth(0), m_max_parse_depth(kMaxParseDepth) { m_lexer = pdfium::MakeUnique<CXFA_FMLexer>(wsFormcalc); m_token = m_lexer->NextToken(); @@ -33,7 +33,7 @@ std::unique_ptr<CXFA_FMFunctionDefinition> CXFA_FMParser::Parse() { if (HasError()) return nullptr; - std::vector<CFX_WideStringC> arguments; + std::vector<WideStringView> arguments; return pdfium::MakeUnique<CXFA_FMFunctionDefinition>( 1, true, L"", std::move(arguments), std::move(expressions)); } @@ -92,8 +92,8 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseFunction() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - CFX_WideStringC ident; - std::vector<CFX_WideStringC> arguments; + WideStringView ident; + std::vector<WideStringView> arguments; std::vector<std::unique_ptr<CXFA_FMExpression>> expressions; uint32_t line = m_token->m_line_num; if (!NextToken()) @@ -208,7 +208,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseVarExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - CFX_WideStringC ident; + WideStringView ident; uint32_t line = m_token->m_line_num; if (!NextToken()) return nullptr; @@ -613,7 +613,7 @@ CXFA_FMParser::ParsePrimaryExpression() { return nullptr; break; case TOKidentifier: { - CFX_WideStringC wsIdentifier(m_token->m_string); + WideStringView wsIdentifier(m_token->m_string); if (!NextToken()) return nullptr; if (m_token->m_type == TOKlbracket) { @@ -714,7 +714,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( m_error = true; return nullptr; } - CFX_WideStringC tempStr = m_token->m_string; + WideStringView tempStr = m_token->m_string; uint32_t tempLine = m_token->m_line_num; if (!NextToken()) return nullptr; @@ -786,7 +786,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( m_error = true; return nullptr; } - CFX_WideStringC tempStr = m_token->m_string; + WideStringView tempStr = m_token->m_string; uint32_t tempLine = m_token->m_line_num; if (!NextToken()) return nullptr; @@ -813,7 +813,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( m_error = true; return nullptr; } - CFX_WideStringC tempStr = m_token->m_string; + WideStringView tempStr = m_token->m_string; uint32_t tempLine = m_token->m_line_num; if (!NextToken()) return nullptr; @@ -1083,7 +1083,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - CFX_WideStringC wsVariant; + WideStringView wsVariant; uint32_t line = m_token->m_line_num; if (!NextToken()) return nullptr; @@ -1152,7 +1152,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForeachExpression() { return nullptr; std::unique_ptr<CXFA_FMExpression> expr; - CFX_WideStringC wsIdentifier; + WideStringView wsIdentifier; std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> pAccessors; std::unique_ptr<CXFA_FMExpression> pList; uint32_t line = m_token->m_line_num; diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.h b/xfa/fxfa/fm2js/cxfa_fmparser.h index ddfaa1aaa6..c536838a3c 100644 --- a/xfa/fxfa/fm2js/cxfa_fmparser.h +++ b/xfa/fxfa/fm2js/cxfa_fmparser.h @@ -15,7 +15,7 @@ class CXFA_FMParser { public: - explicit CXFA_FMParser(const CFX_WideStringC& wsFormcalc); + explicit CXFA_FMParser(const WideStringView& wsFormcalc); ~CXFA_FMParser(); std::unique_ptr<CXFA_FMFunctionDefinition> Parse(); diff --git a/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp index a7e784e63d..192f935309 100644 --- a/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp @@ -20,7 +20,7 @@ TEST(CXFA_FMParserTest, Empty) { CFX_WideTextBuf buf; EXPECT_TRUE(ast->ToJavaScript(buf)); // TODO(dsinclair): This is a little weird ..... - EXPECT_EQ(L"// comments only", buf.AsStringC()); + EXPECT_EQ(L"// comments only", buf.AsStringView()); } TEST(CXFA_FMParserTest, CommentOnlyIsError) { @@ -33,7 +33,7 @@ TEST(CXFA_FMParserTest, CommentOnlyIsError) { CFX_WideTextBuf buf; EXPECT_TRUE(ast->ToJavaScript(buf)); - EXPECT_EQ(L"// comments only", buf.AsStringC()); + EXPECT_EQ(L"// comments only", buf.AsStringView()); } TEST(CXFA_FMParserTest, CommentThenValue) { @@ -51,7 +51,7 @@ TEST(CXFA_FMParserTest, CommentThenValue) { CFX_WideTextBuf buf; EXPECT_TRUE(ast->ToJavaScript(buf)); - EXPECT_EQ(ret, buf.AsStringC()); + EXPECT_EQ(ret, buf.AsStringView()); } TEST(CXFA_FMParserTest, Parse) { @@ -106,7 +106,7 @@ TEST(CXFA_FMParserTest, Parse) { CFX_WideTextBuf buf; EXPECT_TRUE(ast->ToJavaScript(buf)); - EXPECT_EQ(ret, buf.AsStringC()); + EXPECT_EQ(ret, buf.AsStringView()); } TEST(CXFA_FMParserTest, MaxParseDepth) { diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp index fc07609f85..73dfdd55bc 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp @@ -81,7 +81,7 @@ const XFA_FMSOMMethod gs_FMSomMethods[] = { } // namespace -CFX_WideStringC XFA_FM_EXPTypeToString( +WideStringView XFA_FM_EXPTypeToString( XFA_FM_SimpleExpressionType simpleExpType) { return gs_lpStrExpFuncName[simpleExpType]; } @@ -110,7 +110,7 @@ bool CXFA_FMNullExpression::ToJavaScript(CFX_WideTextBuf& javascript) { } CXFA_FMNumberExpression::CXFA_FMNumberExpression(uint32_t line, - CFX_WideStringC wsNumber) + WideStringView wsNumber) : CXFA_FMSimpleExpression(line, TOKnumber), m_wsNumber(wsNumber) {} CXFA_FMNumberExpression::~CXFA_FMNumberExpression() {} @@ -121,13 +121,13 @@ bool CXFA_FMNumberExpression::ToJavaScript(CFX_WideTextBuf& javascript) { } CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line, - CFX_WideStringC wsString) + WideStringView wsString) : CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {} CXFA_FMStringExpression::~CXFA_FMStringExpression() {} bool CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { - CFX_WideString tempStr(m_wsString); + WideString tempStr(m_wsString); if (tempStr.GetLength() <= 2) { javascript << tempStr; return true; @@ -156,14 +156,14 @@ bool CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { CXFA_FMIdentifierExpression::CXFA_FMIdentifierExpression( uint32_t line, - CFX_WideStringC wsIdentifier) + WideStringView wsIdentifier) : CXFA_FMSimpleExpression(line, TOKidentifier), m_wsIdentifier(wsIdentifier) {} CXFA_FMIdentifierExpression::~CXFA_FMIdentifierExpression() {} bool CXFA_FMIdentifierExpression::ToJavaScript(CFX_WideTextBuf& javascript) { - CFX_WideString tempStr(m_wsIdentifier); + WideString tempStr(m_wsIdentifier); if (tempStr == L"$") { tempStr = L"this"; } else if (tempStr == L"!") { @@ -244,7 +244,7 @@ bool CXFA_FMAssignExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << tempExp2; javascript << L");\n}\n"; if (m_pExp1->GetOperatorToken() == TOKidentifier && - tempExp1.AsStringC() != L"this") { + tempExp1.AsStringView() != L"this") { javascript << L"else\n{\n"; javascript << tempExp1; javascript << L" = "; @@ -282,7 +282,7 @@ bool CXFA_FMAssignExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << tempExp2; javascript << L");\n}\n"; if (m_pExp1->GetOperatorToken() == TOKidentifier && - tempExp1.AsStringC() != L"this") { + tempExp1.AsStringView() != L"this") { javascript << L"else\n{\n"; javascript << RUNTIMEFUNCTIONRETURNVALUE; javascript << L" = "; @@ -522,10 +522,10 @@ bool CXFA_FMCallExpression::IsBuiltInFunc(CFX_WideTextBuf* funcName) { if (funcName->GetLength() > g_BuiltInFuncsMaxLen) return false; - auto cmpFunc = [](const wchar_t* iter, const CFX_WideString& val) -> bool { + auto cmpFunc = [](const wchar_t* iter, const WideString& val) -> bool { return val.CompareNoCase(iter) > 0; }; - CFX_WideString str = funcName->MakeString(); + WideString str = funcName->MakeString(); const wchar_t* const* pMatchResult = std::lower_bound( std::begin(g_BuiltInFuncs), std::end(g_BuiltInFuncs), str, cmpFunc); if (pMatchResult != std::end(g_BuiltInFuncs) && @@ -538,8 +538,8 @@ bool CXFA_FMCallExpression::IsBuiltInFunc(CFX_WideTextBuf* funcName) { } uint32_t CXFA_FMCallExpression::IsMethodWithObjParam( - const CFX_WideString& methodName) { - auto cmpFunc = [](const XFA_FMSOMMethod iter, const CFX_WideString& val) { + const WideString& methodName) { + auto cmpFunc = [](const XFA_FMSOMMethod iter, const WideString& val) { return val.Compare(iter.m_wsSomMethodName) > 0; }; const XFA_FMSOMMethod* result = @@ -599,12 +599,12 @@ bool CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { bool isEvalFunc = false; bool isExistsFunc = false; if (IsBuiltInFunc(&funcName)) { - if (funcName.AsStringC() == L"Eval") { + if (funcName.AsStringView() == L"Eval") { isEvalFunc = true; javascript << L"eval.call(this, "; javascript << gs_lpStrExpFuncName[CALL]; javascript << L"Translate"; - } else if (funcName.AsStringC() == L"Exists") { + } else if (funcName.AsStringView() == L"Exists") { isExistsFunc = true; javascript << gs_lpStrExpFuncName[CALL]; javascript << funcName; @@ -655,7 +655,7 @@ CXFA_FMDotAccessorExpression::CXFA_FMDotAccessorExpression( uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, - CFX_WideStringC wsIdentifier, + WideStringView wsIdentifier, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp) : CXFA_FMBinExpression(line, op, @@ -745,7 +745,7 @@ CXFA_FMDotDotAccessorExpression::CXFA_FMDotDotAccessorExpression( uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, - CFX_WideStringC wsIdentifier, + WideStringView wsIdentifier, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp) : CXFA_FMBinExpression(line, op, diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h index a9e9f90289..864c822a12 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h @@ -45,7 +45,7 @@ enum XFA_FM_SimpleExpressionType { class CFX_WideTextBuf; -CFX_WideStringC XFA_FM_EXPTypeToString( +WideStringView XFA_FM_EXPTypeToString( XFA_FM_SimpleExpressionType simpleExpType); enum XFA_FM_AccessorIndex { @@ -78,32 +78,32 @@ class CXFA_FMNullExpression : public CXFA_FMSimpleExpression { class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMNumberExpression(uint32_t line, CFX_WideStringC wsNumber); + CXFA_FMNumberExpression(uint32_t line, WideStringView wsNumber); ~CXFA_FMNumberExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript) override; private: - CFX_WideStringC m_wsNumber; + WideStringView m_wsNumber; }; class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMStringExpression(uint32_t line, CFX_WideStringC wsString); + CXFA_FMStringExpression(uint32_t line, WideStringView wsString); ~CXFA_FMStringExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript) override; private: - CFX_WideStringC m_wsString; + WideStringView m_wsString; }; class CXFA_FMIdentifierExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMIdentifierExpression(uint32_t line, CFX_WideStringC wsIdentifier); + CXFA_FMIdentifierExpression(uint32_t line, WideStringView wsIdentifier); ~CXFA_FMIdentifierExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript) override; private: - CFX_WideStringC m_wsIdentifier; + WideStringView m_wsIdentifier; }; class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression { @@ -240,7 +240,7 @@ class CXFA_FMCallExpression : public CXFA_FMUnaryExpression { ~CXFA_FMCallExpression() override; bool IsBuiltInFunc(CFX_WideTextBuf* funcName); - uint32_t IsMethodWithObjParam(const CFX_WideString& methodName); + uint32_t IsMethodWithObjParam(const WideString& methodName); bool ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -254,13 +254,13 @@ class CXFA_FMDotAccessorExpression : public CXFA_FMBinExpression { uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, - CFX_WideStringC wsIdentifier, + WideStringView wsIdentifier, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp); ~CXFA_FMDotAccessorExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript) override; private: - CFX_WideStringC m_wsIdentifier; + WideStringView m_wsIdentifier; }; class CXFA_FMIndexExpression : public CXFA_FMUnaryExpression { @@ -283,14 +283,14 @@ class CXFA_FMDotDotAccessorExpression : public CXFA_FMBinExpression { uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, - CFX_WideStringC wsIdentifier, + WideStringView wsIdentifier, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp); ~CXFA_FMDotDotAccessorExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript) override; private: - CFX_WideStringC m_wsIdentifier; + WideStringView m_wsIdentifier; }; class CXFA_FMMethodCallExpression : public CXFA_FMBinExpression { diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp index 58ddbac806..5f4d83c327 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp @@ -27,7 +27,7 @@ TEST(FMCallExpressionTest, more_than_32_arguments) { callExp.ToJavaScript(js); // Generate the result javascript string. - CFX_WideString result = L"sign("; + WideString result = L"sign("; for (size_t i = 0; i < 50; i++) { if (i > 0) result += L", "; @@ -41,31 +41,31 @@ TEST(FMCallExpressionTest, more_than_32_arguments) { } result += L")"; - EXPECT_EQ(result.AsStringC(), js.AsStringC()); + EXPECT_EQ(result.AsStringView(), js.AsStringView()); } TEST(FMStringExpressionTest, Empty) { CFX_WideTextBuf accumulator; - CXFA_FMStringExpression(1, CFX_WideStringC()).ToJavaScript(accumulator); - EXPECT_EQ(L"", accumulator.AsStringC()); + CXFA_FMStringExpression(1, WideStringView()).ToJavaScript(accumulator); + EXPECT_EQ(L"", accumulator.AsStringView()); } TEST(FMStringExpressionTest, Short) { CFX_WideTextBuf accumulator; CXFA_FMStringExpression(1, L"a").ToJavaScript(accumulator); - EXPECT_EQ(L"a", accumulator.AsStringC()); + EXPECT_EQ(L"a", accumulator.AsStringView()); } TEST(FMStringExpressionTest, Medium) { CFX_WideTextBuf accumulator; CXFA_FMStringExpression(1, L".abcd.").ToJavaScript(accumulator); - EXPECT_EQ(L"\"abcd\"", accumulator.AsStringC()); + EXPECT_EQ(L"\"abcd\"", accumulator.AsStringView()); } TEST(FMStringExpressionTest, Long) { CFX_WideTextBuf accumulator; - std::vector<CFX_WideStringC::UnsignedType> vec(140000, L'A'); - CXFA_FMStringExpression(1, CFX_WideStringC(vec)).ToJavaScript(accumulator); + std::vector<WideStringView::UnsignedType> vec(140000, L'A'); + CXFA_FMStringExpression(1, WideStringView(vec)).ToJavaScript(accumulator); EXPECT_EQ(140000u, accumulator.GetLength()); } @@ -73,5 +73,5 @@ TEST(FMStringExpressionTest, Quoted) { CFX_WideTextBuf accumulator; CXFA_FMStringExpression(1, L".Simon says \"\"run\"\".") .ToJavaScript(accumulator); - EXPECT_EQ(L"\"Simon says \\\"run\\\"\"", accumulator.AsStringC()); + EXPECT_EQ(L"\"Simon says \\\"run\\\"\"", accumulator.AsStringView()); } diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h index dfd4f343d4..b8595d41dd 100644 --- a/xfa/fxfa/fxfa.h +++ b/xfa/fxfa/fxfa.h @@ -114,22 +114,22 @@ class IXFA_AppProvider { /** * Returns the language of the running host application. Such as zh_CN */ - virtual CFX_WideString GetLanguage() = 0; + virtual WideString GetLanguage() = 0; /** * Returns the platform of the machine running the script. Such as WIN */ - virtual CFX_WideString GetPlatform() = 0; + virtual WideString GetPlatform() = 0; /** * Get application name, such as Phantom. */ - virtual CFX_WideString GetAppName() = 0; + virtual WideString GetAppName() = 0; /** * Get application message box title. */ - virtual CFX_WideString GetAppTitle() const = 0; + virtual WideString GetAppTitle() const = 0; /** * Causes the system to play a sound. @@ -147,8 +147,8 @@ class IXFA_AppProvider { * @return A valid integer representing the value of the button pressed by the * user, refer to XFA_ID. */ - virtual int32_t MsgBox(const CFX_WideString& wsMessage, - const CFX_WideString& wsTitle = L"", + virtual int32_t MsgBox(const WideString& wsMessage, + const WideString& wsTitle = L"", uint32_t dwIconType = 0, uint32_t dwButtonType = 0) = 0; @@ -160,10 +160,10 @@ class IXFA_AppProvider { * @param[in] bMask - Mask the user input with asterisks when true, * @return A string containing the user's response. */ - virtual CFX_WideString Response(const CFX_WideString& wsQuestion, - const CFX_WideString& wsTitle = L"", - const CFX_WideString& wsDefaultAnswer = L"", - bool bMask = true) = 0; + virtual WideString Response(const WideString& wsQuestion, + const WideString& wsTitle = L"", + const WideString& wsDefaultAnswer = L"", + bool bMask = true) = 0; /** * Download something from somewhere. @@ -171,7 +171,7 @@ class IXFA_AppProvider { * "http://www.w3.org/TR/REC-xml-names/". */ virtual CFX_RetainPtr<IFX_SeekableReadStream> DownloadURL( - const CFX_WideString& wsURL) = 0; + const WideString& wsURL) = 0; /** * POST data to the given url. @@ -188,12 +188,12 @@ class IXFA_AppProvider { * @param[out] wsResponse decoded response from server. * @return true Server permitted the post request, false otherwise. */ - virtual bool PostRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsContentType, - const CFX_WideString& wsEncode, - const CFX_WideString& wsHeader, - CFX_WideString& wsResponse) = 0; + virtual bool PostRequestURL(const WideString& wsURL, + const WideString& wsData, + const WideString& wsContentType, + const WideString& wsEncode, + const WideString& wsHeader, + WideString& wsResponse) = 0; /** * PUT data to the given url. @@ -203,9 +203,9 @@ class IXFA_AppProvider { * ISO8859-1, any recognized [IANA]character encoding * @return true Server permitted the post request, false otherwise. */ - virtual bool PutRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsEncode) = 0; + virtual bool PutRequestURL(const WideString& wsURL, + const WideString& wsData, + const WideString& wsEncode) = 0; virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0; }; @@ -237,12 +237,12 @@ class IXFA_DocEnvironment { virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) = 0; virtual bool IsCalculationsEnabled(CXFA_FFDoc* hDoc) = 0; virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) = 0; - virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) = 0; - virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) = 0; + virtual void GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) = 0; + virtual void SetTitle(CXFA_FFDoc* hDoc, const WideString& wsTitle) = 0; virtual void ExportData(CXFA_FFDoc* hDoc, - const CFX_WideString& wsFilePath, + const WideString& wsFilePath, bool bXDP) = 0; - virtual void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) = 0; + virtual void GotoURL(CXFA_FFDoc* hDoc, const WideString& bsURL) = 0; virtual bool IsValidationsEnabled(CXFA_FFDoc* hDoc) = 0; virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) = 0; virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; @@ -254,14 +254,14 @@ class IXFA_DocEnvironment { virtual bool SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) = 0; virtual bool GetGlobalProperty(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue) = 0; virtual bool SetGlobalProperty(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue) = 0; virtual CFX_RetainPtr<IFX_SeekableReadStream> OpenLinkedFile( CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) = 0; + const WideString& wsLink) = 0; }; class IXFA_WidgetIterator { diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp index e2d9f043d1..c5b09d155b 100644 --- a/xfa/fxfa/parser/cscript_datawindow.cpp +++ b/xfa/fxfa/parser/cscript_datawindow.cpp @@ -15,7 +15,7 @@ CScript_DataWindow::CScript_DataWindow(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::DataWindow, - CFX_WideStringC(L"dataWindow")) {} + WideStringView(L"dataWindow")) {} CScript_DataWindow::~CScript_DataWindow() {} diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp index 45f1171321..ecf2a98915 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp @@ -17,14 +17,12 @@ namespace { -void StringProperty(CFXJSE_Value* pValue, - CFX_WideString& wsValue, - bool bSetting) { +void StringProperty(CFXJSE_Value* pValue, WideString& wsValue, bool bSetting) { if (bSetting) { wsValue = pValue->ToWideString(); return; } - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } void InterProperty(CFXJSE_Value* pValue, int32_t& iValue, bool bSetting) { @@ -49,7 +47,7 @@ CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::EventPseudoModel, - CFX_WideStringC(L"eventPseudoModel")) {} + WideStringView(L"eventPseudoModel")) {} CScript_EventPseudoModel::~CScript_EventPseudoModel() {} diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index 2db6677877..f1eaff8c93 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -30,7 +30,7 @@ CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::HostPseudoModel, - CFX_WideStringC(L"hostPseudoModel")) {} + WideStringView(L"hostPseudoModel")) {} CScript_HostPseudoModel::~CScript_HostPseudoModel() {} @@ -89,7 +89,7 @@ void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, return; } pValue->SetString( - pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringC()); + pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, @@ -118,7 +118,7 @@ void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, return; } pValue->SetString( - pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringC()); + pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, @@ -136,9 +136,9 @@ void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, pNotify->GetDocEnvironment()->SetTitle(hDoc, pValue->ToWideString()); return; } - CFX_WideString wsTitle; + WideString wsTitle; pNotify->GetDocEnvironment()->GetTitle(hDoc, wsTitle); - pValue->SetString(wsTitle.UTF8Encode().AsStringC()); + pValue->SetString(wsTitle.UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue, @@ -200,7 +200,7 @@ void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, return; } pValue->SetString( - pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringC()); + pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { @@ -217,10 +217,10 @@ void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { return; } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CFX_WideString wsURL; + WideString wsURL; if (iLength >= 1) { - CFX_ByteString bsURL = pArguments->GetUTF8String(0); - wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC()); + ByteString bsURL = pArguments->GetUTF8String(0); + wsURL = WideString::FromUTF8(bsURL.AsStringView()); } pNotify->GetDocEnvironment()->GotoURL(hDoc, wsURL); } @@ -256,7 +256,7 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( - pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag); + pObject, pValue->ToWideString().AsStringView(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode()) return; @@ -285,39 +285,39 @@ void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { if (!pNotify) { return; } - CFX_WideString wsQuestion; - CFX_WideString wsTitle; - CFX_WideString wsDefaultAnswer; + WideString wsQuestion; + WideString wsTitle; + WideString wsDefaultAnswer; bool bMark = false; if (iLength >= 1) { - CFX_ByteString bsQuestion = pArguments->GetUTF8String(0); - wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsStringC()); + ByteString bsQuestion = pArguments->GetUTF8String(0); + wsQuestion = WideString::FromUTF8(bsQuestion.AsStringView()); } if (iLength >= 2) { - CFX_ByteString bsTitle = pArguments->GetUTF8String(1); - wsTitle = CFX_WideString::FromUTF8(bsTitle.AsStringC()); + ByteString bsTitle = pArguments->GetUTF8String(1); + wsTitle = WideString::FromUTF8(bsTitle.AsStringView()); } if (iLength >= 3) { - CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); - wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsStringC()); + ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); + wsDefaultAnswer = WideString::FromUTF8(bsDefaultAnswer.AsStringView()); } if (iLength >= 4) { bMark = pArguments->GetInt32(3) == 0 ? false : true; } - CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( + WideString wsAnswer = pNotify->GetAppProvider()->Response( wsQuestion, wsTitle, wsDefaultAnswer, bMark); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetString(wsAnswer.UTF8Encode().AsStringC()); + pValue->SetString(wsAnswer.UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) { if (CFXJSE_Value* pValue = pArguments->GetReturnValue()) pValue->SetInteger(0); } -static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, +static int32_t XFA_FilterName(const WideStringView& wsExpression, int32_t nStart, - CFX_WideString& wsFilter) { + WideString& wsFilter) { ASSERT(nStart > -1); int32_t iLength = wsExpression.GetLength(); if (nStart >= iLength) { @@ -349,21 +349,21 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { if (!pNotify) { return; } - CFX_WideString wsExpression; + WideString wsExpression; if (iLength >= 1) { - CFX_ByteString bsExpression = pArguments->GetUTF8String(0); - wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); + ByteString bsExpression = pArguments->GetUTF8String(0); + wsExpression = WideString::FromUTF8(bsExpression.AsStringView()); } if (wsExpression.IsEmpty()) { pNotify->ResetData(); return; } int32_t iStart = 0; - CFX_WideString wsName; + WideString wsName; CXFA_Node* pNode = nullptr; int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { - iStart = XFA_FilterName(wsExpression.AsStringC(), iStart, wsName); + iStart = XFA_FilterName(wsExpression.AsStringView(), iStart, wsName); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -375,8 +375,8 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(pObject, wsName.AsStringC(), - resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + pObject, wsName.AsStringView(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode()) { continue; } @@ -437,7 +437,7 @@ void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( - pObject, pValue->ToWideString().AsStringC(), resoveNodeRS, dwFlag); + pObject, pValue->ToWideString().AsStringView(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.objects.front()->IsNode()) return; @@ -472,8 +472,8 @@ void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { if (!pNotify) { return; } - CFX_WideString wsMessage; - CFX_WideString bsTitle; + WideString wsMessage; + WideString bsTitle; uint32_t dwMessageType = XFA_MBICON_Error; uint32_t dwButtonType = XFA_MB_OK; if (iLength >= 1) { @@ -506,7 +506,7 @@ void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { } bool CScript_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments, int32_t iArgIndex, - CFX_WideString& wsValue) { + WideString& wsValue) { if (!pArguments || iArgIndex < 0) { return false; } @@ -621,11 +621,11 @@ void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { return; } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CFX_WideString wsFilePath; + WideString wsFilePath; bool bXDP = true; if (iLength >= 1) { - CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); - wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); + ByteString bsFilePath = pArguments->GetUTF8String(0); + wsFilePath = WideString::FromUTF8(bsFilePath.AsStringView()); } if (iLength >= 2) { bXDP = pArguments->GetInt32(1) == 0 ? false : true; @@ -673,10 +673,10 @@ void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { if (!pNotify) { return; } - CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); + WideString wsDataTime = pNotify->GetCurrentDateTime(); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetString(wsDataTime.UTF8Encode().AsStringC()); + pValue->SetString(wsDataTime.UTF8Encode().AsStringView()); } void CScript_HostPseudoModel::ThrowSetLanguageException() const { diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.h b/xfa/fxfa/parser/cscript_hostpseudomodel.h index 821f88d137..4ec92dd73a 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.h +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.h @@ -54,7 +54,7 @@ class CScript_HostPseudoModel : public CXFA_Object { private: bool ValidateArgsForMsg(CFXJSE_Arguments* pArguments, int32_t iArgIndex, - CFX_WideString& wsValue); + WideString& wsValue); void ThrowSetLanguageException() const; void ThrowSetNumPagesException() const; void ThrowSetPlatformException() const; diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 46db2ca78c..e35a3b8aa0 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -28,7 +28,7 @@ CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::LayoutPseudoModel, - CFX_WideStringC(L"layoutPseudoModel")) {} + WideStringView(L"layoutPseudoModel")) {} CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {} @@ -73,11 +73,11 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, if (!pNode) return; - CFX_WideString wsUnit(L"pt"); + WideString wsUnit(L"pt"); if (iLength >= 2) { - CFX_ByteString bsUnit = pArguments->GetUTF8String(1); + ByteString bsUnit = pArguments->GetUTF8String(1); if (!bsUnit.IsEmpty()) - wsUnit = CFX_WideString::FromUTF8(bsUnit.AsStringC()); + wsUnit = WideString::FromUTF8(bsUnit.AsStringView()); } int32_t iIndex = iLength >= 3 ? pArguments->GetInt32(2) : 0; @@ -116,8 +116,8 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, measure.Set(rtRect.top, XFA_UNIT_Pt); break; } - float fValue = - measure.ToUnit(CXFA_Measurement::GetUnitFromString(wsUnit.AsStringC())); + float fValue = measure.ToUnit( + CXFA_Measurement::GetUnitFromString(wsUnit.AsStringView())); fValue = FXSYS_round(fValue * 1000) / 1000.0f; pValue->SetFloat(fValue); } @@ -203,7 +203,7 @@ void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) { std::vector<CXFA_Node*> CScript_LayoutPseudoModel::GetObjArray( CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, - const CFX_WideString& wsType, + const WideString& wsType, bool bOnPageArea) { CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(iPageNo); if (!pLayoutPage) @@ -338,14 +338,14 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { return; } int32_t iIndex = 0; - CFX_WideString wsType; + WideString wsType; bool bOnPageArea = false; if (iLength >= 1) iIndex = pArguments->GetInt32(0); if (iLength >= 2) { - CFX_ByteString bsType = pArguments->GetUTF8String(1); - wsType = CFX_WideString::FromUTF8(bsType.AsStringC()); + ByteString bsType = pArguments->GetUTF8String(1); + wsType = WideString::FromUTF8(bsType.AsStringView()); } if (iLength >= 3) bOnPageArea = pArguments->GetInt32(2) == 0 ? false : true; diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.h b/xfa/fxfa/parser/cscript_layoutpseudomodel.h index 6f98997b0d..539fcce4ca 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.h +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.h @@ -53,7 +53,7 @@ class CScript_LayoutPseudoModel : public CXFA_Object { private: std::vector<CXFA_Node*> GetObjArray(CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, - const CFX_WideString& wsType, + const WideString& wsType, bool bOnPageArea); void PageInternals(CFXJSE_Arguments* pArguments, bool bAbsPage); diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp index d9563ac93e..f0747f4a12 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp @@ -15,7 +15,7 @@ CScript_LogPseudoModel::CScript_LogPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::LogPseudoModel, - CFX_WideStringC(L"logPseudoModel")) {} + WideStringView(L"logPseudoModel")) {} CScript_LogPseudoModel::~CScript_LogPseudoModel() {} diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index c746a4e76f..a1136b1ddf 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -18,7 +18,7 @@ CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::SignaturePseudoModel, - CFX_WideStringC(L"signaturePseudoModel")) {} + WideStringView(L"signaturePseudoModel")) {} CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {} diff --git a/xfa/fxfa/parser/cxfa_bind.cpp b/xfa/fxfa/parser/cxfa_bind.cpp index aac2c18321..72373ae571 100644 --- a/xfa/fxfa/parser/cxfa_bind.cpp +++ b/xfa/fxfa/parser/cxfa_bind.cpp @@ -10,7 +10,7 @@ CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {} -void CXFA_Bind::GetPicture(CFX_WideString& wsPicture) { +void CXFA_Bind::GetPicture(WideString& wsPicture) { if (CXFA_Node* pPicture = m_pNode->GetChild(0, XFA_Element::Picture)) pPicture->TryContent(wsPicture); } diff --git a/xfa/fxfa/parser/cxfa_bind.h b/xfa/fxfa/parser/cxfa_bind.h index 40a2a1a482..b24e6f8769 100644 --- a/xfa/fxfa/parser/cxfa_bind.h +++ b/xfa/fxfa/parser/cxfa_bind.h @@ -16,7 +16,7 @@ class CXFA_Bind : public CXFA_Data { public: explicit CXFA_Bind(CXFA_Node* pNode); - void GetPicture(CFX_WideString& wsPicture); + void GetPicture(WideString& wsPicture); }; #endif // XFA_FXFA_PARSER_CXFA_BIND_H_ diff --git a/xfa/fxfa/parser/cxfa_binditems.cpp b/xfa/fxfa/parser/cxfa_binditems.cpp index c3c5cabe4e..c6dbdb3b02 100644 --- a/xfa/fxfa/parser/cxfa_binditems.cpp +++ b/xfa/fxfa/parser/cxfa_binditems.cpp @@ -10,18 +10,18 @@ CXFA_BindItems::CXFA_BindItems(CXFA_Node* pNode) : CXFA_Data(pNode) {} -void CXFA_BindItems::GetLabelRef(CFX_WideStringC& wsLabelRef) { +void CXFA_BindItems::GetLabelRef(WideStringView& wsLabelRef) { m_pNode->TryCData(XFA_ATTRIBUTE_LabelRef, wsLabelRef); } -void CXFA_BindItems::GetValueRef(CFX_WideStringC& wsValueRef) { +void CXFA_BindItems::GetValueRef(WideStringView& wsValueRef) { m_pNode->TryCData(XFA_ATTRIBUTE_ValueRef, wsValueRef); } -void CXFA_BindItems::GetRef(CFX_WideStringC& wsRef) { +void CXFA_BindItems::GetRef(WideStringView& wsRef) { m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef); } -bool CXFA_BindItems::SetConnection(const CFX_WideString& wsConnection) { +bool CXFA_BindItems::SetConnection(const WideString& wsConnection) { return m_pNode->SetCData(XFA_ATTRIBUTE_Connection, wsConnection); } diff --git a/xfa/fxfa/parser/cxfa_binditems.h b/xfa/fxfa/parser/cxfa_binditems.h index 191941a3fb..58e50da8ee 100644 --- a/xfa/fxfa/parser/cxfa_binditems.h +++ b/xfa/fxfa/parser/cxfa_binditems.h @@ -16,10 +16,10 @@ class CXFA_BindItems : public CXFA_Data { public: explicit CXFA_BindItems(CXFA_Node* pNode); - void GetLabelRef(CFX_WideStringC& wsLabelRef); - void GetValueRef(CFX_WideStringC& wsValueRef); - void GetRef(CFX_WideStringC& wsRef); - bool SetConnection(const CFX_WideString& wsConnection); + void GetLabelRef(WideStringView& wsLabelRef); + void GetValueRef(WideStringView& wsValueRef); + void GetRef(WideStringView& wsRef); + bool SetConnection(const WideString& wsConnection); }; #endif // XFA_FXFA_PARSER_CXFA_BINDITEMS_H_ diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp index bc89d81777..3b0f038f6a 100644 --- a/xfa/fxfa/parser/cxfa_calculate.cpp +++ b/xfa/fxfa/parser/cxfa_calculate.cpp @@ -21,7 +21,7 @@ CXFA_Script CXFA_Calculate::GetScript() { return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script)); } -void CXFA_Calculate::GetMessageText(CFX_WideString& wsMessage) { +void CXFA_Calculate::GetMessageText(WideString& wsMessage) { CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Message); if (!pNode) return; diff --git a/xfa/fxfa/parser/cxfa_calculate.h b/xfa/fxfa/parser/cxfa_calculate.h index 1012224069..b3a6ef2eaa 100644 --- a/xfa/fxfa/parser/cxfa_calculate.h +++ b/xfa/fxfa/parser/cxfa_calculate.h @@ -19,7 +19,7 @@ class CXFA_Calculate : public CXFA_Data { int32_t GetOverride(); CXFA_Script GetScript(); - void GetMessageText(CFX_WideString& wsMessage); + void GetMessageText(WideString& wsMessage); }; #endif // XFA_FXFA_PARSER_CXFA_CALCULATE_H_ diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp index 7bf18a5d3e..5a82ce36cb 100644 --- a/xfa/fxfa/parser/cxfa_data.cpp +++ b/xfa/fxfa/parser/cxfa_data.cpp @@ -11,7 +11,7 @@ #include "xfa/fxfa/parser/cxfa_node.h" // Static. -FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) { +FX_ARGB CXFA_Data::ToColor(const WideStringView& wsValue) { uint8_t r = 0, g = 0, b = 0; if (wsValue.GetLength() == 0) return 0xff000000; diff --git a/xfa/fxfa/parser/cxfa_data.h b/xfa/fxfa/parser/cxfa_data.h index 90b689020b..4a073abcb7 100644 --- a/xfa/fxfa/parser/cxfa_data.h +++ b/xfa/fxfa/parser/cxfa_data.h @@ -15,7 +15,7 @@ class CXFA_Node; class CXFA_Data { public: - static FX_ARGB ToColor(const CFX_WideStringC& wsValue); + static FX_ARGB ToColor(const WideStringView& wsValue); explicit CXFA_Data(CXFA_Node* pNode) : m_pNode(pNode) {} diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index 0af9bd47f1..edc7b23b6b 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -22,7 +22,7 @@ namespace { -CFX_WideString ExportEncodeAttribute(const CFX_WideString& str) { +WideString ExportEncodeAttribute(const WideString& str) { CFX_WideTextBuf textBuf; int32_t iLen = str.GetLength(); for (int32_t i = 0; i < iLen; i++) { @@ -54,7 +54,7 @@ bool IsXMLValidChar(wchar_t ch) { (ch >= 0x20 && ch <= 0xD7FF) || (ch >= 0xE000 && ch <= 0xFFFD); } -CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) { +WideString ExportEncodeContent(const WideStringView& str) { CFX_WideTextBuf textBuf; int32_t iLen = str.GetLength(); for (int32_t i = 0; i < iLen; i++) { @@ -87,10 +87,10 @@ CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) { void SaveAttribute(CXFA_Node* pNode, XFA_ATTRIBUTE eName, - const CFX_WideStringC& wsName, + const WideStringView& wsName, bool bProto, - CFX_WideString& wsOutput) { - CFX_WideString wsValue; + WideString& wsOutput) { + WideString wsValue; if ((!bProto && !pNode->HasAttribute((XFA_ATTRIBUTE)eName, bProto)) || !pNode->GetAttribute((XFA_ATTRIBUTE)eName, wsValue, false)) { return; @@ -121,7 +121,7 @@ bool AttributeSaveInDataModel(CXFA_Node* pNode, XFA_ATTRIBUTE eAttribute) { } bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) { - CFX_WideString wsContent; + WideString wsContent; if (!pContentNode->TryContent(wsContent, false, false)) return false; @@ -144,12 +144,12 @@ bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) { } void RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot, - CFX_WideString& wsVersionNumber) { + WideString& wsVersionNumber) { wsVersionNumber.clear(); if (!pTemplateRoot) return; - CFX_WideString wsTemplateNS; + WideString wsTemplateNS; if (!pTemplateRoot->TryNamespace(wsTemplateNS)) return; @@ -164,7 +164,7 @@ void RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot, void RegenerateFormFile_Changed(CXFA_Node* pNode, CFX_WideTextBuf& buf, bool bSaveXML) { - CFX_WideString wsAttrs; + WideString wsAttrs; int32_t iAttrs = 0; const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetElementType(), iAttrs); @@ -175,12 +175,12 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, (AttributeSaveInDataModel(pNode, pAttr->eName) && !bSaveXML)) { continue; } - CFX_WideString wsAttr; + WideString wsAttr; SaveAttribute(pNode, pAttr->eName, pAttr->pName, bSaveXML, wsAttr); wsAttrs += wsAttr; } - CFX_WideString wsChildren; + WideString wsChildren; switch (pNode->GetObjectType()) { case XFA_ObjectType::ContentNode: { if (!bSaveXML && !ContentNodeNeedtoExport(pNode)) @@ -196,7 +196,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, if (!pRawValueNode) break; - CFX_WideString wsContentType; + WideString wsContentType; pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML && wsContentType == L"text/html") { @@ -215,16 +215,16 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, pTempStream->SetCodePage(FX_CODEPAGE_UTF8); pRichTextXML->SaveXMLNode(pTempStream); - wsChildren += CFX_WideString::FromUTF8( - CFX_ByteStringC(pMemStream->GetBuffer(), pMemStream->GetSize())); + wsChildren += WideString::FromUTF8( + ByteStringView(pMemStream->GetBuffer(), pMemStream->GetSize())); } else if (pRawValueNode->GetElementType() == XFA_Element::Sharpxml && wsContentType == L"text/xml") { - CFX_WideString wsRawValue; + WideString wsRawValue; pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, false); if (wsRawValue.IsEmpty()) break; - std::vector<CFX_WideString> wsSelTextArray; + std::vector<WideString> wsSelTextArray; FX_STRSIZE iStart = 0; auto iEnd = wsRawValue.Find(L'\n', iStart); iEnd = !iEnd.has_value() ? wsRawValue.GetLength() : iEnd; @@ -241,7 +241,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, CXFA_Node* pGrandparentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); ASSERT(pGrandparentNode); - CFX_WideString bodyTagName; + WideString bodyTagName; bodyTagName = pGrandparentNode->GetCData(XFA_ATTRIBUTE_Name); if (bodyTagName.IsEmpty()) bodyTagName = L"ListBox1"; @@ -252,16 +252,16 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, for (int32_t i = 0; i < pdfium::CollectionSize<int32_t>(wsSelTextArray); i++) { buf << L"<value\n>"; - buf << ExportEncodeContent(wsSelTextArray[i].AsStringC()); + buf << ExportEncodeContent(wsSelTextArray[i].AsStringView()); buf << L"</value\n>"; } buf << L"</"; buf << bodyTagName; buf << L"\n>"; - wsChildren += buf.AsStringC(); + wsChildren += buf.AsStringView(); buf.Clear(); } else { - CFX_WideStringC wsValue = pRawValueNode->GetCData(XFA_ATTRIBUTE_Value); + WideStringView wsValue = pRawValueNode->GetCData(XFA_ATTRIBUTE_Value); wsChildren += ExportEncodeContent(wsValue); } break; @@ -269,7 +269,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, case XFA_ObjectType::TextNode: case XFA_ObjectType::NodeC: case XFA_ObjectType::NodeV: { - CFX_WideStringC wsValue = pNode->GetCData(XFA_ATTRIBUTE_Value); + WideStringView wsValue = pNode->GetCData(XFA_ATTRIBUTE_Value); wsChildren += ExportEncodeContent(wsValue); break; } @@ -286,7 +286,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChildNode) { RegenerateFormFile_Changed(pChildNode, newBuf, bSaveXML); - wsChildren += newBuf.AsStringC(); + wsChildren += newBuf.AsStringView(); newBuf.Clear(); pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); } @@ -297,7 +297,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChild) { RegenerateFormFile_Changed(pChild, newBuf, bSaveXML); - wsChildren += newBuf.AsStringC(); + wsChildren += newBuf.AsStringView(); newBuf.Clear(); pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); } @@ -307,8 +307,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, if (!wsChildren.IsEmpty() || !wsAttrs.IsEmpty() || pNode->HasAttribute(XFA_ATTRIBUTE_Name)) { - CFX_WideStringC wsElement = pNode->GetClassName(); - CFX_WideString wsName; + WideStringView wsElement = pNode->GetClassName(); + WideString wsName; SaveAttribute(pNode, XFA_ATTRIBUTE_Name, L"name", true, wsName); buf << L"<"; buf << wsElement; @@ -337,18 +337,18 @@ void RegenerateFormFile_Container( RegenerateFormFile_Changed(pNode, buf, bSaveXML); FX_STRSIZE nLen = buf.GetLength(); if (nLen > 0) - pStream->WriteString(buf.AsStringC()); + pStream->WriteString(buf.AsStringView()); return; } - CFX_WideStringC wsElement(pNode->GetClassName()); + WideStringView wsElement(pNode->GetClassName()); pStream->WriteString(L"<"); pStream->WriteString(wsElement); - CFX_WideString wsOutput; + WideString wsOutput; SaveAttribute(pNode, XFA_ATTRIBUTE_Name, L"name", true, wsOutput); - CFX_WideString wsAttrs; + WideString wsAttrs; int32_t iAttrs = 0; const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetElementType(), iAttrs); @@ -358,13 +358,13 @@ void RegenerateFormFile_Container( if (pAttr->eName == XFA_ATTRIBUTE_Name) continue; - CFX_WideString wsAttr; + WideString wsAttr; SaveAttribute(pNode, pAttr->eName, pAttr->pName, false, wsAttr); wsOutput += wsAttr; } if (!wsOutput.IsEmpty()) - pStream->WriteString(wsOutput.AsStringC()); + pStream->WriteString(wsOutput.AsStringView()); CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode) { @@ -391,17 +391,17 @@ void XFA_DataExporter_RegenerateFormFile( if (pNode->IsModelNode()) { pStream->WriteString(L"<form"); if (pChecksum) { - CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum); + WideString wsChecksum = WideString::FromUTF8(pChecksum); pStream->WriteString(L" checksum=\""); - pStream->WriteString(wsChecksum.AsStringC()); + pStream->WriteString(wsChecksum.AsStringView()); pStream->WriteString(L"\""); } pStream->WriteString(L" xmlns=\""); const wchar_t* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; - pStream->WriteString(CFX_WideStringC(pURI, FXSYS_wcslen(pURI))); + pStream->WriteString(WideStringView(pURI, FXSYS_wcslen(pURI))); - CFX_WideString wsVersionNumber; + WideString wsVersionNumber; RecognizeXFAVersionNumber( ToNode(pNode->GetDocument()->GetXFAObject(XFA_HASHCODE_Template)), wsVersionNumber); @@ -409,7 +409,7 @@ void XFA_DataExporter_RegenerateFormFile( wsVersionNumber = L"2.8"; wsVersionNumber += L"/\"\n>"; - pStream->WriteString(wsVersionNumber.AsStringC()); + pStream->WriteString(wsVersionNumber.AsStringView()); CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChildNode) { diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 85d2758467..3a46e26cb7 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -151,11 +151,11 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { if (pDatasetsChild->GetNameHash() != XFA_HASHCODE_Data) continue; - CFX_WideString wsNamespaceURI; + WideString wsNamespaceURI; if (!pDatasetsChild->TryNamespace(wsNamespaceURI)) continue; - CFX_WideString wsDatasetsURI; + WideString wsDatasetsURI; if (!pDatasetsNode->TryNamespace(wsDatasetsURI)) continue; if (wsNamespaceURI == wsDatasetsURI) @@ -255,7 +255,7 @@ bool CXFA_Document::IsInteractive() { if (!pConfig) return false; - CFX_WideString wsInteractive; + WideString wsInteractive; CXFA_Node* pPresent = pConfig->GetFirstChildByClass(XFA_Element::Present); if (!pPresent) return false; @@ -297,11 +297,11 @@ CXFA_ScriptContext* CXFA_Document::GetScriptContext() { } XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( - const CFX_WideString& wsTemplateNS) { - CFX_WideStringC wsTemplateURIPrefix = + const WideString& wsTemplateNS) { + WideStringView wsTemplateURIPrefix = XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI; FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength(); - if (CFX_WideStringC(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) != + if (WideStringView(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) != wsTemplateURIPrefix) { return XFA_VERSION_UNKNOWN; } @@ -325,14 +325,14 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( } CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot, - const CFX_WideStringC& wsID) { + const WideStringView& wsID) { if (!pRoot || wsID.IsEmpty()) return nullptr; CXFA_NodeIterator sIterator(pRoot); for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { - CFX_WideStringC wsIDVal; + WideStringView wsIDVal; if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { if (wsIDVal == wsID) return pNode; @@ -351,11 +351,11 @@ void CXFA_Document::DoProtoMerge() { CXFA_NodeIterator sIterator(pTemplateRoot); for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { - CFX_WideStringC wsIDVal; + WideStringView wsIDVal; if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode; } - CFX_WideStringC wsUseVal; + WideStringView wsUseVal; if (pNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { sUseNodes.insert(pNode); } else if (pNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && @@ -365,33 +365,33 @@ void CXFA_Document::DoProtoMerge() { } for (CXFA_Node* pUseHrefNode : sUseNodes) { - CFX_WideString wsUseVal; - CFX_WideStringC wsURI, wsID, wsSOM; + WideString wsUseVal; + WideStringView wsURI, wsID, wsSOM; if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && !wsUseVal.IsEmpty()) { auto uSharpPos = wsUseVal.Find('#'); if (!uSharpPos.has_value()) { - wsURI = wsUseVal.AsStringC(); + wsURI = wsUseVal.AsStringView(); } else { - wsURI = CFX_WideStringC(wsUseVal.c_str(), uSharpPos.value()); + wsURI = WideStringView(wsUseVal.c_str(), uSharpPos.value()); FX_STRSIZE uLen = wsUseVal.GetLength(); if (uLen >= uSharpPos.value() + 5 && - CFX_WideStringC(wsUseVal.c_str() + uSharpPos.value(), 5) == + WideStringView(wsUseVal.c_str() + uSharpPos.value(), 5) == L"#som(" && wsUseVal[uLen - 1] == ')') { - wsSOM = CFX_WideStringC(wsUseVal.c_str() + uSharpPos.value() + 5, - uLen - 1 - uSharpPos.value() - 5); + wsSOM = WideStringView(wsUseVal.c_str() + uSharpPos.value() + 5, + uLen - 1 - uSharpPos.value() - 5); } else { - wsID = CFX_WideStringC(wsUseVal.c_str() + uSharpPos.value() + 1, - uLen - uSharpPos.value() - 1); + wsID = WideStringView(wsUseVal.c_str() + uSharpPos.value() + 1, + uLen - uSharpPos.value() - 1); } } } else if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { if (wsUseVal[0] == '#') - wsID = CFX_WideStringC(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); + wsID = WideStringView(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); else - wsSOM = CFX_WideStringC(wsUseVal.c_str(), wsUseVal.GetLength()); + wsSOM = WideStringView(wsUseVal.c_str(), wsUseVal.GetLength()); } if (!wsURI.IsEmpty() && wsURI != L".") diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h index 8491febdbf..69154b21e8 100644 --- a/xfa/fxfa/parser/cxfa_document.h +++ b/xfa/fxfa/parser/cxfa_document.h @@ -70,7 +70,7 @@ class CXFA_Document { CXFA_FFNotify* GetNotify() const; CXFA_LocaleMgr* GetLocalMgr(); CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash); - CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); + CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const WideStringView& wsID); CXFA_Node* GetNotBindNode(const std::vector<CXFA_Object*>& arrayNodes); CXFA_LayoutProcessor* GetLayoutProcessor(); CXFA_LayoutProcessor* GetDocLayout(); @@ -87,7 +87,7 @@ class CXFA_Document { bool IsInteractive(); XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } - XFA_VERSION RecognizeXFAVersionNumber(const CFX_WideString& wsTemplateNS); + XFA_VERSION RecognizeXFAVersionNumber(const WideString& wsTemplateNS); CXFA_Node* CreateNode(uint32_t dwPacket, XFA_Element eElement); CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_Element eElement); diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp index d7534289b3..d541ea0f14 100644 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ b/xfa/fxfa/parser/cxfa_event.cpp @@ -26,7 +26,7 @@ XFA_Element CXFA_Event::GetEventType() const { return XFA_Element::Unknown; } -void CXFA_Event::GetRef(CFX_WideStringC& wsRef) { +void CXFA_Event::GetRef(WideStringView& wsRef) { m_pNode->TryCData(XFA_ATTRIBUTE_Ref, wsRef); } @@ -38,12 +38,12 @@ CXFA_Submit CXFA_Event::GetSubmit() const { return CXFA_Submit(m_pNode->GetChild(0, XFA_Element::Submit)); } -void CXFA_Event::GetSignDataTarget(CFX_WideString& wsTarget) { +void CXFA_Event::GetSignDataTarget(WideString& wsTarget) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::SignData); if (!pNode) return; - CFX_WideStringC wsCData; + WideStringView wsCData; pNode->TryCData(XFA_ATTRIBUTE_Target, wsCData); wsTarget = wsCData; } diff --git a/xfa/fxfa/parser/cxfa_event.h b/xfa/fxfa/parser/cxfa_event.h index fc0bcf34cc..3835454c28 100644 --- a/xfa/fxfa/parser/cxfa_event.h +++ b/xfa/fxfa/parser/cxfa_event.h @@ -24,8 +24,8 @@ class CXFA_Event : public CXFA_Data { XFA_Element GetEventType() const; CXFA_Script GetScript() const; CXFA_Submit GetSubmit() const; - void GetRef(CFX_WideStringC& wsRef); - void GetSignDataTarget(CFX_WideString& wsTarget); + void GetRef(WideStringView& wsRef); + void GetSignDataTarget(WideString& wsTarget); }; #endif // XFA_FXFA_PARSER_CXFA_EVENT_H_ diff --git a/xfa/fxfa/parser/cxfa_exdata.cpp b/xfa/fxfa/parser/cxfa_exdata.cpp index ac82b3043c..8ba9d0218b 100644 --- a/xfa/fxfa/parser/cxfa_exdata.cpp +++ b/xfa/fxfa/parser/cxfa_exdata.cpp @@ -10,6 +10,6 @@ CXFA_ExData::CXFA_ExData(CXFA_Node* pNode) : CXFA_Data(pNode) {} -bool CXFA_ExData::SetContentType(const CFX_WideString& wsContentType) { +bool CXFA_ExData::SetContentType(const WideString& wsContentType) { return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); } diff --git a/xfa/fxfa/parser/cxfa_exdata.h b/xfa/fxfa/parser/cxfa_exdata.h index c92bacd3f2..03913a2165 100644 --- a/xfa/fxfa/parser/cxfa_exdata.h +++ b/xfa/fxfa/parser/cxfa_exdata.h @@ -16,7 +16,7 @@ class CXFA_ExData : public CXFA_Data { public: explicit CXFA_ExData(CXFA_Node* pNode); - bool SetContentType(const CFX_WideString& wsContentType); + bool SetContentType(const WideString& wsContentType); }; #endif // XFA_FXFA_PARSER_CXFA_EXDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp index 8a7969d5e4..6b39134126 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -18,7 +18,7 @@ int32_t CXFA_Fill::GetPresence() { void CXFA_Fill::SetColor(FX_ARGB color) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Color); - CFX_WideString wsColor; + WideString wsColor; int a; int r; int g; @@ -30,7 +30,7 @@ void CXFA_Fill::SetColor(FX_ARGB color) { FX_ARGB CXFA_Fill::GetColor(bool bText) { if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color)) { - CFX_WideStringC wsColor; + WideStringView wsColor; if (pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor, false)) return CXFA_Data::ToColor(wsColor); } @@ -54,7 +54,7 @@ XFA_Element CXFA_Fill::GetFillType() { int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Pattern); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { - CFX_WideStringC wsColor; + WideStringView wsColor; pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); foreColor = CXFA_Data::ToColor(wsColor); } else { @@ -68,7 +68,7 @@ int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { int32_t eAttr = 50; pNode->TryInteger(XFA_ATTRIBUTE_Rate, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { - CFX_WideStringC wsColor; + WideStringView wsColor; pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); stippleColor = CXFA_Data::ToColor(wsColor); } else { @@ -82,7 +82,7 @@ int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) { XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight; pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { - CFX_WideStringC wsColor; + WideStringView wsColor; pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); endColor = CXFA_Data::ToColor(wsColor); } else { @@ -96,7 +96,7 @@ int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) { XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge; pNode->TryEnum(XFA_ATTRIBUTE_Type, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { - CFX_WideStringC wsColor; + WideStringView wsColor; pColor->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); endColor = CXFA_Data::ToColor(wsColor); } else { diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index 56e04b75f7..71aa61700f 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -18,21 +18,21 @@ float CXFA_Font::GetBaselineShift() { } float CXFA_Font::GetHorizontalScale() { - CFX_WideString wsValue; + WideString wsValue; m_pNode->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (float)iScale : 100.0f; } float CXFA_Font::GetVerticalScale() { - CFX_WideString wsValue; + WideString wsValue; m_pNode->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (float)iScale : 100.0f; } float CXFA_Font::GetLetterSpacing() { - CFX_WideStringC wsValue; + WideStringView wsValue; if (!m_pNode->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue)) return 0; @@ -66,7 +66,7 @@ float CXFA_Font::GetFontSize() { return ms.ToUnit(XFA_UNIT_Pt); } -void CXFA_Font::GetTypeface(CFX_WideStringC& wsTypeFace) { +void CXFA_Font::GetTypeface(WideStringView& wsTypeFace) { m_pNode->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace); } diff --git a/xfa/fxfa/parser/cxfa_font.h b/xfa/fxfa/parser/cxfa_font.h index 2a5fef1122..af0c348aa7 100644 --- a/xfa/fxfa/parser/cxfa_font.h +++ b/xfa/fxfa/parser/cxfa_font.h @@ -24,7 +24,7 @@ class CXFA_Font : public CXFA_Data { int32_t GetUnderline(); int32_t GetUnderlinePeriod(); float GetFontSize(); - void GetTypeface(CFX_WideStringC& wsTypeFace); + void GetTypeface(WideStringView& wsTypeFace); bool IsBold(); bool IsItalic(); diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_image.cpp index 8d14d62960..b6d78d9eda 100644 --- a/xfa/fxfa/parser/cxfa_image.cpp +++ b/xfa/fxfa/parser/cxfa_image.cpp @@ -15,11 +15,11 @@ int32_t CXFA_Image::GetAspect() { return m_pNode->GetEnum(XFA_ATTRIBUTE_Aspect); } -bool CXFA_Image::GetContentType(CFX_WideString& wsContentType) { +bool CXFA_Image::GetContentType(WideString& wsContentType) { return m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, wsContentType); } -bool CXFA_Image::GetHref(CFX_WideString& wsHref) { +bool CXFA_Image::GetHref(WideString& wsHref) { if (m_bDefValue) return m_pNode->TryCData(XFA_ATTRIBUTE_Href, wsHref); return m_pNode->GetAttribute(L"href", wsHref); @@ -31,18 +31,18 @@ int32_t CXFA_Image::GetTransferEncoding() { return XFA_ATTRIBUTEENUM_Base64; } -bool CXFA_Image::GetContent(CFX_WideString& wsText) { +bool CXFA_Image::GetContent(WideString& wsText) { return m_pNode->TryContent(wsText); } -bool CXFA_Image::SetContentType(const CFX_WideString& wsContentType) { +bool CXFA_Image::SetContentType(const WideString& wsContentType) { return m_pNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); } -bool CXFA_Image::SetHref(const CFX_WideString& wsHref) { +bool CXFA_Image::SetHref(const WideString& wsHref) { if (m_bDefValue) return m_pNode->SetCData(XFA_ATTRIBUTE_Href, wsHref); - return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsStringC()); + return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsStringView()); } bool CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) { diff --git a/xfa/fxfa/parser/cxfa_image.h b/xfa/fxfa/parser/cxfa_image.h index 204441ab6b..cc08bc3380 100644 --- a/xfa/fxfa/parser/cxfa_image.h +++ b/xfa/fxfa/parser/cxfa_image.h @@ -18,12 +18,12 @@ class CXFA_Image : public CXFA_Data { CXFA_Image(CXFA_Node* pNode, bool bDefValue); int32_t GetAspect(); - bool GetContentType(CFX_WideString& wsContentType); - bool GetHref(CFX_WideString& wsHref); + bool GetContentType(WideString& wsContentType); + bool GetHref(WideString& wsHref); int32_t GetTransferEncoding(); - bool GetContent(CFX_WideString& wsText); - bool SetContentType(const CFX_WideString& wsContentType); - bool SetHref(const CFX_WideString& wsHref); + bool GetContent(WideString& wsText); + bool SetContentType(const WideString& wsContentType); + bool SetHref(const WideString& wsHref); bool SetTransferEncoding(int32_t iTransferEncoding); private: diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index f7a019d2d8..7d9a2188c8 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -29,10 +29,10 @@ namespace { -std::vector<CFX_WideString> SeparateStringW(const wchar_t* pStr, - int32_t iStrLen, - wchar_t delimiter) { - std::vector<CFX_WideString> ret; +std::vector<WideString> SeparateStringW(const wchar_t* pStr, + int32_t iStrLen, + wchar_t delimiter) { + std::vector<WideString> ret; if (!pStr) return ret; if (iStrLen < 0) @@ -42,7 +42,7 @@ std::vector<CFX_WideString> SeparateStringW(const wchar_t* pStr, const wchar_t* pEnd = pStr + iStrLen; while (true) { if (pStr >= pEnd || delimiter == *pStr) { - ret.push_back(CFX_WideString(pToken, pStr - pToken)); + ret.push_back(WideString(pToken, pStr - pToken)); pToken = pStr + 1; if (pStr >= pEnd) break; @@ -1746,7 +1746,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { float fContentWidthLimit = bContainerWidthAutoSize ? FLT_MAX : containerSize.width - fLeftInset - fRightInset; - CFX_WideStringC wsColumnWidths; + WideStringView wsColumnWidths; if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { auto widths = SeparateStringW(wsColumnWidths.unterminated_c_str(), wsColumnWidths.GetLength(), L' '); @@ -1756,7 +1756,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { continue; m_rgSpecifiedColumnWidths.push_back( - CXFA_Measurement(width.AsStringC()).ToUnit(XFA_UNIT_Pt)); + CXFA_Measurement(width.AsStringView()).ToUnit(XFA_UNIT_Pt)); } } diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index b80100a5f0..d8fdbb4ba1 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -65,7 +65,7 @@ class PageSetContainerLayoutItem { uint32_t GetRelevant(CXFA_Node* pFormItem, uint32_t dwParentRelvant) { uint32_t dwRelevant = XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable; - CFX_WideStringC wsRelevant; + WideStringView wsRelevant; if (pFormItem->TryCData(XFA_ATTRIBUTE_Relevant, wsRelevant)) { if (wsRelevant == L"+print" || wsRelevant == L"print") dwRelevant &= ~XFA_WidgetStatus_Viewable; @@ -136,18 +136,18 @@ void RemoveLayoutItem(CXFA_ContainerLayoutItem* pLayoutItem) { CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, bool bNewExprStyle, - CFX_WideStringC& wsTargetExpr) { + WideStringView& wsTargetExpr) { CXFA_Document* pDocument = pPageSetRoot->GetDocument(); if (wsTargetExpr.IsEmpty()) return nullptr; - CFX_WideString wsTargetAll(wsTargetExpr); + WideString wsTargetAll(wsTargetExpr); wsTargetAll.TrimLeft(); wsTargetAll.TrimRight(); int32_t iSplitIndex = 0; bool bTargetAllFind = true; while (iSplitIndex != -1) { - CFX_WideString wsExpr; + WideString wsExpr; pdfium::Optional<FX_STRSIZE> iSplitNextIndex = 0; if (!bTargetAllFind) { iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex); @@ -165,17 +165,17 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, if (wsExpr[0] == '#') { CXFA_Node* pNode = pDocument->GetNodeByID( ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)), - wsExpr.Right(wsExpr.GetLength() - 1).AsStringC()); + wsExpr.Right(wsExpr.GetLength() - 1).AsStringView()); if (pNode) return pNode; } else if (bNewExprStyle) { - CFX_WideString wsProcessedTarget = wsExpr; + WideString wsProcessedTarget = wsExpr; if (wsExpr.Left(4) == L"som(" && wsExpr.Last() == L')') { wsProcessedTarget = wsExpr.Mid(4, wsExpr.GetLength() - 5); } XFA_RESOLVENODE_RS rs; int32_t iCount = pDocument->GetScriptContext()->ResolveObjects( - pPageSetRoot, wsProcessedTarget.AsStringC(), rs, + pPageSetRoot, wsProcessedTarget.AsStringView(), rs, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent); @@ -477,7 +477,7 @@ float CXFA_LayoutPageMgr::GetAvailHeight() { } bool XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) { - CFX_WideString wsExpression; + WideString wsExpression; pTestScript->TryContent(wsExpression); if (wsExpression.IsEmpty()) return true; @@ -801,7 +801,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( switch (eType) { case XFA_Element::BreakBefore: case XFA_Element::BreakAfter: { - CFX_WideStringC wsBreakLeader, wsBreakTrailer; + WideStringView wsBreakLeader, wsBreakTrailer; CXFA_Node* pFormNode = pCurNode->GetNodeItem( XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); CXFA_Node* pContainer = pFormNode->GetTemplateNode(); @@ -810,7 +810,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) return false; - CFX_WideStringC wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target); + WideStringView wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target); CXFA_Node* pTarget = ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget); wsBreakTrailer = pCurNode->GetCData(XFA_ATTRIBUTE_Trailer); @@ -845,7 +845,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( } case XFA_Element::Break: { bool bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; - CFX_WideStringC wsTarget = pCurNode->GetCData( + WideStringView wsTarget = pCurNode->GetCData( bBefore ? XFA_ATTRIBUTE_BeforeTarget : XFA_ATTRIBUTE_AfterTarget); CXFA_Node* pTarget = ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget); @@ -936,9 +936,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) ->GetTemplateNode(); if (pOverflowNode->GetElementType() == XFA_Element::Break) { - CFX_WideStringC wsOverflowLeader; - CFX_WideStringC wsOverflowTarget; - CFX_WideStringC wsOverflowTrailer; + WideStringView wsOverflowLeader; + WideStringView wsOverflowTarget; + WideStringView wsOverflowTrailer; pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); @@ -978,9 +978,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, if (pOverflowNode->GetElementType() != XFA_Element::Overflow) return nullptr; - CFX_WideStringC wsOverflowLeader; - CFX_WideStringC wsOverflowTrailer; - CFX_WideStringC wsOverflowTarget; + WideStringView wsOverflowLeader; + WideStringView wsOverflowTrailer; + WideStringView wsOverflowTarget; pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); pOverflowNode->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); @@ -1067,7 +1067,7 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( CXFA_Node* pBookendNode, bool bLeader, CXFA_Node*& pBookendAppendTemplate) { - CFX_WideStringC wsBookendLeader; + WideStringView wsBookendLeader; CXFA_Node* pContainer = pBookendNode ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) @@ -1642,9 +1642,9 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) { for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { if (pCurNode->GetElementType() == XFA_Element::Break) { - CFX_WideStringC wsOverflowLeader; - CFX_WideStringC wsOverflowTarget; - CFX_WideStringC wsOverflowTrailer; + WideStringView wsOverflowLeader; + WideStringView wsOverflowTarget; + WideStringView wsOverflowTrailer; pCurNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); pCurNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp index 833f72c33f..5d74c9bf47 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.cpp +++ b/xfa/fxfa/parser/cxfa_localemgr.cpp @@ -1078,7 +1078,7 @@ static std::unique_ptr<IFX_Locale> XFA_GetLocaleFromBuffer(const uint8_t* pBuf, : nullptr; } -static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { +static uint16_t XFA_GetLanguage(WideString wsLanguage) { if (wsLanguage.GetLength() < 2) return FX_LANG_en_US; @@ -1121,7 +1121,7 @@ static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { return FX_LANG_en_US; } -CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid) +CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, WideString wsDeflcid) : m_dwLocaleFlags(0x00) { m_dwDeflcid = XFA_GetLanguage(wsDeflcid); if (pLocaleSet) { @@ -1194,8 +1194,7 @@ std::unique_ptr<IFX_Locale> CXFA_LocaleMgr::GetLocale(uint16_t lcid) { } } -IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( - const CFX_WideString& wsLocaleName) { +IFX_Locale* CXFA_LocaleMgr::GetLocaleByName(const WideString& wsLocaleName) { for (size_t i = 0; i < m_LocaleArray.size(); i++) { IFX_Locale* pLocale = m_LocaleArray[i].get(); if (pLocale->GetName() == wsLocaleName) @@ -1220,7 +1219,7 @@ void CXFA_LocaleMgr::SetDefLocale(IFX_Locale* pLocale) { m_pDefLocale = pLocale; } -CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { +WideStringView CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { if (!(m_dwLocaleFlags & 0x01)) { m_wsConfigLocale.clear(); if (pConfig) { @@ -1242,5 +1241,5 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { } m_dwLocaleFlags |= 0x01; } - return m_wsConfigLocale.AsStringC(); + return m_wsConfigLocale.AsStringView(); } diff --git a/xfa/fxfa/parser/cxfa_localemgr.h b/xfa/fxfa/parser/cxfa_localemgr.h index f730304c10..d77a94a519 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.h +++ b/xfa/fxfa/parser/cxfa_localemgr.h @@ -19,15 +19,15 @@ class IFX_Locale; class CXFA_LocaleMgr { public: - CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); + CXFA_LocaleMgr(CXFA_Node* pLocaleSet, WideString wsDeflcid); ~CXFA_LocaleMgr(); uint16_t GetDefLocaleID() const; IFX_Locale* GetDefLocale(); - IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName); + IFX_Locale* GetLocaleByName(const WideString& wsLocaleName); void SetDefLocale(IFX_Locale* pLocale); - CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); + WideStringView GetConfigLocaleName(CXFA_Node* pConfig); private: std::unique_ptr<IFX_Locale> GetLocale(uint16_t lcid); @@ -35,7 +35,7 @@ class CXFA_LocaleMgr { std::vector<std::unique_ptr<IFX_Locale>> m_LocaleArray; std::vector<std::unique_ptr<IFX_Locale>> m_XMLLocaleArray; IFX_Locale* m_pDefLocale; // owned by m_LocaleArray or m_XMLLocaleArray. - CFX_WideString m_wsConfigLocale; + WideString m_wsConfigLocale; uint16_t m_dwDeflcid; uint16_t m_dwLocaleFlags; }; diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp index dd56e6d7a1..109254fe2c 100644 --- a/xfa/fxfa/parser/cxfa_localevalue.cpp +++ b/xfa/fxfa/parser/cxfa_localevalue.cpp @@ -41,9 +41,9 @@ FX_LOCALECATEGORY ValueCategory(FX_LOCALECATEGORY eCategory, return FX_LOCALECATEGORY_Unknown; } -bool ValueSplitDateTime(const CFX_WideString& wsDateTime, - CFX_WideString& wsDate, - CFX_WideString& wsTime) { +bool ValueSplitDateTime(const WideString& wsDateTime, + WideString& wsDate, + WideString& wsTime) { wsDate = L""; wsTime = L""; if (wsDateTime.IsEmpty()) @@ -77,7 +77,7 @@ CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr) m_bValid(m_dwType != XFA_VT_NULL) {} CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, + const WideString& wsValue, CXFA_LocaleMgr* pLocaleMgr) : m_pLocaleMgr(pLocaleMgr), m_wsValue(wsValue), @@ -85,8 +85,8 @@ CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, m_bValid(ValidateCanonicalValue(wsValue, dwType)) {} CXFA_LocaleValue::CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, - const CFX_WideString& wsFormat, + const WideString& wsValue, + const WideString& wsFormat, IFX_Locale* pLocale, CXFA_LocaleMgr* pLocaleMgr) : m_pLocaleMgr(pLocaleMgr), @@ -103,24 +103,24 @@ CXFA_LocaleValue& CXFA_LocaleValue::operator=(const CXFA_LocaleValue& value) { CXFA_LocaleValue::~CXFA_LocaleValue() {} -bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, +bool CXFA_LocaleValue::ValidateValue(const WideString& wsValue, + const WideString& wsPattern, IFX_Locale* pLocale, - CFX_WideString* pMatchFormat) { - CFX_WideString wsOutput; + WideString* pMatchFormat) { + WideString wsOutput; IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); if (pLocale) m_pLocaleMgr->SetDefLocale(pLocale); auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr); - std::vector<CFX_WideString> wsPatterns; + std::vector<WideString> wsPatterns; pFormat->SplitFormatString(wsPattern, &wsPatterns); bool bRet = false; int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns); int32_t i = 0; for (; i < iCount && !bRet; i++) { - CFX_WideString wsFormat = wsPatterns[i]; + WideString wsFormat = wsPatterns[i]; switch (ValueCategory(pFormat->GetCategory(wsFormat), m_dwType)) { case FX_LOCALECATEGORY_Null: bRet = pFormat->ParseNull(wsValue, wsFormat); @@ -133,7 +133,7 @@ bool CXFA_LocaleValue::ValidateValue(const CFX_WideString& wsValue, bRet = wsValue == L"0"; break; case FX_LOCALECATEGORY_Num: { - CFX_WideString fNum; + WideString fNum; bRet = pFormat->ParseNum(wsValue, wsFormat, &fNum); if (!bRet) bRet = pFormat->FormatNum(wsValue, wsFormat, &wsOutput); @@ -285,7 +285,7 @@ CFX_DateTime CXFA_LocaleValue::GetTime() const { return CFX_DateTime(); CFX_DateTime dt; - FX_TimeFromCanonical(m_wsValue.AsStringC(), &dt, + FX_TimeFromCanonical(m_wsValue.AsStringView(), &dt, m_pLocaleMgr->GetDefLocale()); return dt; } @@ -301,7 +301,7 @@ bool CXFA_LocaleValue::SetTime(const CFX_DateTime& t) { m_wsValue.Format(L"%02d:%02d:%02d", t.GetHour(), t.GetMinute(), t.GetSecond()); if (t.GetMillisecond() > 0) { - CFX_WideString wsTemp; + WideString wsTemp; wsTemp.Format(L"%:03d", t.GetMillisecond()); m_wsValue += wsTemp; } @@ -314,19 +314,19 @@ bool CXFA_LocaleValue::SetDateTime(const CFX_DateTime& dt) { dt.GetMonth(), dt.GetDay(), dt.GetHour(), dt.GetMinute(), dt.GetSecond()); if (dt.GetMillisecond() > 0) { - CFX_WideString wsTemp; + WideString wsTemp; wsTemp.Format(L"%:03d", dt.GetMillisecond()); m_wsValue += wsTemp; } return true; } -bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, +bool CXFA_LocaleValue::FormatPatterns(WideString& wsResult, + const WideString& wsFormat, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const { auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr); - std::vector<CFX_WideString> wsPatterns; + std::vector<WideString> wsPatterns; pFormat->SplitFormatString(wsFormat, &wsPatterns); wsResult.clear(); int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns); @@ -337,8 +337,8 @@ bool CXFA_LocaleValue::FormatPatterns(CFX_WideString& wsResult, return false; } -bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, +bool CXFA_LocaleValue::FormatSinglePattern(WideString& wsResult, + const WideString& wsFormat, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const { IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); @@ -391,7 +391,7 @@ bool CXFA_LocaleValue::FormatSinglePattern(CFX_WideString& wsResult, return bRet; } -bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, +bool CXFA_LocaleValue::ValidateCanonicalValue(const WideString& wsValue, uint32_t dwVType) { if (wsValue.IsEmpty()) return true; @@ -402,8 +402,8 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, if (ValidateCanonicalDate(wsValue, &dt)) return true; - CFX_WideString wsDate; - CFX_WideString wsTime; + WideString wsDate; + WideString wsTime; if (ValueSplitDateTime(wsValue, wsDate, wsTime) && ValidateCanonicalDate(wsDate, &dt)) { return true; @@ -414,8 +414,8 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, if (ValidateCanonicalTime(wsValue)) return true; - CFX_WideString wsDate; - CFX_WideString wsTime; + WideString wsDate; + WideString wsTime; if (ValueSplitDateTime(wsValue, wsDate, wsTime) && ValidateCanonicalTime(wsTime)) { return true; @@ -423,7 +423,7 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, return false; } case XFA_VT_DATETIME: { - CFX_WideString wsDate, wsTime; + WideString wsDate, wsTime; if (ValueSplitDateTime(wsValue, wsDate, wsTime) && ValidateCanonicalDate(wsDate, &dt) && ValidateCanonicalTime(wsTime)) { return true; @@ -433,7 +433,7 @@ bool CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, return true; } -bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, +bool CXFA_LocaleValue::ValidateCanonicalDate(const WideString& wsDate, CFX_DateTime* unDate) { static const uint16_t LastDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; @@ -510,7 +510,7 @@ bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, return true; } -bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { +bool CXFA_LocaleValue::ValidateCanonicalTime(const WideString& wsTime) { int nLen = wsTime.GetLength(); if (nLen < 2) return false; @@ -605,20 +605,20 @@ bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { wFraction <= 999; } -bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, +bool CXFA_LocaleValue::ParsePatternValue(const WideString& wsValue, + const WideString& wsPattern, IFX_Locale* pLocale) { IFX_Locale* locale = m_pLocaleMgr->GetDefLocale(); if (pLocale) m_pLocaleMgr->SetDefLocale(pLocale); auto pFormat = pdfium::MakeUnique<CFGAS_FormatString>(m_pLocaleMgr); - std::vector<CFX_WideString> wsPatterns; + std::vector<WideString> wsPatterns; pFormat->SplitFormatString(wsPattern, &wsPatterns); bool bRet = false; int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns); for (int32_t i = 0; i < iCount && !bRet; i++) { - CFX_WideString wsFormat = wsPatterns[i]; + WideString wsFormat = wsPatterns[i]; switch (ValueCategory(pFormat->GetCategory(wsFormat), m_dwType)) { case FX_LOCALECATEGORY_Null: bRet = pFormat->ParseNull(wsValue, wsFormat); @@ -631,7 +631,7 @@ bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, m_wsValue = L"0"; break; case FX_LOCALECATEGORY_Num: { - CFX_WideString fNum; + WideString fNum; bRet = pFormat->ParseNum(wsValue, wsFormat, &fNum); if (bRet) m_wsValue = fNum; @@ -682,7 +682,7 @@ bool CXFA_LocaleValue::ParsePatternValue(const CFX_WideString& wsValue, return bRet; } -void CXFA_LocaleValue::GetNumericFormat(CFX_WideString& wsFormat, +void CXFA_LocaleValue::GetNumericFormat(WideString& wsFormat, int32_t nIntLen, int32_t nDecLen) { ASSERT(wsFormat.IsEmpty()); @@ -718,8 +718,8 @@ void CXFA_LocaleValue::GetNumericFormat(CFX_WideString& wsFormat, wsFormat.ReleaseBuffer(nTotalLen); } -bool CXFA_LocaleValue::ValidateNumericTemp(const CFX_WideString& wsNumeric, - const CFX_WideString& wsFormat, +bool CXFA_LocaleValue::ValidateNumericTemp(const WideString& wsNumeric, + const WideString& wsFormat, IFX_Locale* pLocale) { if (wsFormat.IsEmpty() || wsNumeric.IsEmpty()) return true; @@ -761,15 +761,15 @@ bool CXFA_LocaleValue::ValidateNumericTemp(const CFX_WideString& wsNumeric, ++nf; } - CFX_WideString wsDecimalSymbol; + WideString wsDecimalSymbol; if (pLocale) wsDecimalSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal); else - wsDecimalSymbol = CFX_WideString(L'.'); + wsDecimalSymbol = WideString(L'.'); if (pFmt[nf] != L'.') return false; - if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.') + if (wsDecimalSymbol != WideStringView(c) && c != L'.') return false; ++nf; diff --git a/xfa/fxfa/parser/cxfa_localevalue.h b/xfa/fxfa/parser/cxfa_localevalue.h index caf4b0c0f1..d49376332d 100644 --- a/xfa/fxfa/parser/cxfa_localevalue.h +++ b/xfa/fxfa/parser/cxfa_localevalue.h @@ -31,34 +31,32 @@ class CXFA_LocaleValue { CXFA_LocaleValue(const CXFA_LocaleValue& value); CXFA_LocaleValue(uint32_t dwType, CXFA_LocaleMgr* pLocaleMgr); CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, + const WideString& wsValue, CXFA_LocaleMgr* pLocaleMgr); CXFA_LocaleValue(uint32_t dwType, - const CFX_WideString& wsValue, - const CFX_WideString& wsFormat, + const WideString& wsValue, + const WideString& wsFormat, IFX_Locale* pLocale, CXFA_LocaleMgr* pLocaleMgr); ~CXFA_LocaleValue(); CXFA_LocaleValue& operator=(const CXFA_LocaleValue& value); - bool ValidateValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, + bool ValidateValue(const WideString& wsValue, + const WideString& wsPattern, IFX_Locale* pLocale, - CFX_WideString* pMatchFormat); + WideString* pMatchFormat); - bool FormatPatterns(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, + bool FormatPatterns(WideString& wsResult, + const WideString& wsFormat, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const; - void GetNumericFormat(CFX_WideString& wsFormat, - int32_t nIntLen, - int32_t nDecLen); - bool ValidateNumericTemp(const CFX_WideString& wsNumeric, - const CFX_WideString& wsFormat, + void GetNumericFormat(WideString& wsFormat, int32_t nIntLen, int32_t nDecLen); + bool ValidateNumericTemp(const WideString& wsNumeric, + const WideString& wsFormat, IFX_Locale* pLocale); - CFX_WideString GetValue() const { return m_wsValue; } + WideString GetValue() const { return m_wsValue; } uint32_t GetType() const { return m_dwType; } double GetDoubleNum() const; bool SetDate(const CFX_DateTime& d); @@ -68,24 +66,23 @@ class CXFA_LocaleValue { bool IsValid() const { return m_bValid; } private: - bool FormatSinglePattern(CFX_WideString& wsResult, - const CFX_WideString& wsFormat, + bool FormatSinglePattern(WideString& wsResult, + const WideString& wsFormat, IFX_Locale* pLocale, XFA_VALUEPICTURE eValueType) const; - bool ValidateCanonicalValue(const CFX_WideString& wsValue, uint32_t dwVType); - bool ValidateCanonicalDate(const CFX_WideString& wsDate, - CFX_DateTime* unDate); - bool ValidateCanonicalTime(const CFX_WideString& wsTime); + bool ValidateCanonicalValue(const WideString& wsValue, uint32_t dwVType); + bool ValidateCanonicalDate(const WideString& wsDate, CFX_DateTime* unDate); + bool ValidateCanonicalTime(const WideString& wsTime); bool SetTime(const CFX_DateTime& t); bool SetDateTime(const CFX_DateTime& dt); - bool ParsePatternValue(const CFX_WideString& wsValue, - const CFX_WideString& wsPattern, + bool ParsePatternValue(const WideString& wsValue, + const WideString& wsPattern, IFX_Locale* pLocale); CXFA_LocaleMgr* m_pLocaleMgr; - CFX_WideString m_wsValue; + WideString m_wsValue; uint32_t m_dwType; bool m_bValid; }; diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp index 1c427209f9..24b5ba2f59 100644 --- a/xfa/fxfa/parser/cxfa_measurement.cpp +++ b/xfa/fxfa/parser/cxfa_measurement.cpp @@ -18,7 +18,7 @@ constexpr float kPtToPc = 12; } // namespace -CXFA_Measurement::CXFA_Measurement(const CFX_WideStringC& wsMeasure) { +CXFA_Measurement::CXFA_Measurement(const WideStringView& wsMeasure) { SetString(wsMeasure); } @@ -30,7 +30,7 @@ CXFA_Measurement::CXFA_Measurement(float fValue, XFA_UNIT eUnit) { Set(fValue, eUnit); } -void CXFA_Measurement::SetString(const CFX_WideStringC& wsMeasure) { +void CXFA_Measurement::SetString(const WideStringView& wsMeasure) { if (wsMeasure.IsEmpty()) { m_fValue = 0; m_eUnit = XFA_UNIT_Unknown; @@ -45,7 +45,7 @@ void CXFA_Measurement::SetString(const CFX_WideStringC& wsMeasure) { Set(fValue, eUnit); } -bool CXFA_Measurement::ToString(CFX_WideString* wsMeasure) const { +bool CXFA_Measurement::ToString(WideString* wsMeasure) const { switch (GetUnit()) { case XFA_UNIT_Mm: wsMeasure->Format(L"%.8gmm", GetValue()); @@ -135,7 +135,7 @@ bool CXFA_Measurement::ToUnitInternal(XFA_UNIT eUnit, float* fValue) const { } // static -XFA_UNIT CXFA_Measurement::GetUnitFromString(const CFX_WideStringC& wsUnit) { +XFA_UNIT CXFA_Measurement::GetUnitFromString(const WideStringView& wsUnit) { if (wsUnit == L"mm") return XFA_UNIT_Mm; if (wsUnit == L"pt") diff --git a/xfa/fxfa/parser/cxfa_measurement.h b/xfa/fxfa/parser/cxfa_measurement.h index 2c03ec0dc6..0212ea1729 100644 --- a/xfa/fxfa/parser/cxfa_measurement.h +++ b/xfa/fxfa/parser/cxfa_measurement.h @@ -13,11 +13,11 @@ class CXFA_Measurement { public: - explicit CXFA_Measurement(const CFX_WideStringC& wsMeasure); + explicit CXFA_Measurement(const WideStringView& wsMeasure); CXFA_Measurement(); CXFA_Measurement(float fValue, XFA_UNIT eUnit); - static XFA_UNIT GetUnitFromString(const CFX_WideStringC& wsUnit); + static XFA_UNIT GetUnitFromString(const WideStringView& wsUnit); void Set(float fValue, XFA_UNIT eUnit) { m_fValue = fValue; @@ -27,11 +27,11 @@ class CXFA_Measurement { XFA_UNIT GetUnit() const { return m_eUnit; } float GetValue() const { return m_fValue; } - bool ToString(CFX_WideString* wsMeasure) const; + bool ToString(WideString* wsMeasure) const; float ToUnit(XFA_UNIT eUnit) const; private: - void SetString(const CFX_WideStringC& wsMeasure); + void SetString(const WideStringView& wsMeasure); bool ToUnitInternal(XFA_UNIT eUnit, float* fValue) const; float m_fValue; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 2f741c59e6..1dc20485ab 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -40,12 +40,12 @@ namespace { void XFA_DeleteWideString(void* pData) { - delete static_cast<CFX_WideString*>(pData); + delete static_cast<WideString*>(pData); } void XFA_CopyWideString(void*& pData) { if (pData) { - CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData); + WideString* pNewData = new WideString(*(WideString*)pData); pData = pNewData; } } @@ -74,8 +74,8 @@ int32_t GetCount(CXFA_Node* pInstMgrNode) { continue; } if (iCount == 0) { - CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); - CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' || wsInstName.Right(wsInstName.GetLength() - 1) != wsName) { return iCount; @@ -195,8 +195,8 @@ CXFA_Node* GetItem(CXFA_Node* pInstMgrNode, int32_t iIndex) { continue; } if (iCount == 0) { - CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); - CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' || wsInstName.Right(wsInstName.GetLength() - 1) != wsName) { return nullptr; @@ -377,7 +377,7 @@ static const XFA_ExecEventParaInfo gs_eventParaInfos[] = { }; const XFA_ExecEventParaInfo* GetEventParaInfoByName( - const CFX_WideStringC& wsEventName) { + const WideStringView& wsEventName) { uint32_t uHash = FX_HashCode_GetW(wsEventName, false); int32_t iStart = 0; int32_t iEnd = (sizeof(gs_eventParaInfos) / sizeof(gs_eventParaInfos[0])) - 1; @@ -394,10 +394,7 @@ const XFA_ExecEventParaInfo* GetEventParaInfoByName( return nullptr; } -void StrToRGB(const CFX_WideString& strRGB, - int32_t& r, - int32_t& g, - int32_t& b) { +void StrToRGB(const WideString& strRGB, int32_t& r, int32_t& g, int32_t& b) { r = 0; g = 0; b = 0; @@ -434,7 +431,7 @@ enum XFA_KEYTYPE { XFA_KEYTYPE_Element, }; -void* GetMapKey_Custom(const CFX_WideStringC& wsKey) { +void* GetMapKey_Custom(const WideStringView& wsKey) { uint32_t dwKey = FX_HashCode_GetW(wsKey, false); return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); } @@ -481,7 +478,7 @@ CXFA_Node::CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_ObjectType oType, XFA_Element eType, - const CFX_WideStringC& elementName) + const WideStringView& elementName) : CXFA_Object(pDoc, oType, eType, elementName), m_pNext(nullptr), m_pChild(nullptr), @@ -520,12 +517,12 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) { if (IsNeedSavingXMLNode()) { std::unique_ptr<CFX_XMLNode> pCloneXML; if (IsAttributeInXML()) { - CFX_WideString wsName; + WideString wsName; GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); auto pCloneXMLElement = pdfium::MakeUnique<CFX_XMLElement>(wsName); - CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); + WideStringView wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { - pCloneXMLElement->SetTextData(CFX_WideString(wsValue)); + pCloneXMLElement->SetTextData(WideString(wsValue)); } pCloneXML.reset(pCloneXMLElement.release()); pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); @@ -802,7 +799,7 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { XFA_ATTRIBUTEENUM_MultiSelect) { return nullptr; } else { - CFX_WideString wsPicture; + WideString wsPicture; if (pFieldWidgetData) { pFieldWidgetData->GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); @@ -846,7 +843,7 @@ CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { : nullptr; } -bool CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { +bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) { CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode(); CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_Element::Subform); ASSERT(pTopSubform); @@ -971,8 +968,8 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"resolveNode"); return; } - CFX_WideString wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); + WideString wsExpression = + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -984,7 +981,7 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( - refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag); + refNode, wsExpression.AsStringView(), resoveNodeRS, dwFlag); if (iRet < 1) { pArguments->GetReturnValue()->SetNull(); return; @@ -1014,8 +1011,8 @@ void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"resolveNodes"); return; } - CFX_WideString wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); + WideString wsExpression = + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (!pValue) return; @@ -1029,7 +1026,7 @@ void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { } void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, - CFX_WideString wsExpression, + WideString wsExpression, uint32_t dwFlag, CXFA_Node* refNode) { CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); @@ -1038,7 +1035,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, XFA_RESOLVENODE_RS resoveNodeRS; if (!refNode) refNode = this; - pScriptContext->ResolveObjects(refNode, wsExpression.AsStringC(), + pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(), resoveNodeRS, dwFlag); CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument.Get()); if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { @@ -1067,9 +1064,9 @@ void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue, } uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; - CFX_WideString wsName; + WideString wsName; GetAttribute(XFA_ATTRIBUTE_Name, wsName); - CFX_WideString wsExpression = wsName + L"[*]"; + WideString wsExpression = wsName + L"[*]"; Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag); } @@ -1080,8 +1077,8 @@ void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, if (!pScriptContext) return; if (bSetting) { - CFX_WideString wsMessage = L"Unable to set "; - FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC()); + WideString wsMessage = L"Unable to set "; + FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView()); } else { CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument.Get(), this); @@ -1097,7 +1094,7 @@ void CXFA_Node::Script_TreeClass_ClassAll(CFXJSE_Value* pValue, return; } uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; - CFX_WideString wsExpression = L"#" + GetClassName() + L"[*]"; + WideString wsExpression = L"#" + GetClassName() + L"[*]"; Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag); } @@ -1143,9 +1140,9 @@ void CXFA_Node::Script_TreeClass_SomExpression(CFXJSE_Value* pValue, ThrowInvalidPropertyException(); return; } - CFX_WideString wsSOMExpression; + WideString wsSOMExpression; GetSOMExpression(wsSOMExpression); - pValue->SetString(wsSOMExpression.UTF8Encode().AsStringC()); + pValue->SetString(wsSOMExpression.UTF8Encode().AsStringView()); } void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { @@ -1154,8 +1151,8 @@ void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"applyXSL"); return; } - CFX_WideString wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); + WideString wsExpression = + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); // TODO(weili): check whether we need to implement this, pdfium:501. // For now, just put the variables here to avoid unused variable warning. (void)wsExpression; @@ -1167,14 +1164,13 @@ void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"assignNode"); return; } - CFX_WideString wsExpression; - CFX_WideString wsValue; + WideString wsExpression; + WideString wsValue; int32_t iAction = 0; wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); if (iLength >= 2) { - wsValue = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC()); + wsValue = WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringView()); } if (iLength >= 3) iAction = pArguments->GetInt32(2); @@ -1203,13 +1199,13 @@ void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"getAttribute"); return; } - CFX_WideString wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); - CFX_WideString wsValue; - GetAttribute(wsExpression.AsStringC(), wsValue); + WideString wsExpression = + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); + WideString wsValue; + GetAttribute(wsExpression.AsStringView(), wsValue); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { @@ -1218,14 +1214,14 @@ void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"getElement"); return; } - CFX_WideString wsExpression; + WideString wsExpression; int32_t iValue = 0; wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); if (iLength >= 2) iValue = pArguments->GetInt32(1); - CXFA_Node* pNode = - GetProperty(iValue, XFA_GetElementTypeForName(wsExpression.AsStringC())); + CXFA_Node* pNode = GetProperty( + iValue, XFA_GetElementTypeForName(wsExpression.AsStringView())); pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); } @@ -1242,15 +1238,15 @@ void CXFA_Node::Script_NodeClass_IsPropertySpecified( if (!pValue) return; - CFX_WideString wsExpression = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); + WideString wsExpression = + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); const XFA_ATTRIBUTEINFO* pAttributeInfo = - XFA_GetAttributeByName(wsExpression.AsStringC()); + XFA_GetAttributeByName(wsExpression.AsStringView()); bool bHas = pAttributeInfo ? HasAttribute(pAttributeInfo->eName) : false; if (!bHas) { bool bParent = iLength < 2 || pArguments->GetInt32(1); int32_t iIndex = iLength == 3 ? pArguments->GetInt32(2) : 0; - XFA_Element eType = XFA_GetElementTypeForName(wsExpression.AsStringC()); + XFA_Element eType = XFA_GetElementTypeForName(wsExpression.AsStringView()); bHas = !!GetProperty(iIndex, eType); if (!bHas && bParent && m_pParent) { // Also check on the parent. @@ -1271,7 +1267,7 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { bool bIgnoreRoot = true; bool bOverwrite = 0; - CFX_ByteString wsExpression = pArguments->GetUTF8String(0); + ByteString wsExpression = pArguments->GetUTF8String(0); if (wsExpression.IsEmpty()) return; if (iLength >= 2) @@ -1291,10 +1287,9 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { bIgnoreRoot = false; } CXFA_Node* pFakeRoot = Clone(false); - CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType); + WideStringView wsContentType = GetCData(XFA_ATTRIBUTE_ContentType); if (!wsContentType.IsEmpty()) { - pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, - CFX_WideString(wsContentType)); + pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, WideString(wsContentType)); } std::unique_ptr<CFX_XMLNode> pFakeXMLRoot(pFakeRoot->GetXMLMappingNode()); @@ -1304,7 +1299,7 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { } if (!pFakeXMLRoot) { pFakeXMLRoot = - pdfium::MakeUnique<CFX_XMLElement>(CFX_WideString(GetClassName())); + pdfium::MakeUnique<CFX_XMLElement>(WideString(GetClassName())); } if (bIgnoreRoot) { @@ -1391,7 +1386,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { } bPrettyMode = true; } - CFX_WideString bsXMLHeader = L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + WideString bsXMLHeader = L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; if (GetPacketID() == XFA_XDPPACKET_Form || GetPacketID() == XFA_XDPPACKET_Datasets) { CFX_XMLNode* pElement = nullptr; @@ -1399,7 +1394,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { pElement = GetXMLMappingNode(); if (!pElement || pElement->GetType() != FX_XMLNODE_Element) { pArguments->GetReturnValue()->SetString( - bsXMLHeader.UTF8Encode().AsStringC()); + bsXMLHeader.UTF8Encode().AsStringView()); return; } XFA_DataExporter_DealWithDataGroupNode(this); @@ -1408,7 +1403,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pMemoryStream, true); pStream->SetCodePage(FX_CODEPAGE_UTF8); - pStream->WriteString(bsXMLHeader.AsStringC()); + pStream->WriteString(bsXMLHeader.AsStringView()); if (GetPacketID() == XFA_XDPPACKET_Form) XFA_DataExporter_RegenerateFormFile(this, pStream, nullptr, true); @@ -1418,7 +1413,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { // For now, just put it here to avoid unused variable warning. (void)bPrettyMode; pArguments->GetReturnValue()->SetString( - CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); + ByteStringView(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); return; } pArguments->GetReturnValue()->SetString(""); @@ -1430,11 +1425,12 @@ void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"setAttribute"); return; } - CFX_WideString wsAttributeValue = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); - CFX_WideString wsAttribute = - CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC()); - SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), true); + WideString wsAttributeValue = + WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); + WideString wsAttribute = + WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringView()); + SetAttribute(wsAttribute.AsStringView(), wsAttributeValue.AsStringView(), + true); } void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { @@ -1444,10 +1440,10 @@ void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { return; } CXFA_Node* pNode = nullptr; - CFX_WideString wsName; + WideString wsName; pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); if (iLength == 2) - wsName = CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC()); + wsName = WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringView()); // TODO(weili): check whether we need to implement this, pdfium:501. // For now, just put the variables here to avoid unused variable warning. (void)pNode; @@ -1462,9 +1458,9 @@ void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue, return; } - CFX_WideString wsNameSpace; + WideString wsNameSpace; TryNamespace(wsNameSpace); - pValue->SetString(wsNameSpace.UTF8Encode().AsStringC()); + pValue->SetString(wsNameSpace.UTF8Encode().AsStringView()); } void CXFA_Node::Script_NodeClass_Model(CFXJSE_Value* pValue, @@ -1499,7 +1495,7 @@ void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, pValue->SetBoolean(false); return; } - CFX_WideString strValue; + WideString strValue; pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty()); } @@ -1538,12 +1534,12 @@ void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"isCompatibleNS"); return; } - CFX_WideString wsNameSpace; + WideString wsNameSpace; if (iLength >= 1) { - CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0); - wsNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC()); + ByteString bsNameSpace = pArguments->GetUTF8String(0); + wsNameSpace = WideString::FromUTF8(bsNameSpace.AsStringView()); } - CFX_WideString wsNodeNameSpace; + WideString wsNodeNameSpace; TryNamespace(wsNodeNameSpace); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) @@ -1755,8 +1751,8 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - CFX_WideString wsValue = pValue->ToWideString(); - SetAttribute(eAttribute, wsValue.AsStringC(), true); + WideString wsValue = pValue->ToWideString(); + SetAttribute(eAttribute, wsValue.AsStringView(), true); if (eAttribute == XFA_ATTRIBUTE_Use && GetElementType() == XFA_Element::Desc) { CXFA_Node* pTemplateNode = @@ -1765,11 +1761,11 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, pTemplateNode->GetFirstChildByClass(XFA_Element::Subform) ->GetFirstChildByClass(XFA_Element::Proto); - CFX_WideString wsID; - CFX_WideString wsSOM; + WideString wsID; + WideString wsSOM; if (!wsValue.IsEmpty()) { if (wsValue[0] == '#') { - wsID = CFX_WideString(wsValue.c_str() + 1, wsValue.GetLength() - 1); + wsID = WideString(wsValue.c_str() + 1, wsValue.GetLength() - 1); } else { wsSOM = wsValue; } @@ -1782,12 +1778,12 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( - pProtoRoot, wsSOM.AsStringC(), resoveNodeRS, dwFlag); + pProtoRoot, wsSOM.AsStringView(), resoveNodeRS, dwFlag); if (iRet > 0 && resoveNodeRS.objects.front()->IsNode()) { pProtoNode = resoveNodeRS.objects.front()->AsNode(); } } else if (!wsID.IsEmpty()) { - pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsStringC()); + pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsStringView()); } if (pProtoNode) { CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1811,9 +1807,9 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, } } } else { - CFX_WideString wsValue; + WideString wsValue; GetAttribute(eAttribute, wsValue); - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } } @@ -1825,9 +1821,9 @@ void CXFA_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue, return; } - CFX_WideString wsValue; + WideString wsValue; GetAttribute(eAttribute, wsValue); - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { @@ -1891,7 +1887,7 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, pNotify->AddCalcValidate(this); } } else { - CFX_WideString wsMessage; + WideString wsMessage; switch (iMessageType) { case XFA_SOM_ValidationMessage: validate.GetScriptMessageText(wsMessage); @@ -1905,7 +1901,7 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, default: break; } - pValue->SetString(wsMessage.UTF8Encode().AsStringC()); + pValue->SetString(wsMessage.UTF8Encode().AsStringView()); } } @@ -1948,14 +1944,14 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, return; } if (bSetting) { - CFX_WideString wsNewValue; + WideString wsNewValue; if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) wsNewValue = pValue->ToWideString(); - CFX_WideString wsFormatValue(wsNewValue); + WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = nullptr; if (GetPacketID() == XFA_XDPPACKET_Datasets) { - CFX_WideString wsPicture; + WideString wsPicture; for (CXFA_Node* pFormNode : GetBindItems()) { if (!pFormNode || pFormNode->HasRemovedChildren()) continue; @@ -1976,17 +1972,17 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, } SetScriptContent(wsNewValue, wsFormatValue, true, true); } else { - CFX_WideString content = GetScriptContent(true); + WideString content = GetScriptContent(true); if (content.IsEmpty() && eType != XFA_Element::Text && eType != XFA_Element::SubmitUrl) { pValue->SetNull(); } else if (eType == XFA_Element::Integer) { pValue->SetInteger(FXSYS_wtoi(content.c_str())); } else if (eType == XFA_Element::Float || eType == XFA_Element::Decimal) { - CFX_Decimal decimal(content.AsStringC()); + CFX_Decimal decimal(content.AsStringView()); pValue->SetFloat((float)(double)decimal); } else { - pValue->SetString(content.UTF8Encode().AsStringC()); + pValue->SetString(content.UTF8Encode().AsStringView()); } } } @@ -1999,32 +1995,32 @@ void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, return; } - CFX_WideString content = GetScriptContent(true); + WideString content = GetScriptContent(true); if (content.IsEmpty()) { pValue->SetNull(); return; } - pValue->SetString(content.UTF8Encode().AsStringC()); + pValue->SetString(content.UTF8Encode().AsStringView()); } void CXFA_Node::Script_Boolean_Value(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - CFX_ByteString newValue; + ByteString newValue; if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) newValue = pValue->ToString(); int32_t iValue = FXSYS_atoi(newValue.c_str()); - CFX_WideString wsNewValue(iValue == 0 ? L"0" : L"1"); - CFX_WideString wsFormatValue(wsNewValue); + WideString wsNewValue(iValue == 0 ? L"0" : L"1"); + WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); if (pContainerWidgetData) { pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); } SetScriptContent(wsNewValue, wsFormatValue, true, true); } else { - CFX_WideString wsValue = GetScriptContent(true); + WideString wsValue = GetScriptContent(true); pValue->SetBoolean(wsValue == L"1"); } } @@ -2056,9 +2052,9 @@ void CXFA_Node::Script_Som_BorderColor(CFXJSE_Value* pValue, int32_t g; int32_t b; std::tie(a, r, g, b) = ArgbDecode(color); - CFX_WideString strColor; + WideString strColor; strColor.Format(L"%d,%d,%d", r, g, b); - pValue->SetString(strColor.UTF8Encode().AsStringC()); + pValue->SetString(strColor.UTF8Encode().AsStringView()); } } @@ -2071,19 +2067,19 @@ void CXFA_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue, } CXFA_Border border = pWidgetData->GetBorder(true); int32_t iSize = border.CountEdges(); - CFX_WideString wsThickness; + WideString wsThickness; if (bSetting) { wsThickness = pValue->ToWideString(); for (int32_t i = 0; i < iSize; ++i) { CXFA_Edge edge = border.GetEdge(i); - CXFA_Measurement thickness(wsThickness.AsStringC()); + CXFA_Measurement thickness(wsThickness.AsStringView()); edge.SetMSThickness(thickness); } } else { CXFA_Edge edge = border.GetEdge(0); CXFA_Measurement thickness = edge.GetMSThickness(); thickness.ToString(&wsThickness); - pValue->SetString(wsThickness.UTF8Encode().AsStringC()); + pValue->SetString(wsThickness.UTF8Encode().AsStringView()); } } @@ -2114,9 +2110,9 @@ void CXFA_Node::Script_Som_FillColor(CFXJSE_Value* pValue, int32_t g; int32_t b; std::tie(a, r, g, b) = ArgbDecode(color); - CFX_WideString wsColor; + WideString wsColor; wsColor.Format(L"%d,%d,%d", r, g, b); - pValue->SetString(wsColor.UTF8Encode().AsStringC()); + pValue->SetString(wsColor.UTF8Encode().AsStringView()); } } @@ -2146,17 +2142,17 @@ void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, ASSERT(pWidgetData); XFA_Element uiType = pWidgetData->GetUIType(); if (uiType == XFA_Element::Text) { - CFX_WideString wsNewValue = pValue->ToWideString(); - CFX_WideString wsFormatValue(wsNewValue); + WideString wsNewValue = pValue->ToWideString(); + WideString wsFormatValue(wsNewValue); SetScriptContent(wsNewValue, wsFormatValue, true, true); } } } else { - CFX_WideString content = GetScriptContent(true); + WideString content = GetScriptContent(true); if (content.IsEmpty()) pValue->SetNull(); else - pValue->SetString(content.UTF8Encode().AsStringC()); + pValue->SetString(content.UTF8Encode().AsStringView()); } } @@ -2175,7 +2171,7 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; pWidgetData->m_bIsNull = false; } - CFX_WideString wsNewText; + WideString wsNewText; if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) wsNewText = pValue->ToWideString(); @@ -2189,13 +2185,13 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); } CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); - CFX_WideString wsFormatText(wsNewText); + WideString wsFormatText(wsNewText); if (pContainerWidgetData) { pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); } SetScriptContent(wsNewText, wsFormatText, true, true); } else { - CFX_WideString content = GetScriptContent(true); + WideString content = GetScriptContent(true); if (content.IsEmpty()) { pValue->SetNull(); } else { @@ -2205,9 +2201,9 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { if (pUIChild->GetElementType() == XFA_Element::NumericEdit && (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { - pValue->SetString(content.UTF8Encode().AsStringC()); + pValue->SetString(content.UTF8Encode().AsStringView()); } else { - CFX_Decimal decimal(content.AsStringC()); + CFX_Decimal decimal(content.AsStringView()); pValue->SetFloat((float)(double)decimal); } } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { @@ -2215,10 +2211,10 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, } else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) { pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? false : true); } else if (pNode && pNode->GetElementType() == XFA_Element::Float) { - CFX_Decimal decimal(content.AsStringC()); + CFX_Decimal decimal(content.AsStringView()); pValue->SetFloat((float)(double)decimal); } else { - pValue->SetString(content.UTF8Encode().AsStringC()); + pValue->SetString(content.UTF8Encode().AsStringView()); } } } @@ -2234,9 +2230,9 @@ void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue, if (bSetting) { pWidgetData->SetValue(pValue->ToWideString(), XFA_VALUEPICTURE_Edit); } else { - CFX_WideString wsValue; + WideString wsValue; pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit); - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } } @@ -2266,9 +2262,9 @@ void CXFA_Node::Script_Som_FontColor(CFXJSE_Value* pValue, int32_t g; int32_t b; std::tie(a, r, g, b) = ArgbDecode(color); - CFX_WideString wsColor; + WideString wsColor; wsColor.Format(L"%d,%d,%d", r, g, b); - pValue->SetString(wsColor.UTF8Encode().AsStringC()); + pValue->SetString(wsColor.UTF8Encode().AsStringView()); } } @@ -2288,9 +2284,9 @@ void CXFA_Node::Script_Field_FormattedValue(CFXJSE_Value* pValue, if (bSetting) { pWidgetData->SetValue(pValue->ToWideString(), XFA_VALUEPICTURE_Display); } else { - CFX_WideString wsValue; + WideString wsValue; pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display); - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } } @@ -2308,10 +2304,10 @@ void CXFA_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, int32_t iValue = validate.GetNullTest(); const XFA_ATTRIBUTEENUMINFO* pInfo = GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); - CFX_WideString wsValue; + WideString wsValue; if (pInfo) wsValue = pInfo->pName; - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } } @@ -2364,9 +2360,9 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { return; } - CFX_ByteString eventString = pArguments->GetUTF8String(0); + ByteString eventString = pArguments->GetUTF8String(0); int32_t iRet = execSingleEventByName( - CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), + WideString::FromUTF8(eventString.AsStringView()).AsStringView(), XFA_Element::Field); if (eventString != "validate") return; @@ -2421,12 +2417,12 @@ void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) { pArguments->GetReturnValue()->SetNull(); return; } - CFX_WideString wsValue; + WideString wsValue; if (!pWidgetData->GetChoiceListItem(wsValue, iIndex, true)) { pArguments->GetReturnValue()->SetNull(); return; } - pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC()); + pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringView()); } void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { @@ -2439,13 +2435,13 @@ void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { if (!pWidgetData) { return; } - CFX_ByteString bsValue = pArguments->GetUTF8String(0); - CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); - CFX_WideString wsBoundValue; - pWidgetData->GetItemValue(wsValue.AsStringC(), wsBoundValue); + ByteString bsValue = pArguments->GetUTF8String(0); + WideString wsValue = WideString::FromUTF8(bsValue.AsStringView()); + WideString wsBoundValue; + pWidgetData->GetItemValue(wsValue.AsStringView(), wsBoundValue); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetString(wsBoundValue.UTF8Encode().AsStringC()); + pValue->SetString(wsBoundValue.UTF8Encode().AsStringView()); } void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { @@ -2496,12 +2492,12 @@ void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) { pArguments->GetReturnValue()->SetNull(); return; } - CFX_WideString wsValue; + WideString wsValue; if (!pWidgetData->GetChoiceListItem(wsValue, iIndex, false)) { pArguments->GetReturnValue()->SetNull(); return; } - pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC()); + pArguments->GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringView()); } void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { @@ -2533,15 +2529,15 @@ void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { if (!pWidgetData) { return; } - CFX_WideString wsLabel; - CFX_WideString wsValue; + WideString wsLabel; + WideString wsValue; if (iLength >= 1) { - CFX_ByteString bsLabel = pArguments->GetUTF8String(0); - wsLabel = CFX_WideString::FromUTF8(bsLabel.AsStringC()); + ByteString bsLabel = pArguments->GetUTF8String(0); + wsLabel = WideString::FromUTF8(bsLabel.AsStringView()); } if (iLength >= 2) { - CFX_ByteString bsValue = pArguments->GetUTF8String(1); - wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); + ByteString bsValue = pArguments->GetUTF8String(1); + wsValue = WideString::FromUTF8(bsValue.AsStringView()); } pWidgetData->InsertItem(wsLabel, wsValue, true); } @@ -2579,15 +2575,15 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue, return; } if (bSetting) { - pWidgetData->SetSelectedMemberByValue(pValue->ToWideString().AsStringC(), + pWidgetData->SetSelectedMemberByValue(pValue->ToWideString().AsStringView(), true, true, true); } else { - CFX_WideString wsValue = GetScriptContent(true); + WideString wsValue = GetScriptContent(true); XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { pValue->SetNull(); } else { - pValue->SetString(wsValue.UTF8Encode().AsStringC()); + pValue->SetString(wsValue.UTF8Encode().AsStringView()); } } } @@ -2602,9 +2598,9 @@ void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { return; } - CFX_ByteString eventString = pArguments->GetUTF8String(0); + ByteString eventString = pArguments->GetUTF8String(0); execSingleEventByName( - CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), + WideString::FromUTF8(eventString.AsStringView()).AsStringView(), XFA_Element::ExclGroup); } @@ -2625,10 +2621,10 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { if (argc == 0) { pReturnNode = pWidgetData->GetSelectedMember(); } else { - CFX_ByteString szName; + ByteString szName; szName = pArguments->GetUTF8String(0); pReturnNode = pWidgetData->SetSelectedMember( - CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC(), true); + WideString::FromUTF8(szName.AsStringView()).AsStringView(), true); } if (!pReturnNode) { pArguments->GetReturnValue()->SetNull(); @@ -2725,12 +2721,12 @@ void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, return; } - CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsName = GetCData(XFA_ATTRIBUTE_Name); CXFA_Node* pInstanceMgr = nullptr; for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { if (pNode->GetElementType() == XFA_Element::InstanceManager) { - CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName[0] == '_' && wsInstMgrName.Right(wsInstMgrName.GetLength() - 1) == wsName) { pInstanceMgr = pNode; @@ -2753,9 +2749,9 @@ void CXFA_Node::Script_Subform_Locale(CFXJSE_Value* pValue, if (bSetting) { SetCData(XFA_ATTRIBUTE_Locale, pValue->ToWideString(), true, true); } else { - CFX_WideString wsLocaleName; + WideString wsLocaleName; GetLocaleName(wsLocaleName); - pValue->SetString(wsLocaleName.UTF8Encode().AsStringC()); + pValue->SetString(wsLocaleName.UTF8Encode().AsStringView()); } } @@ -2765,9 +2761,9 @@ void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { return; } - CFX_ByteString eventString = pArguments->GetUTF8String(0); + ByteString eventString = pArguments->GetUTF8String(0); execSingleEventByName( - CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), + WideString::FromUTF8(eventString.AsStringView()).AsStringView(), XFA_Element::Subform); } @@ -2870,20 +2866,20 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { return; } - CFX_WideString strName; - CFX_WideString strNameSpace; - CFX_ByteString bsTagName = pArguments->GetUTF8String(0); - CFX_WideString strTagName = CFX_WideString::FromUTF8(bsTagName.AsStringC()); + WideString strName; + WideString strNameSpace; + ByteString bsTagName = pArguments->GetUTF8String(0); + WideString strTagName = WideString::FromUTF8(bsTagName.AsStringView()); if (argc > 1) { - CFX_ByteString bsName = pArguments->GetUTF8String(1); - strName = CFX_WideString::FromUTF8(bsName.AsStringC()); + ByteString bsName = pArguments->GetUTF8String(1); + strName = WideString::FromUTF8(bsName.AsStringView()); if (argc == 3) { - CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2); - strNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC()); + ByteString bsNameSpace = pArguments->GetUTF8String(2); + strNameSpace = WideString::FromUTF8(bsNameSpace.AsStringView()); } } - XFA_Element eType = XFA_GetElementTypeForName(strTagName.AsStringC()); + XFA_Element eType = XFA_GetElementTypeForName(strTagName.AsStringView()); CXFA_Node* pNewNode = CreateSamePacketNode(eType); if (!pNewNode) { pArguments->GetReturnValue()->SetNull(); @@ -2902,7 +2898,7 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { return; } - pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), true); + pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringView(), true); if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) pNewNode->CreateXMLMappingNode(); @@ -3156,13 +3152,13 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { return 0; } if (iDesired < iCount) { - CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); - CFX_WideString wsInstanceName = CFX_WideString( + WideStringView wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); + WideString wsInstanceName = WideString( wsInstManagerName.IsEmpty() ? wsInstManagerName : wsInstManagerName.Right(wsInstManagerName.GetLength() - 1)); uint32_t dInstanceNameHash = - FX_HashCode_GetW(wsInstanceName.AsStringC(), false); + FX_HashCode_GetW(wsInstanceName.AsStringView(), false); CXFA_Node* pPrevSibling = (iDesired == 0) ? this : GetItem(this, iDesired - 1); while (iCount > iDesired) { @@ -3352,12 +3348,12 @@ void CXFA_Node::Script_Form_Checksum(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - SetAttribute(XFA_ATTRIBUTE_Checksum, pValue->ToWideString().AsStringC()); + SetAttribute(XFA_ATTRIBUTE_Checksum, pValue->ToWideString().AsStringView()); return; } - CFX_WideString wsChecksum; + WideString wsChecksum; GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, false); - pValue->SetString(wsChecksum.UTF8Encode().AsStringC()); + pValue->SetString(wsChecksum.UTF8Encode().AsStringView()); } void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { @@ -3365,15 +3361,15 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"getAttribute"); return; } - CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); - CFX_WideString wsAttributeValue; + ByteString bsAttributeName = pArguments->GetUTF8String(0); + WideString wsAttributeValue; CFX_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { wsAttributeValue = static_cast<CFX_XMLElement*>(pXMLNode)->GetString( - CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str()); + WideString::FromUTF8(bsAttributeName.AsStringView()).c_str()); } pArguments->GetReturnValue()->SetString( - wsAttributeValue.UTF8Encode().AsStringC()); + wsAttributeValue.UTF8Encode().AsStringView()); } void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { @@ -3381,13 +3377,13 @@ void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { ThrowParamCountMismatchException(L"setAttribute"); return; } - CFX_ByteString bsValue = pArguments->GetUTF8String(0); - CFX_ByteString bsName = pArguments->GetUTF8String(1); + ByteString bsValue = pArguments->GetUTF8String(0); + ByteString bsName = pArguments->GetUTF8String(1); CFX_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { static_cast<CFX_XMLElement*>(pXMLNode)->SetString( - CFX_WideString::FromUTF8(bsName.AsStringC()), - CFX_WideString::FromUTF8(bsValue.AsStringC())); + WideString::FromUTF8(bsName.AsStringView()), + WideString::FromUTF8(bsValue.AsStringView())); } pArguments->GetReturnValue()->SetNull(); } @@ -3398,8 +3394,8 @@ void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { return; } - CFX_ByteString bsName = pArguments->GetUTF8String(0); - CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC()); + ByteString bsName = pArguments->GetUTF8String(0); + WideString wsName = WideString::FromUTF8(bsName.AsStringView()); CFX_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); @@ -3420,13 +3416,13 @@ void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue, pXMLElement->SetTextData(pValue->ToWideString()); } } else { - CFX_WideString wsTextData; + WideString wsTextData; CFX_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); wsTextData = pXMLElement->GetTextData(); } - pValue->SetString(wsTextData.UTF8Encode().AsStringC()); + pValue->SetString(wsTextData.UTF8Encode().AsStringView()); } } @@ -3548,7 +3544,7 @@ void CXFA_Node::Script_Script_Stateless(CFXJSE_Value* pValue, ThrowInvalidPropertyException(); return; } - pValue->SetString(FX_UTF8Encode(CFX_WideStringC(L"0", 1)).AsStringC()); + pValue->SetString(FX_UTF8Encode(WideStringView(L"0", 1)).AsStringView()); } void CXFA_Node::Script_Encrypt_Format(CFXJSE_Value* pValue, @@ -3561,7 +3557,7 @@ bool CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, bool bCanInherit) { } bool CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, - const CFX_WideStringC& wsValue, + const WideStringView& wsValue, bool bNotify) { const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); if (!pAttr) @@ -3582,7 +3578,7 @@ bool CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, bNotify); } break; case XFA_ATTRIBUTETYPE_Cdata: - return SetCData(pAttr->eName, CFX_WideString(wsValue), bNotify); + return SetCData(pAttr->eName, WideString(wsValue), bNotify); case XFA_ATTRIBUTETYPE_Boolean: return SetBoolean(pAttr->eName, wsValue != L"0", bNotify); case XFA_ATTRIBUTETYPE_Integer: @@ -3599,7 +3595,7 @@ bool CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, } bool CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, - CFX_WideString& wsValue, + WideString& wsValue, bool bUseDefault) { const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); if (!pAttr) @@ -3621,7 +3617,7 @@ bool CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, return true; } case XFA_ATTRIBUTETYPE_Cdata: { - CFX_WideStringC wsValueC; + WideStringView wsValueC; if (!TryCData(pAttr->eName, wsValueC, bUseDefault)) return false; @@ -3657,8 +3653,8 @@ bool CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, } } -bool CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr, - const CFX_WideStringC& wsValue, +bool CXFA_Node::SetAttribute(const WideStringView& wsAttr, + const WideStringView& wsValue, bool bNotify) { const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsValue); if (pAttributeInfo) { @@ -3669,22 +3665,22 @@ bool CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr, return true; } -bool CXFA_Node::GetAttribute(const CFX_WideStringC& wsAttr, - CFX_WideString& wsValue, +bool CXFA_Node::GetAttribute(const WideStringView& wsAttr, + WideString& wsValue, bool bUseDefault) { const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsAttr); if (pAttributeInfo) { return GetAttribute(pAttributeInfo->eName, wsValue, bUseDefault); } void* pKey = GetMapKey_Custom(wsAttr); - CFX_WideStringC wsValueC; + WideStringView wsValueC; if (GetMapModuleString(pKey, wsValueC)) { wsValue = wsValueC; } return true; } -bool CXFA_Node::RemoveAttribute(const CFX_WideStringC& wsAttr) { +bool CXFA_Node::RemoveAttribute(const WideStringView& wsAttr) { void* pKey = GetMapKey_Custom(wsAttr); RemoveMapModuleKey(pKey); return true; @@ -3755,16 +3751,16 @@ CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { } bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, - const CFX_WideString& wsValue, + const WideString& wsValue, bool bNotify, bool bScriptModify) { void* pKey = GetMapKey_Element(GetElementType(), eAttr); OnChanging(eAttr, bNotify); if (eAttr == XFA_ATTRIBUTE_Value) { - CFX_WideString* pClone = new CFX_WideString(wsValue); + WideString* pClone = new WideString(wsValue); SetUserData(pKey, pClone, &deleteWideStringCallBack); } else { - SetMapModuleString(pKey, wsValue.AsStringC()); + SetMapModuleString(pKey, wsValue.AsStringView()); if (eAttr == XFA_ATTRIBUTE_Name) UpdateNameHash(); } @@ -3787,7 +3783,7 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, case FX_XMLNODE_Element: if (IsAttributeInXML()) { static_cast<CFX_XMLElement*>(m_pXMLNode) - ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), + ->SetString(WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), wsValue); } else { bool bDeleteChildren = true; @@ -3820,7 +3816,7 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); if (pInfo) { ASSERT(m_pXMLNode->GetType() == FX_XMLNODE_Element); - CFX_WideString wsAttrName = pInfo->pName; + WideString wsAttrName = pInfo->pName; if (pInfo->eName == XFA_ATTRIBUTE_ContentType) { wsAttrName = L"xfa:" + wsAttrName; } @@ -3829,13 +3825,13 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, return true; } -bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, - const CFX_WideString& wsXMLValue, +bool CXFA_Node::SetAttributeValue(const WideString& wsValue, + const WideString& wsXMLValue, bool bNotify, bool bScriptModify) { void* pKey = GetMapKey_Element(GetElementType(), XFA_ATTRIBUTE_Value); OnChanging(XFA_ATTRIBUTE_Value, bNotify); - CFX_WideString* pClone = new CFX_WideString(wsValue); + WideString* pClone = new WideString(wsValue); SetUserData(pKey, pClone, &deleteWideStringCallBack); OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify); if (IsNeedSavingXMLNode()) { @@ -3844,7 +3840,7 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, case FX_XMLNODE_Element: if (IsAttributeInXML()) { static_cast<CFX_XMLElement*>(m_pXMLNode) - ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), + ->SetString(WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), wsXMLValue); } else { bool bDeleteChildren = true; @@ -3876,18 +3872,18 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, } bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, - CFX_WideString& wsValue, + WideString& wsValue, bool bUseDefault, bool bProto) { void* pKey = GetMapKey_Element(GetElementType(), eAttr); if (eAttr == XFA_ATTRIBUTE_Value) { - CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); + WideString* pStr = (WideString*)GetUserData(pKey, bProto); if (pStr) { wsValue = *pStr; return true; } } else { - CFX_WideStringC wsValueC; + WideStringView wsValueC; if (GetMapModuleString(pKey, wsValueC)) { wsValue = wsValueC; return true; @@ -3906,14 +3902,14 @@ bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, } bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, - CFX_WideStringC& wsValue, + WideStringView& wsValue, bool bUseDefault, bool bProto) { void* pKey = GetMapKey_Element(GetElementType(), eAttr); if (eAttr == XFA_ATTRIBUTE_Value) { - CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); + WideString* pStr = (WideString*)GetUserData(pKey, bProto); if (pStr) { - wsValue = pStr->AsStringC(); + wsValue = pStr->AsStringView(); return true; } } else { @@ -3927,7 +3923,7 @@ bool CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, void* pValue = nullptr; if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { - wsValue = (CFX_WideStringC)(const wchar_t*)pValue; + wsValue = (WideStringView)(const wchar_t*)pValue; return true; } return false; @@ -3971,7 +3967,7 @@ bool CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, ->SetString(pInfo->pName, pValue ? L"1" : L"0"); break; case XFA_ATTRIBUTETYPE_Integer: { - CFX_WideString wsValue; + WideString wsValue; wsValue.Format( L"%d", static_cast<int32_t>(reinterpret_cast<uintptr_t>(pValue))); static_cast<CFX_XMLElement*>(m_pXMLNode) @@ -4017,8 +4013,8 @@ bool CXFA_Node::TryUserData(void* pKey, void*& pData, bool bProtoAlso) { return iBytes == sizeof(void*) && memcpy(&pData, pData, iBytes); } -bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, - const CFX_WideString& wsXMLValue, +bool CXFA_Node::SetScriptContent(const WideString& wsContent, + const WideString& wsXMLValue, bool bNotify, bool bScriptModify, bool bSyncData) { @@ -4038,7 +4034,7 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, bScriptModify, false); CXFA_Node* pBind = GetBindData(); if (bSyncData && pBind) { - std::vector<CFX_WideString> wsSaveTextArray; + std::vector<WideString> wsSaveTextArray; size_t iSize = 0; if (!wsContent.IsEmpty()) { FX_STRSIZE iStart = 0; @@ -4132,12 +4128,12 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, break; } case XFA_ObjectType::ContentNode: { - CFX_WideString wsContentType; + WideString wsContentType; if (GetElementType() == XFA_Element::ExData) { GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); if (wsContentType == L"text/html") { wsContentType = L""; - SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC()); + SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringView()); } } CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); @@ -4193,8 +4189,8 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, return true; } -bool CXFA_Node::SetContent(const CFX_WideString& wsContent, - const CFX_WideString& wsXMLValue, +bool CXFA_Node::SetContent(const WideString& wsContent, + const WideString& wsXMLValue, bool bNotify, bool bScriptModify, bool bSyncData) { @@ -4202,16 +4198,16 @@ bool CXFA_Node::SetContent(const CFX_WideString& wsContent, bSyncData); } -CFX_WideString CXFA_Node::GetScriptContent(bool bScriptModify) { - CFX_WideString wsContent; - return TryContent(wsContent, bScriptModify) ? wsContent : CFX_WideString(); +WideString CXFA_Node::GetScriptContent(bool bScriptModify) { + WideString wsContent; + return TryContent(wsContent, bScriptModify) ? wsContent : WideString(); } -CFX_WideString CXFA_Node::GetContent() { +WideString CXFA_Node::GetContent() { return GetScriptContent(); } -bool CXFA_Node::TryContent(CFX_WideString& wsContent, +bool CXFA_Node::TryContent(WideString& wsContent, bool bScriptModify, bool bProto) { CXFA_Node* pNode = nullptr; @@ -4238,7 +4234,7 @@ bool CXFA_Node::TryContent(CFX_WideString& wsContent, if (!pContentRawDataNode) { XFA_Element element = XFA_Element::Sharptext; if (GetElementType() == XFA_Element::ExData) { - CFX_WideString wsContentType; + WideString wsContentType; GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); if (wsContentType == L"text/html") { element = XFA_Element::SharpxHTML; @@ -4298,7 +4294,7 @@ CXFA_Node* CXFA_Node::GetModelNode() { } } -bool CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { +bool CXFA_Node::TryNamespace(WideString& wsNamespace) { wsNamespace.clear(); if (IsModelNode() || GetElementType() == XFA_Element::Packet) { CFX_XMLNode* pXMLNode = GetXMLMappingNode(); @@ -4554,17 +4550,17 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { if (pNode->m_pXMLNode->GetType() == FX_XMLNODE_Element) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pNode->m_pXMLNode); - CFX_WideStringC wsAttributeName = + WideStringView wsAttributeName = pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); // TODO(tsepez): check usage of c_str() below. pXMLElement->RemoveAttribute(wsAttributeName.unterminated_c_str()); } - CFX_WideString wsName; + WideString wsName; pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); CFX_XMLElement* pNewXMLElement = new CFX_XMLElement(wsName); - CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); + WideStringView wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { - pNewXMLElement->SetTextData(CFX_WideString(wsValue)); + pNewXMLElement->SetTextData(WideString(wsValue)); } pNode->m_pXMLNode = pNewXMLElement; pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); @@ -4576,7 +4572,7 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { return true; } -CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { +CXFA_Node* CXFA_Node::GetFirstChildByName(const WideStringView& wsName) const { return GetFirstChildByName(FX_HashCode_GetW(wsName, false)); } @@ -4611,7 +4607,7 @@ CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { } CXFA_Node* CXFA_Node::GetNextSameNameSibling( - const CFX_WideStringC& wsNodeName) const { + const WideStringView& wsNodeName) const { return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false)); } @@ -4641,7 +4637,7 @@ int32_t CXFA_Node::GetNodeSameClassIndex() const { return pScriptContext->GetIndexByClassName(const_cast<CXFA_Node*>(this)); } -void CXFA_Node::GetSOMExpression(CFX_WideString& wsSOMExpression) { +void CXFA_Node::GetSOMExpression(WideString& wsSOMExpression) { CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; @@ -4664,8 +4660,8 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { break; } if (eType == XFA_Element::InstanceManager) { - CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); - CFX_WideStringC wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsName = GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name); if (wsInstName.GetLength() > 0 && wsInstName[0] == '_' && wsInstName.Right(wsInstName.GetLength() - 1) == wsName) { pInstanceMgr = pNode; @@ -4733,7 +4729,7 @@ void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr, } } -int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, +int32_t CXFA_Node::execSingleEventByName(const WideStringView& wsEventName, XFA_Element eType) { int32_t iRet = XFA_EVENTERROR_NotExist; const XFA_ExecEventParaInfo* eventParaInfo = @@ -4797,7 +4793,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, void CXFA_Node::UpdateNameHash() { const XFA_NOTSUREATTRIBUTE* pNotsure = XFA_GetNotsureAttribute(GetElementType(), XFA_ATTRIBUTE_Name); - CFX_WideStringC wsName; + WideStringView wsName; if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { wsName = GetCData(XFA_ATTRIBUTE_Name); m_dwNameHash = FX_HashCode_GetW(wsName, false); @@ -4809,7 +4805,7 @@ void CXFA_Node::UpdateNameHash() { CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() { if (!m_pXMLNode) { - CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); + WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); m_pXMLNode = new CFX_XMLElement(wsTag); SetFlag(XFA_NodeFlag_OwnXMLNode, false); } @@ -4852,19 +4848,19 @@ bool CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) { return false; } -void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) { +void CXFA_Node::SetMapModuleString(void* pKey, const WideStringView& wsValue) { SetMapModuleBuffer(pKey, (void*)wsValue.unterminated_c_str(), wsValue.GetLength() * sizeof(wchar_t)); } -bool CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) { +bool CXFA_Node::GetMapModuleString(void* pKey, WideStringView& wsValue) { void* pValue; int32_t iBytes; if (!GetMapModuleBuffer(pKey, pValue, iBytes)) return false; // Defensive measure: no out-of-bounds pointers even if zero length. int32_t iChars = iBytes / sizeof(wchar_t); - wsValue = CFX_WideStringC(iChars ? (const wchar_t*)pValue : nullptr, iChars); + wsValue = WideStringView(iChars ? (const wchar_t*)pValue : nullptr, iChars); return true; } @@ -5047,8 +5043,8 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { } } if (pDstModule->IsNodeV()) { - CFX_WideString wsValue = pDstModule->GetScriptContent(false); - CFX_WideString wsFormatValue(wsValue); + WideString wsValue = pDstModule->GetScriptContent(false); + WideString wsFormatValue(wsValue); CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); if (pWidgetData) { pWidgetData->GetFormatDataValue(wsValue, wsFormatValue); @@ -5076,15 +5072,13 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, pSrcModule->MoveBufferMapData(pDstModule, pKey); } -void CXFA_Node::ThrowMissingPropertyException( - const CFX_WideString& obj, - const CFX_WideString& prop) const { +void CXFA_Node::ThrowMissingPropertyException(const WideString& obj, + const WideString& prop) const { ThrowException(L"'%s' doesn't have property '%s'.", obj.c_str(), prop.c_str()); } -void CXFA_Node::ThrowTooManyOccurancesException( - const CFX_WideString& obj) const { +void CXFA_Node::ThrowTooManyOccurancesException(const WideString& obj) const { ThrowException( L"The element [%s] has violated its allowable number of occurrences.", obj.c_str()); diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index db4b2ce553..7faed0e38f 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -105,29 +105,29 @@ class CXFA_Node : public CXFA_Object { void UpdateNameHash(); bool HasAttribute(XFA_ATTRIBUTE eAttr, bool bCanInherit = false); bool SetAttribute(XFA_ATTRIBUTE eAttr, - const CFX_WideStringC& wsValue, + const WideStringView& wsValue, bool bNotify = false); bool GetAttribute(XFA_ATTRIBUTE eAttr, - CFX_WideString& wsValue, + WideString& wsValue, bool bUseDefault = true); - bool SetAttribute(const CFX_WideStringC& wsAttr, - const CFX_WideStringC& wsValue, + bool SetAttribute(const WideStringView& wsAttr, + const WideStringView& wsValue, bool bNotify = false); - bool GetAttribute(const CFX_WideStringC& wsAttr, - CFX_WideString& wsValue, + bool GetAttribute(const WideStringView& wsAttr, + WideString& wsValue, bool bUseDefault = true); - bool RemoveAttribute(const CFX_WideStringC& wsAttr); - bool SetContent(const CFX_WideString& wsContent, - const CFX_WideString& wsXMLValue, + bool RemoveAttribute(const WideStringView& wsAttr); + bool SetContent(const WideString& wsContent, + const WideString& wsXMLValue, bool bNotify = false, bool bScriptModify = false, bool bSyncData = true); - bool TryContent(CFX_WideString& wsContent, + bool TryContent(WideString& wsContent, bool bScriptModify = false, bool bProto = true); - CFX_WideString GetContent(); + WideString GetContent(); - bool TryNamespace(CFX_WideString& wsNamespace); + bool TryNamespace(WideString& wsNamespace); bool SetBoolean(XFA_ATTRIBUTE eAttr, bool bValue, bool bNotify = false) { return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (void*)(uintptr_t)bValue, @@ -163,24 +163,24 @@ class CXFA_Node : public CXFA_Object { return TryEnum(eAttr, eValue, true) ? eValue : XFA_ATTRIBUTEENUM_Unknown; } bool SetCData(XFA_ATTRIBUTE eAttr, - const CFX_WideString& wsValue, + const WideString& wsValue, bool bNotify = false, bool bScriptModify = false); - bool SetAttributeValue(const CFX_WideString& wsValue, - const CFX_WideString& wsXMLValue, + bool SetAttributeValue(const WideString& wsValue, + const WideString& wsXMLValue, bool bNotify = false, bool bScriptModify = false); bool TryCData(XFA_ATTRIBUTE eAttr, - CFX_WideString& wsValue, + WideString& wsValue, bool bUseDefault = true, bool bProto = true); bool TryCData(XFA_ATTRIBUTE eAttr, - CFX_WideStringC& wsValue, + WideStringView& wsValue, bool bUseDefault = true, bool bProto = true); - CFX_WideStringC GetCData(XFA_ATTRIBUTE eAttr) { - CFX_WideStringC wsValue; - return TryCData(eAttr, wsValue) ? wsValue : CFX_WideStringC(); + WideStringView GetCData(XFA_ATTRIBUTE eAttr) { + WideStringView wsValue; + return TryCData(eAttr, wsValue) ? wsValue : WideStringView(); } bool SetMeasure(XFA_ATTRIBUTE eAttr, CXFA_Measurement mValue, @@ -236,24 +236,24 @@ class CXFA_Node : public CXFA_Object { bool HasBindItem(); CXFA_WidgetData* GetWidgetData(); CXFA_WidgetData* GetContainerWidgetData(); - bool GetLocaleName(CFX_WideString& wsLocaleName); + bool GetLocaleName(WideString& wsLocaleName); XFA_ATTRIBUTEENUM GetIntact(); - CXFA_Node* GetFirstChildByName(const CFX_WideStringC& wsNodeName) const; + CXFA_Node* GetFirstChildByName(const WideStringView& wsNodeName) const; CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const; CXFA_Node* GetFirstChildByClass(XFA_Element eType) const; CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const; - CXFA_Node* GetNextSameNameSibling(const CFX_WideStringC& wsNodeName) const; + CXFA_Node* GetNextSameNameSibling(const WideStringView& wsNodeName) const; CXFA_Node* GetNextSameClassSibling(XFA_Element eType) const; int32_t GetNodeSameNameIndex() const; int32_t GetNodeSameClassIndex() const; - void GetSOMExpression(CFX_WideString& wsSOMExpression); + void GetSOMExpression(WideString& wsSOMExpression); CXFA_Node* GetInstanceMgrOfSubform(); CXFA_Node* GetOccurNode(); void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments); void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments); void Script_Som_ResolveNodeList(CFXJSE_Value* pValue, - CFX_WideString wsExpression, + WideString wsExpression, uint32_t dwFlag, CXFA_Node* refNode = nullptr); void Script_TreeClass_All(CFXJSE_Value* pValue, @@ -540,7 +540,7 @@ class CXFA_Node : public CXFA_Object { uint16_t ePacket, XFA_ObjectType oType, XFA_Element eType, - const CFX_WideStringC& elementName); + const WideStringView& elementName); ~CXFA_Node() override; bool HasFlag(XFA_NodeFlag dwFlag) const; @@ -556,20 +556,20 @@ class CXFA_Node : public CXFA_Object { void OnRemoved(bool bNotify); void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify); void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, bool bScriptModify); - int32_t execSingleEventByName(const CFX_WideStringC& wsEventName, + int32_t execSingleEventByName(const WideStringView& wsEventName, XFA_Element eType); - bool SetScriptContent(const CFX_WideString& wsContent, - const CFX_WideString& wsXMLValue, + bool SetScriptContent(const WideString& wsContent, + const WideString& wsXMLValue, bool bNotify = true, bool bScriptModify = false, bool bSyncData = true); - CFX_WideString GetScriptContent(bool bScriptModify = false); + WideString GetScriptContent(bool bScriptModify = false); XFA_MAPMODULEDATA* CreateMapModuleData(); XFA_MAPMODULEDATA* GetMapModuleData() const; void SetMapModuleValue(void* pKey, void* pValue); bool GetMapModuleValue(void* pKey, void*& pValue); - void SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue); - bool GetMapModuleString(void* pKey, CFX_WideStringC& wsValue); + void SetMapModuleString(void* pKey, const WideStringView& wsValue); + bool GetMapModuleString(void* pKey, WideStringView& wsValue); void SetMapModuleBuffer( void* pKey, void* pValue, @@ -600,9 +600,9 @@ class CXFA_Node : public CXFA_Object { XFA_MAPMODULEDATA* m_pMapModuleData; private: - void ThrowMissingPropertyException(const CFX_WideString& obj, - const CFX_WideString& prop) const; - void ThrowTooManyOccurancesException(const CFX_WideString& obj) const; + void ThrowMissingPropertyException(const WideString& obj, + const WideString& prop) const; + void ThrowTooManyOccurancesException(const WideString& obj) const; }; #endif // XFA_FXFA_PARSER_CXFA_NODE_H_ diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index 4f1ed04fe3..bc91c66f77 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -31,7 +31,7 @@ CXFA_Node* CXFA_NodeHelper::ResolveNodes_GetOneChild(CXFA_Node* parent, return nullptr; std::vector<CXFA_Node*> siblings; - uint32_t uNameHash = FX_HashCode_GetW(CFX_WideStringC(pwsName), false); + uint32_t uNameHash = FX_HashCode_GetW(WideStringView(pwsName), false); NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName); return !siblings.empty() ? siblings[0] : nullptr; } @@ -228,13 +228,13 @@ int32_t CXFA_NodeHelper::GetIndex(CXFA_Node* pNode, } void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode, - CFX_WideString& wsName, + WideString& wsName, bool bIsAllPath, XFA_LOGIC_TYPE eLogicType) { wsName.clear(); if (bIsAllPath) { GetNameExpression(refNode, wsName, false, eLogicType); - CFX_WideString wsParent; + WideString wsParent; CXFA_Node* parent = ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); while (parent) { @@ -247,7 +247,7 @@ void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode, return; } - CFX_WideString ws; + WideString ws; bool bIsProperty = NodeIsProperty(refNode); if (refNode->IsUnnamed() || (bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) { @@ -275,9 +275,9 @@ bool CXFA_NodeHelper::NodeIsTransparent(CXFA_Node* refNode) { return false; } -bool CXFA_NodeHelper::CreateNode_ForCondition(CFX_WideString& wsCondition) { +bool CXFA_NodeHelper::CreateNode_ForCondition(WideString& wsCondition) { int32_t iLen = wsCondition.GetLength(); - CFX_WideString wsIndex(L"0"); + WideString wsIndex(L"0"); bool bAll = false; if (iLen == 0) { m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne; @@ -314,8 +314,8 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(CFX_WideString& wsCondition) { } bool CXFA_NodeHelper::ResolveNodes_CreateNode( - CFX_WideString wsName, - CFX_WideString wsCondition, + WideString wsName, + WideString wsCondition, bool bLastNode, CXFA_ScriptContext* pScriptContext) { if (!m_pCreateParent) { @@ -336,7 +336,7 @@ bool CXFA_NodeHelper::ResolveNodes_CreateNode( CreateNode_ForCondition(wsCondition); } if (bIsClassName) { - XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringC()); + XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringView()); if (eType == XFA_Element::Unknown) return false; @@ -358,7 +358,7 @@ bool CXFA_NodeHelper::ResolveNodes_CreateNode( for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) { CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType); if (pNewNode) { - pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsStringC()); + pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsStringView()); pNewNode->CreateXMLMappingNode(); m_pCreateParent->InsertChild(pNewNode); if (iIndex == m_iCreateCount - 1) { diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h index cf6c2f17a0..4c7d7ae10c 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.h +++ b/xfa/fxfa/parser/cxfa_nodehelper.h @@ -49,15 +49,15 @@ class CXFA_NodeHelper { bool bIsProperty = false, bool bIsClassIndex = false); void GetNameExpression(CXFA_Node* refNode, - CFX_WideString& wsName, + WideString& wsName, bool bIsAllPath, XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent); bool NodeIsTransparent(CXFA_Node* refNode); - bool ResolveNodes_CreateNode(CFX_WideString wsName, - CFX_WideString wsCondition, + bool ResolveNodes_CreateNode(WideString wsName, + WideString wsCondition, bool bLastNode, CXFA_ScriptContext* pScriptContext); - bool CreateNode_ForCondition(CFX_WideString& wsCondition); + bool CreateNode_ForCondition(WideString& wsCondition); void SetCreateNodeType(CXFA_Node* refNode); bool NodeIsProperty(CXFA_Node* refNode); diff --git a/xfa/fxfa/parser/cxfa_nodelist.cpp b/xfa/fxfa/parser/cxfa_nodelist.cpp index f47a1b1752..cea1f127a6 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.cpp +++ b/xfa/fxfa/parser/cxfa_nodelist.cpp @@ -17,14 +17,14 @@ CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList, - CFX_WideStringC(L"nodeList")) { + WideStringView(L"nodeList")) { m_pDocument->GetScriptContext()->AddToCacheList( std::unique_ptr<CXFA_NodeList>(this)); } CXFA_NodeList::~CXFA_NodeList() {} -CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { +CXFA_Node* CXFA_NodeList::NamedItem(const WideStringView& wsName) { uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); int32_t iCount = GetLength(); for (int32_t i = 0; i < iCount; i++) { @@ -105,9 +105,9 @@ void CXFA_NodeList::Script_TreelistClass_NamedItem( return; } - CFX_ByteString szName = pArguments->GetUTF8String(0); + ByteString szName = pArguments->GetUTF8String(0); CXFA_Node* pNode = - NamedItem(CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC()); + NamedItem(WideString::FromUTF8(szName.AsStringView()).AsStringView()); if (!pNode) return; diff --git a/xfa/fxfa/parser/cxfa_nodelist.h b/xfa/fxfa/parser/cxfa_nodelist.h index 6fffb7bb67..2fccd5d7a5 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.h +++ b/xfa/fxfa/parser/cxfa_nodelist.h @@ -19,7 +19,7 @@ class CXFA_NodeList : public CXFA_Object { explicit CXFA_NodeList(CXFA_Document* pDocument); ~CXFA_NodeList() override; - CXFA_Node* NamedItem(const CFX_WideStringC& wsName); + CXFA_Node* NamedItem(const WideStringView& wsName); virtual int32_t GetLength() = 0; virtual bool Append(CXFA_Node* pNode) = 0; virtual bool Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) = 0; diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp index 78b0cef278..d0d1fd34e4 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.cpp +++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp @@ -24,7 +24,7 @@ const wchar_t g_FX_Integer[] = L"z,zzz,zzz,zzz,zzz,zzz"; } // namespace -CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) { +WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) { switch (category) { case FX_LOCALENUMPATTERN_Percent: return g_FX_Percent; @@ -35,20 +35,19 @@ CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category) { case FX_LOCALENUMPATTERN_Integer: return g_FX_Integer; } - return CFX_WideString(); + return WideString(); } CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {} CXFA_NodeLocale::~CXFA_NodeLocale() {} -CFX_WideString CXFA_NodeLocale::GetName() const { - return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name) - : nullptr); +WideString CXFA_NodeLocale::GetName() const { + return WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name) + : nullptr); } -CFX_WideString CXFA_NodeLocale::GetNumbericSymbol( - FX_LOCALENUMSYMBOL eType) const { +WideString CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const { switch (eType) { case FX_LOCALENUMSYMBOL_Decimal: return GetSymbol(XFA_Element::NumberSymbols, L"decimal"); @@ -65,25 +64,25 @@ CFX_WideString CXFA_NodeLocale::GetNumbericSymbol( case FX_LOCALENUMSYMBOL_CurrencyName: return GetSymbol(XFA_Element::CurrencySymbols, L"isoname"); } - return CFX_WideString(); + return WideString(); } -CFX_WideString CXFA_NodeLocale::GetDateTimeSymbols() const { +WideString CXFA_NodeLocale::GetDateTimeSymbols() const { CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols) : nullptr; - return pSymbols ? pSymbols->GetContent() : CFX_WideString(); + return pSymbols ? pSymbols->GetContent() : WideString(); } -CFX_WideString CXFA_NodeLocale::GetMonthName(int32_t nMonth, bool bAbbr) const { +WideString CXFA_NodeLocale::GetMonthName(int32_t nMonth, bool bAbbr) const { return GetCalendarSymbol(XFA_Element::MonthNames, nMonth, bAbbr); } -CFX_WideString CXFA_NodeLocale::GetDayName(int32_t nWeek, bool bAbbr) const { +WideString CXFA_NodeLocale::GetDayName(int32_t nWeek, bool bAbbr) const { return GetCalendarSymbol(XFA_Element::DayNames, nWeek, bAbbr); } -CFX_WideString CXFA_NodeLocale::GetMeridiemName(bool bAM) const { +WideString CXFA_NodeLocale::GetMeridiemName(bool bAM) const { return GetCalendarSymbol(XFA_Element::MeridiemNames, bAM ? 0 : 1, false); } @@ -91,11 +90,11 @@ FX_TIMEZONE CXFA_NodeLocale::GetTimeZone() const { return CXFA_TimeZoneProvider().GetTimeZone(); } -CFX_WideString CXFA_NodeLocale::GetEraName(bool bAD) const { +WideString CXFA_NodeLocale::GetEraName(bool bAD) const { return GetCalendarSymbol(XFA_Element::EraNames, bAD ? 1 : 0, false); } -CFX_WideString CXFA_NodeLocale::GetDatePattern( +WideString CXFA_NodeLocale::GetDatePattern( FX_LOCALEDATETIMESUBCATEGORY eType) const { switch (eType) { case FX_LOCALEDATETIMESUBCATEGORY_Short: @@ -108,10 +107,10 @@ CFX_WideString CXFA_NodeLocale::GetDatePattern( case FX_LOCALEDATETIMESUBCATEGORY_Long: return GetSymbol(XFA_Element::DatePatterns, L"long"); } - return CFX_WideString(); + return WideString(); } -CFX_WideString CXFA_NodeLocale::GetTimePattern( +WideString CXFA_NodeLocale::GetTimePattern( FX_LOCALEDATETIMESUBCATEGORY eType) const { switch (eType) { case FX_LOCALEDATETIMESUBCATEGORY_Short: @@ -124,20 +123,19 @@ CFX_WideString CXFA_NodeLocale::GetTimePattern( case FX_LOCALEDATETIMESUBCATEGORY_Long: return GetSymbol(XFA_Element::TimePatterns, L"long"); } - return CFX_WideString(); + return WideString(); } -CFX_WideString CXFA_NodeLocale::GetNumPattern( - FX_LOCALENUMSUBCATEGORY eType) const { +WideString CXFA_NodeLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const { return XFA_PatternToString(eType); } CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, - const CFX_WideStringC& wsName) const { + const WideStringView& wsName) const { CXFA_Node* pChild = pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; while (pChild) { - CFX_WideString wsChild; + WideString wsChild; if (pChild->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) { if (wsChild == wsName) return pChild; @@ -147,29 +145,28 @@ CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, return nullptr; } -CFX_WideString CXFA_NodeLocale::GetSymbol( - XFA_Element eElement, - const CFX_WideStringC& symbol_type) const { +WideString CXFA_NodeLocale::GetSymbol(XFA_Element eElement, + const WideStringView& symbol_type) const { CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr; CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type); - return pSymbol ? pSymbol->GetContent() : CFX_WideString(); + return pSymbol ? pSymbol->GetContent() : WideString(); } -CFX_WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, - int index, - bool bAbbr) const { +WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, + int index, + bool bAbbr) const { CXFA_Node* pCalendar = m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols) : nullptr; if (!pCalendar) - return CFX_WideString(); + return WideString(); CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { if (pNode->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown); - return pSymbol ? pSymbol->GetContent() : CFX_WideString(); + return pSymbol ? pSymbol->GetContent() : WideString(); } } - return CFX_WideString(); + return WideString(); } diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h index e051bb6ac3..5ad0d4c626 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.h +++ b/xfa/fxfa/parser/cxfa_nodelocale.h @@ -14,7 +14,7 @@ class CXFA_Node; -CFX_WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category); +WideString XFA_PatternToString(FX_LOCALENUMSUBCATEGORY category); class CXFA_NodeLocale : public IFX_Locale { public: @@ -22,30 +22,28 @@ class CXFA_NodeLocale : public IFX_Locale { ~CXFA_NodeLocale() override; // IFX_Locale - CFX_WideString GetName() const override; - CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override; + WideString GetName() const override; + WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override; - CFX_WideString GetDateTimeSymbols() const override; - CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const override; - CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const override; - CFX_WideString GetMeridiemName(bool bAM) const override; + WideString GetDateTimeSymbols() const override; + WideString GetMonthName(int32_t nMonth, bool bAbbr) const override; + WideString GetDayName(int32_t nWeek, bool bAbbr) const override; + WideString GetMeridiemName(bool bAM) const override; FX_TIMEZONE GetTimeZone() const override; - CFX_WideString GetEraName(bool bAD) const override; + WideString GetEraName(bool bAD) const override; - CFX_WideString GetDatePattern( - FX_LOCALEDATETIMESUBCATEGORY eType) const override; - CFX_WideString GetTimePattern( - FX_LOCALEDATETIMESUBCATEGORY eType) const override; - CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override; + WideString GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override; + WideString GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override; + WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override; private: CXFA_Node* GetNodeByName(CXFA_Node* pParent, - const CFX_WideStringC& wsName) const; - CFX_WideString GetSymbol(XFA_Element eElement, - const CFX_WideStringC& symbol_type) const; - CFX_WideString GetCalendarSymbol(XFA_Element eElement, - int index, - bool bAbbr) const; + const WideStringView& wsName) const; + WideString GetSymbol(XFA_Element eElement, + const WideStringView& symbol_type) const; + WideString GetCalendarSymbol(XFA_Element eElement, + int index, + bool bAbbr) const; CFX_UnownedPtr<CXFA_Node> const m_pLocale; }; diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 8ebedf9fed..c23420446a 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -16,7 +16,7 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType objectType, XFA_Element elementType, - const CFX_WideStringC& elementName) + const WideStringView& elementName) : CFXJSE_HostObject(kXFA), m_pDocument(pDocument), m_objectType(objectType), @@ -33,7 +33,7 @@ void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, ThrowInvalidPropertyException(); return; } - pValue->SetString(FX_UTF8Encode(GetClassName()).AsStringC()); + pValue->SetString(FX_UTF8Encode(GetClassName()).AsStringView()); } void CXFA_Object::ThrowInvalidPropertyException() const { @@ -45,7 +45,7 @@ void CXFA_Object::ThrowIndexOutOfBoundsException() const { } void CXFA_Object::ThrowParamCountMismatchException( - const CFX_WideString& method) const { + const WideString& method) const { ThrowException(L"Incorrect number of parameters calling method '%.16s'.", method.c_str()); } @@ -55,13 +55,13 @@ void CXFA_Object::ThrowArgumentMismatchException() const { } void CXFA_Object::ThrowException(const wchar_t* str, ...) const { - CFX_WideString wsMessage; + WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, str); wsMessage.FormatV(str, arg_ptr); va_end(arg_ptr); ASSERT(!wsMessage.IsEmpty()); - FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC()); + FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView()); } CXFA_Node* CXFA_Object::AsNode() { diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h index 4f1850f14c..49442d254d 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -35,7 +35,7 @@ class CXFA_Object : public CFXJSE_HostObject { CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType objectType, XFA_Element eType, - const CFX_WideStringC& elementName); + const WideStringView& elementName); ~CXFA_Object() override; CXFA_Document* GetDocument() const { return m_pDocument.Get(); } @@ -71,7 +71,7 @@ class CXFA_Object : public CFXJSE_HostObject { const CXFA_NodeList* AsNodeList() const; XFA_Element GetElementType() const { return m_elementType; } - CFX_WideStringC GetClassName() const { return m_elementName; } + WideStringView GetClassName() const { return m_elementName; } uint32_t GetClassHashCode() const { return m_elementNameHash; } void Script_ObjectClass_ClassName(CFXJSE_Value* pValue, @@ -81,7 +81,7 @@ class CXFA_Object : public CFXJSE_HostObject { void ThrowInvalidPropertyException() const; void ThrowArgumentMismatchException() const; void ThrowIndexOutOfBoundsException() const; - void ThrowParamCountMismatchException(const CFX_WideString& method) const; + void ThrowParamCountMismatchException(const WideString& method) const; protected: void ThrowException(const wchar_t* str, ...) const; @@ -91,7 +91,7 @@ class CXFA_Object : public CFXJSE_HostObject { const XFA_Element m_elementType; const uint32_t m_elementNameHash; - const CFX_WideStringC m_elementName; + const WideStringView m_elementName; }; CXFA_Node* ToNode(CXFA_Object* pObj); diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 15c3f14b23..4d0ec516b2 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -34,7 +34,7 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { if (!rnd.m_CurObject->IsNode()) { if (rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) { return ResolveForAttributeRs(rnd.m_CurObject, rnd, - rnd.m_wsName.AsStringC()); + rnd.m_wsName.AsStringView()); } return 0; } @@ -72,7 +72,7 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { rnd.m_Objects.push_back(rnd.m_CurObject); } else if ((rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) && ResolveForAttributeRs(rnd.m_CurObject, rnd, - rnd.m_wsName.AsStringC())) { + rnd.m_wsName.AsStringView())) { return 1; } if (!rnd.m_Objects.empty()) @@ -87,8 +87,8 @@ int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { } int32_t CXFA_ResolveProcessor::ResolveAnyChild(CXFA_ResolveNodesData& rnd) { - CFX_WideString wsName = rnd.m_wsName; - CFX_WideString wsCondition = rnd.m_wsCondition; + WideString wsName = rnd.m_wsName; + WideString wsCondition = rnd.m_wsCondition; CXFA_Node* findNode = nullptr; bool bClassName = false; if (wsName.GetLength() && wsName[0] == '#') { @@ -115,8 +115,8 @@ int32_t CXFA_ResolveProcessor::ResolveAnyChild(CXFA_ResolveNodesData& rnd) { } int32_t CXFA_ResolveProcessor::ResolveDollar(CXFA_ResolveNodesData& rnd) { - CFX_WideString wsName = rnd.m_wsName; - CFX_WideString wsCondition = rnd.m_wsCondition; + WideString wsName = rnd.m_wsName; + WideString wsCondition = rnd.m_wsCondition; int32_t iNameLen = wsName.GetLength(); if (iNameLen == 1) { rnd.m_Objects.push_back(rnd.m_CurObject); @@ -126,7 +126,7 @@ int32_t CXFA_ResolveProcessor::ResolveDollar(CXFA_ResolveNodesData& rnd) { return -1; } XFA_HashCode dwNameHash = static_cast<XFA_HashCode>(FX_HashCode_GetW( - CFX_WideStringC(wsName.c_str() + 1, iNameLen - 1), false)); + WideStringView(wsName.c_str() + 1, iNameLen - 1), false)); if (dwNameHash == XFA_HASHCODE_Xfa) { rnd.m_Objects.push_back(rnd.m_pSC->GetDocument()->GetRoot()); } else { @@ -154,7 +154,7 @@ int32_t CXFA_ResolveProcessor::ResolveExcalmatory(CXFA_ResolveNodesData& rnd) { rndFind.m_CurObject = datasets; rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); rndFind.m_uHashName = static_cast<XFA_HashCode>( - FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false)); + FX_HashCode_GetW(rndFind.m_wsName.AsStringView(), false)); rndFind.m_nLevel = rnd.m_nLevel + 1; rndFind.m_dwStyles = XFA_RESOLVENODE_Children; rndFind.m_wsCondition = rnd.m_wsCondition; @@ -165,10 +165,10 @@ int32_t CXFA_ResolveProcessor::ResolveExcalmatory(CXFA_ResolveNodesData& rnd) { } int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) { - CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); - CFX_WideString wsCondition = rnd.m_wsCondition; + WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); + WideString wsCondition = rnd.m_wsCondition; CXFA_Node* curNode = ToNode(rnd.m_CurObject); - if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC())) + if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringView())) return 1; CXFA_ResolveNodesData rndFind; @@ -179,7 +179,7 @@ int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) { rndFind.m_dwStyles &= ~XFA_RESOLVENODE_Attributes; rndFind.m_wsName = wsName; rndFind.m_uHashName = static_cast<XFA_HashCode>( - FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false)); + FX_HashCode_GetW(rndFind.m_wsName.AsStringView(), false)); rndFind.m_wsCondition = wsCondition; rndFind.m_CurObject = curNode; ResolveNormal(rndFind); @@ -199,7 +199,7 @@ int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) { int32_t CXFA_ResolveProcessor::ResolveForAttributeRs( CXFA_Object* curNode, CXFA_ResolveNodesData& rnd, - const CFX_WideStringC& strAttr) { + const WideStringView& strAttr) { const XFA_SCRIPTATTRIBUTEINFO* lpScriptAttribute = XFA_GetScriptAttributeByName(curNode->GetElementType(), strAttr); if (!lpScriptAttribute) @@ -218,9 +218,9 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { CXFA_Node* curNode = rnd.m_CurObject->AsNode(); size_t nNum = rnd.m_Objects.size(); uint32_t dwStyles = rnd.m_dwStyles; - CFX_WideString& wsName = rnd.m_wsName; + WideString& wsName = rnd.m_wsName; XFA_HashCode uNameHash = rnd.m_uHashName; - CFX_WideString& wsCondition = rnd.m_wsCondition; + WideString& wsCondition = rnd.m_wsCondition; CXFA_ResolveNodesData rndFind; rndFind.m_wsName = rnd.m_wsName; rndFind.m_wsCondition = rnd.m_wsCondition; @@ -256,7 +256,7 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { } else { rndFind.m_CurObject = pVariablesNode; SetStylesForChild(dwStyles, rndFind); - CFX_WideString wsSaveCondition = rndFind.m_wsCondition; + WideString wsSaveCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.clear(); ResolveNormal(rndFind); rndFind.m_wsCondition = wsSaveCondition; @@ -288,7 +288,7 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { bSetFlag = true; } rndFind.m_CurObject = child; - CFX_WideString wsSaveCondition = rndFind.m_wsCondition; + WideString wsSaveCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.clear(); ResolveNormal(rndFind); rndFind.m_wsCondition = wsSaveCondition; @@ -317,7 +317,7 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { } } if (dwStyles & XFA_RESOLVENODE_Attributes) { - if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC())) + if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringView())) return 1; } if (dwStyles & XFA_RESOLVENODE_Properties) { @@ -346,7 +346,7 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { pProp = pInstanceManager->GetProperty(0, XFA_Element::Occur, true); } } else { - XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringC()); + XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringView()); if (eType != XFA_Element::Unknown) { pProp = curNode->AsNode()->GetProperty(0, eType, eType != XFA_Element::PageSet); @@ -419,7 +419,7 @@ int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { } if (bInnerSearch) { rndFind.m_CurObject = child; - CFX_WideString wsOriginCondition = rndFind.m_wsCondition; + WideString wsOriginCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.clear(); uint32_t dwOriginStyle = rndFind.m_dwStyles; rndFind.m_dwStyles = dwOriginStyle | XFA_RESOLVENODE_ALL; @@ -488,7 +488,7 @@ int32_t CXFA_ResolveProcessor::ResolvePopStack(std::vector<int32_t>* stack) { return nType; } -int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, +int32_t CXFA_ResolveProcessor::GetFilter(const WideStringView& wsExpression, int32_t nStart, CXFA_ResolveNodesData& rnd) { ASSERT(nStart > -1); @@ -496,8 +496,8 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, if (nStart >= iLength) { return 0; } - CFX_WideString& wsName = rnd.m_wsName; - CFX_WideString& wsCondition = rnd.m_wsCondition; + WideString& wsName = rnd.m_wsName; + WideString& wsCondition = rnd.m_wsCondition; wchar_t* pNameBuf = wsName.GetBuffer(iLength - nStart); wchar_t* pConditionBuf = wsCondition.GetBuffer(iLength - nStart); int32_t nNameCount = 0; @@ -585,11 +585,11 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, wsCondition.TrimLeft(); wsCondition.TrimRight(); rnd.m_uHashName = - static_cast<XFA_HashCode>(FX_HashCode_GetW(wsName.AsStringC(), false)); + static_cast<XFA_HashCode>(FX_HashCode_GetW(wsName.AsStringView(), false)); return nStart; } void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex, - CFX_WideString wsCondition, + WideString wsCondition, int32_t iFoundCount, CXFA_ResolveNodesData& rnd) { int32_t iLen = wsCondition.GetLength(); @@ -635,7 +635,7 @@ void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex, if (iFoundCount == 1 && !iLen) { return; } - CFX_WideString wsIndex; + WideString wsIndex; wsIndex = wsCondition.Mid(i, iLen - 1 - i); int32_t iIndex = wsIndex.GetInteger(); if (bRelative) { @@ -655,11 +655,11 @@ void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex, } void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, - CFX_WideString wsCondition, + WideString wsCondition, int32_t iFoundCount, CXFA_ResolveNodesData& rnd) { ASSERT(iFoundCount == pdfium::CollectionSize<int32_t>(rnd.m_Objects)); - CFX_WideString wsExpression; + WideString wsExpression; XFA_SCRIPTLANGTYPE eLangType = XFA_SCRIPTLANGTYPE_Unkown; if (wsCondition.Left(2) == L".[" && wsCondition.Last() == L']') { eLangType = XFA_SCRIPTLANGTYPE_Formcalc; @@ -673,7 +673,7 @@ void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3); for (int32_t i = iFoundCount - 1; i >= 0; i--) { auto pRetValue = pdfium::MakeUnique<CFXJSE_Value>(rnd.m_pSC->GetRuntime()); - bool bRet = pContext->RunScript(eLangType, wsExpression.AsStringC(), + bool bRet = pContext->RunScript(eLangType, wsExpression.AsStringView(), pRetValue.get(), rnd.m_Objects[i]); if (!bRet || !pRetValue->ToBoolean()) rnd.m_Objects.erase(rnd.m_Objects.begin() + i); @@ -681,7 +681,7 @@ void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, } void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd, - CFX_WideString wsCondition) { + WideString wsCondition) { int32_t iCurrIndex = 0; const std::vector<CXFA_Node*>* pArray = rnd.m_pSC->GetUpObjectArray(); if (!pArray->empty()) { @@ -753,7 +753,7 @@ void CXFA_ResolveProcessor::SetStylesForChild(uint32_t dwParentStyles, int32_t CXFA_ResolveProcessor::SetResultCreateNode( XFA_RESOLVENODE_RS& resolveNodeRS, - CFX_WideString& wsLastCondition) { + WideString& wsLastCondition) { if (m_pNodeHelper->m_pCreateParent) resolveNodeRS.objects.push_back(m_pNodeHelper->m_pCreateParent); else @@ -767,7 +767,7 @@ int32_t CXFA_ResolveProcessor::SetResultCreateNode( return pdfium::CollectionSize<int32_t>(resolveNodeRS.objects); } -void CXFA_ResolveProcessor::SetIndexDataBind(CFX_WideString& wsNextCondition, +void CXFA_ResolveProcessor::SetIndexDataBind(WideString& wsNextCondition, int32_t& iIndex, int32_t iCount) { if (m_pNodeHelper->CreateNode_ForCondition(wsNextCondition)) { diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.h b/xfa/fxfa/parser/cxfa_resolveprocessor.h index f4eafea023..b48ee36476 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.h +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.h @@ -22,9 +22,9 @@ class CXFA_ResolveNodesData { CXFA_ScriptContext* m_pSC; CXFA_Object* m_CurObject; - CFX_WideString m_wsName; + WideString m_wsName; XFA_HashCode m_uHashName; - CFX_WideString m_wsCondition; + WideString m_wsCondition; int32_t m_nLevel; std::vector<CXFA_Object*> m_Objects; // Not owned. uint32_t m_dwStyles; @@ -38,12 +38,12 @@ class CXFA_ResolveProcessor { ~CXFA_ResolveProcessor(); int32_t Resolve(CXFA_ResolveNodesData& rnd); - int32_t GetFilter(const CFX_WideStringC& wsExpression, + int32_t GetFilter(const WideStringView& wsExpression, int32_t nStart, CXFA_ResolveNodesData& rnd); int32_t SetResultCreateNode(XFA_RESOLVENODE_RS& resolveNodeRS, - CFX_WideString& wsLastCondition); - void SetIndexDataBind(CFX_WideString& wsNextCondition, + WideString& wsLastCondition); + void SetIndexDataBind(WideString& wsNextCondition, int32_t& iIndex, int32_t iCount); void SetCurStart(int32_t start) { m_iCurStart = start; } @@ -53,7 +53,7 @@ class CXFA_ResolveProcessor { private: int32_t ResolveForAttributeRs(CXFA_Object* curNode, CXFA_ResolveNodesData& rnd, - const CFX_WideStringC& strAttr); + const WideStringView& strAttr); int32_t ResolveAnyChild(CXFA_ResolveNodesData& rnd); int32_t ResolveDollar(CXFA_ResolveNodesData& rnd); int32_t ResolveExcalmatory(CXFA_ResolveNodesData& rnd); @@ -64,14 +64,14 @@ class CXFA_ResolveProcessor { void SetStylesForChild(uint32_t dwParentStyles, CXFA_ResolveNodesData& rnd); void ConditionArray(int32_t iCurIndex, - CFX_WideString wsCondition, + WideString wsCondition, int32_t iFoundCount, CXFA_ResolveNodesData& rnd); void DoPredicateFilter(int32_t iCurIndex, - CFX_WideString wsCondition, + WideString wsCondition, int32_t iFoundCount, CXFA_ResolveNodesData& rnd); - void FilterCondition(CXFA_ResolveNodesData& rnd, CFX_WideString wsCondition); + void FilterCondition(CXFA_ResolveNodesData& rnd, WideString wsCondition); int32_t m_iCurStart; std::unique_ptr<CXFA_NodeHelper> m_pNodeHelper; diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp index ccd1997c47..6b6f6ba1c8 100644 --- a/xfa/fxfa/parser/cxfa_script.cpp +++ b/xfa/fxfa/parser/cxfa_script.cpp @@ -11,7 +11,7 @@ CXFA_Script::CXFA_Script(CXFA_Node* pNode) : CXFA_Data(pNode) {} XFA_SCRIPTTYPE CXFA_Script::GetContentType() { - CFX_WideStringC cData; + WideStringView cData; if (m_pNode->TryCData(XFA_ATTRIBUTE_ContentType, cData, false)) { if (cData == L"application/x-javascript") return XFA_SCRIPTTYPE_Javascript; @@ -26,6 +26,6 @@ int32_t CXFA_Script::GetRunAt() { return m_pNode->GetEnum(XFA_ATTRIBUTE_RunAt); } -void CXFA_Script::GetExpression(CFX_WideString& wsExpression) { +void CXFA_Script::GetExpression(WideString& wsExpression) { m_pNode->TryContent(wsExpression); } diff --git a/xfa/fxfa/parser/cxfa_script.h b/xfa/fxfa/parser/cxfa_script.h index d89062487d..bb98f58abc 100644 --- a/xfa/fxfa/parser/cxfa_script.h +++ b/xfa/fxfa/parser/cxfa_script.h @@ -26,7 +26,7 @@ class CXFA_Script : public CXFA_Data { XFA_SCRIPTTYPE GetContentType(); int32_t GetRunAt(); - void GetExpression(CFX_WideString& wsExpression); + void GetExpression(WideString& wsExpression); }; #endif // XFA_FXFA_PARSER_CXFA_SCRIPT_H_ diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index 98b5da057f..38d503962d 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -81,7 +81,7 @@ CXFA_ThisProxy* ToThisProxy(CFXJSE_Value* pValue, CFXJSE_Class* pClass) { } const XFA_METHODINFO* GetMethodByName(XFA_Element eElement, - const CFX_WideStringC& wsMethodName) { + const WideStringView& wsMethodName) { if (wsMethodName.IsEmpty()) return nullptr; @@ -146,10 +146,10 @@ void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) { } bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, - const CFX_WideStringC& wsScript, + const WideStringView& wsScript, CFXJSE_Value* hRetValue, CXFA_Object* pThisObject) { - CFX_ByteString btScript; + ByteString btScript; CFX_AutoRestorer<XFA_SCRIPTLANGTYPE> typeRestorer(&m_eScriptType); m_eScriptType = eScriptType; if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { @@ -162,7 +162,7 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, hRetValue->SetUndefined(); return false; } - btScript = FX_UTF8Encode(wsJavaScript.AsStringC()); + btScript = FX_UTF8Encode(wsJavaScript.AsStringView()); } else { btScript = FX_UTF8Encode(wsScript); } @@ -173,21 +173,21 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, } void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue) { CXFA_Object* lpOrginalNode = ToObject(pObject, nullptr); CXFA_Document* pDoc = lpOrginalNode->GetDocument(); CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode); - CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); + WideString wsPropName = WideString::FromUTF8(szPropName); uint32_t dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; CXFA_Node* pRefNode = ToNode(lpScriptContext->GetThisObject()); if (lpOrginalNode->IsVariablesThis()) pRefNode = ToNode(lpCurNode); - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue, - dwFlag, true)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringView(), + pValue, dwFlag, true)) { return; } if (lpOrginalNode->IsVariablesThis()) { @@ -204,7 +204,7 @@ void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, szPropName, pValue); } bool CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, - const CFX_WideStringC& propname, + const WideStringView& propname, CFXJSE_Value* pValue, uint32_t dwFlag, bool bSetting) { @@ -227,20 +227,20 @@ bool CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, return true; } void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue) { CXFA_Object* pOriginalObject = ToObject(pObject, nullptr); CXFA_Document* pDoc = pOriginalObject->GetDocument(); CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject); - CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); + WideString wsPropName = WideString::FromUTF8(szPropName); if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { if (szPropName == kFormCalcRuntime) { lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(pValue); return; } XFA_HashCode uHashCode = static_cast<XFA_HashCode>( - FX_HashCode_GetW(wsPropName.AsStringC(), false)); + FX_HashCode_GetW(wsPropName.AsStringView(), false)); if (uHashCode != XFA_HASHCODE_Layout) { CXFA_Object* pObj = lpScriptContext->GetDocument()->GetXFAObject(uHashCode); @@ -256,13 +256,13 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, if (pOriginalObject->IsVariablesThis()) { pRefNode = ToNode(lpCurNode); } - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue, - dwFlag, false)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringView(), + pValue, dwFlag, false)) { return; } dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringC(), pValue, - dwFlag, false)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsStringView(), + pValue, dwFlag, false)) { return; } CXFA_Object* pScriptObject = @@ -280,14 +280,14 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, szPropName, pValue); } void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pReturnValue) { CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr); if (!pOriginalObject) { pReturnValue->SetUndefined(); return; } - CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); + WideString wsPropName = WideString::FromUTF8(szPropName); CXFA_ScriptContext* lpScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); @@ -300,7 +300,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; bool bRet = lpScriptContext->QueryNodeByFlag( - ToNode(pObject), wsPropName.AsStringC(), pReturnValue, dwFlag, false); + ToNode(pObject), wsPropName.AsStringView(), pReturnValue, dwFlag, false); if (bRet) { return; } @@ -308,8 +308,9 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript && !lpScriptContext->IsStrictScopeInJavaScript())) { dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; - bRet = lpScriptContext->QueryNodeByFlag( - ToNode(pObject), wsPropName.AsStringC(), pReturnValue, dwFlag, false); + bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), + wsPropName.AsStringView(), + pReturnValue, dwFlag, false); } if (bRet) { return; @@ -325,7 +326,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, } } void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pReturnValue) { CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr); if (!pOriginalObject) @@ -334,9 +335,9 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, CXFA_ScriptContext* lpScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); - CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); + WideString wsPropName = WideString::FromUTF8(szPropName); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName( - pObject->GetElementType(), wsPropName.AsStringC()); + pObject->GetElementType(), wsPropName.AsStringView()); if (lpAttributeInfo) { (pObject->*(lpAttributeInfo->lpfnCallback))( pReturnValue, true, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); @@ -347,17 +348,17 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, } CXFA_Node* pNode = ToNode(pObject); CXFA_Node* pPropOrChild = nullptr; - XFA_Element eType = XFA_GetElementTypeForName(wsPropName.AsStringC()); + XFA_Element eType = XFA_GetElementTypeForName(wsPropName.AsStringView()); if (eType != XFA_Element::Unknown) pPropOrChild = pNode->GetProperty(0, eType); else - pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringC()); + pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringView()); if (pPropOrChild) { - CFX_WideString wsDefaultName(L"{default}"); + WideString wsDefaultName(L"{default}"); const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetElementType(), - wsDefaultName.AsStringC()); + wsDefaultName.AsStringView()); if (lpAttrInfo) { (pPropOrChild->*(lpAttrInfo->lpfnCallback))( pReturnValue, true, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute); @@ -375,7 +376,7 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, } int32_t CXFA_ScriptContext::NormalPropTypeGetter( CFXJSE_Value* pOriginalValue, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, bool bQueryIn) { CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); if (!pObject) @@ -385,19 +386,19 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); XFA_Element eType = pObject->GetElementType(); - CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); - if (GetMethodByName(eType, wsPropName.AsStringC())) { + WideString wsPropName = WideString::FromUTF8(szPropName); + if (GetMethodByName(eType, wsPropName.AsStringView())) { return FXJSE_ClassPropType_Method; } if (bQueryIn && - !XFA_GetScriptAttributeByName(eType, wsPropName.AsStringC())) { + !XFA_GetScriptAttributeByName(eType, wsPropName.AsStringView())) { return FXJSE_ClassPropType_None; } return FXJSE_ClassPropType_Property; } int32_t CXFA_ScriptContext::GlobalPropTypeGetter( CFXJSE_Value* pOriginalValue, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, bool bQueryIn) { CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); if (!pObject) @@ -407,14 +408,14 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); XFA_Element eType = pObject->GetElementType(); - CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); - if (GetMethodByName(eType, wsPropName.AsStringC())) { + WideString wsPropName = WideString::FromUTF8(szPropName); + if (GetMethodByName(eType, wsPropName.AsStringView())) { return FXJSE_ClassPropType_Method; } return FXJSE_ClassPropType_Property; } void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args) { CXFA_Object* pObject = ToObject(pThis, nullptr); if (!pObject) @@ -423,9 +424,9 @@ void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, CXFA_ScriptContext* lpScriptContext = pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); - CFX_WideString wsFunName = CFX_WideString::FromUTF8(szFuncName); + WideString wsFunName = WideString::FromUTF8(szFuncName); const XFA_METHODINFO* lpMethodInfo = - GetMethodByName(pObject->GetElementType(), wsFunName.AsStringC()); + GetMethodByName(pObject->GetElementType(), wsFunName.AsStringView()); if (!lpMethodInfo) return; @@ -488,11 +489,11 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { if (!pTextNode) return false; - CFX_WideStringC wsScript; + WideStringView wsScript; if (!pTextNode->TryCData(XFA_ATTRIBUTE_Value, wsScript)) return false; - CFX_ByteString btScript = FX_UTF8Encode(wsScript); + ByteString btScript = FX_UTF8Encode(wsScript); auto hRetValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent); CFXJSE_Context* pVariablesContext = @@ -503,7 +504,7 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { } bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue, bool bGetter) { if (!pScriptNode || pScriptNode->GetElementType() != XFA_Element::Script) @@ -544,7 +545,7 @@ void CXFA_ScriptContext::DefineJsClass() { } void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const { - static const CFX_ByteStringC OBJ_NAME[2] = {"Number", "Date"}; + static const ByteStringView OBJ_NAME[2] = {"Number", "Date"}; std::unique_ptr<CFXJSE_Value> pObject = pContext->GetGlobalObject(); auto hProp = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); for (int i = 0; i < 2; ++i) { @@ -557,7 +558,7 @@ CFXJSE_Class* CXFA_ScriptContext::GetJseNormalClass() { } int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject, - const CFX_WideStringC& wsExpression, + const WideStringView& wsExpression, XFA_RESOLVENODE_RS& resolveNodeRS, uint32_t dwStyles, CXFA_Node* bindNode) { @@ -757,7 +758,7 @@ int32_t CXFA_ScriptContext::GetIndexByClassName(CXFA_Node* refNode) { lpNodeHelper->NodeIsProperty(refNode), true); } void CXFA_ScriptContext::GetSomExpression(CXFA_Node* refNode, - CFX_WideString& wsExpression) { + WideString& wsExpression) { CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper(); lpNodeHelper->GetNameExpression(refNode, wsExpression, true, XFA_LOGIC_Transparent); diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h index 45e6897a4c..d3632e2859 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.h +++ b/xfa/fxfa/parser/cxfa_scriptcontext.h @@ -30,12 +30,12 @@ class CXFA_ScriptContext { void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } CXFA_EventParam* GetEventParam() { return &m_eventParam; } bool RunScript(XFA_SCRIPTLANGTYPE eScriptType, - const CFX_WideStringC& wsScript, + const WideStringView& wsScript, CFXJSE_Value* pRetValue, CXFA_Object* pThisObject); int32_t ResolveObjects(CXFA_Object* refObject, - const CFX_WideStringC& wsExpression, + const WideStringView& wsExpression, XFA_RESOLVENODE_RS& resolveNodeRS, uint32_t dwStyles = XFA_RESOLVENODE_Children, CXFA_Node* bindNode = nullptr); @@ -46,7 +46,7 @@ class CXFA_ScriptContext { int32_t GetIndexByName(CXFA_Node* refNode); int32_t GetIndexByClassName(CXFA_Node* refNode); - void GetSomExpression(CXFA_Node* refNode, CFX_WideString& wsExpression); + void GetSomExpression(CXFA_Node* refNode, WideString& wsExpression); void SetNodesOfRunScript(std::vector<CXFA_Node*>* pArray); void AddNodesOfRunScript(const std::vector<CXFA_Node*>& nodes); @@ -56,36 +56,36 @@ class CXFA_ScriptContext { void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } bool IsRunAtClient() { return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; } bool QueryNodeByFlag(CXFA_Node* refNode, - const CFX_WideStringC& propname, + const WideStringView& propname, CFXJSE_Value* pValue, uint32_t dwFlag, bool bSetting); bool QueryVariableValue(CXFA_Node* pScriptNode, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue, bool bGetter); - bool QueryBuiltinValue(const CFX_ByteStringC& szPropName, + bool QueryBuiltinValue(const ByteStringView& szPropName, CFXJSE_Value* pValue); static void GlobalPropertyGetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue); static void GlobalPropertySetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue); static void NormalPropertyGetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue); static void NormalPropertySetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue); static void NormalMethodCall(CFXJSE_Value* hThis, - const CFX_ByteStringC& szFuncName, + const ByteStringView& szFuncName, CFXJSE_Arguments& args); static int32_t NormalPropTypeGetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, bool bQueryIn); static int32_t GlobalPropTypeGetter(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, bool bQueryIn); bool RunVariablesScript(CXFA_Node* pScriptNode); CXFA_Object* GetVariablesThis(CXFA_Object* pObject, bool bScriptNode = false); diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index dd72f40d56..5b58761712 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -57,25 +57,25 @@ CFX_XMLNode* GetDocumentNode(CFX_XMLDoc* pXMLDoc, return nullptr; } -CFX_WideString GetElementTagNamespaceURI(CFX_XMLElement* pElement) { - CFX_WideString wsNodeStr = pElement->GetNamespacePrefix(); - CFX_WideString wsNamespaceURI; +WideString GetElementTagNamespaceURI(CFX_XMLElement* pElement) { + WideString wsNodeStr = pElement->GetNamespacePrefix(); + WideString wsNamespaceURI; if (!XFA_FDEExtension_ResolveNamespaceQualifier( - pElement, wsNodeStr.AsStringC(), &wsNamespaceURI)) { - return CFX_WideString(); + pElement, wsNodeStr.AsStringView(), &wsNamespaceURI)) { + return WideString(); } return wsNamespaceURI; } bool MatchNodeName(CFX_XMLNode* pNode, - const CFX_WideStringC& wsLocalTagName, - const CFX_WideStringC& wsNamespaceURIPrefix, + const WideStringView& wsLocalTagName, + const WideStringView& wsNamespaceURIPrefix, uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) { if (!pNode || pNode->GetType() != FX_XMLNODE_Element) return false; CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pNode); - CFX_WideString wsNodeStr = pElement->GetLocalTagName(); + WideString wsNodeStr = pElement->GetLocalTagName(); if (wsNodeStr != wsLocalTagName) return false; @@ -90,9 +90,9 @@ bool MatchNodeName(CFX_XMLNode* pNode, return wsNodeStr == wsNamespaceURIPrefix; } -bool GetAttributeLocalName(const CFX_WideStringC& wsAttributeName, - CFX_WideString& wsLocalAttrName) { - CFX_WideString wsAttrName(wsAttributeName); +bool GetAttributeLocalName(const WideStringView& wsAttributeName, + WideString& wsLocalAttrName) { + WideString wsAttrName(wsAttributeName); auto pos = wsAttrName.Find(L':', 0); if (!pos.has_value()) { wsLocalAttrName = wsAttrName; @@ -103,11 +103,11 @@ bool GetAttributeLocalName(const CFX_WideStringC& wsAttributeName, } bool ResolveAttribute(CFX_XMLElement* pElement, - const CFX_WideStringC& wsAttributeName, - CFX_WideString& wsLocalAttrName, - CFX_WideString& wsNamespaceURI) { - CFX_WideString wsAttrName(wsAttributeName); - CFX_WideString wsNSPrefix; + const WideStringView& wsAttributeName, + WideString& wsLocalAttrName, + WideString& wsNamespaceURI) { + WideString wsAttrName(wsAttributeName); + WideString wsNSPrefix; if (GetAttributeLocalName(wsAttributeName, wsLocalAttrName)) { wsNSPrefix = wsAttrName.Left(wsAttributeName.GetLength() - wsLocalAttrName.GetLength() - 1); @@ -117,7 +117,7 @@ bool ResolveAttribute(CFX_XMLElement* pElement, return false; } if (!XFA_FDEExtension_ResolveNamespaceQualifier( - pElement, wsNSPrefix.AsStringC(), &wsNamespaceURI)) { + pElement, wsNSPrefix.AsStringView(), &wsNamespaceURI)) { wsNamespaceURI.clear(); return false; } @@ -125,17 +125,17 @@ bool ResolveAttribute(CFX_XMLElement* pElement, } bool FindAttributeWithNS(CFX_XMLElement* pElement, - const CFX_WideStringC& wsLocalAttributeName, - const CFX_WideStringC& wsNamespaceURIPrefix, - CFX_WideString& wsValue, + const WideStringView& wsLocalAttributeName, + const WideStringView& wsNamespaceURIPrefix, + WideString& wsValue, bool bMatchNSAsPrefix = false) { if (!pElement) return false; - CFX_WideString wsAttrNS; + WideString wsAttrNS; for (auto it : pElement->GetAttributes()) { auto pos = it.first.Find(L':', 0); - CFX_WideString wsNSPrefix; + WideString wsNSPrefix; if (!pos.has_value()) { if (wsLocalAttributeName != it.first) continue; @@ -148,7 +148,7 @@ bool FindAttributeWithNS(CFX_XMLElement* pElement, } if (!XFA_FDEExtension_ResolveNamespaceQualifier( - pElement, wsNSPrefix.AsStringC(), &wsAttrNS)) { + pElement, wsNSPrefix.AsStringView(), &wsAttrNS)) { continue; } if (bMatchNSAsPrefix) { @@ -194,20 +194,19 @@ CFX_XMLNode* GetDataSetsFromXDP(CFX_XMLNode* pXMLDocumentNode) { return nullptr; } -bool IsStringAllWhitespace(CFX_WideString wsText) { +bool IsStringAllWhitespace(WideString wsText) { wsText.TrimRight(L"\x20\x9\xD\xA"); return wsText.IsEmpty(); } -void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, - CFX_WideString& wsOutput) { +void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, WideString& wsOutput) { for (CFX_XMLNode* pXMLChild = pRootXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { switch (pXMLChild->GetType()) { case FX_XMLNODE_Element: { - CFX_WideString wsTextData = + WideString wsTextData = static_cast<CFX_XMLElement*>(pXMLChild)->GetTextData(); wsTextData += L"\n"; wsOutput += wsTextData; @@ -215,7 +214,7 @@ void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, } case FX_XMLNODE_Text: case FX_XMLNODE_CharData: { - CFX_WideString wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText(); + WideString wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText(); if (IsStringAllWhitespace(wsText)) continue; @@ -229,7 +228,7 @@ void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, } } -const XFA_PACKETINFO* GetPacketByName(const CFX_WideStringC& wsName) { +const XFA_PACKETINFO* GetPacketByName(const WideStringView& wsName) { if (wsName.IsEmpty()) return nullptr; @@ -315,7 +314,7 @@ int32_t CXFA_SimpleParser::DoParse() { return XFA_PARSESTATUS_Done; } -CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML) { +CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const ByteString& wsXML) { CloseParser(); m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>(); @@ -353,9 +352,9 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, return; CFX_XMLElement* child = static_cast<CFX_XMLElement*>(pXMLChild); - CFX_WideString wsNodeStr = child->GetLocalTagName(); + WideString wsNodeStr = child->GetLocalTagName(); pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); - CFX_WideString wsChildValue; + WideString wsChildValue; XFA_GetPlainTextFromRichText(child, wsChildValue); if (!wsChildValue.IsEmpty()) pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsChildValue); @@ -388,13 +387,13 @@ CFX_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { bool XFA_FDEExtension_ResolveNamespaceQualifier( CFX_XMLElement* pNode, - const CFX_WideStringC& wsQualifier, - CFX_WideString* wsNamespaceURI) { + const WideStringView& wsQualifier, + WideString* wsNamespaceURI) { if (!pNode) return false; CFX_XMLNode* pFakeRoot = pNode->GetNodeItem(CFX_XMLNode::Root); - CFX_WideString wsNSAttribute; + WideString wsNSAttribute; bool bRet = false; if (wsQualifier.IsEmpty()) { wsNSAttribute = L"xmlns"; @@ -503,9 +502,9 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( continue; CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pChildItem); - CFX_WideString wsPacketName = pElement->GetLocalTagName(); + WideString wsPacketName = pElement->GetLocalTagName(); const XFA_PACKETINFO* pPacketInfo = - GetPacketByName(wsPacketName.AsStringC()); + GetPacketByName(wsPacketName.AsStringView()); if (pPacketInfo && pPacketInfo->pURI) { if (!MatchNodeName(pElement, pPacketInfo->pName, pPacketInfo->pURI, pPacketInfo->eFlags)) { @@ -612,7 +611,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( if (m_bDocumentParser) { CFX_XMLElement* pXMLDocumentElement = static_cast<CFX_XMLElement*>(pXMLDocumentNode); - CFX_WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI(); + WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI(); if (wsNamespaceURI.IsEmpty()) wsNamespaceURI = pXMLDocumentElement->GetString(L"xmlns:xfa"); @@ -628,7 +627,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) { CFX_XMLElement* pXMLDocumentElement = static_cast<CFX_XMLElement*>(pXMLDocumentNode); - CFX_WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum"); + WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum"); if (wsChecksum.GetLength() != 28 || m_pXMLParser->m_dwCheckStatus != 0x03) { return nullptr; @@ -641,7 +640,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[1], m_pXMLParser->m_nSize[1]); pChecksum->FinishChecksum(); - CFX_ByteString bsCheck = pChecksum->GetChecksum(); + ByteString bsCheck = pChecksum->GetChecksum(); if (bsCheck != wsChecksum.UTF8Encode()) return nullptr; @@ -651,7 +650,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Form)->pName); - pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsStringC()); + pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsStringView()); CXFA_Node* pTemplateRoot = m_pRootNode->GetFirstChildByClass(XFA_Element::Template); CXFA_Node* pTemplateChosen = @@ -724,7 +723,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( delete pDataXMLNode; return nullptr; } - CFX_WideString wsLocalName = + WideString wsLocalName = static_cast<CFX_XMLElement*>(pDataXMLNode)->GetLocalTagName(); pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); if (!DataLoader(pNode, pDataXMLNode, true)) @@ -821,7 +820,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( if (!pNode) return nullptr; - CFX_WideString wsName = + WideString wsName = static_cast<CFX_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(); pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); if (!UserPacketLoader(pNode, pXMLDocumentNode)) @@ -854,8 +853,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, switch (pXMLChild->GetType()) { case FX_XMLNODE_Element: { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild); - CFX_WideString wsTagName = pXMLElement->GetLocalTagName(); - XFA_Element eType = XFA_GetElementTypeForName(wsTagName.AsStringC()); + WideString wsTagName = pXMLElement->GetLocalTagName(); + XFA_Element eType = XFA_GetElementTypeForName(wsTagName.AsStringView()); if (eType == XFA_Element::Unknown) continue; @@ -873,17 +872,17 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, if (!pXFAChild) return nullptr; if (ePacketID == XFA_XDPPACKET_Config) - pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName.AsStringC()); + pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName.AsStringView()); bool IsNeedValue = true; for (auto it : pXMLElement->GetAttributes()) { - CFX_WideString wsAttrName; - GetAttributeLocalName(it.first.AsStringC(), wsAttrName); + WideString wsAttrName; + GetAttributeLocalName(it.first.AsStringView(), wsAttrName); if (wsAttrName == L"nil" && it.second == L"true") IsNeedValue = false; const XFA_ATTRIBUTEINFO* lpAttrInfo = - XFA_GetAttributeByName(wsAttrName.AsStringC()); + XFA_GetAttributeByName(wsAttrName.AsStringView()); if (!lpAttrInfo) continue; @@ -891,7 +890,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, lpAttrInfo->eName != XFA_ATTRIBUTE_Save) { continue; } - pXFAChild->SetAttribute(lpAttrInfo->eName, it.second.AsStringC()); + pXFAChild->SetAttribute(lpAttrInfo->eName, it.second.AsStringView()); } pXFANode->InsertChild(pXFAChild); if (eType == XFA_Element::Validate || eType == XFA_Element::Locale) { @@ -931,7 +930,7 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, XFA_XDPPACKET ePacketID) { XFA_Element element = XFA_Element::Sharptext; if (pXFANode->GetElementType() == XFA_Element::ExData) { - CFX_WideStringC wsContentType = + WideStringView wsContentType = pXFANode->GetCData(XFA_ATTRIBUTE_ContentType); if (wsContentType == L"text/html") element = XFA_Element::SharpxHTML; @@ -941,7 +940,7 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, if (element == XFA_Element::SharpxHTML) pXFANode->SetXMLMappingNode(pXMLNode); - CFX_WideString wsValue; + WideString wsValue; for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild); pXMLChild; pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) { @@ -992,8 +991,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, case FX_XMLNODE_Element: { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild); { - CFX_WideString wsNamespaceURI = - GetElementTagNamespaceURI(pXMLElement); + WideString wsNamespaceURI = GetElementTagNamespaceURI(pXMLElement); if (wsNamespaceURI == L"http://www.xfa.com/schema/xfa-package/" || wsNamespaceURI == L"http://www.xfa.org/schema/xfa-package/" || wsNamespaceURI == L"http://www.w3.org/2001/XMLSchema-instance") { @@ -1003,7 +1001,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, XFA_Element eNodeType = XFA_Element::DataModel; if (eNodeType == XFA_Element::DataModel) { - CFX_WideString wsDataNodeAttr; + WideString wsDataNodeAttr; if (FindAttributeWithNS(pXMLElement, L"dataNode", L"http://www.xfa.org/schema/xfa-data/1.0/", wsDataNodeAttr)) { @@ -1013,7 +1011,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, eNodeType = XFA_Element::DataValue; } } - CFX_WideString wsContentType; + WideString wsContentType; if (eNodeType == XFA_Element::DataModel) { if (FindAttributeWithNS(pXMLElement, L"contentType", L"http://www.xfa.org/schema/xfa-data/1.0/", @@ -1048,9 +1046,9 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, bool bNeedValue = true; for (auto it : pXMLElement->GetAttributes()) { - CFX_WideString wsName; - CFX_WideString wsNS; - if (!ResolveAttribute(pXMLElement, it.first.AsStringC(), wsName, + WideString wsName; + WideString wsNS; + if (!ResolveAttribute(pXMLElement, it.first.AsStringView(), wsName, wsNS)) { continue; } @@ -1080,7 +1078,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } if (!bNeedValue) { - CFX_WideString wsNilName(L"xsi:nil"); + WideString wsNilName(L"xsi:nil"); pXMLElement->RemoveAttribute(wsNilName.c_str()); } pXFANode->InsertChild(pXFAChild); @@ -1096,7 +1094,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, case FX_XMLNODE_CharData: case FX_XMLNODE_Text: { CFX_XMLText* pXMLText = static_cast<CFX_XMLText*>(pXMLChild); - CFX_WideString wsText = pXMLText->GetText(); + WideString wsText = pXMLText->GetText(); if (IsStringAllWhitespace(wsText)) continue; @@ -1131,7 +1129,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, if (eNodeType == FX_XMLNODE_Instruction) continue; - CFX_WideString wsText; + WideString wsText; if (eNodeType == FX_XMLNODE_Text || eNodeType == FX_XMLNODE_CharData) { wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText(); if (!pXMLCurValueNode) @@ -1148,7 +1146,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } else { bMarkAsCompound = true; if (pXMLCurValueNode) { - CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); + WideString wsCurValue = wsCurValueTextBuf.MakeString(); if (!wsCurValue.IsEmpty()) { CXFA_Node* pXFAChild = m_pFactory->CreateNode(ePacketID, XFA_Element::DataValue); @@ -1170,19 +1168,19 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, if (!pXFAChild) return; - CFX_WideString wsNodeStr = + WideString wsNodeStr = static_cast<CFX_XMLElement*>(pXMLChild)->GetLocalTagName(); pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); ParseDataValue(pXFAChild, pXMLChild, ePacketID); pXFANode->InsertChild(pXFAChild); pXFAChild->SetXMLMappingNode(pXMLChild); pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); - CFX_WideStringC wsCurValue = pXFAChild->GetCData(XFA_ATTRIBUTE_Value); + WideStringView wsCurValue = pXFAChild->GetCData(XFA_ATTRIBUTE_Value); wsValueTextBuf << wsCurValue; } } if (pXMLCurValueNode) { - CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); + WideString wsCurValue = wsCurValueTextBuf.MakeString(); if (!wsCurValue.IsEmpty()) { if (bMarkAsCompound) { CXFA_Node* pXFAChild = @@ -1201,7 +1199,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } pXMLCurValueNode = nullptr; } - CFX_WideString wsNodeValue = wsValueTextBuf.MakeString(); + WideString wsNodeValue = wsValueTextBuf.MakeString(); pXFANode->SetCData(XFA_ATTRIBUTE_Value, wsNodeValue); } @@ -1211,9 +1209,8 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, if (!m_bDocumentParser) return; - CFX_WideString wsTargetName = pXMLInstruction->GetName(); - const std::vector<CFX_WideString>& target_data = - pXMLInstruction->GetTargetData(); + WideString wsTargetName = pXMLInstruction->GetName(); + const std::vector<WideString>& target_data = pXMLInstruction->GetTargetData(); if (wsTargetName == L"originalXFAVersion") { if (target_data.size() > 1 && (pXFANode->GetDocument()->RecognizeXFAVersionNumber(target_data[0]) != diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index 705b6bde5c..91bfb054b5 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -28,7 +28,7 @@ class CXFA_SimpleParser { int32_t StartParse(const CFX_RetainPtr<IFX_SeekableStream>& pStream, XFA_XDPPACKET ePacketID); int32_t DoParse(); - CFX_XMLNode* ParseXMLData(const CFX_ByteString& wsXML); + CFX_XMLNode* ParseXMLData(const ByteString& wsXML); void ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLNode* pXMLNode); CXFA_Node* GetRootNode() const; CFX_XMLDoc* GetXMLDoc() const; diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp index e81c0ce591..f1319340a0 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -52,7 +52,7 @@ FX_ARGB CXFA_Stroke::GetColor() const { if (!pNode) return 0xFF000000; - CFX_WideStringC wsColor; + WideStringView wsColor; pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor); return CXFA_Data::ToColor(wsColor); } @@ -62,7 +62,7 @@ void CXFA_Stroke::SetColor(FX_ARGB argb) { return; CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Color); - CFX_WideString wsColor; + WideString wsColor; int a; int r; int g; diff --git a/xfa/fxfa/parser/cxfa_submit.cpp b/xfa/fxfa/parser/cxfa_submit.cpp index e390e6314b..7fb04a3c64 100644 --- a/xfa/fxfa/parser/cxfa_submit.cpp +++ b/xfa/fxfa/parser/cxfa_submit.cpp @@ -18,10 +18,10 @@ int32_t CXFA_Submit::GetSubmitFormat() { return m_pNode->GetEnum(XFA_ATTRIBUTE_Format); } -void CXFA_Submit::GetSubmitTarget(CFX_WideStringC& wsTarget) { +void CXFA_Submit::GetSubmitTarget(WideStringView& wsTarget) { m_pNode->TryCData(XFA_ATTRIBUTE_Target, wsTarget); } -void CXFA_Submit::GetSubmitXDPContent(CFX_WideStringC& wsContent) { +void CXFA_Submit::GetSubmitXDPContent(WideStringView& wsContent) { m_pNode->TryCData(XFA_ATTRIBUTE_XdpContent, wsContent); } diff --git a/xfa/fxfa/parser/cxfa_submit.h b/xfa/fxfa/parser/cxfa_submit.h index f10435e1f5..9d4d7fe281 100644 --- a/xfa/fxfa/parser/cxfa_submit.h +++ b/xfa/fxfa/parser/cxfa_submit.h @@ -19,8 +19,8 @@ class CXFA_Submit : public CXFA_Data { bool IsSubmitEmbedPDF(); int32_t GetSubmitFormat(); - void GetSubmitTarget(CFX_WideStringC& wsTarget); - void GetSubmitXDPContent(CFX_WideStringC& wsContent); + void GetSubmitTarget(WideStringView& wsTarget); + void GetSubmitXDPContent(WideStringView& wsContent); }; #endif // XFA_FXFA_PARSER_CXFA_SUBMIT_H_ diff --git a/xfa/fxfa/parser/cxfa_text.cpp b/xfa/fxfa/parser/cxfa_text.cpp index 192a4deac4..cab11a6892 100644 --- a/xfa/fxfa/parser/cxfa_text.cpp +++ b/xfa/fxfa/parser/cxfa_text.cpp @@ -10,6 +10,6 @@ CXFA_Text::CXFA_Text(CXFA_Node* pNode) : CXFA_Data(pNode) {} -void CXFA_Text::GetContent(CFX_WideString& wsText) { +void CXFA_Text::GetContent(WideString& wsText) { m_pNode->TryContent(wsText); } diff --git a/xfa/fxfa/parser/cxfa_text.h b/xfa/fxfa/parser/cxfa_text.h index ca41c0dbb4..18b5628482 100644 --- a/xfa/fxfa/parser/cxfa_text.h +++ b/xfa/fxfa/parser/cxfa_text.h @@ -16,7 +16,7 @@ class CXFA_Text : public CXFA_Data { public: explicit CXFA_Text(CXFA_Node* pNode); - void GetContent(CFX_WideString& wsText); + void GetContent(WideString& wsText); }; #endif // XFA_FXFA_PARSER_CXFA_TEXT_H_ diff --git a/xfa/fxfa/parser/cxfa_thisproxy.cpp b/xfa/fxfa/parser/cxfa_thisproxy.cpp index 2938c1fb3f..55e676ecdc 100644 --- a/xfa/fxfa/parser/cxfa_thisproxy.cpp +++ b/xfa/fxfa/parser/cxfa_thisproxy.cpp @@ -12,7 +12,7 @@ CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis, XFA_Element::Unknown, - CFX_WideStringC()), + WideStringView()), m_pThisNode(nullptr), m_pScriptNode(nullptr) { m_pThisNode = pThisNode; diff --git a/xfa/fxfa/parser/cxfa_tooltip.cpp b/xfa/fxfa/parser/cxfa_tooltip.cpp index f3de7aa591..9561ef2ac5 100644 --- a/xfa/fxfa/parser/cxfa_tooltip.cpp +++ b/xfa/fxfa/parser/cxfa_tooltip.cpp @@ -10,6 +10,6 @@ CXFA_ToolTip::CXFA_ToolTip(CXFA_Node* pNode) : CXFA_Data(pNode) {} -bool CXFA_ToolTip::GetTip(CFX_WideString& wsTip) { +bool CXFA_ToolTip::GetTip(WideString& wsTip) { return m_pNode->TryContent(wsTip); } diff --git a/xfa/fxfa/parser/cxfa_tooltip.h b/xfa/fxfa/parser/cxfa_tooltip.h index 433885d89c..cc4bc31841 100644 --- a/xfa/fxfa/parser/cxfa_tooltip.h +++ b/xfa/fxfa/parser/cxfa_tooltip.h @@ -16,7 +16,7 @@ class CXFA_ToolTip : public CXFA_Data { public: explicit CXFA_ToolTip(CXFA_Node* pNode); - bool GetTip(CFX_WideString& wsTip); + bool GetTip(WideString& wsTip); }; #endif // XFA_FXFA_PARSER_CXFA_TOOLTIP_H_ diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index 712d0f2829..fc472741a9 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -16,10 +16,10 @@ int32_t CXFA_Validate::GetFormatTest() { } bool CXFA_Validate::SetTestValue(int32_t iType, - CFX_WideString& wsValue, + WideString& wsValue, XFA_ATTRIBUTEENUM eName) { const XFA_ATTRIBUTEENUMINFO* pInfo = - XFA_GetAttributeEnumByName(wsValue.AsStringC()); + XFA_GetAttributeEnumByName(wsValue.AsStringView()); if (pInfo) eName = pInfo->eName; @@ -27,7 +27,7 @@ bool CXFA_Validate::SetTestValue(int32_t iType, return true; } -bool CXFA_Validate::SetNullTest(CFX_WideString wsValue) { +bool CXFA_Validate::SetNullTest(WideString wsValue) { return SetTestValue(XFA_ATTRIBUTE_NullTest, wsValue, XFA_ATTRIBUTEENUM_Disabled); } @@ -40,8 +40,8 @@ int32_t CXFA_Validate::GetScriptTest() { return m_pNode->GetEnum(XFA_ATTRIBUTE_ScriptTest); } -void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, - const CFX_WideString& wsMessageType) { +void CXFA_Validate::GetMessageText(WideString& wsMessage, + const WideString& wsMessageType) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, false); if (!pNode) return; @@ -52,7 +52,7 @@ void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, if (pItemNode->GetElementType() != XFA_Element::Text) continue; - CFX_WideStringC wsName; + WideStringView wsName; pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName); if (wsName.IsEmpty() || wsName == wsMessageType) { pItemNode->TryContent(wsMessage); @@ -61,24 +61,24 @@ void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, } } -void CXFA_Validate::SetFormatMessageText(CFX_WideString wsMessage) { +void CXFA_Validate::SetFormatMessageText(WideString wsMessage) { SetMessageText(wsMessage, L"formatTest"); } -void CXFA_Validate::GetFormatMessageText(CFX_WideString& wsMessage) { +void CXFA_Validate::GetFormatMessageText(WideString& wsMessage) { GetMessageText(wsMessage, L"formatTest"); } -void CXFA_Validate::SetNullMessageText(CFX_WideString wsMessage) { +void CXFA_Validate::SetNullMessageText(WideString wsMessage) { SetMessageText(wsMessage, L"nullTest"); } -void CXFA_Validate::GetNullMessageText(CFX_WideString& wsMessage) { +void CXFA_Validate::GetNullMessageText(WideString& wsMessage) { GetMessageText(wsMessage, L"nullTest"); } -void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, - const CFX_WideString& wsMessageType) { +void CXFA_Validate::SetMessageText(WideString& wsMessage, + const WideString& wsMessageType) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Message, true); if (!pNode) return; @@ -89,7 +89,7 @@ void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, if (pItemNode->GetElementType() != XFA_Element::Text) continue; - CFX_WideStringC wsName; + WideStringView wsName; pItemNode->TryCData(XFA_ATTRIBUTE_Name, wsName); if (wsName.IsEmpty() || wsName == wsMessageType) { pItemNode->SetContent(wsMessage, wsMessage, false); @@ -102,15 +102,15 @@ void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, pTextNode->SetContent(wsMessage, wsMessage, false); } -void CXFA_Validate::GetScriptMessageText(CFX_WideString& wsMessage) { +void CXFA_Validate::GetScriptMessageText(WideString& wsMessage) { GetMessageText(wsMessage, L"scriptTest"); } -void CXFA_Validate::SetScriptMessageText(CFX_WideString wsMessage) { +void CXFA_Validate::SetScriptMessageText(WideString wsMessage) { SetMessageText(wsMessage, L"scriptTest"); } -void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) { +void CXFA_Validate::GetPicture(WideString& wsPicture) { if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture)) pNode->TryContent(wsPicture); } diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validate.h index 470cefe773..ce4ba647cc 100644 --- a/xfa/fxfa/parser/cxfa_validate.h +++ b/xfa/fxfa/parser/cxfa_validate.h @@ -20,24 +20,22 @@ class CXFA_Validate : public CXFA_Data { int32_t GetFormatTest(); int32_t GetNullTest(); - bool SetNullTest(CFX_WideString wsValue); + bool SetNullTest(WideString wsValue); int32_t GetScriptTest(); - void GetFormatMessageText(CFX_WideString& wsMessage); - void SetFormatMessageText(CFX_WideString wsMessage); - void GetNullMessageText(CFX_WideString& wsMessage); - void SetNullMessageText(CFX_WideString wsMessage); - void GetScriptMessageText(CFX_WideString& wsMessage); - void SetScriptMessageText(CFX_WideString wsMessage); - void GetPicture(CFX_WideString& wsPicture); + void GetFormatMessageText(WideString& wsMessage); + void SetFormatMessageText(WideString wsMessage); + void GetNullMessageText(WideString& wsMessage); + void SetNullMessageText(WideString wsMessage); + void GetScriptMessageText(WideString& wsMessage); + void SetScriptMessageText(WideString wsMessage); + void GetPicture(WideString& wsPicture); CXFA_Script GetScript(); private: - void GetMessageText(CFX_WideString& wsMessage, - const CFX_WideString& wsMessageType); - void SetMessageText(CFX_WideString& wsMessage, - const CFX_WideString& wsMessageType); + void GetMessageText(WideString& wsMessage, const WideString& wsMessageType); + void SetMessageText(WideString& wsMessage, const WideString& wsMessageType); bool SetTestValue(int32_t iType, - CFX_WideString& wsValue, + WideString& wsValue, XFA_ATTRIBUTEENUM eName); }; diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp index 4f166d5d42..abf55da260 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -16,7 +16,7 @@ XFA_Element CXFA_Value::GetChildValueClassID() { return XFA_Element::Unknown; } -bool CXFA_Value::GetChildValueContent(CFX_WideString& wsContent) { +bool CXFA_Value::GetChildValueContent(WideString& wsContent) { if (!m_pNode) return false; if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h index 225e1879da..52df169ee4 100644 --- a/xfa/fxfa/parser/cxfa_value.h +++ b/xfa/fxfa/parser/cxfa_value.h @@ -23,7 +23,7 @@ class CXFA_Value : public CXFA_Data { explicit CXFA_Value(CXFA_Node* pNode) : CXFA_Data(pNode) {} XFA_Element GetChildValueClassID(); - bool GetChildValueContent(CFX_WideString& wsContent); + bool GetChildValueContent(WideString& wsContent); CXFA_Arc GetArc(); CXFA_Line GetLine(); CXFA_Rectangle GetRectangle(); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 80981d97d6..1879377ae4 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -34,9 +34,9 @@ float GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes, return fThickness; } -bool SplitDateTime(const CFX_WideString& wsDateTime, - CFX_WideString& wsDate, - CFX_WideString& wsTime) { +bool SplitDateTime(const WideString& wsDateTime, + WideString& wsDate, + WideString& wsTime) { wsDate = L""; wsTime = L""; if (wsDateTime.IsEmpty()) @@ -208,9 +208,9 @@ XFA_ATTRIBUTEENUM GetAttributeDefaultValue_Enum(XFA_Element eElement, return XFA_ATTRIBUTEENUM_Unknown; } -CFX_WideStringC GetAttributeDefaultValue_Cdata(XFA_Element eElement, - XFA_ATTRIBUTE eAttribute, - uint32_t dwPacket) { +WideStringView GetAttributeDefaultValue_Cdata(XFA_Element eElement, + XFA_ATTRIBUTE eAttribute, + uint32_t dwPacket) { void* pValue; if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, XFA_ATTRIBUTETYPE_Cdata, dwPacket)) { @@ -251,7 +251,7 @@ XFA_Element CXFA_WidgetData::GetUIType() { return m_eUIType; } -CFX_WideString CXFA_WidgetData::GetRawValue() { +WideString CXFA_WidgetData::GetRawValue() { return m_pNode->GetContent(); } @@ -309,13 +309,13 @@ std::vector<CXFA_Node*> CXFA_WidgetData::GetEventByActivity(int32_t iActivity, CXFA_Event event(pNode); if (event.GetActivity() == iActivity) { if (iActivity == XFA_ATTRIBUTEENUM_Ready) { - CFX_WideStringC wsRef; + WideStringView wsRef; event.GetRef(wsRef); if (bIsFormReady) { - if (wsRef == CFX_WideStringC(L"$form")) + if (wsRef == WideStringView(L"$form")) events.push_back(pNode); } else { - if (wsRef == CFX_WideStringC(L"$layout")) + if (wsRef == WideStringView(L"$layout")) events.push_back(pNode); } } else { @@ -430,12 +430,12 @@ int32_t CXFA_WidgetData::GetButtonHighlight() { XFA_Element::Button, XFA_ATTRIBUTE_Highlight, XFA_XDPPACKET_Form); } -bool CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover, +bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover, bool& bRichText) { if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { - CFX_WideStringC wsName; + WideStringView wsName; pText->TryCData(XFA_ATTRIBUTE_Name, wsName); if (wsName == L"rollover") { pText->TryContent(wsRollover); @@ -448,11 +448,11 @@ bool CXFA_WidgetData::GetButtonRollover(CFX_WideString& wsRollover, return false; } -bool CXFA_WidgetData::GetButtonDown(CFX_WideString& wsDown, bool& bRichText) { +bool CXFA_WidgetData::GetButtonDown(WideString& wsDown, bool& bRichText) { if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { - CFX_WideStringC wsName; + WideStringView wsName; pText->TryCData(XFA_ATTRIBUTE_Name, wsName); if (wsName == L"down") { pText->TryContent(wsDown); @@ -505,7 +505,7 @@ bool CXFA_WidgetData::IsAllowNeutral() { } XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { - CFX_WideString wsValue = GetRawValue(); + WideString wsValue = GetRawValue(); if (wsValue.IsEmpty()) return XFA_CHECKSTATE_Off; @@ -513,7 +513,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); int32_t i = 0; while (pText) { - CFX_WideString wsContent; + WideString wsContent; if (pText->TryContent(wsContent) && (wsContent == wsValue)) return (XFA_CHECKSTATE)i; @@ -527,7 +527,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { CXFA_WidgetData exclGroup(GetExclGroupNode()); if (exclGroup) { - CFX_WideString wsValue; + WideString wsValue; if (eCheckState != XFA_CHECKSTATE_Off) { if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -549,8 +549,8 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { if (!pItemchild) continue; - CFX_WideString text = pItemchild->GetContent(); - CFX_WideString wsChildValue = text; + WideString text = pItemchild->GetContent(); + WideString wsChildValue = text; if (wsValue != text) { pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); if (pItemchild) @@ -569,7 +569,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { int32_t i = -1; CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); - CFX_WideString wsContent; + WideString wsContent; while (pText) { i++; if (i == eCheckState) { @@ -591,7 +591,7 @@ CXFA_Node* CXFA_WidgetData::GetExclGroupNode() { CXFA_Node* CXFA_WidgetData::GetSelectedMember() { CXFA_Node* pSelectedMember = nullptr; - CFX_WideString wsState = GetRawValue(); + WideString wsState = GetRawValue(); if (wsState.IsEmpty()) return pSelectedMember; @@ -606,7 +606,7 @@ CXFA_Node* CXFA_WidgetData::GetSelectedMember() { return pSelectedMember; } -CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, +CXFA_Node* CXFA_WidgetData::SetSelectedMember(const WideStringView& wsName, bool bNotify) { uint32_t nameHash = FX_HashCode_GetW(wsName, false); for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)); @@ -620,11 +620,11 @@ CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, return nullptr; } -void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, +void CXFA_WidgetData::SetSelectedMemberByValue(const WideStringView& wsValue, bool bNotify, bool bScriptModify, bool bSyncData) { - CFX_WideString wsExclGroup; + WideString wsExclGroup; for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pNode->GetElementType() != XFA_Element::Field) @@ -638,7 +638,7 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, if (!pItemchild) continue; - CFX_WideString wsChildValue = pItemchild->GetContent(); + WideString wsChildValue = pItemchild->GetContent(); if (wsValue != wsChildValue) { pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); if (pItemchild) @@ -740,7 +740,7 @@ int32_t CXFA_WidgetData::CountChoiceListItems(bool bSaveValue) { return pItem->CountChildren(XFA_Element::Unknown); } -bool CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, +bool CXFA_WidgetData::GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue) { wsText.clear(); @@ -776,8 +776,7 @@ bool CXFA_WidgetData::GetChoiceListItem(CFX_WideString& wsText, return false; } -std::vector<CFX_WideString> CXFA_WidgetData::GetChoiceListItems( - bool bSaveValue) { +std::vector<WideString> CXFA_WidgetData::GetChoiceListItems(bool bSaveValue) { std::vector<CXFA_Node*> items; for (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); pNode && items.size() < 2; @@ -786,7 +785,7 @@ std::vector<CFX_WideString> CXFA_WidgetData::GetChoiceListItems( items.push_back(pNode); } if (items.empty()) - return std::vector<CFX_WideString>(); + return std::vector<WideString>(); CXFA_Node* pItem = items.front(); if (items.size() > 1) { @@ -796,7 +795,7 @@ std::vector<CFX_WideString> CXFA_WidgetData::GetChoiceListItems( pItem = items[1]; } - std::vector<CFX_WideString> wsTextArray; + std::vector<WideString> wsTextArray; for (CXFA_Node* pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { wsTextArray.emplace_back(); @@ -806,12 +805,12 @@ std::vector<CFX_WideString> CXFA_WidgetData::GetChoiceListItems( } int32_t CXFA_WidgetData::CountSelectedItems() { - std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue(); + std::vector<WideString> wsValueArray = GetSelectedItemsValue(); if (IsListBox() || !IsChoiceListAllowTextEntry()) return pdfium::CollectionSize<int32_t>(wsValueArray); int32_t iSelected = 0; - std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true); + std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true); for (const auto& value : wsValueArray) { if (pdfium::ContainsValue(wsSaveTextArray, value)) iSelected++; @@ -820,11 +819,11 @@ int32_t CXFA_WidgetData::CountSelectedItems() { } int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) { - std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue(); + std::vector<WideString> wsValueArray = GetSelectedItemsValue(); if (!pdfium::IndexInBounds(wsValueArray, nIndex)) return -1; - std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true); + std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true); auto it = std::find(wsSaveTextArray.begin(), wsSaveTextArray.end(), wsValueArray[nIndex]); return it != wsSaveTextArray.end() ? it - wsSaveTextArray.begin() : -1; @@ -832,8 +831,8 @@ int32_t CXFA_WidgetData::GetSelectedItem(int32_t nIndex) { std::vector<int32_t> CXFA_WidgetData::GetSelectedItems() { std::vector<int32_t> iSelArray; - std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue(); - std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true); + std::vector<WideString> wsValueArray = GetSelectedItemsValue(); + std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true); for (const auto& value : wsValueArray) { auto it = std::find(wsSaveTextArray.begin(), wsSaveTextArray.end(), value); if (it != wsSaveTextArray.end()) @@ -842,9 +841,9 @@ std::vector<int32_t> CXFA_WidgetData::GetSelectedItems() { return iSelArray; } -std::vector<CFX_WideString> CXFA_WidgetData::GetSelectedItemsValue() { - std::vector<CFX_WideString> wsSelTextArray; - CFX_WideString wsValue = GetRawValue(); +std::vector<WideString> CXFA_WidgetData::GetSelectedItemsValue() { + std::vector<WideString> wsSelTextArray; + WideString wsValue = GetRawValue(); if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { if (!wsValue.IsEmpty()) { FX_STRSIZE iStart = 0; @@ -868,7 +867,7 @@ std::vector<CFX_WideString> CXFA_WidgetData::GetSelectedItemsValue() { } bool CXFA_WidgetData::GetItemState(int32_t nIndex) { - std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true); + std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true); return pdfium::IndexInBounds(wsSaveTextArray, nIndex) && pdfium::ContainsValue(GetSelectedItemsValue(), wsSaveTextArray[nIndex]); @@ -879,12 +878,12 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, bool bNotify, bool bScriptModify, bool bSyncData) { - std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true); + std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true); if (!pdfium::IndexInBounds(wsSaveTextArray, nIndex)) return; int32_t iSel = -1; - std::vector<CFX_WideString> wsValueArray = GetSelectedItemsValue(); + std::vector<WideString> wsValueArray = GetSelectedItemsValue(); auto it = std::find(wsValueArray.begin(), wsValueArray.end(), wsSaveTextArray[nIndex]); if (it != wsValueArray.end()) @@ -893,7 +892,7 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { if (bSelected) { if (iSel < 0) { - CFX_WideString wsValue = GetRawValue(); + WideString wsValue = GetRawValue(); if (!wsValue.IsEmpty()) { wsValue += L"\n"; } @@ -911,15 +910,15 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, } else { if (bSelected) { if (iSel < 0) { - CFX_WideString wsSaveText = wsSaveTextArray[nIndex]; - CFX_WideString wsFormatText(wsSaveText); + WideString wsSaveText = wsSaveTextArray[nIndex]; + WideString wsFormatText(wsSaveText); GetFormatDataValue(wsSaveText, wsFormatText); m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify, bSyncData); } } else if (iSel >= 0) { - m_pNode->SetContent(CFX_WideString(), CFX_WideString(), bNotify, - bScriptModify, bSyncData); + m_pNode->SetContent(WideString(), WideString(), bNotify, bScriptModify, + bSyncData); } } } @@ -928,18 +927,18 @@ void CXFA_WidgetData::SetSelectedItems(const std::vector<int32_t>& iSelArray, bool bNotify, bool bScriptModify, bool bSyncData) { - CFX_WideString wsValue; + WideString wsValue; int32_t iSize = pdfium::CollectionSize<int32_t>(iSelArray); if (iSize >= 1) { - std::vector<CFX_WideString> wsSaveTextArray = GetChoiceListItems(true); - CFX_WideString wsItemValue; + std::vector<WideString> wsSaveTextArray = GetChoiceListItems(true); + WideString wsItemValue; for (int32_t i = 0; i < iSize; i++) { wsItemValue = (iSize == 1) ? wsSaveTextArray[iSelArray[i]] : wsSaveTextArray[iSelArray[i]] + L"\n"; wsValue += wsItemValue; } } - CFX_WideString wsFormat(wsValue); + WideString wsFormat(wsValue); if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) GetFormatDataValue(wsValue, wsFormat); @@ -949,7 +948,7 @@ void CXFA_WidgetData::SetSelectedItems(const std::vector<int32_t>& iSelArray, void CXFA_WidgetData::ClearAllSelections() { CXFA_Node* pBind = m_pNode->GetBindData(); if (!pBind || GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) { - SyncValue(CFX_WideString(), false); + SyncValue(WideString(), false); return; } @@ -957,11 +956,11 @@ void CXFA_WidgetData::ClearAllSelections() { pBind->RemoveChild(pChildNode); } -void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, - const CFX_WideString& wsValue, +void CXFA_WidgetData::InsertItem(const WideString& wsLabel, + const WideString& wsValue, bool bNotify) { int32_t nIndex = -1; - CFX_WideString wsNewValue(wsValue); + WideString wsNewValue(wsValue); if (wsNewValue.IsEmpty()) wsNewValue = wsLabel; @@ -999,7 +998,7 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, CXFA_Node* pListNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); int32_t i = 0; while (pListNode) { - CFX_WideString wsOldValue; + WideString wsOldValue; pListNode->TryContent(wsOldValue); InsertListTextItem(pSaveItems, wsOldValue, i); i++; @@ -1015,8 +1014,8 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, this, wsLabel.c_str(), wsValue.c_str(), nIndex); } -void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, - CFX_WideString& wsLabel) { +void CXFA_WidgetData::GetItemLabel(const WideStringView& wsValue, + WideString& wsLabel) { int32_t iCount = 0; std::vector<CXFA_Node*> listitems; CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1040,7 +1039,7 @@ void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, } iCount = 0; int32_t iSearch = -1; - CFX_WideString wsContent; + WideString wsContent; CXFA_Node* pChildItem = pSaveItems->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChildItem; pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) { @@ -1060,8 +1059,8 @@ void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, } } -void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, - CFX_WideString& wsValue) { +void CXFA_WidgetData::GetItemValue(const WideStringView& wsLabel, + WideString& wsValue) { int32_t iCount = 0; std::vector<CXFA_Node*> listitems; for (CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1085,7 +1084,7 @@ void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, } iCount = 0; int32_t iSearch = -1; - CFX_WideString wsContent; + WideString wsContent; CXFA_Node* pChildItem = pLabelItems->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChildItem; pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) { @@ -1154,15 +1153,15 @@ int32_t CXFA_WidgetData::GetNumberOfCells() { return -1; } -CFX_WideString CXFA_WidgetData::GetBarcodeType() { +WideString CXFA_WidgetData::GetBarcodeType() { CXFA_Node* pUIChild = GetUIChild(); - return pUIChild ? CFX_WideString(pUIChild->GetCData(XFA_ATTRIBUTE_Type)) - : CFX_WideString(); + return pUIChild ? WideString(pUIChild->GetCData(XFA_ATTRIBUTE_Type)) + : WideString(); } bool CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); - CFX_WideString wsCharEncoding; + WideString wsCharEncoding; if (pUIChild->TryCData(XFA_ATTRIBUTE_CharEncoding, wsCharEncoding)) { if (wsCharEncoding.CompareNoCase(L"UTF-16")) { *val = CHAR_ENCODING_UNICODE; @@ -1202,7 +1201,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_Checksum(bool* val) { bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); - CFX_WideString wsDataLength; + WideString wsDataLength; if (pUIChild->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength)) { *val = FXSYS_wtoi(wsDataLength.c_str()); return true; @@ -1212,7 +1211,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) { bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { CXFA_Node* pUIChild = GetUIChild(); - CFX_WideStringC wsStartEndChar; + WideStringView wsStartEndChar; if (pUIChild->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) { if (wsStartEndChar.GetLength()) { *val = static_cast<char>(wsStartEndChar[0]); @@ -1224,7 +1223,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) { CXFA_Node* pUIChild = GetUIChild(); - CFX_WideStringC wsStartEndChar; + WideStringView wsStartEndChar; if (pUIChild->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar)) { if (wsStartEndChar.GetLength()) { *val = static_cast<char>(wsStartEndChar[0]); @@ -1236,7 +1235,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) { bool CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); - CFX_WideString wsECLevel; + WideString wsECLevel; if (pUIChild->TryCData(XFA_ATTRIBUTE_ErrorCorrectionLevel, wsECLevel)) { *val = FXSYS_wtoi(wsECLevel.c_str()); return true; @@ -1313,7 +1312,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_Truncate(bool* val) { bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { CXFA_Node* pUIChild = GetUIChild(); - CFX_WideString wsWideNarrowRatio; + WideString wsWideNarrowRatio; if (pUIChild->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, wsWideNarrowRatio)) { auto ptPos = wsWideNarrowRatio.Find(':'); float fRatio = 0; @@ -1335,7 +1334,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { return false; } -void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) { +void CXFA_WidgetData::GetPasswordChar(WideString& wsPassWord) { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { pUIChild->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord); @@ -1400,7 +1399,7 @@ bool CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) { return false; } -bool CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, +bool CXFA_WidgetData::SetValue(const WideString& wsValue, XFA_VALUEPICTURE eValueType) { if (wsValue.IsEmpty()) { SyncValue(wsValue, true); @@ -1408,8 +1407,8 @@ bool CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, } m_bPreNull = m_bIsNull; m_bIsNull = false; - CFX_WideString wsNewText(wsValue); - CFX_WideString wsPicture; + WideString wsNewText(wsValue); + WideString wsPicture; GetPictureContent(wsPicture, eValueType); bool bValidate = true; bool bSyncData = false; @@ -1455,7 +1454,7 @@ bool CXFA_WidgetData::SetValue(const CFX_WideString& wsValue, return bValidate; } -bool CXFA_WidgetData::GetPictureContent(CFX_WideString& wsPicture, +bool CXFA_WidgetData::GetPictureContent(WideString& wsPicture, XFA_VALUEPICTURE ePicture) { if (ePicture == XFA_VALUEPICTURE_Raw) return false; @@ -1549,7 +1548,7 @@ IFX_Locale* CXFA_WidgetData::GetLocal() { if (!m_pNode) return nullptr; - CFX_WideString wsLocaleName; + WideString wsLocaleName; if (!m_pNode->GetLocaleName(wsLocaleName)) return nullptr; if (wsLocaleName == L"ambient") @@ -1557,14 +1556,14 @@ IFX_Locale* CXFA_WidgetData::GetLocal() { return m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName); } -bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, +bool CXFA_WidgetData::GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType) { wsValue = m_pNode->GetContent(); if (eValueType == XFA_VALUEPICTURE_Display) - GetItemLabel(wsValue.AsStringC(), wsValue); + GetItemLabel(wsValue.AsStringView(), wsValue); - CFX_WideString wsPicture; + WideString wsPicture; GetPictureContent(wsPicture, eValueType); CXFA_Node* pNode = GetUIChild(); if (!pNode) @@ -1584,7 +1583,7 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, if (eValueType != XFA_VALUEPICTURE_Raw && wsPicture.IsEmpty()) { IFX_Locale* pLocale = GetLocal(); if (eValueType == XFA_VALUEPICTURE_Display && pLocale) { - CFX_WideString wsOutput; + WideString wsOutput; NormalizeNumStr(wsValue, wsOutput); FormatNumStr(wsOutput, pLocale, wsOutput); wsValue = wsOutput; @@ -1602,7 +1601,7 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr(); switch (widgetValue.GetType()) { case XFA_VT_DATE: { - CFX_WideString wsDate, wsTime; + WideString wsDate, wsTime; if (SplitDateTime(wsValue, wsDate, wsTime)) { CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr); if (date.FormatPatterns(wsValue, wsPicture, pLocale, eValueType)) @@ -1611,7 +1610,7 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, break; } case XFA_VT_TIME: { - CFX_WideString wsDate, wsTime; + WideString wsDate, wsTime; if (SplitDateTime(wsValue, wsDate, wsTime)) { CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr); if (time.FormatPatterns(wsValue, wsPicture, pLocale, eValueType)) @@ -1627,13 +1626,13 @@ bool CXFA_WidgetData::GetValue(CFX_WideString& wsValue, return true; } -bool CXFA_WidgetData::GetNormalizeDataValue(const CFX_WideString& wsValue, - CFX_WideString& wsNormalizeValue) { +bool CXFA_WidgetData::GetNormalizeDataValue(const WideString& wsValue, + WideString& wsNormalizeValue) { wsNormalizeValue = wsValue; if (wsValue.IsEmpty()) return true; - CFX_WideString wsPicture; + WideString wsPicture; GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); if (wsPicture.IsEmpty()) return true; @@ -1651,13 +1650,13 @@ bool CXFA_WidgetData::GetNormalizeDataValue(const CFX_WideString& wsValue, return false; } -bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, - CFX_WideString& wsFormattedValue) { +bool CXFA_WidgetData::GetFormatDataValue(const WideString& wsValue, + WideString& wsFormattedValue) { wsFormattedValue = wsValue; if (wsValue.IsEmpty()) return true; - CFX_WideString wsPicture; + WideString wsPicture; GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); if (wsPicture.IsEmpty()) return true; @@ -1706,7 +1705,7 @@ bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, CXFA_LocaleValue widgetValue(iVTType, wsValue, pLocalMgr); switch (widgetValue.GetType()) { case XFA_VT_DATE: { - CFX_WideString wsDate, wsTime; + WideString wsDate, wsTime; if (SplitDateTime(wsValue, wsDate, wsTime)) { CXFA_LocaleValue date(XFA_VT_DATE, wsDate, pLocalMgr); if (date.FormatPatterns(wsFormattedValue, wsPicture, pLocale, @@ -1717,7 +1716,7 @@ bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, break; } case XFA_VT_TIME: { - CFX_WideString wsDate, wsTime; + WideString wsDate, wsTime; if (SplitDateTime(wsValue, wsDate, wsTime)) { CXFA_LocaleValue time(XFA_VT_TIME, wsTime, pLocalMgr); if (time.FormatPatterns(wsFormattedValue, wsPicture, pLocale, @@ -1736,8 +1735,8 @@ bool CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue, return false; } -void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue, - CFX_WideString& wsOutput) { +void CXFA_WidgetData::NormalizeNumStr(const WideString& wsValue, + WideString& wsOutput) { if (wsValue.IsEmpty()) return; @@ -1753,14 +1752,14 @@ void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue, wsOutput.InsertAtFront('0'); } -void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue, +void CXFA_WidgetData::FormatNumStr(const WideString& wsValue, IFX_Locale* pLocale, - CFX_WideString& wsOutput) { + WideString& wsOutput) { if (wsValue.IsEmpty()) return; - CFX_WideString wsSrcNum = wsValue; - CFX_WideString wsGroupSymbol = + WideString wsSrcNum = wsValue; + WideString wsGroupSymbol = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Grouping); bool bNeg = false; if (wsSrcNum[0] == '-') { @@ -1791,11 +1790,11 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue, } } -void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, bool bNotify) { +void CXFA_WidgetData::SyncValue(const WideString& wsValue, bool bNotify) { if (!m_pNode) return; - CFX_WideString wsFormatValue(wsValue); + WideString wsFormatValue(wsValue); CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData(); if (pContainerWidgetData) pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue); @@ -1804,20 +1803,20 @@ void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, bool bNotify) { } void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, - const CFX_WideString& wsText, + const WideString& wsText, int32_t nIndex) { CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_Element::Text); pItems->InsertChild(nIndex, pText); pText->SetContent(wsText, wsText, false, false, false); } -CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue, - int32_t iLead, - int32_t iTread) const { +WideString CXFA_WidgetData::NumericLimit(const WideString& wsValue, + int32_t iLead, + int32_t iTread) const { if ((iLead == -1) && (iTread == -1)) return wsValue; - CFX_WideString wsRet; + WideString wsRet; int32_t iLead_ = 0, iTread_ = -1; int32_t iCount = wsValue.GetLength(); if (iCount == 0) @@ -1839,7 +1838,7 @@ CFX_WideString CXFA_WidgetData::NumericLimit(const CFX_WideString& wsValue, iTread_++; if (iTread_ > iTread) { if (iTread != -1) { - CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsStringC()); + CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsStringView()); wsDeci.SetScale(iTread); wsRet = wsDeci; } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index f53d926655..69f8d0d5a2 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -45,7 +45,7 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Node* GetUIChild(); XFA_Element GetUIType(); - CFX_WideString GetRawValue(); + WideString GetRawValue(); int32_t GetAccess(); int32_t GetRotate(); @@ -73,8 +73,8 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Border GetUIBorder(); CFX_RectF GetUIMargin(); int32_t GetButtonHighlight(); - bool GetButtonRollover(CFX_WideString& wsRollover, bool& bRichText); - bool GetButtonDown(CFX_WideString& wsDown, bool& bRichText); + bool GetButtonRollover(WideString& wsRollover, bool& bRichText); + bool GetButtonDown(WideString& wsDown, bool& bRichText); int32_t GetCheckButtonShape(); int32_t GetCheckButtonMark(); float GetCheckButtonSize(); @@ -84,8 +84,8 @@ class CXFA_WidgetData : public CXFA_Data { void SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify); CXFA_Node* GetExclGroupNode(); CXFA_Node* GetSelectedMember(); - CXFA_Node* SetSelectedMember(const CFX_WideStringC& wsName, bool bNotify); - void SetSelectedMemberByValue(const CFX_WideStringC& wsValue, + CXFA_Node* SetSelectedMember(const WideStringView& wsName, bool bNotify); + void SetSelectedMemberByValue(const WideStringView& wsValue, bool bNotify, bool bScriptModify, bool bSyncData); @@ -96,14 +96,12 @@ class CXFA_WidgetData : public CXFA_Data { int32_t GetChoiceListOpen(); bool IsListBox(); int32_t CountChoiceListItems(bool bSaveValue); - bool GetChoiceListItem(CFX_WideString& wsText, - int32_t nIndex, - bool bSaveValue); - std::vector<CFX_WideString> GetChoiceListItems(bool bSaveValue); + bool GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue); + std::vector<WideString> GetChoiceListItems(bool bSaveValue); int32_t CountSelectedItems(); int32_t GetSelectedItem(int32_t nIndex); std::vector<int32_t> GetSelectedItems(); - std::vector<CFX_WideString> GetSelectedItemsValue(); + std::vector<WideString> GetSelectedItemsValue(); bool GetItemState(int32_t nIndex); void SetItemState(int32_t nIndex, bool bSelected, @@ -115,25 +113,25 @@ class CXFA_WidgetData : public CXFA_Data { bool bScriptModify, bool bSyncData); void ClearAllSelections(); - void InsertItem(const CFX_WideString& wsLabel, - const CFX_WideString& wsValue, + void InsertItem(const WideString& wsLabel, + const WideString& wsValue, bool bNotify); - void GetItemLabel(const CFX_WideStringC& wsValue, CFX_WideString& wsLabel); - void GetItemValue(const CFX_WideStringC& wsLabel, CFX_WideString& wsValue); + void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel); + void GetItemValue(const WideStringView& wsLabel, WideString& wsValue); bool DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify); int32_t GetHorizontalScrollPolicy(); int32_t GetNumberOfCells(); - bool SetValue(const CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType); - bool GetPictureContent(CFX_WideString& wsPicture, XFA_VALUEPICTURE ePicture); + bool SetValue(const WideString& wsValue, XFA_VALUEPICTURE eValueType); + bool GetPictureContent(WideString& wsPicture, XFA_VALUEPICTURE ePicture); IFX_Locale* GetLocal(); - bool GetValue(CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType); - bool GetNormalizeDataValue(const CFX_WideString& wsValue, - CFX_WideString& wsNormalizeValue); - bool GetFormatDataValue(const CFX_WideString& wsValue, - CFX_WideString& wsFormattedValue); - void NormalizeNumStr(const CFX_WideString& wsValue, CFX_WideString& wsOutput); - - CFX_WideString GetBarcodeType(); + bool GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType); + bool GetNormalizeDataValue(const WideString& wsValue, + WideString& wsNormalizeValue); + bool GetFormatDataValue(const WideString& wsValue, + WideString& wsFormattedValue); + void NormalizeNumStr(const WideString& wsValue, WideString& wsOutput); + + WideString GetBarcodeType(); bool GetBarcodeAttribute_CharEncoding(int32_t* val); bool GetBarcodeAttribute_Checksum(bool* val); bool GetBarcodeAttribute_DataLength(int32_t* val); @@ -146,7 +144,7 @@ class CXFA_WidgetData : public CXFA_Data { bool GetBarcodeAttribute_TextLocation(int32_t* val); bool GetBarcodeAttribute_Truncate(bool* val); bool GetBarcodeAttribute_WideNarrowRatio(float* val); - void GetPasswordChar(CFX_WideString& wsPassWord); + void GetPasswordChar(WideString& wsPassWord); bool IsMultiLine(); int32_t GetVerticalScrollPolicy(); @@ -154,22 +152,22 @@ class CXFA_WidgetData : public CXFA_Data { bool GetFracDigits(int32_t& iFracDigits); bool GetLeadDigits(int32_t& iLeadDigits); - CFX_WideString NumericLimit(const CFX_WideString& wsValue, - int32_t iLead, - int32_t iTread) const; + WideString NumericLimit(const WideString& wsValue, + int32_t iLead, + int32_t iTread) const; bool m_bIsNull; bool m_bPreNull; private: CXFA_Bind GetBind(); - void SyncValue(const CFX_WideString& wsValue, bool bNotify); + void SyncValue(const WideString& wsValue, bool bNotify); void InsertListTextItem(CXFA_Node* pItems, - const CFX_WideString& wsText, + const WideString& wsText, int32_t nIndex); - void FormatNumStr(const CFX_WideString& wsValue, + void FormatNumStr(const WideString& wsValue, IFX_Locale* pLocale, - CFX_WideString& wsOutput); + WideString& wsOutput); CXFA_Node* m_pUiChildNode; XFA_Element m_eUIType; diff --git a/xfa/fxfa/parser/cxfa_xmllocale.cpp b/xfa/fxfa/parser/cxfa_xmllocale.cpp index 4055c155dd..f9e4353dca 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.cpp +++ b/xfa/fxfa/parser/cxfa_xmllocale.cpp @@ -21,14 +21,13 @@ CXFA_XMLLocale::CXFA_XMLLocale(std::unique_ptr<CXML_Element> pLocaleData) CXFA_XMLLocale::~CXFA_XMLLocale() {} -CFX_WideString CXFA_XMLLocale::GetName() const { - return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : CFX_WideString(); +WideString CXFA_XMLLocale::GetName() const { + return m_pLocaleData ? m_pLocaleData->GetAttrValue("name") : WideString(); } -CFX_WideString CXFA_XMLLocale::GetNumbericSymbol( - FX_LOCALENUMSYMBOL eType) const { - CFX_ByteString bsSymbols; - CFX_WideString wsName; +WideString CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const { + ByteString bsSymbols; + WideString wsName; switch (eType) { case FX_LOCALENUMSYMBOL_Decimal: bsSymbols = "numberSymbols"; @@ -59,43 +58,43 @@ CFX_WideString CXFA_XMLLocale::GetNumbericSymbol( wsName = L"isoname"; break; default: - return CFX_WideString(); + return WideString(); } CXML_Element* pElement = - m_pLocaleData->GetElement("", bsSymbols.AsStringC(), 0); + m_pLocaleData->GetElement("", bsSymbols.AsStringView(), 0); if (!pElement) - return CFX_WideString(); + return WideString(); return GetPattern( - pElement, CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1), - wsName.AsStringC()); + pElement, ByteStringView(bsSymbols.c_str(), bsSymbols.GetLength() - 1), + wsName.AsStringView()); } -CFX_WideString CXFA_XMLLocale::GetDateTimeSymbols() const { +WideString CXFA_XMLLocale::GetDateTimeSymbols() const { if (!m_pLocaleData) - return CFX_WideString(); + return WideString(); CXML_Element* pNumberSymbols = m_pLocaleData->GetElement("", "dateTimeSymbols", 0); if (!pNumberSymbols) - return CFX_WideString(); + return WideString(); CXML_Content* pContent = ToContent(pNumberSymbols->GetChild(0)); if (!pContent) - return CFX_WideString(); + return WideString(); return pContent->m_Content; } -CFX_WideString CXFA_XMLLocale::GetMonthName(int32_t nMonth, bool bAbbr) const { +WideString CXFA_XMLLocale::GetMonthName(int32_t nMonth, bool bAbbr) const { return GetCalendarSymbol("month", nMonth, bAbbr); } -CFX_WideString CXFA_XMLLocale::GetDayName(int32_t nWeek, bool bAbbr) const { +WideString CXFA_XMLLocale::GetDayName(int32_t nWeek, bool bAbbr) const { return GetCalendarSymbol("day", nWeek, bAbbr); } -CFX_WideString CXFA_XMLLocale::GetMeridiemName(bool bAM) const { +WideString CXFA_XMLLocale::GetMeridiemName(bool bAM) const { return GetCalendarSymbol("meridiem", bAM ? 0 : 1, false); } @@ -103,47 +102,47 @@ FX_TIMEZONE CXFA_XMLLocale::GetTimeZone() const { return CXFA_TimeZoneProvider().GetTimeZone(); } -CFX_WideString CXFA_XMLLocale::GetEraName(bool bAD) const { +WideString CXFA_XMLLocale::GetEraName(bool bAD) const { return GetCalendarSymbol("era", bAD ? 1 : 0, false); } -CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol, - int index, - bool bAbbr) const { +WideString CXFA_XMLLocale::GetCalendarSymbol(const ByteStringView& symbol, + int index, + bool bAbbr) const { if (!m_pLocaleData) - return CFX_WideString(); + return WideString(); CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols", 0); if (!pChild) - return CFX_WideString(); + return WideString(); - CFX_ByteString pstrSymbolNames = symbol + "Names"; + ByteString pstrSymbolNames = symbol + "Names"; CXML_Element* pSymbolNames = - pChild->GetElement("", pstrSymbolNames.AsStringC(), 0); + pChild->GetElement("", pstrSymbolNames.AsStringView(), 0); if (!pSymbolNames) - return CFX_WideString(); + return WideString(); if ((!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr) - pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringC(), 1); + pSymbolNames = pChild->GetElement("", pstrSymbolNames.AsStringView(), 1); if (!pSymbolNames || (!!pSymbolNames->GetAttrInteger("abbr")) != bAbbr) - return CFX_WideString(); + return WideString(); CXML_Element* pSymbolName = pSymbolNames->GetElement("", symbol, index); if (!pSymbolName) - return CFX_WideString(); + return WideString(); CXML_Content* pContent = ToContent(pSymbolName->GetChild(0)); - return pContent ? pContent->m_Content : CFX_WideString(); + return pContent ? pContent->m_Content : WideString(); } -CFX_WideString CXFA_XMLLocale::GetDatePattern( +WideString CXFA_XMLLocale::GetDatePattern( FX_LOCALEDATETIMESUBCATEGORY eType) const { CXML_Element* pElement = m_pLocaleData->GetElement("", "datePatterns", 0); if (!pElement) - return CFX_WideString(); + return WideString(); - CFX_WideString wsName; + WideString wsName; switch (eType) { case FX_LOCALEDATETIMESUBCATEGORY_Short: wsName = L"short"; @@ -159,16 +158,16 @@ CFX_WideString CXFA_XMLLocale::GetDatePattern( wsName = L"long"; break; } - return GetPattern(pElement, "datePattern", wsName.AsStringC()); + return GetPattern(pElement, "datePattern", wsName.AsStringView()); } -CFX_WideString CXFA_XMLLocale::GetTimePattern( +WideString CXFA_XMLLocale::GetTimePattern( FX_LOCALEDATETIMESUBCATEGORY eType) const { CXML_Element* pElement = m_pLocaleData->GetElement("", "timePatterns", 0); if (!pElement) - return CFX_WideString(); + return WideString(); - CFX_WideString wsName; + WideString wsName; switch (eType) { case FX_LOCALEDATETIMESUBCATEGORY_Short: wsName = L"short"; @@ -184,26 +183,25 @@ CFX_WideString CXFA_XMLLocale::GetTimePattern( wsName = L"long"; break; } - return GetPattern(pElement, "timePattern", wsName.AsStringC()); + return GetPattern(pElement, "timePattern", wsName.AsStringView()); } -CFX_WideString CXFA_XMLLocale::GetNumPattern( - FX_LOCALENUMSUBCATEGORY eType) const { +WideString CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const { return m_pLocaleData->GetElement("", "numberPatterns", 0) ? XFA_PatternToString(eType) - : CFX_WideString(); + : WideString(); } -CFX_WideString CXFA_XMLLocale::GetPattern(CXML_Element* pElement, - const CFX_ByteStringC& bsTag, - const CFX_WideStringC& wsName) const { +WideString CXFA_XMLLocale::GetPattern(CXML_Element* pElement, + const ByteStringView& bsTag, + const WideStringView& wsName) const { int32_t iCount = pElement->CountElements("", bsTag); for (int32_t i = 0; i < iCount; i++) { CXML_Element* pChild = pElement->GetElement("", bsTag, i); if (pChild->GetAttrValue("name") == wsName) { CXML_Content* pContent = ToContent(pChild->GetChild(0)); - return pContent ? pContent->m_Content : CFX_WideString(); + return pContent ? pContent->m_Content : WideString(); } } - return CFX_WideString(); + return WideString(); } diff --git a/xfa/fxfa/parser/cxfa_xmllocale.h b/xfa/fxfa/parser/cxfa_xmllocale.h index a58385601c..5050855ca6 100644 --- a/xfa/fxfa/parser/cxfa_xmllocale.h +++ b/xfa/fxfa/parser/cxfa_xmllocale.h @@ -19,29 +19,27 @@ class CXFA_XMLLocale : public IFX_Locale { ~CXFA_XMLLocale() override; // IFX_Locale - CFX_WideString GetName() const override; - CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override; + WideString GetName() const override; + WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const override; - CFX_WideString GetDateTimeSymbols() const override; - CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const override; - CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const override; - CFX_WideString GetMeridiemName(bool bAM) const override; + WideString GetDateTimeSymbols() const override; + WideString GetMonthName(int32_t nMonth, bool bAbbr) const override; + WideString GetDayName(int32_t nWeek, bool bAbbr) const override; + WideString GetMeridiemName(bool bAM) const override; FX_TIMEZONE GetTimeZone() const override; - CFX_WideString GetEraName(bool bAD) const override; + WideString GetEraName(bool bAD) const override; - CFX_WideString GetDatePattern( - FX_LOCALEDATETIMESUBCATEGORY eType) const override; - CFX_WideString GetTimePattern( - FX_LOCALEDATETIMESUBCATEGORY eType) const override; - CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override; + WideString GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override; + WideString GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType) const override; + WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const override; private: - CFX_WideString GetPattern(CXML_Element* pElement, - const CFX_ByteStringC& bsTag, - const CFX_WideStringC& wsName) const; - CFX_WideString GetCalendarSymbol(const CFX_ByteStringC& symbol, - int index, - bool bAbbr) const; + WideString GetPattern(CXML_Element* pElement, + const ByteStringView& bsTag, + const WideStringView& wsName) const; + WideString GetCalendarSymbol(const ByteStringView& symbol, + int index, + bool bAbbr) const; std::unique_ptr<CXML_Element> m_pLocaleData; }; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index d4cd058b44..373412ebf9 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -73,7 +73,7 @@ void FormValueNode_MatchNoneCreateChild(CXFA_Node* pFormNode) { } bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, - const CFX_WideString& wsContent, + const WideString& wsContent, XFA_Element iType = XFA_Element::Unknown) { if (!pValueNode) return false; @@ -90,7 +90,7 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, if (!pContentRawDataNode) { XFA_Element element = XFA_Element::Sharptext; if (pChildNode->GetElementType() == XFA_Element::ExData) { - CFX_WideString wsContentType; + WideString wsContentType; pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false); if (wsContentType == L"text/html") @@ -131,13 +131,13 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element eUIType = pWidgetData->GetUIType(); CXFA_Value defValue(pFormNode->GetProperty(0, XFA_Element::Value)); if (!bDataToForm) { - CFX_WideString wsValue; - CFX_WideString wsFormattedValue; + WideString wsValue; + WideString wsFormattedValue; switch (eUIType) { case XFA_Element::ImageEdit: { CXFA_Image image = defValue.GetImage(); - CFX_WideString wsContentType; - CFX_WideString wsHref; + WideString wsContentType; + WideString wsHref; if (image) { image.GetContent(wsValue); image.GetContentType(wsContentType); @@ -157,7 +157,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, case XFA_Element::ChoiceList: defValue.GetChildValueContent(wsValue); if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { - std::vector<CFX_WideString> wsSelTextArray = + std::vector<WideString> wsSelTextArray = pWidgetData->GetSelectedItemsValue(); if (!wsSelTextArray.empty()) { for (const auto& text : wsSelTextArray) { @@ -211,7 +211,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!pText) continue; - CFX_WideString wsContent; + WideString wsContent; if (pText->TryContent(wsContent) && (wsContent == wsValue)) { pChecked = pChild; wsFormattedValue = wsValue; @@ -237,7 +237,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (pText) pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); - CFX_WideString wsContent; + WideString wsContent; if (pText) pText->TryContent(wsContent); @@ -250,7 +250,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) break; - CFX_WideString wsOutput; + WideString wsOutput; pWidgetData->NormalizeNumStr(wsValue, wsOutput); wsValue = wsOutput; pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue); @@ -271,9 +271,9 @@ void CreateDataBinding(CXFA_Node* pFormNode, return; } - CFX_WideString wsXMLValue; + WideString wsXMLValue; pDataNode->TryContent(wsXMLValue); - CFX_WideString wsNormalizeValue; + WideString wsNormalizeValue; pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormalizeValue); pDataNode->SetAttributeValue(wsNormalizeValue, wsXMLValue); switch (eUIType) { @@ -286,14 +286,14 @@ void CreateDataBinding(CXFA_Node* pFormNode, static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode()); ASSERT(pXMLDataElement); - CFX_WideString wsContentType = + WideString wsContentType = pXMLDataElement->GetString(L"xfa:contentType"); if (!wsContentType.IsEmpty()) { pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); image.SetContentType(wsContentType); } - CFX_WideString wsHref = pXMLDataElement->GetString(L"href"); + WideString wsHref = pXMLDataElement->GetString(L"href"); if (!wsHref.IsEmpty()) image.SetHref(wsHref); } @@ -305,7 +305,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!items.empty()) { bool single = items.size() == 1; wsNormalizeValue.clear(); - CFX_WideString wsItem; + WideString wsItem; for (CXFA_Node* pNode : items) { pNode->TryContent(wsItem); wsItem = single ? wsItem : wsItem + L"\n"; @@ -327,8 +327,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element::Text); break; case XFA_Element::ExclGroup: { - pWidgetData->SetSelectedMemberByValue(wsNormalizeValue.AsStringC(), false, - false, false); + pWidgetData->SetSelectedMemberByValue(wsNormalizeValue.AsStringView(), + false, false, false); break; } case XFA_Element::DateTimeEdit: @@ -336,10 +336,10 @@ void CreateDataBinding(CXFA_Node* pFormNode, XFA_Element::DateTime); break; case XFA_Element::NumericEdit: { - CFX_WideString wsPicture; + WideString wsPicture; pWidgetData->GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); if (wsPicture.IsEmpty()) { - CFX_WideString wsOutput; + WideString wsOutput; pWidgetData->NormalizeNumStr(wsNormalizeValue, wsOutput); wsNormalizeValue = wsOutput; } @@ -407,7 +407,7 @@ CXFA_Node* ScopeMatchGlobalBinding(CXFA_Node* pDataScope, } CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument, - CFX_WideStringC wsName, + WideStringView wsName, CXFA_Node* pDataScope, XFA_Element eMatchNodeType) { if (wsName.IsEmpty()) @@ -425,7 +425,7 @@ CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument, } CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument, - CFX_WideStringC wsName, + WideStringView wsName, CXFA_Node* pDataScope, XFA_Element eMatchNodeType) { if (wsName.IsEmpty()) @@ -452,7 +452,7 @@ CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument, } CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument, - CFX_WideStringC wsRef, + WideStringView wsRef, CXFA_Node* pDataScope, XFA_Element eMatchNodeType, CXFA_Node* pTemplateNode, @@ -496,10 +496,10 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument, CXFA_Node* pFormParent, CXFA_Node* pTemplateNode, std::vector<CXFA_Node*>* subforms) { - CFX_WideStringC wsSubformName = pTemplateNode->GetCData(XFA_ATTRIBUTE_Name); - CFX_WideString wsInstMgrNodeName = L"_" + wsSubformName; + WideStringView wsSubformName = pTemplateNode->GetCData(XFA_ATTRIBUTE_Name); + WideString wsInstMgrNodeName = L"_" + wsSubformName; uint32_t dwInstNameHash = - FX_HashCode_GetW(wsInstMgrNodeName.AsStringC(), false); + FX_HashCode_GetW(wsInstMgrNodeName.AsStringView(), false); CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( pDocument, XFA_Element::InstanceManager, dwInstNameHash, pFormParent); if (pExistingNode) { @@ -1000,7 +1000,7 @@ CXFA_Node* CopyContainer_Field(CXFA_Document* pDocument, CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument, CXFA_Node* pDataParent, XFA_Element eNodeType, - const CFX_WideString& wsName) { + const WideString& wsName) { if (!pDataParent) return nullptr; @@ -1023,13 +1023,14 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument, if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) continue; - CFX_WideString wsNamespace; + WideString wsNamespace; if (!pDDGroupNode->TryNamespace(wsNamespace) || wsNamespace != L"http://ns.adobe.com/data-description/") { continue; } } - CXFA_Node* pDDNode = pDDGroupNode->GetFirstChildByName(wsName.AsStringC()); + CXFA_Node* pDDNode = + pDDGroupNode->GetFirstChildByName(wsName.AsStringView()); if (!pDDNode) continue; if (pDDNode->GetElementType() != eNodeType) @@ -1086,7 +1087,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, : XFA_Element::DataValue; pDataNode = MaybeCreateDataNode( pDocument, pDataScope, eDataNodeType, - CFX_WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name))); + WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name))); if (pDataNode) CreateDataBinding(pFormNode, pDataNode, false); } @@ -1118,7 +1119,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)); pDataNode = MaybeCreateDataNode( pDocument, pRecordNode, eDataNodeType, - CFX_WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name))); + WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name))); if (pDataNode) { CreateDataBinding(pFormNode, pDataNode, false); RegisterGlobalBinding(pDocument, pFormNode->GetNameHash(), @@ -1136,8 +1137,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, bMatchRef = bDataRef; bParentDataRef = true; if (!pDataNode && bDataRef) { - CFX_WideStringC wsRef = - pTemplateNodeBind->GetCData(XFA_ATTRIBUTE_Ref); + WideStringView wsRef = pTemplateNodeBind->GetCData(XFA_ATTRIBUTE_Ref); uint32_t dFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_CreateNode; XFA_RESOLVENODE_RS rs; @@ -1197,7 +1197,7 @@ void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) { if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) continue; - CFX_WideString wsNamespace; + WideString wsNamespace; if (!pDDGroupNode->TryNamespace(wsNamespace) || wsNamespace != L"http://ns.adobe.com/data-description/") { continue; @@ -1363,7 +1363,7 @@ void CXFA_Document::DoDataMerge() { pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode); } CXFA_Node *pDataRoot = nullptr, *pDDRoot = nullptr; - CFX_WideString wsDatasetsURI; + WideString wsDatasetsURI; pDatasetsRoot->TryNamespace(wsDatasetsURI); for (CXFA_Node* pChildNode = pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1372,7 +1372,7 @@ void CXFA_Document::DoDataMerge() { if (pChildNode->GetElementType() != XFA_Element::DataGroup) continue; - CFX_WideString wsNamespaceURI; + WideString wsNamespaceURI; if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) { if (!pChildNode->TryNamespace(wsNamespaceURI)) continue; @@ -1435,9 +1435,8 @@ void CXFA_Document::DoDataMerge() { this, pFormRoot, pTemplateChosen, false, nullptr); ASSERT(pSubformSetNode); if (!pDataTopLevel) { - CFX_WideStringC wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name); - CFX_WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" - : wsFormName); + WideStringView wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name); + WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" : wsFormName); CFX_XMLElement* pDataTopLevelXMLNode = new CFX_XMLElement(wsDataTopLevelName); diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index fa75f18015..e1ee29d2b7 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -39,8 +39,8 @@ const double fraction_scales[] = {0.1, 0.000000000000001, 0.0000000000000001}; -double WideStringToDouble(const CFX_WideString& wsStringVal) { - CFX_WideString wsValue = wsStringVal; +double WideStringToDouble(const WideString& wsStringVal) { + WideString wsValue = wsStringVal; wsValue.TrimLeft(); wsValue.TrimRight(); int64_t nIntegral = 0; @@ -172,15 +172,15 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { pWidgetData->GetNode()->GetDocument()->GetLocalMgr()); } void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode, - CFX_WideString& wsPlainText) { + WideString& wsPlainText) { if (!pXMLNode) { return; } switch (pXMLNode->GetType()) { case FX_XMLNODE_Element: { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode); - CFX_WideString wsTag = pXMLElement->GetLocalTagName(); - uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringC(), true); + WideString wsTag = pXMLElement->GetLocalTagName(); + uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringView(), true); if (uTag == 0x0001f714) { wsPlainText += L"\n"; } else if (uTag == 0x00000070) { @@ -197,7 +197,7 @@ void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode, } case FX_XMLNODE_Text: case FX_XMLNODE_CharData: { - CFX_WideString wsContent = static_cast<CFX_XMLText*>(pXMLNode)->GetText(); + WideString wsContent = static_cast<CFX_XMLText*>(pXMLNode)->GetText(); wsPlainText += wsContent; break; } @@ -228,8 +228,8 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { return bRet; } -double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { - CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); +double XFA_ByteStringToDouble(const ByteStringView& szStringVal) { + WideString wsValue = WideString::FromUTF8(szStringVal); return WideStringToDouble(wsValue); } @@ -241,7 +241,7 @@ int32_t XFA_MapRotation(int32_t nRotation) { const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_Element eElement, - const CFX_WideStringC& wsAttributeName) { + const WideStringView& wsAttributeName) { if (wsAttributeName.IsEmpty()) return nullptr; @@ -376,7 +376,7 @@ const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName) { : nullptr; } -XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName) { +XFA_Element XFA_GetElementTypeForName(const WideStringView& wsName) { if (wsName.IsEmpty()) return XFA_Element::Unknown; @@ -428,7 +428,7 @@ bool XFA_GetAttributeDefaultValue(void*& pValue, return false; } -const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { +const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const WideStringView& wsName) { if (wsName.IsEmpty()) return nullptr; @@ -449,7 +449,7 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { } const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( - const CFX_WideStringC& wsName) { + const WideStringView& wsName) { if (wsName.IsEmpty()) return nullptr; diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index bc05381fc3..404586bd56 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -21,8 +21,8 @@ int XFA_GetMaxFractionalScale(); bool XFA_FDEExtension_ResolveNamespaceQualifier( CFX_XMLElement* pNode, - const CFX_WideStringC& wsQualifier, - CFX_WideString* wsNamespaceURI); + const WideStringView& wsQualifier, + WideString* wsNamespaceURI); template <class NodeType, class TraverseStrategy> class CXFA_NodeIteratorTemplate { @@ -144,12 +144,12 @@ class CXFA_NodeIteratorTemplate { }; CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData); -double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal); +double XFA_ByteStringToDouble(const ByteStringView& szStringVal); int32_t XFA_MapRotation(int32_t nRotation); bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode); void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode, - CFX_WideString& wsPlainText); + WideString& wsPlainText); bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); @@ -166,7 +166,7 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute( const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_Element eElement, - const CFX_WideStringC& wsAttributeName); + const WideStringView& wsAttributeName); const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, XFA_Element eProperty, @@ -175,7 +175,7 @@ const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, int32_t& iCount); const uint8_t* XFA_GetElementAttributes(XFA_Element eElement, int32_t& iCount); const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName); -XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName); +XFA_Element XFA_GetElementTypeForName(const WideStringView& wsName); CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement, XFA_ATTRIBUTE eAttribute, uint32_t dwPacket); @@ -184,10 +184,10 @@ bool XFA_GetAttributeDefaultValue(void*& pValue, XFA_ATTRIBUTE eAttribute, XFA_ATTRIBUTETYPE eType, uint32_t dwPacket); -const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName); +const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const WideStringView& wsName); const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName); const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( - const CFX_WideStringC& wsName); + const WideStringView& wsName); const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket); const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket); |